當前位置: 首頁>>代碼示例>>Java>>正文


Java RootPaneContainer類代碼示例

本文整理匯總了Java中javax.swing.RootPaneContainer的典型用法代碼示例。如果您正苦於以下問題:Java RootPaneContainer類的具體用法?Java RootPaneContainer怎麽用?Java RootPaneContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RootPaneContainer類屬於javax.swing包,在下文中一共展示了RootPaneContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: detachWindow

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/** 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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ZOrderManager.java

示例2: findDefaultButton

import javax.swing.RootPaneContainer; //導入依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:FileChooserBuilderTest.java

示例3: showSpyDialog

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * 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);
		}
	});
}
 
開發者ID:igr,項目名稱:swingspy,代碼行數:28,代碼來源:SwingSpy.java

示例4: getRootContainer

import javax.swing.RootPaneContainer; //導入依賴的package包/類
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;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:20,代碼來源:GlassPaneUtils.java

示例5: installOperation

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * {@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;
}
 
開發者ID:kartoFlane,項目名稱:hiervis,代碼行數:21,代碼來源:SwingUIUtils.java

示例6: uninstallOperation

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * 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 int condition,
	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 );
}
 
開發者ID:kartoFlane,項目名稱:hiervis,代碼行數:37,代碼來源:SwingUIUtils.java

示例7: getInstalledOperation

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * 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 );
	}
}
 
開發者ID:kartoFlane,項目名稱:hiervis,代碼行數:35,代碼來源:SwingUIUtils.java

示例8: DesignGridLayout

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:pgdurand,項目名稱:jGAF,代碼行數:32,代碼來源:DesignGridLayout.java

示例9: setShortcutsActive

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/** 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);
		}
	}
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:22,代碼來源:LocationPaneUI.java

示例10: isDarkBackground

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/** 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;
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:25,代碼來源:CustomizedToolbar.java

示例11: getOrNull

import javax.swing.RootPaneContainer; //導入依賴的package包/類
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;
	}
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:18,代碼來源:MetasfreshGlassPane.java

示例12: setRootPaneContainer

import javax.swing.RootPaneContainer; //導入依賴的package包/類
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);
}
 
開發者ID:phylogeography,項目名稱:SpreaD3,代碼行數:23,代碼來源:DialogFooter.java

示例13: MWaitCursor

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * 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);
	}
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:27,代碼來源:MWaitCursor.java

示例14: isInState

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * {@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;
}
 
開發者ID:khuxtable,項目名稱:seaglass,代碼行數:24,代碼來源:TitlePaneMaximizeButtonWindowMaximizedState.java

示例15: setKeyCatcher

import javax.swing.RootPaneContainer; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:30,代碼來源:Helper.java


注:本文中的javax.swing.RootPaneContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。