Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- public class gameApp{
- public static void main(String [] args){
- gameFrame gf = new gameFrame();
- gf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- gf.setSize(600,400);
- gf.setVisible(true);
- }
- }
- import java.io.*;
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.Graphics.*;
- import javax.swing.*;
- public class gameFrame extends JFrame implements ActionListener{
- JButton newGame;
- boolean showMainMenu;
- boolean showCharSelectScreen;
- public gameFrame(){
- showMainMenu = true;
- setLayout(null);
- newGame = new JButton("New Game");
- newGame.setBounds(300,200,100,50);
- this.add(newGame);
- }
- public void actionPerformed(ActionEvent ae){
- if(ae.getActionCommand().equals("New Game")){
- showMainMenu = false;
- showCharSelectScreen = true;
- repaint();
- }
- }
- }
- public void paintComponent(Graphics g){
- super.paintComponent(g);
- if(showCharSelectScreen){
- g.drawString("Please choose a character class");
- }
- }
Add Comment
Please, Sign In to add comment