This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Intializing Cell Renderers on click spans multiple action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Intializing Cell Renderers on click spans multiple action" Watch "Intializing Cell Renderers on click spans multiple action" New topic
Author

Intializing Cell Renderers on click spans multiple action

Manju Krishna
Ranch Hand

Joined: Apr 09, 2009
Posts: 48
    
    1
Hi,

I have CellRenderers implemented for sorting Jtable columns..
In my panel.. i have a clear button which will clear table contents and should also clear the cell renderers on the columns already present..
On click of clear button i tried to initialise the CellRenderers again on the colums...
But on clicking the column headers for sorting.. the column listeners are getting caled twice and so the sorting does not happen..
Please help.

The code snippet of initialising renderer is as below..


K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2380
    
    7

How many times you physically call initCellRenderer() method? Or can you make the renderer (SortButtonRender class) into instance variable and null it when clear button is clicked?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Manju Krishna
Ranch Hand

Joined: Apr 09, 2009
Posts: 48
    
    1
i call it thrice ..

on initComponents() of the panel..

on clear button and one more search button..

i cant make it null because the renderer has to work on subsequently when table is populated again with data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Intializing Cell Renderers on click spans multiple action