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.
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
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.
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.
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. ...
.text-input:readonly {
-fx-background-color: transparent;
}
Should've checked JavaFX CSS reference before asking a question!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With