Studyon Minte9.com
Java SE




Look & Fill




package testexample; import javax.swing.*; import java.awt.*; public class Test extends JFrame { public static void main(String[] args) { // --- Look here --- // setLookAndFill(); Test frame = new Test(); frame.setBounds(200, 200, 250, 200); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.setVisible(true); } // --- Look here --- // private static void setLookAndFill() { // Nimbus look and fill (introduced in Java SE 6). If not available keep default. try { //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex) {} } public Test() { initMenu(); } public void initMenu() { JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); JMenuItem menuItemNew = new JMenuItem("New"); JMenuItem menuItemOpen = new JMenuItem("Open"); menu.setMnemonic('F'); menuItemNew.setMnemonic('N'); menuItemOpen.setMnemonic('O'); menuBar.add(menu); menu.add(menuItemNew); menu.add(menuItemOpen); this.setJMenuBar(menuBar); } }
 


http://thebadprogrammer.com/swing-uimanager-keys
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/color.html