src/share/classes/javax/swing/JFrame.java

Print this page




 249     public JFrame(String title, GraphicsConfiguration gc) {
 250         super(title, gc);
 251         frameInit();
 252     }
 253 
 254     /** Called by the constructors to init the <code>JFrame</code> properly. */
 255     protected void frameInit() {
 256         enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK);
 257         setLocale( JComponent.getDefaultLocale() );
 258         setRootPane(createRootPane());
 259         setBackground(UIManager.getColor("control"));
 260         setRootPaneCheckingEnabled(true);
 261         if (JFrame.isDefaultLookAndFeelDecorated()) {
 262             boolean supportsWindowDecorations =
 263             UIManager.getLookAndFeel().getSupportsWindowDecorations();
 264             if (supportsWindowDecorations) {
 265                 setUndecorated(true);
 266                 getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
 267             }
 268         }
 269         sun.awt.SunToolkit.checkAndSetPolicy(this, true);
 270     }
 271 
 272     /**
 273      * Called by the constructor methods to create the default
 274      * <code>rootPane</code>.
 275      */
 276     protected JRootPane createRootPane() {
 277         JRootPane rp = new JRootPane();
 278         // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
 279         // is NO reason for the RootPane not to be opaque. For painting to
 280         // work the contentPane must be opaque, therefor the RootPane can
 281         // also be opaque.
 282         rp.setOpaque(true);
 283         return rp;
 284     }
 285 
 286     /**
 287      * Processes window events occurring on this component.
 288      * Hides the window or disposes of it, as specified by the setting
 289      * of the <code>defaultCloseOperation</code> property.




 249     public JFrame(String title, GraphicsConfiguration gc) {
 250         super(title, gc);
 251         frameInit();
 252     }
 253 
 254     /** Called by the constructors to init the <code>JFrame</code> properly. */
 255     protected void frameInit() {
 256         enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK);
 257         setLocale( JComponent.getDefaultLocale() );
 258         setRootPane(createRootPane());
 259         setBackground(UIManager.getColor("control"));
 260         setRootPaneCheckingEnabled(true);
 261         if (JFrame.isDefaultLookAndFeelDecorated()) {
 262             boolean supportsWindowDecorations =
 263             UIManager.getLookAndFeel().getSupportsWindowDecorations();
 264             if (supportsWindowDecorations) {
 265                 setUndecorated(true);
 266                 getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
 267             }
 268         }
 269         sun.awt.SunToolkit.checkAndSetPolicy(this);
 270     }
 271 
 272     /**
 273      * Called by the constructor methods to create the default
 274      * <code>rootPane</code>.
 275      */
 276     protected JRootPane createRootPane() {
 277         JRootPane rp = new JRootPane();
 278         // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
 279         // is NO reason for the RootPane not to be opaque. For painting to
 280         // work the contentPane must be opaque, therefor the RootPane can
 281         // also be opaque.
 282         rp.setOpaque(true);
 283         return rp;
 284     }
 285 
 286     /**
 287      * Processes window events occurring on this component.
 288      * Hides the window or disposes of it, as specified by the setting
 289      * of the <code>defaultCloseOperation</code> property.