Hi, I'm using eclipse to write my programs
but for some reason this code does not work
can someone tell me whats wrong with it?
here is the code. and sorry if i didnt use the code wrapper properly.

package dataTypes;
import javax.swing.*;

public class Window
{
    JPanel pnl = new JPanel();

    public static void main(String[] args)
    {
        // TODO Auto-generated method stub
        Window gui = new Window();
    }

    public Window()
    {
        super( "hello kishan" );
        setSize( 500, 200);
        setDefaultCloseOperation( EXIT_ON_CLOSE);
        add( pnl ):
        setVisible( true );

    }
}

Recommended Answers

All 5 Replies

Your class needs to extend the JFrame class

thnx hopefully that works =)

thnx for trying to help me out
but that doesnt work!
Thanks!

thnx for trying to help me out
but that doesnt work

If you truly made an effort to use the code tags you would have used them correctly. There is a sticky at the top of the forum showing how to use them. There is a button on the post reply box that inserts code tags. You can also "reply w/ quote" to this post and you'll see how to do it correctly.

Then Iamkishan, edit your post to correct the code tags!
Thanks!

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.