Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX set appearance of non-editable text field in css

Tags:

java

css

javafx

Is it possible to set the appearance of non-editable text fields in css? I want non-editable text fields to look like labels. I couldn't find any answers to this (or similar) question, I tried this:

.text-input:editable {
    -fx-background-color: transparent;
}

But that didn't work, obviously.

like image 541
user1009569 Avatar asked Feb 23 '15 23:02

user1009569


People also ask

What is textfield in JavaFX?

In JavaFX, the TextField is a control that holds a single-line of unformatted, free text input. The character count of a TextField can be limited, or its contents validated by setting a TextFormatter, and the text can be bound as a property. Creating a text field, setting prompt text, alignment and size

How do I implement a text editing area in JavaFX?

If you need to implement a text editing area in your JavaFX application, use the HTMLEditor component. For more information about the HTMLEditor control, see Using JavaFX UI Controls.

How do I set the font in JavaFX?

When adding text, you can also set some of its properties. To set the font, you can use an instance of the javafx.scene.text.Font class. The Font.font() method enables you to specify the font family name and size. You can also set the text color as shown in Example 5.

How to use CSS in JavaFX?

CSS in JavaFX 1 Selector − A selector is an HTML tag at which a style will be applied. This could be any tag like <h1> or <table>, etc. 2 Property − A property is a type of attribute of the HTML tag. In simpler terms, all the HTML attributes are converted into CSS properties. ... 3 Value − Values are assigned to properties. ...


1 Answers

.text-input:readonly {
    -fx-background-color: transparent;
}

Should've checked JavaFX CSS reference before asking a question!

like image 165
user1009569 Avatar answered Oct 11 '22 06:10

user1009569