User Interface Elements: Extended Radio Buttons with Click Handler

I am new into Swing and Plugin development and have a hard time figuring out how to create the User Interface elements for my plugin. I want a dialog with radio buttons which trigger the (de-)activation of their corresponding ui elements:

  1. If the first radio button "New" is active, a text input field beside it gets activated and should be filled with any string by the user.
  2. If the second radio button "Saved" is active, a combobox with predefined values gets activated and one of the items should be selected by the user.


I created a mockup image to show what i mean:
ui-mockup-tabsession-save-dialog.png

Is there any documentation or tutorial i can study? I did not find much useful information. Maybe you can give me some pointers in the right direction. And if there is a better way to achieve the same result with a better UI experience, i am all ears. Maybe only the combobox with integrated "new item..." field.

1 comment

I figured it out myself, was easier as expected. I created a Dialog with the IDEA "New -> Dialog" Wizard and created the necessary UI Elements with the UI Builder.

The code responsible for setting the elements enabled state is as follows:

radioNew.addChangeListener(new ChangeListener() {
   newName.setEnabled(radioNew.isSelected());    savedName.setEnabled(!radioNew.isSelected()); });              

0

Please sign in to leave a comment.