You might already be using JTables comes with Swing in Java but sometimes may not know theses facts, Here's an some facts about JTables.
JTabledoes not contain or cache data; it is simply a view of your data.- There are two
JTableconstructors that directly accept data (SimpleTableDemouses the first): JTable(Object[][] rowData, Object[] columnNames)JTable(Vector rowData, Vector columnNames)- However, these constructors also have disadvantages:
- They automatically make every cell editable.
- They treat all data types the same (as strings).
- They require that you put all of the table's data in an array or vector, which may not be appropriate for some data.
- When adding a JTable use a JScrollpane
JScrollPane scrollPane = new JScrollPane(table); table.setFillsViewportHeight(true);JTableuses a very simple concept of selection, managed as an intersection of rows and columns. It was not designed to handle fully independent cell selections.
No comments:
Post a Comment