@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() { }
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; }
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; }
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; }
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; }
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()); }
@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); } }
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; }
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; }
/** * 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; }
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; }
/** * 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); }
@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")); }
/** * 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 ); } }
/** * 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; } } }
@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; }
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; } } }); }
/** * 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(); } } }); }
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; }
/** 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); } } }
/** 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; }
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(); }
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(); } } }
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(); }
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; }
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); }
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); }
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(); }
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; }
/** * 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); } }); } }); }
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(); }
/** 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); } }
/** Remove popup panel from previous textComponent root pane */ private void removeFromRootPane(JComponent c) { JRootPane rp = c.getRootPane(); if (rp != null) { rp.getLayeredPane().remove(c); } }
/** 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; }
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)); } }
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(); } } } }
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()); }
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(); } } } }
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); }
@Override public void actionPerformed(ActionEvent e) { JRootPane jrp = getRootPane(); if (jrp != null) { JButton b = getRootPane().getDefaultButton(); if (b != null && b.isEnabled()) { b.doClick(); } } }