Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default values in jtable

    hi, m working with jtable in netbeans ide6.5... on insertion the value is inserted in asecending order whereas i need the latest value on insertion to be the first one i.e.descending order...plzz help me..m stuck up n not able to resolve it

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    Your question makes no sense and does not have nearly enough information to make reasonable suggestion. Data is displayed in the order you build the TableModel. If you are using sorting then data is sorted in the appropriate order. If you don't like it ascending, then change the sort order to descending.

  3. #3
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    thanks for the reply..
    m actually new to the netbeans enviornment.. i have binded JTable component to my database table. while inserting the values from the GUI, i wish to insert it in desc format. can u plz tel me how to change the tablemodel or where to change the the sorting manner?? i tried but couldnt find anything specific!!

  4. #4
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    Well, the classes that bind the table to the database are not core JDK classes so I don't know how they work. But I would guess you need to customize your SQL query to do what you want.

  5. #5
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    5

    Default

    If the JTable is built on a DefaultTableModel,
    and if rows are added with its add() method,
    switch to the insert() method and put the row where you want it.
    This is model-based ordering of the data.

    Data can also be ordered strictly within the view.
    See JTable.setRowSorter() and the TableRowSorter class.

Similar Threads

  1. Replies: 7
    Last Post: 09-23-2009, 07:28 PM
  2. inserting values from jtable into database
    By sandeepsai17 in forum New To Java
    Replies: 1
    Last Post: 06-29-2009, 07:31 PM
  3. [SOLVED] Reading values from a jtable
    By Manfizy in forum New To Java
    Replies: 10
    Last Post: 05-20-2009, 12:58 PM
  4. Problem in printing JTable values
    By shanssat in forum AWT / Swing
    Replies: 3
    Last Post: 02-04-2009, 08:15 AM
  5. Getting integer values from a JTable
    By zikojam in forum New To Java
    Replies: 1
    Last Post: 12-11-2008, 02:06 PM

Posting Permissions

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