contoh aray

package javaapplication2;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class Main {
  public static void main(String[] argv) throws Exception {
    Object[][] cellData =
                                       {
                                           { "1-1", "1-2", "1-3",  "1-4" },
                                           { "2-1", "2-2", "2-3",  "2-4" },
                                           { "3-1", "3-2", "3-3",  "3-4" }
                                       };
    String[] columnNames =  {"col1", "col2", "col3", "col4"};

    JTable table = new JTable(cellData, columnNames);
    JScrollPane wadah = new JScrollPane(table);
    JFrame f = new JFrame();
    f.setSize(300,300);
    f.add(wadah);
    f.setVisible(true);
  }
}

Diberdayakan oleh Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More