Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Swing GUI Problem
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SsJBebiGoku




PostPosted: Tue Jan 04, 2005 5:12 pm   Post subject: Swing GUI Problem

Hi,
I am doing a sort of minesweeper game, and there's a menu to choose the difficulty (easy, medium, hard). Each difficulty has a larger play area and more mines. I am making it in a GridLayout. But I'm not sure how to make it so that it does make a whole new window when you choose a different difficulty. Here's the portion of the code that is called to make a new game/different difficulty:
Java:

public BoardDraw(String aDif)
    {
        super("MineSweeper Detection");       
        content = getContentPane();
       
        if (aDif.equals("Easy"))
        {
            content.setLayout(new GridLayout(9,9));
            simBoard = new BoardProperties(9,9,9);
            setBounds(400,300,225,250);
        }
        else if (aDif.equals("Medium"))
        {
            content.setLayout(new GridLayout(15,10));
            simBoard = new BoardProperties(19,15,10);
            setBounds(400,300,275,350);
        }
        else if (aDif.equals("Hard"))
        {
            content.setLayout(new GridLayout(20,15));
            simBoard = new BoardProperties(21,20,15);
            setBounds(400,300,315,450);
        }
        createMenu();
        drawPlayArea();
       
        setResizable(false);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }


Does anyone know how i make it either update the same window and i guess totally repaint it, or kill this window and start a new one?

Thanks a lot.

Martin was here
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: