private static JRadioButtonMenuItem createLookAndFeelItem( String lafName, String lafClassName, final ButtonGroup lookAndFeelRadioGroup) { JRadioButtonMenuItem lafItem = new JRadioButtonMenuItem(); lafItem.setSelected(lafClassName.equals(lookAndFeel)); lafItem.setHideActionText(true); lafItem.setAction( new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { ButtonModel m = lookAndFeelRadioGroup.getSelection(); try { setLookAndFeel(m.getActionCommand()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } } }); lafItem.setText(lafName); lafItem.setActionCommand(lafClassName); lookAndFeelRadioGroup.add(lafItem); return lafItem; }
/** * 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; }