< prev index next >

src/java.desktop/share/classes/javax/swing/JPanel.java

Print this page




 110     }
 111 
 112     /**
 113      * Creates a new <code>JPanel</code> with a double buffer
 114      * and a flow layout.
 115      */
 116     public JPanel() {
 117         this(true);
 118     }
 119 
 120     /**
 121      * Resets the UI property with a value from the current look and feel.
 122      *
 123      * @see JComponent#updateUI
 124      */
 125     public void updateUI() {
 126         setUI((PanelUI)UIManager.getUI(this));
 127     }
 128 
 129     /**
 130      * Returns the look and feel (L&amp;amp;F) object that renders this component.
 131      *
 132      * @return the PanelUI object that renders this component
 133      * @since 1.4
 134      */
 135     public PanelUI getUI() {
 136         return (PanelUI)ui;
 137     }
 138 
 139 
 140     /**
 141      * Sets the look and feel (L&amp;F) object that renders this component.
 142      *
 143      * @param ui  the PanelUI L&amp;F object
 144      * @see UIDefaults#getUI
 145      * @since 1.4
 146      */
 147     @BeanProperty(hidden = true, visualUpdate = true, description
 148             = "The UI object that implements the Component's LookAndFeel.")
 149     public void setUI(PanelUI ui) {
 150         super.setUI(ui);
 151     }
 152 
 153     /**
 154      * Returns a string that specifies the name of the L&amp;F class
 155      * that renders this component.
 156      *
 157      * @return "PanelUI"
 158      * @see JComponent#getUIClassID
 159      * @see UIDefaults#getUI
 160      */
 161     @BeanProperty(bound = false, expert = true, description
 162             = "A string that specifies the name of the L&amp;F class.")
 163     public String getUIClassID() {
 164         return uiClassID;
 165     }
 166 
 167 
 168     /**
 169      * See readObject() and writeObject() in JComponent for more
 170      * information about serialization in Swing.
 171      */
 172     private void writeObject(ObjectOutputStream s) throws IOException {
 173         s.defaultWriteObject();
 174         if (getUIClassID().equals(uiClassID)) {
 175             byte count = JComponent.getWriteObjCounter(this);
 176             JComponent.setWriteObjCounter(this, --count);
 177             if (count == 0 && ui != null) {
 178                 ui.installUI(this);
 179             }
 180         }
 181     }
 182 




 110     }
 111 
 112     /**
 113      * Creates a new <code>JPanel</code> with a double buffer
 114      * and a flow layout.
 115      */
 116     public JPanel() {
 117         this(true);
 118     }
 119 
 120     /**
 121      * Resets the UI property with a value from the current look and feel.
 122      *
 123      * @see JComponent#updateUI
 124      */
 125     public void updateUI() {
 126         setUI((PanelUI)UIManager.getUI(this));
 127     }
 128 
 129     /**
 130      * Returns the look and feel (L&amp;F) object that renders this component.
 131      *
 132      * @return the PanelUI object that renders this component
 133      * @since 1.4
 134      */
 135     public PanelUI getUI() {
 136         return (PanelUI)ui;
 137     }
 138 
 139 
 140     /**
 141      * Sets the look and feel (L&amp;F) object that renders this component.
 142      *
 143      * @param ui  the PanelUI L&amp;F object
 144      * @see UIDefaults#getUI
 145      * @since 1.4
 146      */
 147     @BeanProperty(hidden = true, visualUpdate = true, description
 148             = "The UI object that implements the Component's LookAndFeel.")
 149     public void setUI(PanelUI ui) {
 150         super.setUI(ui);
 151     }
 152 
 153     /**
 154      * Returns a string that specifies the name of the L&amp;F class
 155      * that renders this component.
 156      *
 157      * @return "PanelUI"
 158      * @see JComponent#getUIClassID
 159      * @see UIDefaults#getUI
 160      */
 161     @BeanProperty(bound = false, expert = true, description
 162             = "A string that specifies the name of the L&F class.")
 163     public String getUIClassID() {
 164         return uiClassID;
 165     }
 166 
 167 
 168     /**
 169      * See readObject() and writeObject() in JComponent for more
 170      * information about serialization in Swing.
 171      */
 172     private void writeObject(ObjectOutputStream s) throws IOException {
 173         s.defaultWriteObject();
 174         if (getUIClassID().equals(uiClassID)) {
 175             byte count = JComponent.getWriteObjCounter(this);
 176             JComponent.setWriteObjCounter(this, --count);
 177             if (count == 0 && ui != null) {
 178                 ui.installUI(this);
 179             }
 180         }
 181     }
 182 


< prev index next >