1 Attachment(s)
Creating menu screen for games
i am making a game of bow and arrow and want to put the attached image as the main screen menu. On that i want to put two buttons play and quit.
but i run this program there is a screen of size (534,329) and all over the frame there is a big play button.
how can i get rid of that???
is there a way that when i click the "play" written on the attached image, the second screen opens...because i dont want a button to spoil the screen.
hope u understood my prob.
Code:
package Screens;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class FirstScreen extends JApplet implements ActionListener
{
Screen2 scr=new Screen2();
JLabel screen;
JFrame frame;
JButton play,quit;
public void init()
{
setLayout(new FlowLayout());
screen= new JLabel(new ImageIcon ("back.png"));
frame = new JFrame("BOW MASTER");
play=new JButton("PLAY");
quit= new JButton("QUIT");
frame.add(screen);
frame.add(quit);
frame.add(play);
play.addActionListener(this);
quit.addActionListener(this);
frame.setSize(534,329);
frame.setResizable(false);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==quit)
{
System.exit(0);
}
if(e.getSource()==play)
{
Screen2 scr=new Screen2();
scr.setVisible(true);
}
}
}