use of javax.swing.JInternalFrame in project GCViewer by chewiebug.
the class GCViewerGuiInternalFrameController method internalFrameClosing.
@Override
public void internalFrameClosing(InternalFrameEvent e) {
JInternalFrame internalFrame = e.getInternalFrame();
internalFrame.removeInternalFrameListener(this);
internalFrame.getRootPane().remove(internalFrame);
if (internalFrame.getRootPane().getComponentCount() == 0) {
getActionMap(e).get(ActionCommands.ARRANGE.toString()).setEnabled(false);
}
// remove menuitem from menu and from button group
JMenu windowMenu = getMenuBar(e).getWindowMenu();
for (int i = 2; i < windowMenu.getItemCount(); i++) {
JMenuItem item = windowMenu.getItem(i);
if (((WindowMenuItemAction) item.getAction()).getInternalFrame() == internalFrame) {
getMenuBar(e).removeFromWindowMenuGroup(item);
break;
}
}
// -> otherwise any settings done by the user are lost
if (getGCViewerGui(e).getDesktopPane().getComponentCount() == 1) {
updateMenuItemState(e);
// set same menustate, when the last is closed as is set for deactivated
internalFrameDeactivated(e);
}
// if some thread is still loading, it should stop now
getSelectedGCDocument(e).getGCResources().stream().forEach(gcResource -> gcResource.setIsReadCancelled(true));
}
use of javax.swing.JInternalFrame in project jdk8u_jdk by JetBrains.
the class DimensionEncapsulation method run.
@Override
public void run() {
runTest(new Panel());
runTest(new Button());
runTest(new Checkbox());
runTest(new Canvas());
runTest(new Choice());
runTest(new Label());
runTest(new Scrollbar());
runTest(new TextArea());
runTest(new TextField());
runTest(new Dialog(new JFrame()));
runTest(new Frame());
runTest(new Window(new JFrame()));
runTest(new FileDialog(new JFrame()));
runTest(new List());
runTest(new ScrollPane());
runTest(new JFrame());
runTest(new JDialog(new JFrame()));
runTest(new JWindow(new JFrame()));
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
//runTest(new JScrollBar()); --> don't test defines max and min in
// terms of preferred
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JInternalFrame in project jdk8u_jdk by JetBrains.
the class bug8020708 method testInternalFrameMnemonic.
static void testInternalFrameMnemonic() throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
robot.setAutoDelay(50);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 200);
JDesktopPane desktop = new JDesktopPane();
internalFrame = new JInternalFrame("Test");
internalFrame.setSize(200, 100);
internalFrame.setClosable(true);
desktop.add(internalFrame);
internalFrame.setVisible(true);
internalFrame.setMaximizable(true);
frame.getContentPane().add(desktop);
frame.setVisible(true);
}
});
toolkit.realSync();
Point clickPoint = Util.getCenterPoint(internalFrame);
robot.mouseMove(clickPoint.x, clickPoint.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
toolkit.realSync();
Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
toolkit.realSync();
Util.hitKeys(robot, KeyEvent.VK_C);
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
if (internalFrame.isVisible()) {
throw new RuntimeException("Close mnemonic does not work");
}
frame.dispose();
}
});
}
use of javax.swing.JInternalFrame in project ats-framework by Axway.
the class SwingElementLocator method getContainerFixture.
/**
* Change container by specified name or title.
* For internal use
* @param driver
* @param containerProperties property with name inside
* @return the {@link ContainerFinxture}
*/
public static ContainerFixture<?> getContainerFixture(SwingDriverInternal driver, UiElementProperties containerProperties) {
String containerName = containerProperties.getProperty("name");
final String containerTitle = containerProperties.getProperty("title");
if (StringUtils.isNullOrEmpty(containerName) && StringUtils.isNullOrEmpty(containerTitle)) {
throw new IllegalArgumentException("Illegal name/title (empty/null string) passed to search for container");
}
ContainerFixture<?> containerFixture = driver.getActiveContainerFixture();
ContainerFixture<?> windowsFixture = driver.getWindowFixture();
Robot robot = null;
if (containerFixture != null) {
// use the current robot instance
robot = containerFixture.robot;
} else {
robot = BasicRobot.robotWithCurrentAwtHierarchy();
}
if (!StringUtils.isNullOrEmpty(containerName)) {
try {
Container cont = BasicComponentFinder.finderWithCurrentAwtHierarchy().findByName(windowsFixture.component(), containerName, Container.class);
return new ContainerFixture<Container>(robot, cont) {
};
} catch (WaitTimedOutError wtoe) {
throw new ElementNotFoundException("Unable to find container with name '" + containerName + "' under current window/dialog. If needed change current window first with swingEngineInstance.setActiveWindow()");
}
} else {
try {
Container cont = BasicComponentFinder.finderWithCurrentAwtHierarchy().find(windowsFixture.component(), new GenericTypeMatcher<Container>(Container.class, true) {
@Override
protected boolean isMatching(Container component) {
if (component instanceof Dialog) {
return ((Dialog) component).getTitle().equals(containerTitle);
} else if (component instanceof Frame) {
return ((Frame) component).getTitle().equals(containerTitle);
} else if (component instanceof JInternalFrame) {
return ((JInternalFrame) component).getTitle().equals(containerTitle);
}
return false;
}
});
return new ContainerFixture<Container>(robot, cont) {
};
} catch (WaitTimedOutError wtoe) {
throw new ElementNotFoundException("Unable to find container with title '" + containerName + "' under current window/dialog. If needed change current window first with swingEngineInstance.setActiveWindow()");
}
}
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class TableFrames method openBlockPathFrame.
protected void openBlockPathFrame(String sysName) {
JInternalFrame frame = _blockPathMap.get(sysName);
if (frame == null) {
OBlock block = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class).getBySystemName(sysName);
if (block == null) {
return;
}
frame = makeBlockPathFrame(block);
_blockPathMap.put(sysName, frame);
frame.setVisible(true);
_desktop.add(frame);
frame.moveToFront();
} else {
frame.setVisible(true);
try {
frame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("BlockPath Table Frame for \"" + sysName + "\" vetoed setIcon " + pve.toString());
}
frame.moveToFront();
}
}
Aggregations