Ejemplo n.º 1
0
 /**
  * Overrides <code>JComponent.removeNotify</code> to check if this button is currently set as the
  * default button on the <code>RootPane</code>, and if so, sets the <code>RootPane</code>'s
  * default button to <code>null</code> to ensure the <code>RootPane</code> doesn't hold onto an
  * invalid button reference.
  */
 public void removeNotify() {
   JRootPane root = SwingUtilities.getRootPane(this);
   if (root != null && root.getDefaultButton() == this) {
     root.setDefaultButton(null);
   }
   super.removeNotify();
 }
Ejemplo n.º 2
0
 /**
  * Gets the value of the <code>defaultButton</code> property, which if <code>true</code> means
  * that this button is the current default button for its <code>JRootPane</code>. Most look and
  * feels render the default button differently, and may potentially provide bindings to access the
  * default button.
  *
  * @return the value of the <code>defaultButton</code> property
  * @see JRootPane#setDefaultButton
  * @see #isDefaultCapable
  * @beaninfo description: Whether or not this button is the default button
  */
 public boolean isDefaultButton() {
   JRootPane root = SwingUtilities.getRootPane(this);
   if (root != null) {
     return root.getDefaultButton() == this;
   }
   return false;
 }
Ejemplo n.º 3
0
 /**
  * Called by the browser or applet viewer to inform this JApplet that it has been loaded into the
  * system. It is always called before the first time that the start method is called.
  */
 public void init() {
   // this is a workaround for a security conflict with some browsers
   // including some versions of Netscape & Internet Explorer which do
   // not allow access to the AWT system event queue which JApplets do
   // on startup to check access. May not be necessary with your browser.
   JRootPane rootPane = this.getRootPane();
   rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
   setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
   b1 = new Button("Choose this card");
   add(b1);
   b1.addActionListener(this);
   // provide any initialisation necessary for your JApplet
 }
Ejemplo n.º 4
0
 private static boolean isWindowTextured(final Component c) {
   if (!(c instanceof JComponent)) {
     return false;
   }
   final JRootPane pane = ((JComponent) c).getRootPane();
   if (pane == null) {
     return false;
   }
   Object prop = pane.getClientProperty(CPlatformWindow.WINDOW_BRUSH_METAL_LOOK);
   if (prop != null) {
     return Boolean.parseBoolean(prop.toString());
   }
   prop = pane.getClientProperty(CPlatformWindow.WINDOW_STYLE);
   return prop != null && "textured".equals(prop);
 }