/[classpath]/classpath/javax/swing/plaf/basic/BasicTextUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicTextUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by rabbit78, Thu Sep 8 12:44:29 2005 UTC revision 1.37 by rabbit78, Thu Sep 8 13:41:45 2005 UTC
# Line 347  public abstract class BasicTextUI extend Line 347  public abstract class BasicTextUI extend
347            // Document changed.            // Document changed.
348                modelChanged();                modelChanged();
349          }          }
       else if (event.getPropertyName().equals("enabled")  
                || event.getPropertyName().equals("editable"))  
         {  
           updateComponentColors();  
         }  
350      }      }
351    }    }
352    
# Line 431  public abstract class BasicTextUI extend Line 426  public abstract class BasicTextUI extend
426    DocumentHandler documentHandler = new DocumentHandler();    DocumentHandler documentHandler = new DocumentHandler();
427    
428    /**    /**
    * The standard foreground color. This is the color which is used to paint  
    * text in enabled text components.  
    */  
   Color foreground;  
   
   /**  
429     * The standard background color. This is the color which is used to paint     * The standard background color. This is the color which is used to paint
430     * text in enabled text components.     * text in enabled text components.
431     */     */
432    Color background;    Color background;
433    
434    /**    /**
    * The inactive foreground color. This is the color which is used to paint  
    * text in disabled text components.  
    */  
   Color inactiveForeground;  
   
   /**  
435     * The inactive background color. This is the color which is used to paint     * The inactive background color. This is the color which is used to paint
436     * text in disabled text components.     * text in disabled text components.
437     */     */
# Line 544  public abstract class BasicTextUI extend Line 527  public abstract class BasicTextUI extend
527      caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));      caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
528    
529      // Fetch the colors for enabled/disabled text components.      // Fetch the colors for enabled/disabled text components.
     foreground = defaults.getColor(prefix + ".foreground");  
530      background = defaults.getColor(prefix + ".background");      background = defaults.getColor(prefix + ".background");
     inactiveForeground = defaults.getColor(prefix + ".inactiveForeground");  
531      inactiveBackground = defaults.getColor(prefix + ".inactiveBackground");      inactiveBackground = defaults.getColor(prefix + ".inactiveBackground");
532        textComponent.setForeground(defaults.getColor(prefix + ".foreground"));
533        textComponent.setDisabledTextColor
534                             (defaults.getColor(prefix + ".inactiveForeground"));
535      updateComponentColors();      updateComponentColors();
536    }    }
537    
# Line 832  public abstract class BasicTextUI extend Line 816  public abstract class BasicTextUI extend
816     */     */
817    protected void paintBackground(Graphics g)    protected void paintBackground(Graphics g)
818    {    {
819        if (textComponent.isEditable())
820          textComponent.setBackground(background);
821        else
822          textComponent.setBackground(inactiveBackground);
823    
824      g.setColor(textComponent.getBackground());      g.setColor(textComponent.getBackground());
825      g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());      g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());
826    }    }
# Line 1085  public abstract class BasicTextUI extend Line 1074  public abstract class BasicTextUI extend
1074     */     */
1075    void updateComponentColors()    void updateComponentColors()
1076    {    {
     if (textComponent.isEditable())  
       textComponent.setBackground(background);  
     else  
       textComponent.setBackground(inactiveBackground);  
   
     if (textComponent.isEnabled())  
       textComponent.setForeground(foreground);  
     else  
       textComponent.setForeground(inactiveForeground);  
1077    }    }
1078  }  }

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26