I have created a class which extends JDialog, where I have some checkboxes and 3 buttons: accept, cancel, and select all.
When user clicks select all, every checkbox
The button does not disappear, it just becomes too wide to fit in the window. Just redraw the component when changing the button label :
@Override
public void actionPerformed(ActionEvent e) {
if(allCheckBoxesSelected){
allCheckBoxesSelected = false;
allButton.setText("Select all");
} else {
allCheckBoxesSelected = true;
allButton.setText("Unselect all");
NodeSelectionCheckBoxJDialog.this.pack();
}
}