类javax.swing.RootPaneContainer源码实例Demo

下面列出了怎么用javax.swing.RootPaneContainer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FlatLaf   文件: FlatInspector.java
/**
 * Installs a key listener into the application that allows enabling and disabling
 * the UI inspector with the given keystroke (e.g. "ctrl shift alt X").
 */
public static void install( String activationKeys ) {
	KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys );
	Toolkit.getDefaultToolkit().addAWTEventListener( e -> {
		if( e.getID() == KeyEvent.KEY_RELEASED &&
			((KeyEvent)e).getKeyCode() == keyStroke.getKeyCode() &&
			(((KeyEvent)e).getModifiersEx() & KEY_MODIFIERS_MASK) == (keyStroke.getModifiers() & KEY_MODIFIERS_MASK)  )
		{
			Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
			if( activeWindow instanceof RootPaneContainer ) {
				JRootPane rootPane = ((RootPaneContainer)activeWindow).getRootPane();
				FlatInspector inspector = (FlatInspector) rootPane.getClientProperty( FlatInspector.class );
				if( inspector == null ) {
					inspector = new FlatInspector( rootPane );
					rootPane.putClientProperty( FlatInspector.class, inspector );
					inspector.setEnabled( true );
				} else {
					inspector.uninstall();
					rootPane.putClientProperty( FlatInspector.class, null );
				}
			}
		}
	}, AWTEvent.KEY_EVENT_MASK );
}
 
源代码2 项目: 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;

	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;
}
 
/**
 * {@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;
}
 
源代码4 项目: 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);
    }
}
 
源代码5 项目: 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);
}
 
源代码6 项目: bboxdb   文件: BBoxDBGui.java
/**
 * Get the glass pane of the main panel
 * @return
 */
public Component getGlassPane() {
	
	if(mainPanel == null) {
		return null;
	}
	
	final RootPaneContainer root = 
			(RootPaneContainer) mainPanel.getTopLevelAncestor();
	   
	if(root == null) {
		return null;
	}
	
	return root.getGlassPane();
}
 
源代码7 项目: jdk8u_jdk   文件: 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);
}
 
源代码8 项目: spring-analysis-note   文件: ProxyFactoryTests.java
@Test
@Ignore("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
	JFrame frame = new JFrame();
	ProxyFactory proxyFactory = new ProxyFactory(frame);
	Object proxy = proxyFactory.getProxy();
	assertTrue(proxy instanceof RootPaneContainer);
	assertTrue(proxy instanceof Accessible);
}
 
源代码9 项目: dragonwell8_jdk   文件: 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);
}
 
源代码10 项目: jdk8u_jdk   文件: JDialog741.java
public void start() {

        System.setProperty("jbre.popupwindow.settype", "true");

        jFrame = new JFrame("Wrong popup z-order");
        jFrame.setSize(200, 200);
        jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        JPanel jPanel = new JPanel();
        jPanel.setPreferredSize(new Dimension(200, 200));

        Popup popup = PopupFactory.getSharedInstance().getPopup(jFrame, jPanel, 100, 100);
        windowAncestor = SwingUtilities.getWindowAncestor(jPanel);
        ((RootPaneContainer) windowAncestor).getRootPane().putClientProperty("SIMPLE_WINDOW", true);
        windowAncestor.setFocusable(true);
        windowAncestor.setFocusableWindowState(true);
        windowAncestor.setAutoRequestFocus(true);

        jFrame.setVisible(true);
        popup.show();


        modalBlocker = new JDialog(windowAncestor, "Modal Blocker");
        modalBlocker.setModal(true);
        modalBlocker.setSize(new Dimension(200, 200));
        modalBlocker.setLocation(200, 200);
        modalBlocker.addWindowListener(new JDialog741Listener());
        modalBlocker.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

        modalBlocker.setVisible(true);
    }
 
源代码11 项目: snap-desktop   文件: Session.java
public static Container getRootPaneContainer(JComponent component) {
    Container parent = component;
    Container lastParent;
    do {
        if (parent instanceof RootPaneContainer) {
            return parent;
        }
        lastParent = parent;
        parent = lastParent.getParent();
    } while (parent != null);
    return lastParent;
}
 
源代码12 项目: TencentKona-8   文件: 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);
}
 
源代码13 项目: java-technology-stack   文件: ProxyFactoryTests.java
@Test
@Ignore("Not implemented yet, see http://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
	JFrame frame = new JFrame();
	ProxyFactory proxyFactory = new ProxyFactory(frame);
	Object proxy = proxyFactory.getProxy();
	assertTrue(proxy instanceof RootPaneContainer);
	assertTrue(proxy instanceof Accessible);
}
 
源代码14 项目: jdk8u60   文件: 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);
}
 
源代码15 项目: jdk8u60   文件: 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);
        }
    });
}
 
源代码16 项目: pcgen   文件: CursorControlUtilities.java
public static void startWaitCursor(JComponent component)
{
	RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor());
	root.getGlassPane().setCursor(WAIT_CURSOR);
	root.getGlassPane().addMouseListener(CLICK_CONSUMER);
	root.getGlassPane().setVisible(true);
	root.getRootPane().validate();
}
 
源代码17 项目: openjdk-8   文件: 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);
}
 
源代码18 项目: 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();
}
 
源代码19 项目: spring4-understanding   文件: ProxyFactoryTests.java
@Test
@Ignore("Not implemented yet, see http://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
	JFrame frame = new JFrame();
	ProxyFactory proxyFactory = new ProxyFactory(frame);
	Object proxy = proxyFactory.getProxy();
	assertTrue(proxy instanceof RootPaneContainer);
	assertTrue(proxy instanceof Accessible);
}
 
源代码20 项目: netbeans   文件: ZOrderManager.java
private WeakReference<RootPaneContainer> getWeak (RootPaneContainer rpc) {
    for (WeakReference<RootPaneContainer> elem : zOrder) {
        if (elem.get() == rpc) {
            return elem;
        }
    }
    return null;
}
 
源代码21 项目: netbeans   文件: ZOrderManager.java
private WeakReference<RootPaneContainer> getExcludedWeak (RootPaneContainer rpc) {
    for (WeakReference<RootPaneContainer> elem : excludeSet) {
        if (elem.get() == rpc) {
            return elem;
        }
    }
    return null;
}
 
源代码22 项目: jdk8u_jdk   文件: JDialog705.java
public static void main(String[] args) throws Exception {

        SwingUtilities.invokeAndWait(() -> {
            jFrame = new JFrame("Wrong popup z-order");
            jFrame.setSize(200, 200);

            JPanel jPanel = new JPanel();
            jPanel.setPreferredSize(new Dimension(200, 200));
            jPanel.setBackground(Color.BLACK);

            Popup popup = PopupFactory.getSharedInstance().getPopup(jFrame, jPanel, 100, 100);
            windowAncestor = SwingUtilities.getWindowAncestor(jPanel);
            ((RootPaneContainer) windowAncestor).getRootPane().putClientProperty("SIMPLE_WINDOW", true);
            windowAncestor.setFocusable(true);
            windowAncestor.setFocusableWindowState(true);
            windowAncestor.setAutoRequestFocus(true);

            jFrame.setVisible(true);
            popup.show();


            modalBlocker = new JDialog(windowAncestor, "Modal Blocker");
            modalBlocker.setModal(true);
            modalBlocker.setSize(new Dimension(200, 200));
            modalBlocker.setLocation(200, 200);
            modalBlocker.addWindowListener(new DialogListener());

            modalBlocker.setVisible(true);
        });
    }
 
源代码23 项目: drmips   文件: Util.java
/**
 * Configures the given window to be closed when the Escape button is pressed.
 * @param <W> A window (JFrame, JDialog, etc.).
 * @param window Window to configure.
 */
public static <W extends Window & RootPaneContainer> void enableCloseWindowWithEscape(final W window) {
	Action closeAction = new AbstractAction() {
		@Override
		public void actionPerformed(ActionEvent e) {
			window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
		}
	};
	
	window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close");
	window.getRootPane().getActionMap().put("close", closeAction);
}
 
源代码24 项目: openjdk-jdk8u-backup   文件: 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);
}
 
源代码25 项目: pcgen   文件: CursorControlUtilities.java
public static void stopWaitCursor(JComponent component)
{
	RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor());
	root.getGlassPane().setCursor(DEFAULT_CURSOR);
	root.getGlassPane().removeMouseListener(CLICK_CONSUMER);
	root.getGlassPane().setVisible(false);
	root.getRootPane().validate();
}
 
源代码26 项目: jdk8u-dev-jdk   文件: 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);
}
 
源代码27 项目: pcgen   文件: CursorControlUtilities.java
public static void stopWaitCursor(JComponent component)
{
	RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor());
	root.getGlassPane().setCursor(DEFAULT_CURSOR);
	root.getGlassPane().removeMouseListener(CLICK_CONSUMER);
	root.getGlassPane().setVisible(false);
	root.getRootPane().validate();
}
 
源代码28 项目: jdk8u-jdk   文件: 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);
}
 
源代码29 项目: jdk8u-jdk   文件: 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);
        }
    });
}
 
源代码30 项目: seaglass   文件: SeaGlassTitlePane.java
/**
 * Creates a new SeaGlassTitlePane object.
 *
 * @param rootPane the JRootPane containing the title pane.
 * @param ui       the UI delegate for the root pane.
 */
public SeaGlassTitlePane(JRootPane rootPane, SeaGlassRootPaneUI ui) {
    this.rootPane   = rootPane;
    this.rootPaneUI = ui;
    rootParent      = (RootPaneContainer) rootPane.getParent();
    installTitlePane();
}
 
 类所在包
 类方法
 同包方法