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

Recommended Answers

All 3 Replies

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();
    }
}

im using the gui from AWT not from swing.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.