开发者

RadioButtons in JDialog in Swing?

开发者 https://www.devze.com 2023-01-24 14:29 出处:网络
I need to d开发者_StackOverflowisplay a dialog box which contains radio buttons; and when I select the appropriate radio button, the dialog box should disappear?Try to use TaskDialog framework. It hel

I need to d开发者_StackOverflowisplay a dialog box which contains radio buttons; and when I select the appropriate radio button, the dialog box should disappear?


Try to use TaskDialog framework. It helps to accomplish just the things you ask for in few lines of code. For your case using Command Links is the best solution.

RadioButtons in JDialog in Swing?

Radio buttons are possible but not a better solution from usability point of view.

RadioButtons in JDialog in Swing?


In your radio button listener, use setVisible(false), as discussed in the articles How to Use Radio Buttons and Creating and Showing Simple Dialogs.


I agree with the others that having a "dialog disappear" on radio button click is not a very good UI design. Users generally expect that a "dialog disappears" when they select a button at the bottom (e.g. OK, Cancel, Yes, No, etc.).

In any event, if I am to assume that by "dialog disappears" you mean the window closes, then the way to do that is to call dispose on the dialog.

Also, you may want to consider using JOptionPane.

0

精彩评论

暂无评论...
验证码 换一张
取 消