0

i was trying out some java gui's and when I tried the Panel nothing seems to come out. The frame does! but no panel.

i was wondering it could be the JDK was old my version out home is jdk1.0.5 something like that. or my code was old school. The book i based it on was 1999. were there many significant changes in java particularly pane codingl 7 years ago?

i dont have my code here to show you since it was at my house. im using the internet at internet cafes.

anyone here can help me..

thanks in advance

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by hooknc
0

With just a blank panel, there's really nothing to see.

import javax.swing.*;
 
class TestClass extends JFrame
{
    public TestClass()
    {
         //change layout of frame
         this.setLayout(new BorderLayout());
 
        this.getContentPane().add(new JPanel(), BorderLayout.CENTER);
 
    }
 
    public static void main(String[] args)
    {
          TestClass test = new TestClass();
          test.show();
    }
}
0

AWT and Swing work very similarly. You should be able to change the code example that Phaelax provided to work with AWT.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.