Java 类javax.swing.JRootPane 实例源码

项目:alevin-svn2    文件:AbstractSearchField.java   
@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() {
}
项目:incubator-netbeans    文件:ResizeGestureRecognizer.java   
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;
}
项目: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;
}
项目:incubator-netbeans    文件:WindowBuilders.java   
static ComponentBuilder getBuilder(Instance instance, Heap heap) {
    if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) {
        return new JRootPaneBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) {
        return new JDesktopPaneBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) {
        return new JLayeredPaneBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) {
        return new FrameBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) {
        return new DialogBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) {
        return new JInternalFrameBuilder(instance, heap);
    }
    return null;
}
项目:incubator-netbeans    文件:WindowBuilders.java   
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;
}
项目:incubator-netbeans    文件:ProgressSupportTest.java   
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());
}
项目:incubator-netbeans    文件:EditorContextDispatcher.java   
@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);
    }
}
项目:incubator-netbeans    文件:NotificationLineSupportTest.java   
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;
}
项目:rapidminer    文件:RoundedRectanglePopup.java   
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;
}
项目:VASSAL-src    文件:GenericListener.java   
/**
 * 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;
}
项目:Equella    文件:ProgressDialog.java   
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;
}
项目:javify    文件:BasicRootPaneUI.java   
/**
 * 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);
}
项目:-Receptionist-information-system    文件:DatePicker.java   
@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"));
   }
项目: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 );
    }
}
项目:typewriter    文件:PRoDialog.java   
/**
 * 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;
        }
    }
}
项目:DataRecorder    文件:EscapeDialog.java   
@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;
}
项目:KATscans    文件:MainFrame.java   
private void setupGlobalKeys() {
    getRootPane().getInputMap(JRootPane.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_1, KeyEvent.CTRL_DOWN_MASK), "showTree");
    getRootPane().getActionMap().put("showTree", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (pojectBrowserMinized) {
                datasetView.makeVisible();
                datasetBrowser.focusTree();
                pojectBrowserMinized = false;
            } else {
                datasetView.restore();
                datasetView.minimize();
                pojectBrowserMinized = true;
            }
        }
    });
}
项目:KATscans    文件:LoadDiag.java   
/**
 * Creates new form LoadDataFileDiag
 */
public LoadDiag(Format format) {
    super(Init.getFrameReference(), "Load " + format.getFormat().getName() + " file", true);
    loadHandler = new LoadSaveHandler(format);

    initComponents();        
    ((SpinnerNumberModel)spnMax.getModel()).setMaximum(format.getFormat().getMaxValue());

    setLocationRelativeTo(Init.getFrameReference());
    setGlassPane(new LoadingPanel(true));

    txtFileBorder = new ValidatableBorder();
    setupTxtFile();
    loading = false;

    getRootPane().getInputMap(JRootPane.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
    getRootPane().getActionMap().put("cancel", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (!loading) {
                dispose();
            }
        }
    });
}
项目:VisualDCT    文件:ComboBoxFileChooser.java   
protected JDialog createDialog(Component parent) throws HeadlessException {     
    Frame frame = parent instanceof Frame ? (Frame) parent
                  : (Frame)SwingUtilities.getAncestorOfClass(Frame.class, parent);

        String title = getUI().getDialogTitle(this);
            getAccessibleContext().setAccessibleDescription(title);

            dialog = new ComboBoxFileChooserDialog(frame, this);
            dialog.setTitle(title);

            if (JDialog.isDefaultLookAndFeelDecorated()) {
                boolean supportsWindowDecorations = 
                UIManager.getLookAndFeel().getSupportsWindowDecorations();
                if (supportsWindowDecorations) {
                    dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
                }
            }

            dialog.pack();
            dialog.setLocationRelativeTo(parent);

        return dialog;
}
项目: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;
}
项目:pumpernickel    文件:AbstractSearchHighlight.java   
private void initialize(HighlightInfo info) {
    highlightInfo = info;
    currentID = id;

    JRootPane rootPane = info.jc.getRootPane();
    layeredPane = rootPane.getLayeredPane();

    highlights = highlightInfo.createHighlights();
    for(HighlightImage highlight : highlights) {
        layeredPane.add(highlight, JLayeredPane.DRAG_LAYER);
    }
    updateAnimation(highlights, 0);

    timer.start();

}
项目:javify    文件:BasicRootPaneUI.java   
public void propertyChange(PropertyChangeEvent event)
{
  JRootPane source = (JRootPane) event.getSource();
  String propertyName = event.getPropertyName();
  if (propertyName.equals("defaultButton"))
    {
      Object newValue = event.getNewValue();
      InputMap im =
        SwingUtilities.getUIInputMap(source,
                                     JComponent.WHEN_IN_FOCUSED_WINDOW);
      if (newValue != null)
        {
          Object[] keybindings = (Object[]) UIManager.get(
              "RootPane.defaultButtonWindowKeyBindings");
          LookAndFeel.loadKeyBindings(im, keybindings);
        }
      else
        {
          im.clear();
        }
    }
}
项目:runelite    文件:ClientUI.java   
public void showWithChrome(boolean customChrome)
{
    setUndecorated(customChrome);
    if (customChrome)
    {
        getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    }
    pack();
    revalidateMinimumSize();
    setLocationRelativeTo(getOwner());
    if (customChrome)
    {
        new TitleBarPane(this.getRootPane(), (SubstanceRootPaneUI) this.getRootPane().getUI()).editTitleBar(this);
    }

    setVisible(true);
    toFront();
}
项目:littleluck    文件:LuckMetalRootPaneUI.java   
protected void installTitlePane(JRootPane root, LuckTitlePanel titlePane, Window window)
{
    JLayeredPane layeredPane = root.getLayeredPane();

    JComponent oldTitlePane = getTitlePane();

    if (oldTitlePane != null)
    {
        oldTitlePane.setVisible(false);

        layeredPane.remove(oldTitlePane);
    }

    if (titlePane != null)
    {
        titlePane.setOpaque(true);

        layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);

        titlePane.setVisible(true);
    }

    this.titlePane = titlePane;
}
项目:littleluck    文件:LuckRootPaneLayout.java   
public Dimension minimumLayoutSize(Container parent)
{
    Insets insets = parent.getInsets();

    JRootPane root = (JRootPane) parent;

    Dimension cpd = null;

    if (root.getContentPane() != null)
    {
        cpd = root.getContentPane().getMinimumSize();
    }
    else
    {
        cpd = root.getSize();
    }

    return getDimension(insets, cpd.width, cpd.height);
}
项目:littleluck    文件:LuckRootPaneLayout.java   
public Dimension maximumLayoutSize(Container parent)
{
    Insets insets = parent.getInsets();

    JRootPane root = (JRootPane) parent;

    Dimension cpd = null;

    if (root.getContentPane() != null)
    {
        cpd = root.getContentPane().getMaximumSize();
    }
    else
    {
        cpd = root.getSize();
    }

    return getDimension(insets, cpd.width, cpd.height);
}
项目:codic-netbeans-plugin    文件:CodicTranslateDialog.java   
public static void showDialog(int x, int y, List<Translation> translations, JTextComponent textComponent, Casing casing, boolean undecorated) {
    if (dialog != null) {
        return;
    }
    // add listener
    Toolkit.getDefaultToolkit().addAWTEventListener(AWT_EVENT_LISNER, AWTEvent.MOUSE_EVENT_MASK);

    Frame mainWindow = WindowManager.getDefault().getMainWindow();
    dialog = new CodicTranslateDialog(mainWindow, translations, textComponent, casing);
    dialog.dispose();
    dialog.setName(DIALOG_NAME);
    dialog.setUndecorated(undecorated);
    dialog.setLocation(x, y);

    // close by ESC key
    JRootPane rootPane = dialog.getRootPane();
    rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ESC_STROKE, CLOSE_KEY);
    rootPane.getActionMap().put(CLOSE_KEY, CLOSE_ACTION);
    dialog.pack();
    dialog.setVisible(true);
    dialog.requestFocus();
    dialog.requestFocusInWindow();
}
项目:iSeleda    文件:MyJDialog.java   
public JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");
    Action action = new AbstractAction() {

        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            System.out.println("escaping..");
            setVisible(false);
            dispose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(stroke, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", action);
    return rootPane;
}
项目:SweetHome3D    文件:ViewerHelper.java   
/**
 * Sets the rendering error listener bound to Java 3D 
 * to avoid default System exit in case of error during 3D rendering. 
 */
private void addComponent3DRenderingErrorObserver(final JRootPane rootPane, final UserPreferences preferences)
{
    // Instead of adding a RenderingErrorListener directly to VirtualUniverse, 
    // we add it through Canvas3DManager, because offscreen rendering needs to check 
    // rendering errors with its own RenderingErrorListener
    Component3DManager.getInstance().setRenderingErrorObserver(new Component3DManager.RenderingErrorObserver()
    {
        public void errorOccured(int errorCode, String errorMessage)
        {
            System.err.print("Error in Java 3D : " + errorCode + " " + errorMessage);
            EventQueue.invokeLater(new Runnable()
            {
                public void run()
                {
                    String message = preferences.getLocalizedString(ViewerHelper.class, "3DErrorMessage");
                    showError(rootPane, message);
                }
            });
        }
    });
}
项目:SweetHome3D    文件:RoomTest.java   
public RoomTestFrame() {
  super("Room Test");
  // Create model objects
  this.home = new Home();
  Locale.setDefault(Locale.FRANCE);
  this.preferences = new DefaultUserPreferences() {
      @Override
      public void write() throws RecorderException {
      }
    };
  ViewFactory viewFactory = new SwingViewFactory() {
      @Override
      public PlanView createPlanView(Home home, UserPreferences preferences, PlanController controller) {
        return new PlanComponent(home, preferences, controller);
      }
    };
  FileContentManager contentManager = new FileContentManager(this.preferences);
  this.homeController = new HomeController(this.home, this.preferences, viewFactory, contentManager);
  setRootPane((JRootPane)this.homeController.getView());
  pack();
}
项目:incubator-netbeans    文件:PopupManager.java   
/** Install popup panel to current textComponent root pane */
private void installToRootPane(JComponent c) {
    JRootPane rp = textComponent.getRootPane();
    if (rp != null) {
        rp.getLayeredPane().add(c, JLayeredPane.POPUP_LAYER, 0);
    }
}
项目:incubator-netbeans    文件:PopupManager.java   
/** Remove popup panel from previous textComponent root pane */
private void removeFromRootPane(JComponent c) {
    JRootPane rp = c.getRootPane();
    if (rp != null) {
        rp.getLayeredPane().remove(c);
    }
}
项目:incubator-netbeans    文件:DropGlassPane.java   
/** Sets the original glass pane to the root pane of stored container.
 */
static void putBackOriginal() {
    if (oldPane == null) {
        throw new IllegalStateException("No original pane present");
    }
    final JRootPane rp = originalSource.getRootPane();
    if (rp == null) {
        if( null != SwingUtilities.getWindowAncestor( originalSource ) ) //#232187 - only complain when the originalSource is still in component hierarchy
            throw new IllegalStateException("originalSource " + originalSource + " has no root pane: " + rp); // NOI18N
    } else {
        rp.setGlassPane(oldPane);
        oldPane.setVisible(wasVisible);
    }
    oldPane = null;
}
项目:incubator-netbeans    文件:TreeView.java   
private void showWaitCursor (boolean show) {
    JRootPane rPane = getRootPane();
    if (rPane == null) {
        return;
    }

    if (SwingUtilities.isEventDispatchThread()) {
        doShowWaitCursor(rPane.getGlassPane(), show);
    } else {
        SwingUtilities.invokeLater(new CursorR(rPane.getGlassPane(), show));
    }
}
项目:incubator-netbeans    文件:EditablePropertyDisplayer.java   
private void trySendEnterToDialog() {
    //        System.err.println("SendEnterToDialog");
    EventObject ev = EventQueue.getCurrentEvent();

    if (ev instanceof KeyEvent && (((KeyEvent) ev).getKeyCode() == KeyEvent.VK_ENTER)) {
        if (ev.getSource() instanceof JComboBox && ((JComboBox) ev.getSource()).isPopupVisible()) {
            return;
        }

        if (
            ev.getSource() instanceof JTextComponent &&
                ((JTextComponent) ev.getSource()).getParent() instanceof JComboBox &&
                ((JComboBox) ((JTextComponent) ev.getSource()).getParent()).isPopupVisible()
        ) {
            return;
        }

        JRootPane jrp = getRootPane();

        if (jrp != null) {
            JButton b = jrp.getDefaultButton();

            if ((b != null) && b.isEnabled()) {
                b.doClick();
            }
        }
    }
}
项目:incubator-netbeans    文件:BaseTable.java   
public void focusGained(FocusEvent e) {
    //it will be the first focus gained event, so go select
    //whatever matches the first character
    processSearchText(((JTextField) e.getSource()).getText());

    JRootPane root = getRootPane();

    if (root != null) { // #57417 NPE
        root.getLayeredPane().repaint();
    }
    setCaretPosition(getText().length());
}
项目:incubator-netbeans    文件:BaseTable.java   
private void trySendEnterToDialog(BaseTable bt) {
    //        System.err.println("SendEnterToDialog");
    EventObject ev = EventQueue.getCurrentEvent();

    if (ev instanceof KeyEvent && (((KeyEvent) ev).getKeyCode() == KeyEvent.VK_ENTER)) {
        if (ev.getSource() instanceof JComboBox && ((JComboBox) ev.getSource()).isPopupVisible()) {
            return;
        }

        if (
            ev.getSource() instanceof JTextComponent &&
                ((JTextComponent) ev.getSource()).getParent() instanceof JComboBox &&
                ((JComboBox) ((JTextComponent) ev.getSource()).getParent()).isPopupVisible()
        ) {
            return;
        }

        JRootPane jrp = bt.getRootPane();

        if (jrp != null) {
            JButton b = jrp.getDefaultButton();

            if ((b != null) && b.isEnabled()) {
                b.doClick();
            }
        }
    }
}
项目:incubator-netbeans    文件:FocusAfterBadEditTest.java   
public void testFocusReturn() throws Exception {
    if (!focusWorks) {
        return;
    }
    clickOn(tb, 1, 1);
    requestFocus(tb);
    typeKey(tb, KeyEvent.VK_B);
    typeKey(tb, KeyEvent.VK_E);
    typeKey(tb, KeyEvent.VK_SPACE);
    typeKey(tb, KeyEvent.VK_N);
    typeKey(tb, KeyEvent.VK_I);
    typeKey(tb, KeyEvent.VK_C);
    typeKey(tb, KeyEvent.VK_E);
    sleep();
    SLEEP_LENGTH=1000;
    Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    sleep();
    pressKey(c, KeyEvent.VK_ENTER);
    typeKey(c, KeyEvent.VK_ENTER);
    sleep();
    sleep();
    sleep();
    sleep();
    c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    assertNotNull(c);
    Container top = ((JComponent) c).getTopLevelAncestor();
    assertTrue("Focus should no longer be on the property sheet after an erroneous value was entered", top != jf);
    assertTrue("An error dialog should be showing after an exception was thrown in setAsText() but focus owner is " + c, jf != top);

    JRootPane jrp = ((JComponent) c).getRootPane();
    jrp.getDefaultButton().doClick();
    sleep();

    c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    assertTrue("After the error dialog is closed following a bad property edit, the table should return to edit mode on the previously edited property",
            c instanceof InplaceEditor);

}
项目:incubator-netbeans    文件:ETable.java   
@Override
public void actionPerformed(ActionEvent e) {
    JRootPane jrp = getRootPane();
    if (jrp != null) {
        JButton b = getRootPane().getDefaultButton();
        if (b != null && b.isEnabled()) {
            b.doClick();
        }
    }
}