symon symon - 1 year ago 100
Java Question

Removing JTable CellRenderer when radiobutton is deselected

I'm using the following code to apply a CellRender on my JTable password field

JRadioButton HidePW = new JRadioButton("Show Passwords ");
HidePW.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {


it is working great, however could someone help me not have this apply when the radio button becomes unselected? is there a simple way to overwrite this custom CellRender or remove it?

Answer Source

In the else block apply the default cell renderer :

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download