Guest User

Untitled

a guest
Jul 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import java.io.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. import javax.swing.*;
  5.  
  6. public class gameApp{
  7. public static void main(String [] args){
  8. gameFrame gf = new gameFrame();
  9. gf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  10. gf.setSize(600,400);
  11. gf.setVisible(true);
  12. }
  13. }
  14.  
  15.  
  16. import java.io.*;
  17. import java.awt.*;
  18. import java.awt.event.*;
  19. import java.awt.Graphics.*;
  20. import javax.swing.*;
  21.  
  22. public class gameFrame extends JFrame implements ActionListener{
  23. JButton newGame;
  24. boolean showMainMenu;
  25. boolean showCharSelectScreen;
  26.  
  27.  
  28. public gameFrame(){
  29. showMainMenu = true;
  30. setLayout(null);
  31. newGame = new JButton("New Game");
  32. newGame.setBounds(300,200,100,50);
  33. this.add(newGame);
  34.  
  35.  
  36. }
  37.  
  38. public void actionPerformed(ActionEvent ae){
  39. if(ae.getActionCommand().equals("New Game")){
  40. showMainMenu = false;
  41. showCharSelectScreen = true;
  42. repaint();
  43. }
  44.  
  45. }
  46.  
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53. public void paintComponent(Graphics g){
  54. super.paintComponent(g);
  55. if(showCharSelectScreen){
  56. g.drawString("Please choose a character class");
  57. }
  58. }
Add Comment
Please, Sign In to add comment