Created
May 22, 2012 02:26
-
-
Save Jimshii/2766145 to your computer and use it in GitHub Desktop.
4thomas
This file contains 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 skeleton; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.Color; | |
import java.io.IOException; | |
import javax.swing.JFrame; | |
import javax.swing.JTextField; | |
import javax.swing.SwingUtilities; | |
import javax.swing.JMenu; | |
import javax.swing.JMenuBar; | |
import javax.swing.JMenuItem; | |
import javax.swing.JTextArea; | |
import javax.swing.JPanel; | |
public class Example extends JFrame { | |
/** | |
* | |
*/ | |
private static final long serialVersionUID = 1L; | |
public Example() { | |
initUI(); | |
} | |
public final void initUI() { | |
JMenuBar menubar = new JMenuBar(); | |
JMenu game = new JMenu("Game"); | |
JMenu settings = new JMenu("Settings"); | |
JMenu help = new JMenu("Help"); | |
JMenuItem Exit = new JMenuItem("Exit"); | |
Exit.setToolTipText("Exit application"); | |
Exit.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent event) { | |
System.exit(0); | |
} | |
}); | |
JMenuItem Vset = new JMenuItem("Visual Settings"); | |
Vset.setToolTipText("Settings related to viewing the game"); | |
Vset.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent event) { | |
} | |
}); | |
JMenuItem Aset = new JMenuItem("Audio Settings"); | |
Aset.setToolTipText("Settings related to sound"); | |
Aset.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent event) { | |
} | |
}); | |
JMenuItem Gset = new JMenuItem("Game Settings"); | |
Gset.setToolTipText("Overall game settings"); | |
Gset.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent event) { | |
} | |
}); | |
JMenuItem Controls = new JMenuItem("Controls"); | |
Controls.setToolTipText("Opens a text file with game controls"); | |
Controls.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent event) { | |
try{ | |
Runtime.getRuntime().exec("notepad C:\\test"); | |
} | |
catch(IOException ex){ | |
ex.printStackTrace(); | |
} | |
} | |
}); | |
help.add(Controls); | |
settings.add(Vset); | |
settings.add(Aset); | |
settings.add(Gset); | |
game.add(Exit); | |
menubar.add(game); | |
menubar.add(settings); | |
menubar.add(help); | |
setJMenuBar(menubar); | |
JPanel main = new JPanel(); | |
main.setBackground(Color.gray); | |
main.setLayout(null); | |
add(main); | |
setTitle("Game Name"); | |
setSize(1200, 700); | |
setLocationRelativeTo(null); | |
setDefaultCloseOperation(EXIT_ON_CLOSE); | |
} | |
public static void main(String[] args) { | |
SwingUtilities.invokeLater(new Runnable() { | |
public void run() { | |
Example ex = new Example(); | |
ex.setVisible(true); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment