Index: javax/swing/plaf/basic/BasicTextUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.36 retrieving revision 1.38 diff -u -r1.36 -r1.38 --- javax/swing/plaf/basic/BasicTextUI.java 8 Sep 2005 12:44:29 -0000 1.36 +++ javax/swing/plaf/basic/BasicTextUI.java 8 Sep 2005 13:45:07 -0000 1.38 @@ -347,11 +347,6 @@ // Document changed. modelChanged(); } - else if (event.getPropertyName().equals("enabled") - || event.getPropertyName().equals("editable")) - { - updateComponentColors(); - } } } @@ -431,24 +426,12 @@ DocumentHandler documentHandler = new DocumentHandler(); /** - * The standard foreground color. This is the color which is used to paint - * text in enabled text components. - */ - Color foreground; - - /** * The standard background color. This is the color which is used to paint * text in enabled text components. */ Color background; /** - * The inactive foreground color. This is the color which is used to paint - * text in disabled text components. - */ - Color inactiveForeground; - - /** * The inactive background color. This is the color which is used to paint * text in disabled text components. */ @@ -544,11 +527,11 @@ caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate")); // Fetch the colors for enabled/disabled text components. - foreground = defaults.getColor(prefix + ".foreground"); background = defaults.getColor(prefix + ".background"); - inactiveForeground = defaults.getColor(prefix + ".inactiveForeground"); inactiveBackground = defaults.getColor(prefix + ".inactiveBackground"); - updateComponentColors(); + textComponent.setForeground(defaults.getColor(prefix + ".foreground")); + textComponent.setDisabledTextColor + (defaults.getColor(prefix + ".inactiveForeground")); } /** @@ -832,6 +815,11 @@ */ protected void paintBackground(Graphics g) { + if (textComponent.isEditable()) + textComponent.setBackground(background); + else + textComponent.setBackground(inactiveBackground); + g.setColor(textComponent.getBackground()); g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight()); } @@ -1077,22 +1065,5 @@ return; View view = factory.create(elem); setView(view); - } - - /** - * Updates the colors of the text component according to its enabled - * state. - */ - void updateComponentColors() - { - if (textComponent.isEditable()) - textComponent.setBackground(background); - else - textComponent.setBackground(inactiveBackground); - - if (textComponent.isEnabled()) - textComponent.setForeground(foreground); - else - textComponent.setForeground(inactiveForeground); } }