Created
May 24, 2012 19:25
-
-
Save Jimshii/2783704 to your computer and use it in GitHub Desktop.
help!
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
public class Example extends JFrame { | |
private static final long serialVersionUID = 1L; | |
protected Component main; | |
public Example() { | |
initUI(); | |
} | |
public final void initUI() { | |
final JPanel main = new JPanel(); | |
main.setBackground(Color.gray); | |
main.setLayout(null); | |
//....................... | |
//Unimportant code here | |
//....................... | |
ImageIcon dungeon = new ImageIcon("images/dungeon.jpg"); | |
final JButton dungeonButton = new JButton(dungeon); | |
dungeonButton.setBackground(Color.gray); | |
final JLabel chInfo = new JLabel(""); | |
chInfo.setBorder(BorderFactory.createEtchedBorder( | |
EtchedBorder.RAISED)); | |
JMenuItem New = new JMenuItem("New Game"); | |
New.setToolTipText("Begins a new game"); | |
New.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent event) { | |
statusbar.setText("Starting a new game"); | |
Character.name = JOptionPane.showInputDialog(main, "What is your name, weary traveller?", | |
"Character Name", JOptionPane.DEFAULT_OPTION); | |
add(dungeonButton); | |
add(chInfo, BorderLayout.WEST); | |
Character.setStats(); | |
chInfo.setText("<html><i><FONT COLOR=GREEN>" + Character.name + "</FONT></i><br><br><FONT COLOR=#B8860B>Level: </FONT>" + | |
Character.level + "<br><FONT COLOR=#9932CC>XP:</FONT> " + Character.xp + "<br><br><FONT COLOR=RED>Health: </FONT>" + Character.health + | |
"<br><FONT COLOR=BROWN>Attack: " + Character.attack + "<br><br><FONT COLOR=BLUE>Mana: </FONT>" + Character.mana + | |
"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>" + | |
"<i>WIP</i><br>Inventory = I<br>Character = C<br>Skills = S<br>Journal = J<br>" + "</html>"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment