aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes can i set an event for jtable header? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "can i set an event for jtable header?" Watch "can i set an event for jtable header?" New topic
Author

can i set an event for jtable header?

phooton misra
Ranch Hand

Joined: Jul 31, 2012
Posts: 36

Somebody please suggest me ,

can i set an event for jtable header?[color=green][/color][size=18][/size]
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 1950
    
  28
What sort of event are you wanting to set up? ie what are you trying to achieve?
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 151
you can to add XxxCellRenderer to the JTableHeader, inc. MouseListener , there are a few ways how to ...
phooton misra
Ranch Hand

Joined: Jul 31, 2012
Posts: 36

hi tony

In my table there is an alternative background colors for the rows and after sorting the background color should be cahnged with change of rows ?

suppose

row 1 green

row2 yellow

row 3 red

and after sorting it should be

row 3 red

row 2 yellow

row 1 green

but it is coming like this

row 3 green

row 2 yellow

row 1 red.
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 151
- JTable can be sorted or filtered, JTable Columns can be reordered,

- then have to convert indexes betweens JTables view to the XxxTableModel or vice versa

- put and implements indexing inside XxxXxxRenderer



- for better help sooner post an (short, runnable, compilable) SSCCE, demonstrating your issue
 
wood burning stoves
 
subject: can i set an event for jtable header?
 
Similar Threads
Can we set an image in a cell of a jtable.
jtable
Disabling the JTable
JTable
JTable Columns