Results 1 to 2 of 2
Thread: Two content panes in one GUI?
- 01-31-2008, 03:56 AM #1Member
- Join Date
- Dec 2007
- Rep Power
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...
- 01-31-2008, 05:02 AM #2Java 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);
- By Java Tip in forum Java SoftwareReplies: 0Last Post: 04-15-2008, 07:49 PM
- By Java Tip in forum Java SoftwareReplies: 0Last Post: 04-01-2008, 05:14 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 02:06 PM
- By ibanez270dx in forum Java AppletsReplies: 1Last Post: 11-02-2007, 02:55 AM
- By JavaBean in forum Java SoftwareReplies: 0Last Post: 09-26-2007, 01:25 PM