Package javax.swing

Examples of javax.swing.JRootPane$AccessibleJRootPane


        }

        /** Return the last alpha level we set on the window. */
        private byte getAlpha(Window w) {
            if (w instanceof RootPaneContainer) {
                JRootPane root = ((RootPaneContainer)w).getRootPane();
                Byte b = (Byte)root.getClientProperty(TRANSPARENT_ALPHA);
                if (b != null) {
                    return b.byteValue();
                }
            }
            return (byte)0xFF;
View Full Code Here


            whenDisplayable(w, new Runnable() {
                public void run() {
                    User32 user = User32.INSTANCE;
                    HWND hWnd = getHWnd(w);
                    int flags = user.GetWindowLong(hWnd, WinUser.GWL_EXSTYLE);
                    JRootPane root = ((RootPaneContainer)w).getRootPane();
                    JLayeredPane lp = root.getLayeredPane();
                    Container content = root.getContentPane();
                    if (content instanceof W32TransparentContentPane) {
                        ((W32TransparentContentPane)content).setTransparent(transparent);
                    }
                    else if (transparent) {
                        W32TransparentContentPane w32content =
                            new W32TransparentContentPane(content);
                        root.setContentPane(w32content);
                        lp.add(new RepaintTrigger(w32content),
                               JLayeredPane.DRAG_LAYER);
                    }
                    if (transparent && !usingUpdateLayeredWindow(w)) {
                        flags |= WinUser.WS_EX_LAYERED;
View Full Code Here

        /** Setting this false restores the original setting. */
        private static final String WDRAG = "apple.awt.draggableWindowBackground";
        private void fixWindowDragging(Window w, String context) {
            if (w instanceof RootPaneContainer) {
                JRootPane p = ((RootPaneContainer)w).getRootPane();
                Boolean oldDraggable = (Boolean)p.getClientProperty(WDRAG);
                if (oldDraggable == null) {
                    p.putClientProperty(WDRAG, Boolean.FALSE);
                    if (w.isDisplayable()) {
                        System.err.println(context + "(): To avoid content dragging, " + context + "() must be called before the window is realized, or " + WDRAG + " must be set to Boolean.FALSE before the window is realized.  If you really want content dragging, set " + WDRAG + " on the window's root pane to Boolean.TRUE before calling " + context + "() to hide this message.");
                    }
                }
            }
View Full Code Here

         * property has no effect.
         * @see <a href="http://developer.apple.com/technotes/tn2007/tn2196.html#APPLE_AWT_DRAGGABLEWINDOWBACKGROUND">Apple Technote 2007</a>
         */
        public void setWindowAlpha(final Window w, final float alpha) {
            if (w instanceof RootPaneContainer) {
                JRootPane p = ((RootPaneContainer)w).getRootPane();
                p.putClientProperty("Window.alpha", new Float(alpha));
                fixWindowDragging(w, "setWindowAlpha");
            }
            whenDisplayable(w, new Runnable() {
        public void run() {
                    Object peer = w.getPeer();
View Full Code Here

                }
            }
        }

        private void setBackgroundTransparent(Window w, boolean transparent, String context) {
            JRootPane rp = w instanceof RootPaneContainer
                ? ((RootPaneContainer)w).getRootPane() : null;
            if (transparent) {
                if (rp != null) {
                    rp.putClientProperty(TRANSPARENT_OLD_BG, w.getBackground());
                }
                w.setBackground(new Color(0,0,0,0));
            }
            else {
                if (rp != null) {
                    Color bg = (Color)rp.getClientProperty(TRANSPARENT_OLD_BG);
                    // If the old bg is a
                    // apple.laf.CColorPaintUIResource, the window's
                    // transparent state will not change
                    if (bg != null) {
                        bg = new Color(bg.getRed(), bg.getGreen(), bg.getBlue(), bg.getAlpha());
                    }
                    w.setBackground(bg);
                    rp.putClientProperty(TRANSPARENT_OLD_BG, null);
                }
                else {
                    w.setBackground(null);
                }
            }
View Full Code Here

                && w.getBackground().getAlpha() == 0;
            if (transparent == isTransparent)
                return;
            whenDisplayable(w, new Runnable() {
                public void run() {
                    JRootPane root = ((RootPaneContainer)w).getRootPane();
                    JLayeredPane lp = root.getLayeredPane();
                    Container content = root.getContentPane();
                    if (content instanceof X11TransparentContentPane) {
                        ((X11TransparentContentPane)content).setTransparent(transparent);
                    }
                    else if (transparent) {
                        X11TransparentContentPane x11content =
                            new X11TransparentContentPane(content);
                        root.setContentPane(x11content);
                        lp.add(new RepaintTrigger(x11content),
                               JLayeredPane.DRAG_LAYER);
                    }
                    setLayersTransparent(w, transparent);
                    setForceHeavyweightPopups(w, transparent);
View Full Code Here

    ActionListener actionListener = new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        setVisible(false);
      }
    };
    JRootPane rootPane = new JRootPane();
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    rootPane.registerKeyboardAction(actionListener, stroke,
        JComponent.WHEN_IN_FOCUSED_WINDOW);
    return rootPane;
  }
View Full Code Here

    return new JApplet();
  }

  @Override
  public Component cloneWidget() {
    JRootPane jrp = new JRootPane();
    JApplet japplet = (JApplet) getWidget();
    JMenuBar jmb = japplet.getJMenuBar();
    if (jmb != null) {
      WidgetAdapter jmbAdapter = WidgetAdapter.getWidgetAdapter(jmb);
      JMenuBar jmenubar = (JMenuBar) jmbAdapter.cloneWidget();
      jrp.setJMenuBar(jmenubar);
    }
    Container container = (Container) contentAdapter.cloneWidget();
    jrp.setContentPane(container);
    return jrp;
  }
View Full Code Here

    return new JDialog();
  }

  @Override
  public Component cloneWidget() {
    JRootPane jrp = new JRootPane();
    JDialog jdialog = (JDialog) getWidget();
    JMenuBar jmb = jdialog.getJMenuBar();
    if (jmb != null) {
      WidgetAdapter jmbAdapter = WidgetAdapter.getWidgetAdapter(jmb);
      JMenuBar jmenubar = (JMenuBar) jmbAdapter.cloneWidget();
      jrp.setJMenuBar(jmenubar);
    }
    Container container = (Container) contentAdapter.cloneWidget();
    jrp.setContentPane(container);
    return jrp;
  }
View Full Code Here

      setDropStatus(JInternalFramePainter.DROPPING_PERMITTED);
      return true;
    } else{
      if(hasMenuBar()){
        JInternalFrame jif = (JInternalFrame) adaptable.getWidget();
        JRootPane rootPane = jif.getRootPane();
        p=SwingUtilities.convertPoint(rootPane, p, adaptable.getContentPane());
      }
      return getContentOperation().dragOver(p);
    }
  }
View Full Code Here

TOP

Related Classes of javax.swing.JRootPane$AccessibleJRootPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.