private JMenuBar createMenuBar() { JMenu menu = new JMenu("Menu"); disablingItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK)); menu.add(disablingItem); menu.addSeparator(); blurItem.setSelected(true); blurItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_MASK)); menu.add(blurItem); embossItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, InputEvent.ALT_MASK)); menu.add(embossItem); busyPainterItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.ALT_MASK)); menu.add(busyPainterItem); ButtonGroup group = new ButtonGroup(); group.add(blurItem); group.add(embossItem); group.add(busyPainterItem); ItemListener menuListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (blurItem.isSelected()) { // layer.setUI(blurUI); } else if (embossItem.isSelected()) { // layer.setUI(embossUI); } else if (busyPainterItem.isSelected()) { layer.setUI(busyPainterUI); } } }; blurItem.addItemListener(menuListener); embossItem.addItemListener(menuListener); busyPainterItem.addItemListener(menuListener); // embossUI.getUnlockButton().addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // disablingItem.doClick(); // } // }); JMenuBar bar = new JMenuBar(); bar.add(menu); bar.add(new LafMenu()); return bar; }
JMenuBar createJMenuBar() { JMenuBar bar = new JMenuBar(); JMenu file = new JMenu("File"); bar.add(file); file.add(save); save.addActionListener(this); save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK)); file.add(savequit); savequit.addActionListener(this); savequit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_DOWN_MASK)); file.add(new JSeparator()); file.add(sim); sim.addActionListener(this); real.addActionListener(this); file.add(real); file.add(new JSeparator()); file.add(quit); quit.addActionListener(this); quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK)); JMenu skin = new JMenu("Skins"); bar.add(skin); skin.add(crossSkin); crossSkin.addActionListener(this); crossSkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, KeyEvent.CTRL_DOWN_MASK)); skin.add(systemSkin); systemSkin.addActionListener(this); systemSkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.CTRL_DOWN_MASK)); skin.add(napkinSkin); napkinSkin.addActionListener(this); napkinSkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, KeyEvent.CTRL_DOWN_MASK)); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(crossSkin); buttonGroup.add(systemSkin); buttonGroup.add(napkinSkin); return bar; }
/** * This method initializes jRadioButtonMenuItem1 * * @return JRadioButtonMenuItem */ private JRadioButtonMenuItem getJRadioButtonMenuItem1() { if (jRadioButtonMenuItem1 == null) { jRadioButtonMenuItem1 = new JRadioButtonMenuItem(); jRadioButtonMenuItem1.setText("System"); jRadioButtonMenuItem1.setMnemonic(java.awt.event.KeyEvent.VK_Y); jRadioButtonMenuItem1.setAccelerator( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_Y, java.awt.Event.ALT_MASK, false)); jRadioButtonMenuItem1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { changeLnF(UIManager.getSystemLookAndFeelClassName()); } }); } return jRadioButtonMenuItem1; }
/** * This method initializes jRadioButtonMenuItem * * @return JRadioButtonMenuItem */ private JRadioButtonMenuItem getJRadioButtonMenuItem() { if (jRadioButtonMenuItem == null) { jRadioButtonMenuItem = new JRadioButtonMenuItem(); jRadioButtonMenuItem.setText("Default"); jRadioButtonMenuItem.setSelected(true); jRadioButtonMenuItem.setAccelerator( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_D, java.awt.Event.ALT_MASK, false)); jRadioButtonMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_D); jRadioButtonMenuItem.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { changeLnF(UIManager.getCrossPlatformLookAndFeelClassName()); } }); } return jRadioButtonMenuItem; }