img
// Create the table.
JTable table = new JTable(data, colHeads);
// Add the table to a scroll pane.
JScrollPane jsp = new JScrollPane(table);
// Add the scroll pane to the content pane.
add(jsp);
}
}
Output from this example is shown here:
Continuing Your Exploration of Swing
Swing defines a very large GUI toolkit. It has many more features that you will want to
explore on your own. For example, Swing provides toolbars, tooltips, and progress bars.
It also provides a complete menu subsystem. Swing's pluggable look and feel lets you
substitute another appearance and behavior for an element. You can define your own
models for the various components, and you can change the way that cells are edited
and rendered when working with tables and trees. The best way to become familiar with
Swing's capabilities is to experiment with it.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home