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

Print this page




 132         TimerQueue q = TimerQueue.sharedInstance();
 133         if(q != null) {
 134             q.startIfNeeded();
 135         }
 136 
 137         /* Workaround for bug 4155072.  The shared double buffer image
 138          * may hang on to a reference to this applet; unfortunately
 139          * Image.getGraphics() will continue to call JApplet.getForeground()
 140          * and getBackground() even after this applet has been destroyed.
 141          * So we ensure that these properties are non-null here.
 142          */
 143         setForeground(Color.black);
 144         setBackground(Color.white);
 145 
 146         setLocale( JComponent.getDefaultLocale() );
 147         setLayout(new BorderLayout());
 148         setRootPane(createRootPane());
 149         setRootPaneCheckingEnabled(true);
 150 
 151         setFocusTraversalPolicyProvider(true);
 152         sun.awt.SunToolkit.checkAndSetPolicy(this, true);
 153 
 154         enableEvents(AWTEvent.KEY_EVENT_MASK);
 155     }
 156 
 157 
 158     /** Called by the constructor methods to create the default rootPane. */
 159     protected JRootPane createRootPane() {
 160         JRootPane rp = new JRootPane();
 161         // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
 162         // is NO reason for the RootPane not to be opaque. For painting to
 163         // work the contentPane must be opaque, therefor the RootPane can
 164         // also be opaque.
 165         rp.setOpaque(true);
 166         return rp;
 167     }
 168 
 169     /**
 170      * Sets the {@code transferHandler} property, which is a mechanism to
 171      * support transfer of data into this component. Use {@code null}
 172      * if the component does not support data transfer operations.




 132         TimerQueue q = TimerQueue.sharedInstance();
 133         if(q != null) {
 134             q.startIfNeeded();
 135         }
 136 
 137         /* Workaround for bug 4155072.  The shared double buffer image
 138          * may hang on to a reference to this applet; unfortunately
 139          * Image.getGraphics() will continue to call JApplet.getForeground()
 140          * and getBackground() even after this applet has been destroyed.
 141          * So we ensure that these properties are non-null here.
 142          */
 143         setForeground(Color.black);
 144         setBackground(Color.white);
 145 
 146         setLocale( JComponent.getDefaultLocale() );
 147         setLayout(new BorderLayout());
 148         setRootPane(createRootPane());
 149         setRootPaneCheckingEnabled(true);
 150 
 151         setFocusTraversalPolicyProvider(true);
 152         sun.awt.SunToolkit.checkAndSetPolicy(this);
 153 
 154         enableEvents(AWTEvent.KEY_EVENT_MASK);
 155     }
 156 
 157 
 158     /** Called by the constructor methods to create the default rootPane. */
 159     protected JRootPane createRootPane() {
 160         JRootPane rp = new JRootPane();
 161         // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
 162         // is NO reason for the RootPane not to be opaque. For painting to
 163         // work the contentPane must be opaque, therefor the RootPane can
 164         // also be opaque.
 165         rp.setOpaque(true);
 166         return rp;
 167     }
 168 
 169     /**
 170      * Sets the {@code transferHandler} property, which is a mechanism to
 171      * support transfer of data into this component. Use {@code null}
 172      * if the component does not support data transfer operations.