/[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.10.2.10 by gnu_andrew, Sat Sep 10 15:31:52 2005 UTC revision 1.10.2.11 by gnu_andrew, Tue Sep 20 18:46:34 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing.plaf.basic;  package javax.swing.plaf.basic;
40    
41    import java.awt.Color;
42  import java.awt.Container;  import java.awt.Container;
43  import java.awt.Dimension;  import java.awt.Dimension;
44  import java.awt.Graphics;  import java.awt.Graphics;
# Line 241  public abstract class BasicTextUI extend Line 242  public abstract class BasicTextUI extend
242      public void paint(Graphics g, Shape s)      public void paint(Graphics g, Shape s)
243      {      {
244        if (view != null)        if (view != null)
245          view.paint(g, s);          view.paint(g, s);
246      }      }
247    
248    
# Line 342  public abstract class BasicTextUI extend Line 343  public abstract class BasicTextUI extend
343      public void propertyChange(PropertyChangeEvent event)      public void propertyChange(PropertyChangeEvent event)
344      {      {
345        if (event.getPropertyName().equals("document"))        if (event.getPropertyName().equals("document"))
346          {          {
347            // Document changed.            // Document changed.
348            modelChanged();                modelChanged();
349          }          }
350          else if (event.getPropertyName().equals("editable"))
351            {
352              if (textComponent.isEditable())
353                textComponent.setBackground(background);
354              else
355                textComponent.setBackground(inactiveBackground);
356            }
357      }      }
358    }    }
359    
# Line 425  public abstract class BasicTextUI extend Line 433  public abstract class BasicTextUI extend
433    DocumentHandler documentHandler = new DocumentHandler();    DocumentHandler documentHandler = new DocumentHandler();
434    
435    /**    /**
436       * The standard background color. This is the color which is used to paint
437       * text in enabled text components.
438       */
439      Color background;
440    
441      /**
442       * The inactive background color. This is the color which is used to paint
443       * text in disabled text components.
444       */
445      Color inactiveBackground;
446    
447      /**
448     * Creates a new <code>BasicTextUI</code> instance.     * Creates a new <code>BasicTextUI</code> instance.
449     */     */
450    public BasicTextUI()    public BasicTextUI()
# Line 507  public abstract class BasicTextUI extend Line 527  public abstract class BasicTextUI extend
527    
528      String prefix = getPropertyPrefix();      String prefix = getPropertyPrefix();
529      UIDefaults defaults = UIManager.getLookAndFeelDefaults();      UIDefaults defaults = UIManager.getLookAndFeelDefaults();
     textComponent.setBackground(defaults.getColor(prefix + ".background"));  
     textComponent.setForeground(defaults.getColor(prefix + ".foreground"));  
530      textComponent.setMargin(defaults.getInsets(prefix + ".margin"));      textComponent.setMargin(defaults.getInsets(prefix + ".margin"));
531      textComponent.setBorder(defaults.getBorder(prefix + ".border"));      textComponent.setBorder(defaults.getBorder(prefix + ".border"));
532      textComponent.setFont(defaults.getFont(prefix + ".font"));      textComponent.setFont(defaults.getFont(prefix + ".font"));
533    
534      caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));      caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
535    
536        // Fetch the colors for enabled/disabled text components.
537        background = defaults.getColor(prefix + ".background");
538        inactiveBackground = defaults.getColor(prefix + ".inactiveBackground");
539        textComponent.setForeground(defaults.getColor(prefix + ".foreground"));
540        textComponent.setDisabledTextColor
541                             (defaults.getColor(prefix + ".inactiveForeground"));
542    }    }
543    
544    /**    /**
# Line 797  public abstract class BasicTextUI extend Line 822  public abstract class BasicTextUI extend
822     */     */
823    protected void paintBackground(Graphics g)    protected void paintBackground(Graphics g)
824    {    {
825      g.setColor(textComponent.getBackground());      // This method does nothing. All the background filling is done by the
826      g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());      // ComponentUI update method. However, the method is called by paint
827        // to provide a way for subclasses to draw something different (e.g. background
828        // images etc) on the background.
829    }    }
830    
831    /**    /**

Legend:
Removed from v.1.10.2.10  
changed lines
  Added in v.1.10.2.11

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