Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18688

Re: Sort a jtable within code

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Sort a jtable within code
Date 2012-09-12 19:39 +0000
Organization UK Free Software Network
Message-ID <k2qodu$srk$1@localhost.localdomain> (permalink)
References <114c9b7c-7ed8-4f59-aa46-c7480a677be7@googlegroups.com>

Show all headers | View raw


On Wed, 12 Sep 2012 06:25:57 -0700, clusardi2k wrote:

> How can I automatically sort a Jtable by a specific column within code,
> and still allow the user to (later) sort any column by clicking on the
> specific table header.
>
I've done it by initially loading a concrete extension of the 
AbstractTableModel from a sorted list of the rows that will display in 
the JTable. I handled resorting on a user-selected column by simply 
reloading the AbstractTableModel's extension with data sorted on the 
required column. The list was sorted by extracting it from a database 
using a SELECT....ORDERED BY SQL statement.
  

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sort a jtable within code clusardi2k@aol.com - 2012-09-12 06:25 -0700
  Re: Sort a jtable within code Martin Gregorie <martin@address-in-sig.invalid> - 2012-09-12 19:39 +0000
  Re: Sort a jtable within code Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 20:48 -0400
  Re: Sort a jtable within code "John B. Matthews" <nospam@nospam.invalid> - 2012-09-12 21:12 -0400
    Re: Sort a jtable within code Lew <lewbloch@gmail.com> - 2012-09-12 22:51 -0700
      Re: Sort a jtable within code clusardi2k@aol.com - 2012-09-12 22:58 -0700
        Re: Sort a jtable within code clusardi2k@aol.com - 2012-09-13 07:53 -0700
      Re: Sort a jtable within code "John B. Matthews" <nospam@nospam.invalid> - 2012-09-13 23:58 -0400

csiph-web