Java Code Examples for javax.swing.SwingUtilities#getRoot()

The following examples show how to use javax.swing.SwingUtilities#getRoot() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UtilityGeometry.java    From Ardulink-2 with Apache License 2.0 6 votes vote down vote up
public static void setAlignmentCentered(Component component, Component referredComponent) {
	if(referredComponent == null) {
		referredComponent = SwingUtilities.getRoot(component);
	}
	Point rootLocation = referredComponent.getLocation();
	Dimension rootDimension = referredComponent.getSize();
	Dimension componentDimension = component.getSize();
	
	Point componentLocation = new Point(rootLocation);
	int dx = (rootDimension.width - componentDimension.width) / 2;
	int dy = (rootDimension.height - componentDimension.height) / 2;
	componentLocation.translate(dx, dy);
	
	component.setLocation(componentLocation);
	
}
 
Example 2
Source File: WaitCursorEventQueue.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
public synchronized void run() {
	while (true) {
		try {
			wait();
			wait(delay);
			if (source instanceof Component) {
				parent = SwingUtilities.getRoot((Component) source);
			} else if (source instanceof MenuComponent) {
				MenuContainer mParent = ((MenuComponent) source).getParent();
				if (mParent instanceof Component) {
					parent = SwingUtilities.getRoot((Component) mParent);
				}
			}
			if ((parent != null) && parent.isShowing()) {
				parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			}
		} catch (InterruptedException ie) {
		}
	}
}
 
Example 3
Source File: UtilityGeometry.java    From Ardulink-1 with Apache License 2.0 6 votes vote down vote up
public static void setAlignmentCentered(Component component, Component referredComponent) {
	if(referredComponent == null) {
		referredComponent = SwingUtilities.getRoot(component);
	}
	Point rootLocation = referredComponent.getLocation();
	Dimension rootDimension = referredComponent.getSize();
	Dimension componentDimension = component.getSize();
	
	Point componentLocation = new Point(rootLocation);
	int dx = (rootDimension.width - componentDimension.width) / 2;
	int dy = (rootDimension.height - componentDimension.height) / 2;
	componentLocation.translate(dx, dy);
	
	component.setLocation(componentLocation);
	
}
 
Example 4
Source File: SwingDialog.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    final Component parent = SwingUtilities.getRoot(this);
    componentListener = new ComponentAdapter() {
        @Override
        public void componentMoved(ComponentEvent e) {
            hidePopUps();
            processComponentEvent(new ComponentEvent(JFXPanelEx.this, ComponentEvent.COMPONENT_MOVED));
        }

        @Override
        public void componentResized(ComponentEvent e) {
            hidePopUps();
            processComponentEvent(new ComponentEvent(JFXPanelEx.this, ComponentEvent.COMPONENT_RESIZED));
            processComponentEvent(new ComponentEvent(JFXPanelEx.this, ComponentEvent.COMPONENT_MOVED)); //is important!!!
        }
    };
    parent.addComponentListener(componentListener);
}
 
Example 5
Source File: ContextMenuWindow.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void eventDispatched(AWTEvent event) {
    if (ignoreMouseEvents) {
        return;
    }
    Component root = SwingUtilities.getRoot((Component) event.getSource());
    if (root instanceof IRecordingArtifact || root.getName().startsWith("###")) {
        return;
    }
    if (!(event instanceof MouseEvent)) {
        return;
    }
    MouseEvent mouseEvent = (MouseEvent) event;
    mouseEvent.consume();
    if (event.getID() == MouseEvent.MOUSE_PRESSED) {
        disposeOverlay();
        Component mouseComponent = SwingUtilities.getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(),
                mouseEvent.getY());
        if (mouseComponent == null) {
            return;
        }
        mouseEvent = SwingUtilities.convertMouseEvent(mouseEvent.getComponent(), mouseEvent, mouseComponent);
        setComponent(mouseComponent, mouseEvent.getPoint(), true);
        return;
    }
}
 
Example 6
Source File: Popups.java    From Logisim with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
	Object source = e.getSource();
	if (source == editLayout) {
		proj.setCurrentCircuit(circuit);
		proj.getFrame().setEditorView(Frame.EDIT_LAYOUT);
	} else if (source == editAppearance) {
		proj.setCurrentCircuit(circuit);
		proj.getFrame().setEditorView(Frame.EDIT_APPEARANCE);
	} else if (source == analyze) {
		ProjectCircuitActions.doAnalyze(proj, circuit);
	} else if (source == stats) {
		JFrame frame = (JFrame) SwingUtilities.getRoot(this);
		StatisticsDialog.show(frame, proj.getLogisimFile(), circuit);
	} else if (source == main) {
		ProjectCircuitActions.doSetAsMainCircuit(proj, circuit);
	} else if (source == remove) {
		ProjectCircuitActions.doRemoveCircuit(proj, circuit);
	}
}
 
Example 7
Source File: Pin.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
private void handleBitPress(InstanceState state, int bit, MouseEvent e) {
	PinAttributes attrs = (PinAttributes) state.getAttributeSet();
	if (!attrs.isInput())
		return;

	java.awt.Component sourceComp = e.getComponent();
	if (sourceComp instanceof Canvas && !state.isCircuitRoot()) {
		Canvas canvas = (Canvas) e.getComponent();
		CircuitState circState = canvas.getCircuitState();
		java.awt.Component frame = SwingUtilities.getRoot(canvas);
		int choice = JOptionPane.showConfirmDialog(frame, Strings.get("pinFrozenQuestion"),
				Strings.get("pinFrozenTitle"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
		if (choice == JOptionPane.OK_OPTION) {
			circState = circState.cloneState();
			canvas.getProject().setCircuitState(circState);
			state = circState.getInstanceState(state.getInstance());
		} else {
			return;
		}
	}

	PinState pinState = getState(state);
	Value val = pinState.sending.get(bit);
	if (val == Value.FALSE) {
		val = Value.TRUE;
	} else if (val == Value.TRUE) {
		val = attrs.threeState ? Value.UNKNOWN : Value.FALSE;
	} else {
		val = Value.FALSE;
	}
	pinState.sending = pinState.sending.set(bit, val);
	state.fireInvalidated();
}
 
Example 8
Source File: AnnotationDiffGUI.java    From gate-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void initLocalData(){
  differ = new AnnotationDiffer();
  pairings = new ArrayList<AnnotationDiffer.Pairing>();
  keyCopyValueRows = new ArrayList<Boolean>();
  resCopyValueRows = new ArrayList<Boolean>();
  significantFeatures = new HashSet<String>();
  keyDoc = null;
  resDoc = null;
  Component root = SwingUtilities.getRoot(AnnotationDiffGUI.this);
  isStandalone = (root instanceof MainFrame);
}
 
Example 9
Source File: SwingDialog.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void removeNotify() {
    super.removeNotify();
    final Component parent = SwingUtilities.getRoot(this);
    if (parent != null){
        parent.removeComponentListener(componentListener);
    }
}
 
Example 10
Source File: ContextMenuHandler.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ContextMenuWindow showPopup(Component component, Point point) {
    Component root = SwingUtilities.getRoot(component);
    if (root instanceof Window) {
        setContextMenu(new ContextMenuWindow((Window) root, recorder, finder));
    } else {
        throw new RuntimeException("Unknown root for component");
    }
    contextMenu.setComponent(component, point, true);
    if (component instanceof JMenu) {
        contextMenu.show(((JMenu) component).getParent(), point.x, point.y);
    } else {
        contextMenu.show(component, point.x, point.y);
    }
    return contextMenu;
}
 
Example 11
Source File: DialogedTableCellEditor.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
protected void edit() {
    AttributeEditorDialog dialog;
    Component c = null;
    if (table != null)
        c = SwingUtilities.getRoot(table);
    if (c instanceof JDialog) {
        dialog = new AttributeEditorDialog((JDialog) c, engine, attribute,
                element, framework, rules, getMetaValue()) {

            /**
             *
             */
            private static final long serialVersionUID = -6963390831133166460L;

            @Override
            protected void closed() {
                stopCellEditing();
            }

            @Override
            protected void onApply(Object value) {
                super.onApply(value);
                DialogedTableCellEditor.this.onApply(value);
            }

        };
    } else if (c instanceof JFrame) {
        dialog = new AttributeEditorDialog((JFrame) c, engine, attribute,
                element, framework, rules, getMetaValue()) {

            /**
             *
             */
            private static final long serialVersionUID = -6963390831133166460L;

            @Override
            protected void closed() {
                stopCellEditing();
            }

            @Override
            protected void onApply(Object value) {
                super.onApply(value);
                DialogedTableCellEditor.this.onApply(value);
            }

        };
    } else {
        dialog = new AttributeEditorDialog(framework.getMainFrame(),
                engine, attribute, element, framework, rules,
                getMetaValue()) {

            /**
             *
             */
            private static final long serialVersionUID = -6963390831133166460L;

            @Override
            protected void closed() {
                stopCellEditing();
            }

            @Override
            protected void onApply(Object value) {
                super.onApply(value);
                DialogedTableCellEditor.this.onApply(value);
            }

        };
    }
    dialog.setVisible(true);
}
 
Example 12
Source File: OtherElementTableCellEditor.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
protected void edit() {
    if (menu != null) {
        menu.setVisible(false);
        menu = null;
    }
    AttributeEditorDialog dialog;
    Component c = null;
    if (table != null)
        c = SwingUtilities.getRoot(table);
    if (c instanceof JDialog) {
        dialog = new AttributeEditorDialog((JDialog) c, rowSet.getEngine(),
                attribute, element, framework, framework.getAccessRules(),
                value) {

            /**
             *
             */
            private static final long serialVersionUID = -6963390831133166460L;

            @Override
            protected void closed() {
                cancelCellEditing();
                // stopCellEditing();
            }

        };
    } else if (c instanceof JFrame) {
        dialog = new AttributeEditorDialog((JFrame) c, rowSet.getEngine(),
                attribute, element, framework, framework.getAccessRules(),
                value) {

            /**
             *
             */
            private static final long serialVersionUID = -6963390831133166460L;

            @Override
            protected void closed() {
                cancelCellEditing();
                // stopCellEditing();
            }

        };
    } else {
        dialog = new AttributeEditorDialog(framework.getMainFrame(),
                rowSet.getEngine(), attribute, element, framework,
                framework.getAccessRules(), value) {

            /**
             *
             */
            private static final long serialVersionUID = -6963390831133166460L;

            @Override
            protected void closed() {
                cancelCellEditing();
                // stopCellEditing();
            }

        };
    }
    dialog.setModal(true);
    dialog.setVisible(true);
    try {
        dialog.getAttributeEditor().close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    // cancelCellEditing();
}
 
Example 13
Source File: Assistant.java    From Dayon with GNU General Public License v3.0 4 votes vote down vote up
private Action createNetworkAssistantConfigurationAction() {
    final Action exit = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent ev) {
            JFrame networkFrame = (JFrame) SwingUtilities.getRoot((Component) ev.getSource());

            final JPanel pane = new JPanel();

            pane.setLayout(new GridLayout(1, 2, 10, 10));

            final JLabel portNumberLbl = new JLabel(Babylon.translate("connection.settings.portNumber"));
            portNumberLbl.setToolTipText(Babylon.translate("connection.settings.portNumber.tooltip"));

            final JTextField portNumberTextField = new JTextField();
            portNumberTextField.setText(String.valueOf(networkConfiguration.getPort()));

            pane.add(portNumberLbl);
            pane.add(portNumberTextField);

            final boolean ok = DialogFactory.showOkCancel(networkFrame, Babylon.translate("connection.network.settings"), pane, () -> {
                final String portNumber = portNumberTextField.getText();
                if (portNumber.isEmpty()) {
                    return Babylon.translate("connection.settings.emptyPortNumber");
                }
                return SystemUtilities.isValidPortNumber(portNumber) ? null : Babylon.translate("connection.settings.invalidPortNumber");
            });

            if (ok) {
                final NetworkAssistantConfiguration xnetworkConfiguration = new NetworkAssistantConfiguration(
                        Integer.parseInt(portNumberTextField.getText()));

                if (!xnetworkConfiguration.equals(networkConfiguration)) {
                    networkConfiguration = xnetworkConfiguration;
                    networkConfiguration.persist();

                    network.reconfigure(networkConfiguration);
                }
            }
        }
    };

    exit.putValue(Action.NAME, "networkAssistantConfiguration");
    exit.putValue(Action.SHORT_DESCRIPTION, Babylon.translate("connection.network.settings"));
    exit.putValue(Action.SMALL_ICON, ImageUtilities.getOrCreateIcon(ImageNames.NETWORK_SETTINGS));

    return exit;
}
 
Example 14
Source File: Assistant.java    From Dayon with GNU General Public License v3.0 4 votes vote down vote up
private Action createCaptureConfigurationAction() {
    final Action configure = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent ev) {
            JFrame captureFrame = (JFrame) SwingUtilities.getRoot((Component) ev.getSource());

            final JPanel pane = new JPanel();

            pane.setLayout(new GridLayout(2, 2, 10, 10));

            final JLabel tickLbl = new JLabel(Babylon.translate("tick"));
            tickLbl.setToolTipText(Babylon.translate("tick.tooltip"));

            final JTextField tickTextField = new JTextField();
            tickTextField.setText(String.valueOf(captureEngineConfiguration.getCaptureTick()));

            pane.add(tickLbl);
            pane.add(tickTextField);

            final JLabel grayLevelsLbl = new JLabel(Babylon.translate("grays"));
            final JComboBox<Gray8Bits> grayLevelsCb = new JComboBox<>(Gray8Bits.values());
            grayLevelsCb.setSelectedItem(captureEngineConfiguration.getCaptureQuantization());

            pane.add(grayLevelsLbl);
            pane.add(grayLevelsCb);

            final boolean ok = DialogFactory.showOkCancel(captureFrame, Babylon.translate("capture.settings"), pane, () -> {
                final String tick = tickTextField.getText();
                if (tick.isEmpty()) {
                    return Babylon.translate("tick.msg1");
                }

                try {
                    Integer.valueOf(tick);
                } catch (NumberFormatException ex) {
                    return Babylon.translate("tick.msg2");
                }

                return null;
            });

            if (ok) {
                final CaptureEngineConfiguration newCaptureEngineConfiguration = new CaptureEngineConfiguration(Integer.parseInt(tickTextField.getText()),
                        (Gray8Bits) grayLevelsCb.getSelectedItem());

                if (!newCaptureEngineConfiguration.equals(captureEngineConfiguration)) {
                    captureEngineConfiguration = newCaptureEngineConfiguration;
                    captureEngineConfiguration.persist();

                    sendCaptureConfiguration(captureEngineConfiguration);
                }
            }
        }
    };

    configure.putValue(Action.NAME, "configureCapture");
    configure.putValue(Action.SHORT_DESCRIPTION, Babylon.translate("capture.settings.msg"));
    configure.putValue(Action.SMALL_ICON, ImageUtilities.getOrCreateIcon(ImageNames.CAPTURE_SETTINGS));

    return configure;
}
 
Example 15
Source File: Assistant.java    From Dayon with GNU General Public License v3.0 4 votes vote down vote up
private Action createComressionConfigurationAction() {
    final Action configure = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent ev) {
            JFrame compressionFrame = (JFrame) SwingUtilities.getRoot((Component) ev.getSource());

            final JPanel pane = new JPanel();
            pane.setLayout(new GridLayout(4, 2, 10, 10));

            final JLabel methodLbl = new JLabel(Babylon.translate("compression.method"));
            // testing only: final JComboBox<CompressionMethod> methodCb = new JComboBox<>(CompressionMethod.values());
            final JComboBox<CompressionMethod> methodCb = new JComboBox<>(Stream.of(CompressionMethod.values()).filter(e -> !e.equals(CompressionMethod.NONE)).toArray(CompressionMethod[]::new));
            methodCb.setSelectedItem(compressorEngineConfiguration.getMethod());

            pane.add(methodLbl);
            pane.add(methodCb);

            final JLabel useCacheLbl = new JLabel(Babylon.translate("compression.cache.usage"));
            final JCheckBox useCacheCb = new JCheckBox();
            useCacheCb.setSelected(compressorEngineConfiguration.useCache());

            pane.add(useCacheLbl);
            pane.add(useCacheCb);

            final JLabel maxSizeLbl = new JLabel(Babylon.translate("compression.cache.max"));
            maxSizeLbl.setToolTipText(Babylon.translate("compression.cache.max.tooltip"));
            final JTextField maxSizeTf = new JTextField(String.valueOf(compressorEngineConfiguration.getCacheMaxSize()));

            pane.add(maxSizeLbl);
            pane.add(maxSizeTf);

            final JLabel purgeSizeLbl = new JLabel(Babylon.translate("compression.cache.purge"));
            purgeSizeLbl.setToolTipText(Babylon.translate("compression.cache.purge.tooltip"));
            final JTextField purgeSizeTf = new JTextField(String.valueOf(compressorEngineConfiguration.getCachePurgeSize()));

            pane.add(purgeSizeLbl);
            pane.add(purgeSizeTf);

            useCacheCb.addActionListener(ev1 -> {
                maxSizeLbl.setEnabled(useCacheCb.isSelected());
                maxSizeTf.setEnabled(useCacheCb.isSelected());
                purgeSizeLbl.setEnabled(useCacheCb.isSelected());
                purgeSizeTf.setEnabled(useCacheCb.isSelected());
            });

            maxSizeLbl.setEnabled(useCacheCb.isSelected());
            maxSizeTf.setEnabled(useCacheCb.isSelected());
            purgeSizeLbl.setEnabled(useCacheCb.isSelected());
            purgeSizeTf.setEnabled(useCacheCb.isSelected());

            final boolean ok = DialogFactory.showOkCancel(compressionFrame, Babylon.translate("compression.settings"), pane, () -> {
                final String max = maxSizeTf.getText();
                if (max.isEmpty()) {
                    return Babylon.translate("compression.cache.max.msg1");
                }

                final int maxValue;

                try {
                    maxValue = Integer.parseInt(max);
                } catch (NumberFormatException ex) {
                    return Babylon.translate("compression.cache.max.msg2");
                }

                if (maxValue <= 0) {
                    return Babylon.translate("compression.cache.max.msg3");
                }

                return validatePurgeValue(purgeSizeTf, maxValue);
            });

            if (ok) {
                final CompressorEngineConfiguration newCompressorEngineConfiguration = new CompressorEngineConfiguration((CompressionMethod) methodCb.getSelectedItem(),
                        useCacheCb.isSelected(), Integer.parseInt(maxSizeTf.getText()), Integer.parseInt(purgeSizeTf.getText()));

                if (!newCompressorEngineConfiguration.equals(compressorEngineConfiguration)) {
                    compressorEngineConfiguration = newCompressorEngineConfiguration;
                    compressorEngineConfiguration.persist();

                    sendCompressorConfiguration(compressorEngineConfiguration);
                }
            }
        }
    };

    configure.putValue(Action.NAME, "configureCompression");
    configure.putValue(Action.SHORT_DESCRIPTION, Babylon.translate("compression.settings.msg"));
    configure.putValue(Action.SMALL_ICON, ImageUtilities.getOrCreateIcon(ImageNames.COMPRESSION_SETTINGS));

    return configure;
}
 
Example 16
Source File: ResizeGestureRecognizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private boolean isInResizeArea(MouseEvent event) {
    if (comp == null || side == null
        || (SwingUtilities.getRoot(comp) == null && SwingUtilities.getWindowAncestor( comp ) == null) ) {
        return false;
    }
    Point leftTop = new Point(0, 0);
    leftTop = SwingUtilities.convertPoint(comp, leftTop, SwingUtilities.getRoot(comp));
    Component comp2 = event.getComponent();
    if (!comp2.isDisplayable()) {
        //#54329 under specific conditions the component in the event can be gone.
        return false;
    }
    Point evtPoint = SwingUtilities.convertPoint(comp2, 
                          event.getPoint(), SwingUtilities.getRoot(comp2));
    if (Constants.BOTTOM.equals(side)) {
        if (evtPoint.x > leftTop.x && evtPoint.x < (leftTop.x + comp.getBounds().width)) {
            if ( Math.abs(evtPoint.y - leftTop.y) < RESIZE_BUFFER) {
                return true;
            } 
        }
    }
    if (Constants.TOP.equals(side)) {
        if (evtPoint.x > leftTop.x && evtPoint.x < (leftTop.x + comp.getBounds().width)) {
            if ( Math.abs(evtPoint.y - (leftTop.y + comp.getBounds().height)) < RESIZE_BUFFER) {
                return true;
            } 
        }
    }
    if (Constants.LEFT.equals(side)) {
        if (evtPoint.y > leftTop.y && evtPoint.y < (leftTop.y + comp.getBounds().height)) {
            int right = comp.getBounds().width + leftTop.x;
            if (Math.abs(evtPoint.x - right) < RESIZE_BUFFER) {
                return  true;
            }
        }
    }
    if (Constants.RIGHT.equals(side)) {
        if (evtPoint.y > leftTop.y && evtPoint.y < (leftTop.y + comp.getBounds().height)) {
            if ( Math.abs(evtPoint.x - leftTop.x) < RESIZE_BUFFER) {
                return  true;
            }
        }
    }
    return false;
}
 
Example 17
Source File: StatusBar.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
void setCursor(int c) {
  final Component root = SwingUtilities.getRoot(this);
  if (root!=null)
    root.setCursor(Cursor.getPredefinedCursor(c));
}
 
Example 18
Source File: ButtonCellEditor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public boolean stopCellEditing() {
    String s = cell.toString();
    Window ancestorWindow = (Window)SwingUtilities.getRoot(cell);
    // #236458: options are now saved asynchronously. If the dialog was to 
    if (ancestorWindow == null) {
        return true;
    }
    // HACK: if this Editor creates a dialog, it will lose the focus and Swing
    // will remove the editor, calling JTable.cancelEditing. Any re-selections performed
    // by the JTable will occur BEFORE the dialog is finished, so we need to
    // reestablish the column selection later from here.
    // This binds the BCEditor to the KeymapTable layout / internals.
    JTable parent = (JTable)cell.getParent();
    
    ShortcutAction sca = (ShortcutAction) action;
    Set<ShortcutAction> conflictingAction = model.getMutableModel().findActionForShortcutPrefix(s);
    conflictingAction.remove(sca); //remove the original action
    
    Collection<ShortcutAction> sameScopeActions = model.getMutableModel().filterSameScope(conflictingAction, sca);
    
    if (!conflictingAction.isEmpty()) {
         if (!SwingUtilities.isEventDispatchThread()) {
             // #236458: options are now saved asynchronously, off EDT. If we display dialog, the IDE will lock up.
            cell.getTextField().setText(orig);
            fireEditingCanceled();
            return true;
         }
        //there is a conflicting action, show err dialog
        Object overrride = overrride(conflictingAction, sameScopeActions);
        
        // bring the focus back
        ancestorWindow.toFront();
        parent.requestFocus();
        if (overrride.equals(DialogDescriptor.YES_OPTION)) {
            for (ShortcutAction sa : conflictingAction) {
                removeConflictingShortcut(sa, s); //remove all conflicting shortcuts
            }
            //proceed with override
        } else if (overrride == DialogDescriptor.CANCEL_OPTION) {
            cell.getTextField().setText(orig);
            fireEditingCanceled();
            setBorderEmpty();
            return true;
        }
        // NO_OPTION fallls through and adds additional shortcut.
    }
    cell.getTextField().removeActionListener(delegate);
    cell.getTextField().removeKeyListener(escapeAdapter);
    model.getMutableModel().removeShortcut((ShortcutAction) action, orig);
    if (!(s.length() == 0)) // do not add empty shortcuts
        model.getMutableModel().addShortcut((ShortcutAction) action, s);
    fireEditingStopped();
    setBorderEmpty();
    model.update();
    return true;
}
 
Example 19
Source File: SessionPanel.java    From tn5250j with GNU General Public License v2.0 4 votes vote down vote up
public void sendScreenEMail() {
	new SendEMailDialog((JFrame)SwingUtilities.getRoot(this),this);
}