aspose file tools*
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
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: 2532
    
    8

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 OCPBCD5
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Intializing Cell Renderers on click spans multiple action