src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java

Print this page




  83      *
  84      * @param g the graphics context
  85      */
  86     protected void paintBackground(Graphics g) {
  87         super.paintBackground(g);
  88     }
  89 
  90     /**
  91      * Creates the caret for a field.
  92      *
  93      * @return the caret
  94      */
  95     protected Caret createCaret() {
  96         return new WindowsFieldCaret();
  97     }
  98 
  99     /**
 100      * WindowsFieldCaret has different scrolling behavior than
 101      * DefaultCaret.
 102      */

 103     static class WindowsFieldCaret extends DefaultCaret implements UIResource {
 104 
 105         public WindowsFieldCaret() {
 106             super();
 107         }
 108 
 109         /**
 110          * Adjusts the visibility of the caret according to
 111          * the windows feel which seems to be to move the
 112          * caret out into the field by about a quarter of
 113          * a field length if not visible.
 114          */
 115         protected void adjustVisibility(Rectangle r) {
 116             SwingUtilities.invokeLater(new SafeScroller(r));
 117         }
 118 
 119         /**
 120          * Gets the painter for the Highlighter.
 121          *
 122          * @return the painter




  83      *
  84      * @param g the graphics context
  85      */
  86     protected void paintBackground(Graphics g) {
  87         super.paintBackground(g);
  88     }
  89 
  90     /**
  91      * Creates the caret for a field.
  92      *
  93      * @return the caret
  94      */
  95     protected Caret createCaret() {
  96         return new WindowsFieldCaret();
  97     }
  98 
  99     /**
 100      * WindowsFieldCaret has different scrolling behavior than
 101      * DefaultCaret.
 102      */
 103     @SuppressWarnings("serial") // Superclass is not serializable across versions
 104     static class WindowsFieldCaret extends DefaultCaret implements UIResource {
 105 
 106         public WindowsFieldCaret() {
 107             super();
 108         }
 109 
 110         /**
 111          * Adjusts the visibility of the caret according to
 112          * the windows feel which seems to be to move the
 113          * caret out into the field by about a quarter of
 114          * a field length if not visible.
 115          */
 116         protected void adjustVisibility(Rectangle r) {
 117             SwingUtilities.invokeLater(new SafeScroller(r));
 118         }
 119 
 120         /**
 121          * Gets the painter for the Highlighter.
 122          *
 123          * @return the painter