Created
February 3, 2009 05:33
-
-
Save pgoodman/57332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package minesweeper; | |
| import javax.swing.JFrame; | |
| import javax.swing.JMenuItem; | |
| import javax.swing.UIManager; | |
| /** | |
| * The Mine Sweeper program. | |
| * | |
| * @author Peter Goodman | |
| */ | |
| public class MineSweeper extends SimpleGUI { | |
| public void create() { | |
| frame("Mine Sweeper", new ComponentDelegate<JFrame>() { | |
| public void call(final JFrame frame) { | |
| menu_bar(frame, | |
| menu("File", | |
| menu_item("Exit", new ComponentDelegate<JMenuItem>() { | |
| public void call(JMenuItem item) { | |
| System.exit(0); | |
| } | |
| }) | |
| ), | |
| menu("Theme", | |
| menu_item("System Default", new ComponentDelegate<JMenuItem>() { | |
| public void call(JMenuItem item) { | |
| set_look_and_feel( | |
| frame, | |
| UIManager.getSystemLookAndFeelClassName() | |
| ); | |
| } | |
| }), | |
| menu_item("Motif", new ComponentDelegate<JMenuItem>() { | |
| public void call(JMenuItem item) { | |
| set_look_and_feel( | |
| frame, | |
| "com.sun.java.swing.plaf.motif.MotifLookAndFeel" | |
| ); | |
| } | |
| }), | |
| menu_item("OMG Ponies", new ComponentDelegate<JMenuItem>(){ | |
| public void call(JMenuItem item) { | |
| } | |
| }) | |
| ) | |
| ); | |
| set_content(frame, label("Hello World")); | |
| } | |
| }); | |
| } | |
| /** | |
| * Create and run the GUI. | |
| * @param args | |
| */ | |
| public static void main(final String[] args) { | |
| run(new MineSweeper()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment