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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 35

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: 1936
    
  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: 150
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: 35

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: 150
- 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can i set an event for jtable header?
 
Similar Threads
Disabling the JTable
Can we set an image in a cell of a jtable.
JTable Columns
jtable
JTable