Problem with the following program...pls help...

Discussion in 'Java' started by vivekdarshan, Oct 17, 2010.

  1. vivekdarshan

    vivekdarshan

    Joined:
    Oct 17, 2010
    Messages:
    1
    import java.awt.event.*;
    import javax.swing.*;

    public class JTableExample extends JFrame{

    String data[][]={{"John","Sunderland","Student"},
    {"George","Davies","Student"},
    {"Melissa","Anderson","Associate"},
    {"Stergios","Maglaras","Developer"},
    };

    String fields[]={"Name","Surname","Status"};

    public static void main(String[] argv) {
    JTableExample myExample = new JTableExample("JTable Example");
    }

    public JTableExample(String title){
    super(title);
    setSize(150,150);
    addWindowListener(new WindowAdaptor(){
    public void windowClosing( WindowEvent we) {
    dispose();
    System.exit(0);
    }});
    init();
    pack();
    setVisible(true);
    }

    private void init() {
    JTable jt = new JTable( data, fields );
    JScrollPane pane = new JScrollPane(jt);
    getContentPane().add(pane);
    }
    }
     
    vivekdarshan, Oct 17, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Bond
    Replies:
    0
    Views:
    533
    James Bond
    Aug 3, 2004
  2. Johnny Lee
    Replies:
    5
    Views:
    428
    Steve Holden
    Sep 21, 2005
  3. Rahul S.
    Replies:
    3
    Views:
    604
    Flash Gordon
    Nov 1, 2004
  4. weepeez@gmail.com
    Replies:
    1
    Views:
    281
    RedGrittyBrick
    Jan 2, 2008
  5. Emiliano
    Replies:
    2
    Views:
    323
    Rajesh.V
    Oct 16, 2003
Loading...

Share This Page