Results 1 to 2 of 2
  1. #1
    r00tb33r is offline Member
    Join Date
    Jun 2010
    Rep Power

    Question JTable column header sorting direction arrows and row selection on focus loss

    Hello all,
    I'd like to know how to add UP/DOWN arrows to JTable column headers indicating sorting direction, like one would see in Windows Explorer in "Details" view.
    I would also like to know how to retain row selection (and selected index) when focus leaves JTable component. By default when focus leaves, getSelectedRow() returns -1, as if nothing was selected.
    Help is much appreciated!

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


    You can a) listed for sorting events, and change the column header title to include up and down arrows using their unicode representation or b) create a custom renderer for the column headers to include arrow images. As for the focus, you should post a short example that demos the problem, since this should not occur normally

Similar Threads

  1. Replies: 4
    Last Post: 02-05-2011, 07:47 PM
  2. Replies: 1
    Last Post: 07-06-2010, 05:50 PM
  3. Sorting in JTable without clicking on column headers
    By ProgrammingPup in forum Advanced Java
    Replies: 6
    Last Post: 11-04-2009, 06:26 AM
  4. Jtable Column Selection Problem
    By REVANSIDDHA in forum Advanced Java
    Replies: 0
    Last Post: 03-31-2009, 08:53 AM
  5. header of jtable
    By bbq in forum AWT / Swing
    Replies: 1
    Last Post: 07-05-2007, 05:11 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