Wierd behavior of AbstractAction
Hi,
This is something I came across yesterday. One would assume that following code would create a checkbox with a label and make the checkbox unchecked.
But this is not the case, there is no label on the checkbox.
//Show Preview Checkbox
JCheckBox showPreviewCheck=new JCheckBox("Preview",false);
showPreviewCheck.setBounds(5,5,150,20);
//Toggle panel on/off
showPreviewCheck.setAction(new CheckBoxAction(frame) );
Following fixes the issue;
//Show Preview Checkbox
JCheckBox showPreviewCheck=new JCheckBox("Preview",false);
showPreviewCheck.setBounds(5,5,150,20);
//Toggle panel on/off
showPreviewCheck.setAction(new CheckBoxAction(frame) );
showPreviewCheck.setText("Show preview panel");
It is important that the setText method is called after setAction otherwise it have no effect.
What is happening here, is this a bug or am I duing something wrong here?

