-
JTable
Code:
public QTable() throws SQLException {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new CompoundBorder());
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(10, 11, 422, 128);
contentPane.add(scrollPane);
scrollPane.setViewportView(MatTable);
QueryTableModel qtm = new QueryTableModel();
MatTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
qtm.setQuery("SELECT idpersona, name, address from test.persona;");
MatTable.setFillsViewportHeight(true);
}
I think I miss something here so that JTable doesn't show up the resulted query
-
OK, solved
changing to
Code:
MatTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
-
-
OK thanks, I'll read that
BTW, I'm looking for a reading about TableModelListener and ActionListener.
I think that's all I'll need to read for the next part, adding a search that change the data populated in the table.
Do you have any recommended URL on this ?
Thanks in advance
-
Reading it at the moment, I was using absolute layout from the UI as I felt the layout provided was kinda troublesome to use and with absolute layout I can just place boxes n labels everywhere.
Earlier on, I had some problem designing the UI view as to when I arrange or resize a textfield or else, sometime the other components got re-arranged by itself and I have to re-adjust all positioning.
After a little read, I think the problem with absolute layout is when talking about resizing, right ? (probably includes changing resolution)
Custom layout however is quite an interesting thing to read there.
Thanks again