Results 1 to 4 of 4
  1. #1
    mDennis10 is offline Member
    Join Date
    Jul 2011
    Rep Power

    Default JTableModel and Relation Database

    I am learning how to use JTables. I have learned how to pass static content into the jTable constructor to populate it. I now want to use the AbstactTableModel class and the resultSet from mysql database to populate the table but i don't have a clue how to implement it can somebody help me. I already know how to use the getColumnCount, getRowCount and getColumn methods but i am not that clear on getValueAt method. I know that it's the getValueAt method that is used to populate the table but not how to use it with sql. And another question i have is if i was to use the AbstractTableModel class with and sucessively set it up with mysql database if i was to make any change to the data within the database would it automatically update the table

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Rep Power

    Default Re: JTableModel and Relation Database

    See: Table From Database Java Tips Weblog for some ideas. The TableFromDatabaseExample code would be the best place to start to better help you understand how TableModels work.

  3. #3
    lerner is offline Member
    Join Date
    Oct 2011
    Rep Power

    Default Re: JTableModel and Relation Database

    Data will be automatically updated every time you refresh the page/or table.
    If you want immediate effect of data change, means whenever the data is changed in the database, immediately the front end will be updated. To implement this, we have to put some extra effort like implementing listeners.

  4. #4
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Rep Power

    Default Re: JTableModel and Relation Database

    Data will be automatically updated every time you refresh the page/or table.
    This is not true, at least relative to the original posters question. Perhaps when the data is being retrieving by a web front end, not a Swing application.

Similar Threads

  1. relation between J2EE and J2ME
    By Cosmos in forum Forum Lobby
    Replies: 4
    Last Post: 07-21-2011, 06:57 PM
  2. Funny Abstract Relation Name in JPA:What Does That Mean?
    By mbaocha in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 11-16-2009, 08:22 AM
  3. Changing JTableModel does not change JScrollpane size
    By stelzergil in forum New To Java
    Replies: 3
    Last Post: 10-19-2009, 02:14 AM
  4. Relation between 2 views
    By tojas in forum SWT / JFace
    Replies: 0
    Last Post: 04-19-2009, 03:22 AM
  5. Relation between Polymorphism and Inheritance
    By janakiram.attuluri in forum Advanced Java
    Replies: 1
    Last Post: 12-27-2007, 12:32 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