微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.RootPaneContainer的实例源码

项目:incubator-netbeans    文件ZOrderManager.java   
/** Stops to track given window (RootPaneContainer).
 */
public boolean detachWindow (RootPaneContainer rpc) {
    logger.entering(getClass().getName(),"detachWindow");

    if (!(rpc instanceof Window)) {
        throw new IllegalArgumentException("Argument must be subclas of java.awt.Window: " + rpc);   //NOI18N
    }

    WeakReference<RootPaneContainer> ww = getWeak(rpc);
    if (ww == null) {
        return false;
    }

    ((Window)rpc).removeWindowListener(this);
    return zOrder.remove(ww);
}
项目:incubator-netbeans    文件FileChooserBuilderTest.java   
private static AbstractButton findDefaultButton(Container c,String txt) {
    if (c instanceof RootPaneContainer) {
        JRootPane root = ((RootPaneContainer) c).getRootPane();
        if (root == null) {
            return null;
        }
        AbstractButton btn = root.getDefaultButton();
        if (btn == null) {
            //Metal L&F does not set default button for JFileChooser
            Container parent = c;
            while (parent.getParent() != null && !(parent instanceof Dialog)) {
                parent = parent.getParent();
            }
            if (parent instanceof Dialog) {
                return findFileChooserAcceptButton ((Dialog) parent,txt);
            }
        } else {
            return btn;
        }
    }
    return null;
}
项目:swingspy    文件SwingSpy.java   
/**
 * Shows spy dialog or reload existing one.
 *
 * @param rootComponent root component
 * @param component current component
 */
public void showSpyDialog(final Component rootComponent,final Component component) {
    if (spyDialog != null) {
        spyDialog.setVisible(true);
        spyGlass.setVisible(true);
        spyPanel.reload(rootComponent,component);
        return;
    }
    if (rootComponent instanceof RootPaneContainer) {
        RootPaneContainer rootPane = (RootPaneContainer) rootComponent;
        spyGlass = new SwingSpyGlasspane(rootPane);
        rootPane.setGlasspane(spyGlass);
        rootPane.getGlasspane().setVisible(true);
        Toolkit.getDefaultToolkit().addAWTEventListener(spyGlass,AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    }

    SwingUtilities.invokelater(new Runnable() {
        public void run() {
            initSpyDialog(rootComponent,component);
        }
    });
}
项目:Equella    文件GlasspaneUtils.java   
private static RootPaneContainer getRootContainer(Component startComponent)
{
    Component aComponent = startComponent;

    // climb the component hierarchy until a RootPaneContainer is found or
    // until the very top
    while( (aComponent.getParent() != null) && !(aComponent instanceof RootPaneContainer) )
    {
        aComponent = aComponent.getParent();
    }

    // Guard against error conditions if climb search wasn't successful
    if( aComponent instanceof RootPaneContainer )
    {
        return (RootPaneContainer) aComponent;
    }

    return null;
}
项目:hiervis    文件SwingUIUtils.java   
/**
 * {@linkplain #installOperation(RootPaneContainer,int,Keystroke,String,Action)}
 */
public static Action installOperation(
    final RootPaneContainer frame,final int condition,final Keystroke keystroke,final String actionKey,final Runnable runnable )
{
    Action result = new AbstractAction( actionKey ) {
        public void actionPerformed( ActionEvent e )
        {
            runnable.run();
        }
    };

    installOperation( frame,condition,keystroke,actionKey,result );
    return result;
}
项目:hiervis    文件SwingUIUtils.java   
/**
 * Removes an operation installed in the specified frame for the specified
 * keystroke and condition.
 * 
 * @param frame
 *            The frame from which the keybind is to be uninstalled.
 * @param condition
 *            When should this keybind be activated.
 *            Either {@link JComponent#WHEN_FOCUSED},{@link JComponent#WHEN_IN_FOCUSED_WINDOW},or
 *            {@link JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}.
 * @param keystroke
 *            The keystroke used to activate the keybind
 */
public static void uninstallOperation(
    final RootPaneContainer frame,final Keystroke keystroke )
{
    JRootPane root = frame.getRootPane();

    InputMap inputMap = root.getInputMap( condition );
    InputMap parentMap = inputMap.getParent();

    // Temporarily remove the parent input map,so that we don't receive the
    // action key from the parent's input map if the current input map has
    // no action key bound to the key stroke.
    inputMap.setParent( null );

    Object actionKey = root.getInputMap( condition ).get( keystroke );
    if ( actionKey == null )
        throw new OperationnotinstalledException( keystroke );
    root.getInputMap( condition ).remove( keystroke );
    root.getActionMap().remove( actionKey );

    inputMap.setParent( parentMap );
}
项目:hiervis    文件SwingUIUtils.java   
/**
 * Returns the Action installed under the specified action key in the specified frame.
 * 
 * @param frame
 *            The frame in which the action is installed
 * @param actionKey
 *            The action key to which the action is bound
 * @param selfOnly
 *            If true,will only check the frame specified in argument for actions bound
 *            to the action key.
 *            If false,will check any parents of the action map for actions bound to the
 *            action key,if none was found in the first one.
 */
public static Action getInstalledOperation(
    final RootPaneContainer frame,final Object actionKey,boolean selfOnly )
{
    JRootPane root = frame.getRootPane();

    if ( selfOnly ) {
        ActionMap actionMap = root.getActionMap();
        ActionMap parentMap = actionMap.getParent();

        actionMap.setParent( null );
        Action result = actionMap.get( actionKey );
        actionMap.setParent( parentMap );

        return result;
    }
    else {
        return root.getActionMap().get( actionKey );
    }
}
项目:jGAF    文件DesignGridLayout.java   
/**
 * Builds a DesignGridLayout instance attached to a {@link Container}.
 * This instance should be then used to add rows and components to the parent
 * container.
 * <p/>
 * Note that this constructor auomatically calls {@code parent.setLayout(this)}
 * so you don't need to call it yourself.
 * <p/>
 * In no way should the {@link Container#add} and {@link Container#remove}
 * ever be used with {@code parent}.
 * 
 * @param parent the container for which we want to use DesignGridLayout; 
 * cannot be {@code null}.
 */
public DesignGridLayout(Container parent)
{
    if (parent == null)
    {
        throw new NullPointerException("parent cannot be null");
    }
    Container target = parent;
    if (parent instanceof RootPaneContainer)
    {
        target = ((RootPaneContainer) parent).getContentPane();
    }
    _wrapper = new ParentWrapper<Container>(target);
    _orientation = new OrientationPolicy(target);
    _layout = new DesignGridLayoutManager(this,_wrapper,_rows,_orientation);
    _layout.setHeightTester(_heightTester);
    target.setLayout(_layout);
}
项目:pumpernickel    文件LocationPaneUI.java   
/** Turn on/off special shortcuts. For example: on Mac command+D should navigate to the desktop.
 */
protected void setShortcutsActive(boolean b) {
    Window window = SwingUtilities.getwindowAncestor(locationPane);
    /** T4L Bug 21770 had to do with a normally hidden LocationPaneUI consuming cmd+D
     * keystrokes. So Now we only install these keystrokes if we're visible and
     * in a dialog...
     */
    if(window instanceof RootPaneContainer && window instanceof Dialog) {
        RootPaneContainer rpc = (RootPaneContainer)window;
        JRootPane rootPane = rpc.getRootPane();
        if(b) {
            rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(desktopKeystroke,"navigatetoDesktop");
            rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(desktopKeystroke,"navigatetoDesktop");
            rootPane.getActionMap().put("navigatetoDesktop",navigatetoDesktop);
        } else {
            rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(desktopKeystroke);
            rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(desktopKeystroke);
        }
    }
}
项目:pumpernickel    文件CustomizedToolbar.java   
/** Are we painting against a dark background?
 * This checks the JVM version,the os,and whether the window's ultimate parent
 * uses Apple's brush-Metal-look. 
 */
protected static boolean isDarkBackground(Window w) {
    if(!isMac)
        return false;

    if(JVM.getMajorJavaVersion()<1.5)
        return false;

    while(w!=null) {
        if(w instanceof RootPaneContainer) {
            JRootPane rootPane = ((RootPaneContainer)w).getRootPane();
            Object obj = rootPane.getClientProperty("apple.awt.brushMetalLook");
            if(obj==null) obj = Boolean.FALSE;
            if(obj.toString().equals("true")) {
                return true;
            }
        }
        w = w.getowner();
    }
    return false;
}
项目:Metasfresh    文件MetasfreshGlasspane.java   
public static final MetasfreshGlasspane getorNull(final RootPaneContainer rootPaneContainer)
{
    if (rootPaneContainer == null)
    {
        return null;
    }

    final Component glasspaneComp = rootPaneContainer.getGlasspane();
    if (glasspaneComp instanceof MetasfreshGlasspane)
    {
        return (MetasfreshGlasspane)glasspaneComp;
    }
    else
    {
        return null;
    }
}
项目:SpreaD3    文件DialogFooter.java   
private void setRootPaneContainer(JButton button,RootPaneContainer c) {
    RootPaneContainer lastContainer = (RootPaneContainer)button.getClientProperty("bric.footer.rpc");
    if(lastContainer==c) return;

    if(lastContainer!=null) {
        lastContainer.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(escapeKey);
        lastContainer.getRootPane().getActionMap().remove(escapeKey);

        if(JVM.isMac)
            lastContainer.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(commandPeriodKey);

    }

    if(c!=null) {
        c.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(escapeKey,escapeKey);
        c.getRootPane().getActionMap().put(escapeKey,new ClickAction(button));

        if(JVM.isMac)
            c.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(commandPeriodKey,escapeKey);
    }
    button.putClientProperty("bric.footer.rpc",c);
}
项目:javamelody    文件MWaitCursor.java   
/**
 * Constructeur : crée le WaitCursor et affiche le sablier.
 * @param comp Component
 */
public MWaitCursor(Component comp) {
    // Curseur de la frame contenant le component
    window = SwingUtilities.windowForComponent(comp);
    windowGlasspaneVisible = window instanceof RootPaneContainer
            && ((RootPaneContainer) window).getGlasspane().isVisible();
    oldWindowCursor = window != null ? window.getCursor() : null;

    // On ne change pas le curseur du component car cela poserait problème en cas d'imbrication
    // pour le remettre à sa valeur initiale (Component.getCursor renvoyant le cursor de son parent si non défini)

    // On active le curseur d'attente
    // (l'utilisation du glasspane rend le curseur visible lors d'un double-clique sur une ligne par ex.
    // et l'utilisation de curseur de la window rend celui-ci visible même si on sort de la fenêtre pour revenir)
    if (window instanceof RootPaneContainer) {
        final Component glasspane = ((RootPaneContainer) window).getGlasspane();
        glasspane.setVisible(true);
        glasspane.setCursor(WAIT_CURSOR);
    }
    if (window != null) {
        window.setCursor(WAIT_CURSOR);
    }
}
项目:seaglass    文件TitlePaneMaximizeButtonWindowMaximizedState.java   
/**
 * {@inheritDoc}
 */
public boolean isInState(JComponent c) {
    Component parent = c;

    while (parent.getParent() != null) {

        if (parent instanceof RootPaneContainer) {
            break;
        }

        parent = parent.getParent();
    }

    if (parent instanceof JFrame) {
        return (((JFrame) parent).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0;
    } else if (parent instanceof JInternalFrame) {
        return ((JInternalFrame) parent).isMaximum();
    }

    return false;
}
项目:incubator-taverna-workbench    文件Helper.java   
/**
 * Set up a key-press catcher for the specified component such that when F1
 * is pressed it should help for the component where the cursor is.
 *
 * @param rootpanecontainer
 */
public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
    @SuppressWarnings("serial")
    AbstractAction theAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            Component component = (Component) rootpanecontainer;
            Container container = (Container) rootpanecontainer;
            logger.info("frame action F1 pressed with source "
                    + evt.getSource().getClass().getName());
            Point mousePosition = getPointerInfo().getLocation();
            Point framePosition = component.getLocation();
            Point relativePosition = (Point) mousePosition.clone();
            relativePosition.translate(-framePosition.x,-framePosition.y);
            Component c = container.findComponentAt(relativePosition);
            if (c != null)
                logger.info("F1 pressed in a " + c.getClass().getName());
            showHelpWithinContainer(rootpanecontainer,c);
        }
    };

    JRootPane pane = rootpanecontainer.getRootPane();
    setKeyCatcher(pane,theAction);
}
项目:codenameone    文件BlockingAction.java   
public final void actionPerformed(ActionEvent e) {
    RootPaneContainer r = (RootPaneContainer)ResourceEditorApp.getApplication().getMainFrame();
    glasspane = r.getGlasspane();
    final ImageIcon progress = new ImageIcon(getClass().getResource("/progress.gif"));
    final JComponent c = new JLabel(progress);
    c.addMouseListener(new MouseAdapter() {});
    c.addKeyListener(new KeyAdapter() {});
    r.setGlasspane(c);
    c.setVisible(true);
    t = new Timer(100,new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rotation += 10;
            if(rotation > 359) {
                rotation = 0;
            }
            c.repaint();
        }
    });
    t.setRepeats(true);
    t.start();
    start();
    new Thread(this).start();
}
项目:codenameone    文件BlockingAction.java   
public final void run() {
    try {
        exectute();
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                afterComplete();
            }
        });
    } catch(Exception err) {
        err.printstacktrace();
    } finally {
        t.stop();
        RootPaneContainer r = (RootPaneContainer)ResourceEditorApp.getApplication().getMainFrame();
        r.setGlasspane(glasspane);
    }
}
项目:codenameone    文件BaseForm.java   
public synchronized void setoverrideMode(boolean overrideMode,java.awt.Component c) {
    RootPaneContainer r = (RootPaneContainer)SwingUtilities.windowForComponent(c);
    if(overrideMode) {
        if(overrideImage == null) {
            overrideImage = new ImageIcon(getClass().getResource("/override_stamp.png"));
        }
        PainterGlasspane pg = new PainterGlasspane();
        MattePainter matte = new MattePainter(new Color(0xcc,0xcc,120)) {
            protected  void doPaint(java.awt.Graphics2D g,java.lang.Object component,int width,int height) {
                super.doPaint(g,component,width,height);
                overrideImage.paintIcon(BaseForm.this,g,0);
                //g.drawImage(overrideImage.getimage(),width / 2 - overrideImage.getIconWidth() / 2,BaseForm.this);
            }
        };
        pg.setPainter(matte);
        pg.addTarget(this);
        r.setGlasspane(pg);
        pg.setBounds(0,r.getContentPane().getWidth(),r.getContentPane().getHeight());
        pg.setVisible(true);
    } else {
        r.setGlasspane(new JLabel());
    }
}
项目:cn1    文件BasicToolBarUI.java   
protected RootPaneContainer createFloatingWindow(final JToolBar toolbar) {
    Window owner = SwingUtilities.getwindowAncestor(toolBar);
    while (owner instanceof FloatingWindow) {
        owner = owner.getowner();
    }
    jdialog floatingFrame;
    if (owner instanceof Dialog) {
        floatingFrame = new FloatingWindow((Dialog)owner,toolbar.getName());
    } else if (owner instanceof Frame) {
        floatingFrame = new FloatingWindow((Frame)owner,toolbar.getName());
    } else {
        floatingFrame = new FloatingWindow((Frame)null,toolbar.getName());
    }

    floatingFrame.setResizable(false);
    floatingFrame.addWindowListener(createFrameListener());
    return floatingFrame;
}
项目:cn1    文件BlockingAction.java   
public final void actionPerformed(ActionEvent e) {
    RootPaneContainer r = (RootPaneContainer)ResourceEditorApp.getApplication().getMainFrame();
    glasspane = r.getGlasspane();
    final ImageIcon progress = new ImageIcon(getClass().getResource("/progress.gif"));
    final JComponent c = new JLabel(progress);
    c.addMouseListener(new MouseAdapter() {});
    c.addKeyListener(new KeyAdapter() {});
    r.setGlasspane(c);
    c.setVisible(true);
    t = new Timer(100,new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rotation += 10;
            if(rotation > 359) {
                rotation = 0;
            }
            c.repaint();
        }
    });
    t.setRepeats(true);
    t.start();
    start();
    new Thread(this).start();
}
项目:cn1    文件BlockingAction.java   
public final void run() {
    try {
        exectute();
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                afterComplete();
            }
        });
    } catch(Exception err) {
        err.printstacktrace();
    } finally {
        t.stop();
        RootPaneContainer r = (RootPaneContainer)ResourceEditorApp.getApplication().getMainFrame();
        r.setGlasspane(glasspane);
    }
}
项目:cn1    文件BaseForm.java   
public synchronized void setoverrideMode(boolean overrideMode,r.getContentPane().getHeight());
        pg.setVisible(true);
    } else {
        r.setGlasspane(new JLabel());
    }
}
项目:jshred    文件SwingUtils.java   
/**
 * Sets the cancel button for a {@link RootPaneContainer}. Pressing the escape key
 * will also trigger that {@link JButton}.
 *
 * @param dialog
 *            {@link RootPaneContainer} to set the cancel button for
 * @param cancel
 *            Cancel {@link JButton}.
 * @since R7
 */
public static void setCancelKey(RootPaneContainer dialog,JButton cancel) {
    final JButton fCancel = cancel;
    final String name = "CancelAction";

    JlayeredPane lp = dialog.getlayeredPane();
    lp.getActionMap().put(name,new AbstractAction(name) {
        private static final long serialVersionUID = 3760844579897030200L;

        @Override
        public void actionPerformed(ActionEvent e) {
            fCancel.doClick();
        }
    });

    Keystroke stroke = Keystroke.getKeystroke(KeyEvent.VK_ESCAPE,0);
    lp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke,name);
}
项目:freeVM    文件BasicToolBarUI.java   
protected RootPaneContainer createFloatingWindow(final JToolBar toolbar) {
    Window owner = SwingUtilities.getwindowAncestor(toolBar);
    while (owner instanceof FloatingWindow) {
        owner = owner.getowner();
    }
    jdialog floatingFrame;
    if (owner instanceof Dialog) {
        floatingFrame = new FloatingWindow((Dialog)owner,toolbar.getName());
    }

    floatingFrame.setResizable(false);
    floatingFrame.addWindowListener(createFrameListener());
    return floatingFrame;
}
项目:wichtel    文件TrayIcon.java   
void showjpopupmenu(final MouseEvent e) {
    if (null != popup) {
        if (null == dialog) {
            dialog = new jdialog((Frame) null);
            dialog.setUndecorated(true);
            dialog.setAlwaysOnTop(true);
            final Dimension size = popup.getPreferredSize();

            final Point centerPoint = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
            if (e.getY() > centerPoint.getY()) {
                dialog.setLocation(Platform.MAC_OSX == PLATFORM ? e.getXOnScreen() : e.getX(),Platform.MAC_OSX == PLATFORM ? MAC_MENUBAR_OFFSET : e
                        .getY()
                        - size.height);
            } else {
                dialog.setLocation(Platform.MAC_OSX == PLATFORM ? e.getXOnScreen() : e.getX(),Platform.MAC_OSX == PLATFORM ? MAC_MENUBAR_OFFSET : e
                        .getY());
            }

            dialog.setVisible(true);

            popup.show(((RootPaneContainer) dialog).getContentPane(),0);

            dialog.toFront();
        }
    }
}
项目:monsiaj    文件WindowBuilder.java   
@Override
void buildChildren(Interface xml,Container parent,WidgetInfo info) {
    Window w = (Window) parent;
    Iterator i = info.getChildren().iterator();
    if (parent instanceof RootPaneContainer) {
        RootPaneContainer rootPaneContainer = (RootPaneContainer) parent;
        parent = rootPaneContainer.getContentPane();
    }
    while (i.hasNext()) {
        ChildInfo cInfo = (ChildInfo) i.next();
        WidgetInfo wInfo = cInfo.getWidgetInfo();
        Component child = WidgetBuilder.buildWidget(xml,wInfo,parent);
        if (child instanceof JMenuBar) {
            xml.setMenuBar((JMenuBar) child);
        } else {
            w.setChild(child);
        }
        if (child instanceof Fixed) {
            wInfo.setProperty("width","1024");
            wInfo.setProperty("height","768");
        }
    }
}
项目:monsiaj    文件ContainerBuilder.java   
void buildChildren(Interface xml,WidgetInfo info) {
    Iterator i = info.getChildren().iterator();
    if (parent instanceof RootPaneContainer) {
        RootPaneContainer rootPaneContainer = (RootPaneContainer)parent;
        parent = rootPaneContainer.getContentPane();
    }
    while (i.hasNext()) {
        ChildInfo cInfo = (ChildInfo)i.next();
        WidgetInfo wInfo = cInfo.getWidgetInfo();
        Component child = WidgetBuilder.buildWidget(xml,parent);
        if (child instanceof JMenuBar) {
            xml.setMenuBar((JMenuBar)child);
        } else {
            parent.add(child);
        }
    }
}
项目:incubator-netbeans    文件ZOrderManager.java   
/** Adds given window (RootPaneContainer) to the set of windows which are tracked.
 */
public void attachWindow (RootPaneContainer rpc) {
    logger.entering(getClass().getName(),"attachWindow");

    if (!(rpc instanceof Window)) {
        throw new IllegalArgumentException("Argument must be subclas of java.awt.Window: " + rpc);   //NOI18N
    }
    if (getWeak(rpc) != null) {
        throw new IllegalArgumentException("Window already attached: " + rpc);   //NOI18N
    }

    zOrder.add(new WeakReference<RootPaneContainer>(rpc));
    ((Window)rpc).addWindowListener(this);
}
项目:incubator-netbeans    文件ZOrderManager.java   
/** Excludes/reincludes given RootPaneContainer from z-ordering. Excluded RootPaneContainer
 * never returns true from isOnTop call,even if it is on top of window stack.
 * RootPaneContainer that is second on top is returned in such situation.
 *
 * Used to distinguish RootPaneContainer that is being dragged.
 *
 * @param rpc Pane container to exlude or include back into rthe z-ordering.
 * @param exclude true when exclusion is needed,false when normal default
 * behavIoUr is desirable.
 */
public void setExcludeFromOrder (RootPaneContainer rpc,boolean exclude) {
    if (exclude) {
        excludeSet.add(new WeakReference<RootPaneContainer>(rpc));
    } else {
        WeakReference<RootPaneContainer> ww = getExcludedWeak(rpc);
        if (ww != null) {
            excludeSet.remove(ww);
        }
    }
}
项目:incubator-netbeans    文件ZOrderManager.java   
public void clear () {
    RootPaneContainer rpc;
    for (WeakReference<RootPaneContainer> elem : zOrder) {
        rpc = elem.get();
        if (rpc != null) {
            ((Window)rpc).removeWindowListener(this);
        }
    }
    zOrder.clear();
}
项目:incubator-netbeans    文件ZOrderManager.java   
public void windowActivated(WindowEvent e) {
    logger.entering(getClass().getName(),"windowActivated");

    WeakReference<RootPaneContainer> ww = getWeak((RootPaneContainer)e.getwindow());
    if (ww != null) {
        // place as last item in zOrder list
        zOrder.remove(ww);
        zOrder.add(ww);
    } else {
        throw new IllegalArgumentException("Window not attached: " + e.getwindow()); //NOI18N
    }
}
项目:incubator-netbeans    文件ZOrderManager.java   
private WeakReference<RootPaneContainer> getWeak (RootPaneContainer rpc) {
    for (WeakReference<RootPaneContainer> elem : zOrder) {
        if (elem.get() == rpc) {
            return elem;
        }
    }
    return null;
}
项目:incubator-netbeans    文件ZOrderManager.java   
private WeakReference<RootPaneContainer> getExcludedWeak (RootPaneContainer rpc) {
    for (WeakReference<RootPaneContainer> elem : excludeSet) {
        if (elem.get() == rpc) {
            return elem;
        }
    }
    return null;
}
项目:swingspy    文件SwingSpyGlasspane.java   
public SwingSpyGlasspane(RootPaneContainer rootPaneContainer) {
    super(null);
 setName("SwingSpyGlass");
    this.rootPaneContainer = rootPaneContainer;
    this.fontColor = Color.RED.darker();
    this.highlightColor = new Color(0xFFdddd);
    this.font = new Font("sansserif",Font.BOLD,14);
    this.alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.5f);
    setopaque(false);
}
项目:VASSAL-src    文件Map.java   
/**
 * When a game is started,create a top-level window,if none exists.
 * When a game is ended,remove all boards from the map.
 *
 * @see GameComponent
 */
public void setup(boolean show) {
  if (show) {
    final GameModule g = GameModule.getGameModule();

    if (shouldDockIntoMainWindow()) {
      mainWindowDock.showComponent();
      final int height = ((Integer)
        Prefs.getGlobalPrefs().getValue(MAIN_WINDOW_HEIGHT)).intValue();
      if (height > 0) {
        final Container top = mainWindowDock.getTopLevelAncestor();
        top.setSize(top.getWidth(),height);
      }
      if (toolBar.getParent() == null) {
        g.getToolBar().addSeparator();
        g.getToolBar().add(toolBar);
      }
      toolBar.setVisible(true);
    }
    else {
      if (SwingUtilities.getwindowAncestor(theMap) == null) {
        final Window topWindow = createParentFrame();
        topWindow.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (useLaunchButton) {
              topWindow.setVisible(false);
            }
            else {
              g.getGameState().setup(false);
            }
          }
        });
        ((RootPaneContainer) topWindow).getContentPane().add("north",getToolBar()); //$NON-NLS-1$
        ((RootPaneContainer) topWindow).getContentPane().add("Center",layeredPane); //$NON-NLS-1$
        topWindow.setSize(600,400);
        final Positionoption option =
          new Positionoption(Positionoption.key + getIdentifier(),topWindow);
        g.getPrefs().addOption(option);
      }
      theMap.getTopLevelAncestor().setVisible(!useLaunchButton);
      theMap.revalidate();
    }
  }
  else {
    pieces.clear();
    boards.clear();
    if (mainWindowDock != null) {
      if (mainWindowDock.getHideableComponent().isShowing()) {
        Prefs.getGlobalPrefs().getoption(MAIN_WINDOW_HEIGHT)
             .setValue(mainWindowDock.getTopLevelAncestor().getHeight());
      }
      mainWindowDock.hideComponent();
      toolBar.setVisible(false);
    }
    else if (theMap.getTopLevelAncestor() != null) {
      theMap.getTopLevelAncestor().setVisible(false);
    }
  }
  launchButton.setEnabled(show);
  launchButton.setVisible(useLaunchButton);
}
项目:Equella    文件GlasspaneUtils.java   
public synchronized static <T extends Component> T mount(Component startComponent,boolean stopClosing,boolean alwaysRecreateGlasspane,Class<T> paneClass,GlasspaneCallback<T> callback)
{
    RootPaneContainer rootpane = getRootContainer(startComponent);
    if( rootpane != null )
    {
        Component gp = rootpane.getGlasspane();
        if( !alwaysRecreateGlasspane )
        {
            if( paneClass.isAssignableFrom(gp.getClass()) )
            {
                if( !gp.isVisible() )
                {
                    T ogp = paneClass.cast(gp);
                    callback.processExisting(ogp);
                    return ogp;
                }
                else
                {
                    return null;
                }
            }
        }

        T ngp = callback.construct();
        rootpane.setGlasspane(ngp);
        return ngp;
    }
    return null;
}
项目:Openjsharp    文件FullScreenHandler.java   
static void addFullScreenListenerTo(final RootPaneContainer window,final FullScreenListener listener) {
    final Object value = window.getRootPane().getClientProperty(CLIENT_PROPERTY);
    if (value instanceof FullScreenHandler) {
        ((FullScreenHandler)value).addListener(listener);
        return;
    }

    if (value != null) return; // some other garbage is in our client property

    final FullScreenHandler newHandler = new FullScreenHandler();
    newHandler.addListener(listener);
    window.getRootPane().putClientProperty(CLIENT_PROPERTY,newHandler);
}
项目:Openjsharp    文件FullScreenHandler.java   
static void handleFullScreenEventFromNative(final Window window,final int type) {
    if (!(window instanceof RootPaneContainer)) return; // handles null

    SunToolkit.executeOnEventHandlerThread(window,new Runnable() {
        public void run() {
            final FullScreenHandler handler = getHandlerFor((RootPaneContainer)window);
            if (handler != null) handler.notifyListener(new FullScreenEvent(window),type);
        }
    });
}
项目:jdk8u-jdk    文件FullScreenHandler.java   
static void addFullScreenListenerTo(final RootPaneContainer window,newHandler);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。