Results 1 to 5 of 5

Thread: JTable

  1. #1
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default JTable

    Java 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

  2. #2
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default

    OK, solved

    changing to
    Java Code:
    MatTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

  4. #4
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default

    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
    Last edited by Levian; 07-04-2011 at 08:33 AM.

  5. #5
    Levian is offline Senior Member
    Join Date
    Jun 2011
    Posts
    109
    Rep Power
    0

    Default

    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

Similar Threads

  1. JTable - Please Help
    By BeeGee in forum Advanced Java
    Replies: 4
    Last Post: 05-27-2010, 06:16 PM
  2. Need help with JTable
    By murali18 in forum AWT / Swing
    Replies: 2
    Last Post: 03-23-2010, 06:07 PM
  3. Adding New JTable in JTable
    By anilkumar_vist in forum New To Java
    Replies: 0
    Last Post: 01-27-2010, 09:27 AM
  4. Regarding JTable
    By adeeb in forum AWT / Swing
    Replies: 12
    Last Post: 06-19-2008, 08:39 AM
  5. Replies: 2
    Last Post: 05-15-2008, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •