Read-only (non-editable) JTextArea – background color not updated
See original GitHub issueNot sure if this could be considered a bug as I’m seeing such behavior with at least one other L&F – Nimbus:
The background color of non-editable text-area doesn’t seem to reflect the actual background color used.
JTextArea textArea = new JTextArea();
textArea.getBackground(); // editable background
textArea.setEditable(false);
textArea.getBackground(); // non-editable background
Using FlatLaf 0.38.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
How to change a read only textarea's background color.
I have two text areas that are set to read only after a value is input into them. Is there a way to...
Read more >Set textbox to readonly and background color to grey in jquery
I would like to make a text box in my jsp to become readonly and its background color to grey like disable in...
Read more >read-only - CSS: Cascading Style Sheets - MDN Web Docs
The :read-only CSS pseudo-class represents an element (such as input or textarea) ... background-color: white; } textarea:-moz-read-write, ...
Read more >Background color of non editable textfield - Oracle Communities
Dear all, how can I set the background color with a css stylesheet of a textfield that is enabled but non editable "textfield....
Read more >Create Read Only JTextField - Java Swing - Java2s.com
To make JTextField read only or non editable use, ... class Main { public void init() { JTextField field = new JTextField("Read Only...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The reason for this is a “temporary” workaround in Swing:
https://github.com/openjdk/jdk/blob/1f5e21a16e1bb9a7291b38cedf4269717bbbe428/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java#L228-L239
Thank you for the extra effort!