FileDocCategorySizeDatePackage
AbstractExample.javaAPI DocExample1068Mon Nov 09 12:45:48 GMT 1998None

AbstractExample

public class AbstractExample extends JFrame

Fields Summary
Constructors Summary
public AbstractExample()

    super("Abstract Model JTable Test");
    setSize(300, 200);
    addWindowListener(new BasicWindowMonitor());

    TableModel tm = new AbstractTableModel() {
      String[][] data = { {"This", "is"}, {"a", "Test"} };
      String[] headers = {"Column", "Header"};

      public int getRowCount() { return data.length; }
      public int getColumnCount() { return headers.length; }
      public Object getValueAt(int r, int c) { return data[r][c]; }
      public String getColumnName(int c) { return headers[c]; }
    };

    JTable jt = new JTable(tm);
                         
    JScrollPane jsp = new JScrollPane(jt);
    getContentPane().add(jsp, BorderLayout.CENTER);
  
Methods Summary
public static voidmain(java.lang.String[] args)

    AbstractExample ae = new AbstractExample();
    ae.setVisible(true);