Results 1 to 2 of 2
  1. #1
    Leprechaun is offline Member
    Join Date
    Dec 2007
    Posts
    30
    Rep Power
    0

    Default Two content panes in one GUI?

    I have made a simple tic tac toe game... I used a grid which worked nicely for the board. However, I tried to add a label at the bottom to tell the user who won and to "Click to restart" but the text is confined to the space of one of the tic tac toe buttons...

    As of now, all the objects are in one content pane. I think I might need to use two content panes but I can't figure out how.

    There may be an easier solution that I haven't though of...

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Java Code:
    JPanel gridPanel = new JPanel();
    // configure gridPanel...
    JLabel statusLabel = new JLabel();
    // configure statusLabel...
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container cp = f.getContentPane();
    // Default layout of contentPane is BorderLayout
    // Add gridPanel to center of BorderLayout
    cp.add(gridPanel);
    // Add statusLabel to south section of BorderLayout
    cp.add(statusLabel, BorderLayout.SOUTH);

Similar Threads

  1. Asbru Web Content Management 6.7.2
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-15-2008, 06:49 PM
  2. Asbru Web Content Management 6.7.1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-01-2008, 04:14 PM
  3. Getting content type from a website
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-26-2007, 01:06 PM
  4. Updating Local Content
    By ibanez270dx in forum Java Applets
    Replies: 1
    Last Post: 11-02-2007, 01:55 AM
  5. Asbru Web Content Management 6.6
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 09-26-2007, 12:25 PM

Posting Permissions

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