当前位置: 首页>>代码示例>>Java>>正文


Java JRootPane类代码示例

本文整理汇总了Java中javax.swing.JRootPane的典型用法代码示例。如果您正苦于以下问题:Java JRootPane类的具体用法?Java JRootPane怎么用?Java JRootPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JRootPane类属于javax.swing包,在下文中一共展示了JRootPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyPressed

import javax.swing.JRootPane; //导入依赖的package包/类
@Override
public void keyPressed(KeyEvent ev) {
	if (ev.getKeyCode() != KeyEvent.VK_ENTER || "".equals(getText()))
		return;
	JRootPane root = SwingUtilities.getRootPane(getParent());
	if (root != null)
		root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

	try {
		// Create regex pattern
		pat = Pattern.compile(getText(), Pattern.CASE_INSENSITIVE);
		search(pat);
	} catch (PatternSyntaxException ex) {
		System.err.println(ex.getMessage());
	}

	if (root != null)
		root.setCursor(null); // turn off wait cursor
	// // Check if there was a recent update to reduce event load!
	// if (!isRunning) {
	// isRunning = true;
	// javax.swing.SwingUtilities.invokeLater(new Runnable() {
	// public void run() {
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:AbstractSearchField.java

示例2: resetState

import javax.swing.JRootPane; //导入依赖的package包/类
private void resetState() {
    state = STATE_NOOP;
    JRootPane pane = SwingUtilities.getRootPane(comp);
    glass.setVisible(false);
    if (pane != null && oldGlass != null) {
        // when clicking results in hidden slide window, pne can be null?
        // how to avoid?
        JComponent current = (JComponent) pane.getGlassPane();
        if (current instanceof GlassPane) {
            pane.setGlassPane(oldGlass);
        }
    }
    if( null != comp )
        comp.setCursor(null);
    oldGlass = null;
    startPoint = null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ResizeGestureRecognizer.java

示例3: findDefaultButton

import javax.swing.JRootPane; //导入依赖的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

示例4: createInstanceImpl

import javax.swing.JRootPane; //导入依赖的package包/类
protected JInternalFrame createInstanceImpl() {
    JInternalFrame frame = new JInternalFrame(title, resizable, closable, maximizable, iconable) {
        protected JRootPane createRootPane() {
            return _rootPane == null ? null : _rootPane.createInstance();
        }
        public void addNotify() {
            try {
                // Doesn't seem to work correctly
                setClosed(_isClosed);
                setMaximum(_isMaximum);
                setIcon(_isIcon);
                setSelected(_isSelected);
            } catch (PropertyVetoException ex) {}
        }
    };
    return frame;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:WindowBuilders.java

示例5: testEscapeDoesNotCloseDialogForBackgroundNonCancellableActions

import javax.swing.JRootPane; //导入依赖的package包/类
public void testEscapeDoesNotCloseDialogForBackgroundNonCancellableActions() {
    List<ProgressSupport.Action> actions = new ArrayList<ProgressSupport.Action>();

    final AtomicBoolean panelOpen = new AtomicBoolean();

    actions.add(new ProgressSupport.BackgroundAction() {
        public void run(final ProgressSupport.Context actionContext) {
            Mutex.EVENT.readAccess(new Mutex.Action<Object>() {
                public Object run() {
                    // fake an escape key press
                    JRootPane rootPane = actionContext.getPanel().getRootPane();
                    KeyEvent event = new KeyEvent(rootPane, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_ESCAPE, KeyEvent.CHAR_UNDEFINED);
                    rootPane.dispatchEvent(event);

                    panelOpen.set(actionContext.getPanel().isOpen());
                    return null;
                }
            });
        }
    });

    ProgressSupport.invoke(actions);
    assertTrue(panelOpen.get());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ProgressSupportTest.java

示例6: propertyChange

import javax.swing.JRootPane; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName();
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("EditorRegistryListener.propertyChange("+propertyName+": "+evt.getOldValue()+" => "+evt.getNewValue()+")");
    }
    if (propertyName.equals(EditorRegistry.FOCUS_LOST_PROPERTY)) {
        Object newFocused = evt.getNewValue();
        if (newFocused instanceof JRootPane) {
            JRootPane root = (JRootPane) newFocused;
            if (root.isAncestorOf((Component) evt.getOldValue())) {
                logger.fine("Focused root.");
                root.addFocusListener(this);
                return;
            }
        }
    }
    if (propertyName.equals(EditorRegistry.FOCUS_GAINED_PROPERTY) ||
        propertyName.equals(EditorRegistry.FOCUS_LOST_PROPERTY) ||
        propertyName.equals(EditorRegistry.FOCUSED_DOCUMENT_PROPERTY)) {
        
        update(true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:EditorContextDispatcher.java

示例7: findNotificationLabel

import javax.swing.JRootPane; //导入依赖的package包/类
private static JLabel findNotificationLabel (Container container) {
    for (Component component : container.getComponents ()) {
        if (component.getClass ().getName ().indexOf (NOTIFICATION_LABEL_NAME) != -1) {
            return (JLabel) component;
        }
        if (component instanceof JRootPane) {
            JRootPane rp = (JRootPane) component;
            return findNotificationLabel (rp.getContentPane ());
        }
        if (component instanceof JPanel) {
            JPanel p = (JPanel) component;
            return findNotificationLabel (p);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NotificationLineSupportTest.java

示例8: getLayeredPane

import javax.swing.JRootPane; //导入依赖的package包/类
private Component getLayeredPane() {
	Container parent = null;
	if (this.owner != null) {
		parent = this.owner instanceof Container ? (Container) this.owner : this.owner.getParent();
	}
	for (Container p = parent; p != null; p = p.getParent()) {
		if (p instanceof JRootPane) {
			if (p.getParent() instanceof JInternalFrame) {
				continue;
			}
			parent = ((JRootPane) p).getLayeredPane();
		} else if (p instanceof Window) {
			if (parent == null) {
				parent = p;
			}
			break;
		} else if (p instanceof JApplet) {
			break;
		}
	}
	return parent;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:RoundedRectanglePopup.java

示例9: isProbablyAContainer

import javax.swing.JRootPane; //导入依赖的package包/类
/**
 * Return true if the given component is likely to be a container such the each
 * component within the container should be be considered as a user input.
 * 
 * @param c
 * @return true if the component children should have this listener added.
 */
protected boolean isProbablyAContainer (Component c) {
    boolean result = extListener != null ? extListener.isContainer(c) : false;
    if (!result) {
        boolean isSwing = isSwingClass(c);
        if (isSwing) {
           result = c instanceof JPanel || c instanceof JSplitPane || c instanceof
                   JToolBar || c instanceof JViewport || c instanceof JScrollPane ||
                   c instanceof JFrame || c instanceof JRootPane || c instanceof
                   Window || c instanceof Frame || c instanceof Dialog ||
                   c instanceof JTabbedPane || c instanceof JInternalFrame ||
                   c instanceof JDesktopPane || c instanceof JLayeredPane;
        } else {
            result = c instanceof Container;
        }
    }
    return result;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:25,代码来源:GenericListener.java

示例10: showProgress

import javax.swing.JRootPane; //导入依赖的package包/类
public static ProgressDialog showProgress(Component parent, String message)
{
	JDialog d = ComponentHelper.createJDialog(parent);
	ProgressDialog p = new ProgressDialog(d);

	d.getRootPane().setWindowDecorationStyle(JRootPane.INFORMATION_DIALOG);
	d.setResizable(false);
	d.setContentPane(p);
	d.setTitle(message);
	d.pack();

	d.setLocationRelativeTo(parent);
	d.setVisible(true);

	return p;
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:ProgressDialog.java

示例11: installKeyboardActions

import javax.swing.JRootPane; //导入依赖的package包/类
/**
 * Installs look and feel keyboard actions on the root pane.
 *
 * @param rp the root pane to install the keyboard actions to
 */
protected void installKeyboardActions(JRootPane rp)
{
  // Install the keyboard actions.
  ActionMapUIResource am = new ActionMapUIResource();
  am.put("press", new DefaultPressAction(rp));
  am.put("release", new DefaultReleaseAction(rp));
  SwingUtilities.replaceUIActionMap(rp, am);

  // Install the input map from the UIManager. It seems like the actual
  // bindings are installed in the JRootPane only when the defaultButton
  // property receives a value. So we also only install an empty
  // input map here, and fill it in propertyChange.
  ComponentInputMapUIResource im = new ComponentInputMapUIResource(rp);
  SwingUtilities.replaceUIInputMap(rp, JComponent.WHEN_IN_FOCUSED_WINDOW,
                                   im);
}
 
开发者ID:vilie,项目名称:javify,代码行数:22,代码来源:BasicRootPaneUI.java

示例12: DatePicker

import javax.swing.JRootPane; //导入依赖的package包/类
@SuppressWarnings("static-access")
public DatePicker(Observer observer, Date selecteddate, Locale locale) {
       super();
       this.locale = locale;
       register(observer);
       screen = new JDialog();
       screen.addWindowFocusListener(this);
       screen.setSize(200, 200);
       screen.setResizable(false);
       screen.setModal(true);
       screen.setUndecorated(true);
       screen.setDefaultLookAndFeelDecorated(true);
       screen.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
       screen.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
       screen.getContentPane().setLayout(new BorderLayout());
       //
       calendar = new GregorianCalendar();
       setSelectedDate(selecteddate);
       Calendar c = calendar;
       if (selectedDate != null)
           c = selectedDate;
       updateScreen(c);
       screen.getContentPane().add(navPanel, BorderLayout.NORTH);

       screen.setTitle(getString("program.title", "Date Picker"));
   }
 
开发者ID:LotfarKaes,项目名称:-Receptionist-information-system,代码行数:27,代码来源:DatePicker.java

示例13: getInstalledOperation

import javax.swing.JRootPane; //导入依赖的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

示例14: setRootPane

import javax.swing.JRootPane; //导入依赖的package包/类
/**
 * Sets the <code>rootPane</code> property. This method is called by the
 * constructor.
 *
 * @param root the <code>rootPane</code> object for this dialog
 * @see #getRootPane
 * @beaninfo hidden: true description: the RootPane object for this dialog.
 */
protected void setRootPane(final JRootPane root) {

    if (rootPane != null) {
        this.remove(rootPane);
    }
    rootPane = root;

    if (rootPane != null) {

        final boolean checkingEnabled = rootPaneCheckingEnabled;
        try {

            rootPaneCheckingEnabled = Boolean.FALSE;
            super.add(rootPane, BorderLayout.CENTER);
        } finally {

            rootPaneCheckingEnabled = checkingEnabled;
        }
    }
}
 
开发者ID:Naoghuman,项目名称:typewriter,代码行数:29,代码来源:PRoDialog.java

示例15: createRootPane

import javax.swing.JRootPane; //导入依赖的package包/类
@Override
protected JRootPane createRootPane() {

    final JRootPane rootPane = new JRootPane();

    final KeyStroke escStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    final ActionListener escKeyListener = new ActionListener() {
        public void actionPerformed(final ActionEvent actionEvent) {
            doEscapePress();
        }
    };
    rootPane.registerKeyboardAction(escKeyListener, escStroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    // Enter/Return key listener
    // the VK_ENTER key stroke does not seem to be capturable using this
    // method, although intercepting the VK_SPACE key stroke does work.
    // Specifically, JXTables do not seem to propagate the Enter key press
    // up to ancestors, so adding an VK_ENTER key listener here does not
    // work when the dialog has JXTables.

    return rootPane;
}
 
开发者ID:chadbeaudin,项目名称:DataRecorder,代码行数:23,代码来源:EscapeDialog.java


注:本文中的javax.swing.JRootPane类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。