mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
TextArea: update background color property if enabled or editable state changes in the same way as Swing does it for all other text components (issue #147)
This commit is contained in:
@@ -134,6 +134,7 @@ public class FlatComponentsTest
|
||||
JLabel labelLabel = new JLabel();
|
||||
JLabel label1 = new JLabel();
|
||||
JLabel label2 = new JLabel();
|
||||
FlatComponentsTest.TestMultiLineLabel testMultiLineLabel1 = new FlatComponentsTest.TestMultiLineLabel();
|
||||
JLabel buttonLabel = new JLabel();
|
||||
JButton button1 = new JButton();
|
||||
JButton button17 = new JButton();
|
||||
@@ -367,6 +368,10 @@ public class FlatComponentsTest
|
||||
label2.setEnabled(false);
|
||||
add(label2, "cell 2 0");
|
||||
|
||||
//---- testMultiLineLabel1 ----
|
||||
testMultiLineLabel1.setText("Multi-line label based on JTextArea\n2nd line");
|
||||
add(testMultiLineLabel1, "cell 3 0 2 1");
|
||||
|
||||
//---- buttonLabel ----
|
||||
buttonLabel.setText("JButton:");
|
||||
add(buttonLabel, "cell 0 1");
|
||||
@@ -1402,4 +1407,24 @@ public class FlatComponentsTest
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//---- class TestMultiLineLabel -------------------------------------------
|
||||
|
||||
private static class TestMultiLineLabel
|
||||
extends JTextArea
|
||||
{
|
||||
public TestMultiLineLabel() {
|
||||
setEditable( false );
|
||||
setFocusable( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
setBackground( UIManager.getColor( "Label.background" ) );
|
||||
setForeground( UIManager.getColor( "Label.foreground" ) );
|
||||
setFont( UIManager.getFont( "Label.font" ) );
|
||||
setBorder( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,12 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestMultiLineLabel" ) {
|
||||
name: "testMultiLineLabel1"
|
||||
"text": "Multi-line label based on JTextArea\n2nd line"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 0 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "buttonLabel"
|
||||
"text": "JButton:"
|
||||
|
||||
Reference in New Issue
Block a user