private PreferencesFrame() { setDefaultCloseOperation(HIDE_ON_CLOSE); setJMenuBar(new LogisimMenuBar(this, null)); panels = new OptionsPanel[] { new TemplateOptions(this), new IntlOptions(this), new WindowOptions(this), new LayoutOptions(this), new ExperimentalOptions(this), }; tabbedPane = new JTabbedPane(); int intlIndex = -1; for (int index = 0; index < panels.length; index++) { OptionsPanel panel = panels[index]; tabbedPane.addTab(panel.getTitle(), null, panel, panel.getToolTipText()); if (panel instanceof IntlOptions) intlIndex = index; } JPanel buttonPanel = new JPanel(); buttonPanel.add(close); close.addActionListener(myListener); Container contents = getContentPane(); tabbedPane.setPreferredSize(new Dimension(450, 300)); contents.add(tabbedPane, BorderLayout.CENTER); contents.add(buttonPanel, BorderLayout.SOUTH); if (intlIndex >= 0) tabbedPane.setSelectedIndex(intlIndex); LocaleManager.addLocaleListener(myListener); myListener.localeChanged(); pack(); }
public WindowMenu(JFrame owner) { this.owner = owner; WindowMenuManager.addMenu(this); int menuMask = getToolkit().getMenuShortcutKeyMask(); minimize.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, menuMask)); close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, menuMask)); if (owner == null) { minimize.setEnabled(false); zoom.setEnabled(false); close.setEnabled(false); } else { minimize.addActionListener(myListener); zoom.addActionListener(myListener); close.addActionListener(myListener); } computeEnabled(); computeContents(); LocaleManager.addLocaleListener(myListener); myListener.localeChanged(); }