use of javax.swing.JDesktopPane 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.JDesktopPane 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.JDesktopPane in project ACS by ACS-Community.
the class CommandCenterGui method prepare.
public void prepare() {
boolean setLookAndFeel = false;
if (setLookAndFeel) {
String lafName = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(lafName);
} catch (Exception exc) {
log.fine("Couldn't set look and feel " + lafName + " due to " + exc);
}
}
// title added later in doFrameTitle()
frame = new JFrame("");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
controller.stop();
}
});
dlgContainerSettings = new EditContainerSettingsDialog(this);
frontPanel = new TabPanel(this);
writeModelToFrontPanel();
// Splitter between tree and the rest
splitLeftRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitLeftRight.setOneTouchExpandable(true);
JPanel p2 = new JPanel(new BorderLayout());
p2.setBorder(new EmptyBorder(10, 10, 10, 10));
p2.add(frontPanel, BorderLayout.NORTH);
splitLeftRight.setLeftComponent(p2);
// Deployment Tree
deploymentInfoPanel = new JPanel(new BorderLayout());
deploymentInfoPanel.setBorder(new CompoundBorder(new EmptyBorder(5, 7, 5, 7), new TitledBorder(LineBorder.createBlackLineBorder(), " Deployment Info ")));
deployTree = new DeploymentTree(controller.deploymentTreeControllerImpl);
JPanel addToDeployTree = new AddToDeployTree(this, deployTree);
deploymentInfoPanel.add(addToDeployTree, BorderLayout.NORTH);
deploymentInfoPanel.add(new JScrollPane(deployTree), BorderLayout.CENTER);
splitLeftRight.setRightComponent(deploymentInfoPanel);
// Feedback Area
feedbackTabs = new FeedbackTabs(this, FeedbackTabs.BOTTOM);
// Logo Panel
JPanel logoPanel = new LogoPanel(COLOR_LogoBackground_A, COLOR_LogoBackground_B);
logoPanel.setLayout(new BorderLayout());
JLabel alma = new JLabel(new ImageIcon(controller.findResource("alma.jpg")));
logoPanel.add(alma, BorderLayout.WEST);
JLabel text = new JLabel("Acs Command Center");
text.setForeground(COLOR_LogoForeground);
text.setHorizontalTextPosition(SwingConstants.CENTER);
text.setFont(text.getFont().deriveFont((float) (text.getFont().getSize() * 2.5)));
text.setBorder(new EmptyBorder(5, 30, 5, 30));
logoPanel.add(text, BorderLayout.CENTER);
// JLabel version = new JLabel(controller.version());
// version.setForeground(COLOR_LogoForeground);
// version.setBorder(new EmptyBorder(0, 0, 0, 4));
// JPanel pnl2 = new JPanel(new BorderLayout());
// pnl2.setOpaque(false);
// pnl2.add(version, BorderLayout.SOUTH);
// logoPanel.add(pnl2, BorderLayout.EAST);
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("Project");
fileMenu.setMnemonic(KeyEvent.VK_P);
{
JMenu newMenu = new JMenu("New");
newMenu.add(new ActionNewProject("Project"));
fileMenu.add(newMenu);
}
fileMenu.add(new ActionOpenProject("Open..."));
fileMenu.add(new ActionSaveProject("Save"));
fileMenu.add(new ActionSaveAsProject("Save As..."));
fileMenu.addSeparator();
fileMenu.add(new ActionExit("Exit"));
menuBar.add(fileMenu);
toolsMenu = new JMenu("Tools");
toolsMenu.setMnemonic(KeyEvent.VK_T);
toolsMenu.add(new ActionConfigureTools("Configure Tools..."));
toolsMenu.addSeparator();
menuBar.add(toolsMenu);
// ---
JMenu extrasMenu = new JMenu("Expert");
extrasMenu.setMnemonic(KeyEvent.VK_E);
{
// JMenu sshMode = new JMenu("SSH Library");
// sshMode.add(new ActionSetSshMode("Platform-independent", false, false));
// sshMode.add(new ActionSetSshMode("Natively installed ssh", true, true));
// extrasMenu.add(sshMode);
// extrasMenu.add(new JSeparator());
JMenu extraTools = new JMenu("Tools Menu");
extraTools.add(new ActionShowExtraTools("View..."));
extraTools.add(new ActionInstallExtraTools("Replace..."));
extrasMenu.add(extraTools);
JMenu builtinTools = new JMenu("Acs Scripts");
builtinTools.add(new ActionShowBuiltinTools("View..."));
builtinTools.add(new ActionLoadBuiltinTools("Replace..."));
extrasMenu.add(builtinTools);
}
extrasMenu.add(new JSeparator());
extrasMenu.add(new ActionShowVariables("Variables..."));
menuBar.add(extrasMenu);
// ---
JMenuItem item;
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic(KeyEvent.VK_H);
item = helpMenu.add(new ActionShowHelp("Online Help"));
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
item = helpMenu.add(new ActionShowAbout("About"));
menuBar.add(Box.createHorizontalGlue());
menuBar.add(helpMenu);
// ---
JPanel h = new JPanel(new SpringLayout());
h.add(logoPanel);
h.add(menuBar);
SpringUtilities.makeCompactGrid(h, 0, 1);
frame.getContentPane().add(h, BorderLayout.NORTH);
// ---
pnlManagerLocationForTools = new ManagerLocationPanel.ForTools();
managerLocationDialog1 = new BasicDialog(this, "Specify Manager and Services for Tools", "Set", pnlManagerLocationForTools);
// ---
pnlManagerLocationForContainers = new ManagerLocationPanel.ForContainers();
managerLocationDialog2 = new BasicDialog(this, "Specify Manager and Services for Containers", "Set", pnlManagerLocationForContainers);
// ---
splitTopBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitLeftRight, feedbackTabs);
splitTopBottom.setOneTouchExpandable(true);
// ---
// 2009-04: Introducing a desktop layout so i can make the
// progress dialog a lightweight window on top the front panel
AccInternalFrame bigInternalFrame = new AccInternalFrame();
bigInternalFrame.add(splitTopBottom);
desktop = new JDesktopPane();
bigInternalFrame.setVisible(true);
desktop.add(bigInternalFrame);
frame.getContentPane().add(desktop, BorderLayout.CENTER);
try {
bigInternalFrame.setSelected(true);
bigInternalFrame.setMaximum(true);
} catch (PropertyVetoException exc) {
}
// for mysterious swing reasons, the desktop has a preferred size
// of (1,1) instead of picking up the preferred size of its child
// component, so i'm doing this manually here.
desktop.setPreferredSize(bigInternalFrame.getPreferredSize());
doFrameTitle();
}
use of javax.swing.JDesktopPane in project JMRI by JMRI.
the class TableFrames method initComponents.
@Override
public void initComponents() {
setTitle(Bundle.getMessage("TitleOBlocks"));
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu(Bundle.getMessage("MenuFile"));
fileMenu.add(new jmri.configurexml.SaveMenu());
JMenuItem printItem = new JMenuItem(Bundle.getMessage("PrintOBlockTable"));
fileMenu.add(printItem);
printItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
// MessageFormat headerFormat = new MessageFormat(getTitle()); // not used below
MessageFormat footerFormat = new MessageFormat(getTitle() + " page {0,number}");
_oBlockTable.print(JTable.PrintMode.FIT_WIDTH, null, footerFormat);
} catch (java.awt.print.PrinterException e1) {
log.warn("error printing: " + e1, e1);
}
}
});
printItem = new JMenuItem(Bundle.getMessage("PrintPortalTable"));
fileMenu.add(printItem);
printItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
// MessageFormat headerFormat = new MessageFormat(getTitle()); // not used below
MessageFormat footerFormat = new MessageFormat(getTitle() + " page {0,number}");
_portalTable.print(JTable.PrintMode.FIT_WIDTH, null, footerFormat);
} catch (java.awt.print.PrinterException e1) {
log.warn("error printing: " + e1, e1);
}
}
});
printItem = new JMenuItem(Bundle.getMessage("PrintSignalTable"));
fileMenu.add(printItem);
printItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
// MessageFormat headerFormat = new MessageFormat(getTitle()); // not used below
MessageFormat footerFormat = new MessageFormat(getTitle() + " page {0,number}");
_signalTable.print(JTable.PrintMode.FIT_WIDTH, null, footerFormat);
} catch (java.awt.print.PrinterException e1) {
log.warn("error printing: " + e1, e1);
}
}
});
printItem = new JMenuItem(Bundle.getMessage("PrintXRef"));
fileMenu.add(printItem);
printItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
// MessageFormat headerFormat = new MessageFormat(getTitle()); // not used below
MessageFormat footerFormat = new MessageFormat(getTitle() + " page {0,number}");
_blockPortalTable.print(JTable.PrintMode.FIT_WIDTH, null, footerFormat);
} catch (java.awt.print.PrinterException e1) {
log.warn("error printing: " + e1, e1);
}
}
});
menuBar.add(fileMenu);
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
editMenu.setMnemonic(KeyEvent.VK_E);
TransferActionListener actionListener = new TransferActionListener();
JMenuItem menuItem = new JMenuItem(Bundle.getMessage("MenuItemCut"));
menuItem.setActionCommand((String) TransferHandler.getCutAction().getValue(Action.NAME));
menuItem.addActionListener(actionListener);
if (SystemType.isMacOSX()) {
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.META_MASK));
} else {
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
}
menuItem.setMnemonic(KeyEvent.VK_T);
editMenu.add(menuItem);
menuItem = new JMenuItem(Bundle.getMessage("MenuItemCopy"));
menuItem.setActionCommand((String) TransferHandler.getCopyAction().getValue(Action.NAME));
menuItem.addActionListener(actionListener);
if (SystemType.isMacOSX()) {
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.META_MASK));
} else {
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
}
menuItem.setMnemonic(KeyEvent.VK_C);
editMenu.add(menuItem);
menuItem = new JMenuItem(Bundle.getMessage("MenuItemPaste"));
menuItem.setActionCommand((String) TransferHandler.getPasteAction().getValue(Action.NAME));
menuItem.addActionListener(actionListener);
if (SystemType.isMacOSX()) {
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.META_MASK));
} else {
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
}
menuItem.setMnemonic(KeyEvent.VK_P);
editMenu.add(menuItem);
menuBar.add(editMenu);
JMenu optionMenu = new JMenu(Bundle.getMessage("MenuOptions"));
_showWarnItem = new JMenuItem(Bundle.getMessage("SuppressWarning"));
_showWarnItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
String cmd = event.getActionCommand();
setShowWarnings(cmd);
}
});
optionMenu.add(_showWarnItem);
setShowWarnings("ShowWarning");
menuBar.add(optionMenu);
_openMenu = new JMenu(Bundle.getMessage("OpenMenu"));
// replaces the last item with appropriate
updateOpenMenu();
menuBar.add(_openMenu);
setJMenuBar(menuBar);
addHelpMenu("package.jmri.jmrit.logix.OBlockTable", true);
_desktop = new JDesktopPane();
_desktop.putClientProperty("JDesktopPane.dragMode", "outline");
_desktop.setPreferredSize(new Dimension(1100, 550));
setContentPane(_desktop);
_blockTableFrame = makeBlockFrame();
_blockTableFrame.setVisible(true);
_desktop.add(_blockTableFrame);
_portalTableFrame = makePortalFrame();
_portalTableFrame.setVisible(true);
_desktop.add(_portalTableFrame);
_signalTableFrame = makeSignalFrame();
_signalTableFrame.setVisible(true);
_desktop.add(_signalTableFrame);
_blockPortalXRefFrame = makeBlockPortalFrame();
_blockPortalXRefFrame.setVisible(false);
_desktop.add(_blockPortalXRefFrame);
setLocation(10, 30);
setVisible(true);
pack();
errorCheck();
}
use of javax.swing.JDesktopPane in project JMRI by JMRI.
the class MdiMainFrame method configureFrame.
protected void configureFrame(String treeFile) {
desktop = new JDesktopPane();
desktop.setBorder(BorderFactory.createLineBorder(Color.black));
leftRightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, makeLeftTree(treeFile), desktop);
leftRightSplitPane.setOneTouchExpandable(true);
// emphasize right part
leftRightSplitPane.setResizeWeight(0.0);
add(leftRightSplitPane, BorderLayout.CENTER);
}
Aggregations