mal nen ganz simples Beispiel:
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class mitarray {
/** Creates a new instance of mitarray */
public mitarray() {
}
public static void main( String[] args ){
String[][] data = new String[][]{
{"a", "b", "c", "d"},
{"e", "f", "g", "h"},
{"i", "j", "k", "l"}
};
String[] title = new String[]{
"A", "B", "C", "D"
};
// Das JTable initialisieren
JTable table = new JTable( data, title );
JFrame frame = new JFrame( "Demo" );
frame.getContentPane().add( new JScrollPane( table ) );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.pack();
frame.setVisible( true );
}