Results 1 to 2 of 2
  1. #1
    sahildave1991 Guest

    Exclamation 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.

    Java 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");
    	public void actionPerformed(ActionEvent e) 
    			Screen2 scr=new Screen2();
    Attached Thumbnails Attached Thumbnails Creating menu screen for games-back.jpg  

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    why are you using a JFrame within your JApplet rather than simply display the applet itself? Your JFrame uses BorderLayout by default, and so the last component added will cover the whole frame since all components are added (again by default) BorderLayout.CENTER. You should read the Sun Swing tutorials especially the layout section.

Similar Threads

  1. Replies: 2
    Last Post: 10-18-2009, 07:27 PM
  2. Replies: 0
    Last Post: 10-28-2008, 10:28 PM
  3. Help! Anagram Games
    By geeky123 in forum New To Java
    Replies: 6
    Last Post: 10-13-2008, 04:16 PM
  4. Creating a splash screen in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 02:29 PM
  5. Replies: 3
    Last Post: 12-16-2007, 12:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts