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

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,JlayeredPane.class.getName())) {
        return new JlayeredPaneBuilder(instance,Frame.class.getName())) {
        return new FrameBuilder(instance,Dialog.class.getName())) {
        return new DialogBuilder(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(),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.@R_903_4045@ION_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-@R_903_4045@ion-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.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();
        }
    }
}

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