< prev index next >

jdk/src/java.desktop/share/classes/javax/swing/JComponent.java

Print this page




 599     /**
 600      * Resets the UI property to a value from the current look and feel.
 601      * <code>JComponent</code> subclasses must override this method
 602      * like this:
 603      * <pre>
 604      *   public void updateUI() {
 605      *      setUI((SliderUI)UIManager.getUI(this);
 606      *   }
 607      *  </pre>
 608      *
 609      * @see #setUI
 610      * @see UIManager#getLookAndFeel
 611      * @see UIManager#getUI
 612      */
 613     public void updateUI() {}
 614 
 615     /**
 616      * Returns the look and feel delegate that renders this component.
 617      *
 618      * @return the {@code ComponentUI} object that renders this component
 619      * @since 1.9
 620      */
 621     @Transient
 622     public ComponentUI getUI() {
 623         return ui;
 624     }
 625 
 626     /**
 627      * Sets the look and feel delegate for this component.
 628      * <code>JComponent</code> subclasses generally override this method
 629      * to narrow the argument type. For example, in <code>JSlider</code>:
 630      * <pre>
 631      * public void setUI(SliderUI newUI) {
 632      *     super.setUI(newUI);
 633      * }
 634      *  </pre>
 635      * <p>
 636      * Additionally <code>JComponent</code> subclasses must provide a
 637      * <code>getUI</code> method that returns the correct type.  For example:
 638      * <pre>
 639      * public SliderUI getUI() {




 599     /**
 600      * Resets the UI property to a value from the current look and feel.
 601      * <code>JComponent</code> subclasses must override this method
 602      * like this:
 603      * <pre>
 604      *   public void updateUI() {
 605      *      setUI((SliderUI)UIManager.getUI(this);
 606      *   }
 607      *  </pre>
 608      *
 609      * @see #setUI
 610      * @see UIManager#getLookAndFeel
 611      * @see UIManager#getUI
 612      */
 613     public void updateUI() {}
 614 
 615     /**
 616      * Returns the look and feel delegate that renders this component.
 617      *
 618      * @return the {@code ComponentUI} object that renders this component
 619      * @since 9
 620      */
 621     @Transient
 622     public ComponentUI getUI() {
 623         return ui;
 624     }
 625 
 626     /**
 627      * Sets the look and feel delegate for this component.
 628      * <code>JComponent</code> subclasses generally override this method
 629      * to narrow the argument type. For example, in <code>JSlider</code>:
 630      * <pre>
 631      * public void setUI(SliderUI newUI) {
 632      *     super.setUI(newUI);
 633      * }
 634      *  </pre>
 635      * <p>
 636      * Additionally <code>JComponent</code> subclasses must provide a
 637      * <code>getUI</code> method that returns the correct type.  For example:
 638      * <pre>
 639      * public SliderUI getUI() {


< prev index next >