use of javax.swing.JMenuBar in project JMRI by JMRI.
the class JmriJFrame method addNotify.
@Override
public void addNotify() {
super.addNotify();
// log.debug("addNotify window ({})", getTitle());
if (mShown) {
return;
}
// resize frame to account for menubar
JMenuBar jMenuBar = getJMenuBar();
if (jMenuBar != null) {
int jMenuBarHeight = jMenuBar.getPreferredSize().height;
Dimension dimension = getSize();
dimension.height += jMenuBarHeight;
setSize(dimension);
}
mShown = true;
}
use of javax.swing.JMenuBar in project jdk8u_jdk by JetBrains.
the class ScreenMenuMemoryLeakTest method showUI.
private static void showUI() {
sFrame = new JFrame();
sFrame.add(new JLabel("Some dummy content"));
JMenuBar menuBar = new JMenuBar();
sMenu = new JMenu("Menu");
JMenuItem item = new JMenuItem("Item");
sMenu.add(item);
sMenuItem = new WeakReference<>(item);
menuBar.add(sMenu);
sFrame.setJMenuBar(menuBar);
sFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
sFrame.pack();
sFrame.setVisible(true);
}
use of javax.swing.JMenuBar in project jdk8u_jdk by JetBrains.
the class InsetsEncapsulation method run.
@Override
public void run() {
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());
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.JMenuBar in project jdk8u_jdk by JetBrains.
the class MenuItemIconTest method createUI.
private static void createUI() throws Exception {
SwingUtilities.invokeAndWait(() -> {
frame = new JFrame();
frame.setTitle("Test");
JMenuBar menuBar = new JMenuBar();
ImageIcon icon = createIcon();
menuItem = new JMenuItem("Command", icon);
menuItem.setHorizontalTextPosition(SwingConstants.LEFT);
menuBar.add(menuItem);
frame.setJMenuBar(menuBar);
frame.setPreferredSize(new Dimension(500, 500));
frame.pack();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
});
}
use of javax.swing.JMenuBar in project jdk8u_jdk by JetBrains.
the class bug8071705 method createGUI.
private static JFrame createGUI() {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Some menu");
menuBar.add(menu);
for (int i = 0; i < 10; i++) {
menu.add(new JMenuItem("Some menu #" + i));
}
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setMinimumSize(new Dimension(200, 200));
frame.setJMenuBar(menuBar);
return frame;
}
Aggregations