Skip to content

Instantly share code, notes, and snippets.

@pgoodman
Created February 3, 2009 05:33
Show Gist options
  • Select an option

  • Save pgoodman/57332 to your computer and use it in GitHub Desktop.

Select an option

Save pgoodman/57332 to your computer and use it in GitHub Desktop.
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