-
An other problem with my JDialogBox (ChoiceBox)
Hi,
I've a problem with my ChoiceBox (JDialogBox);
my ChoiceBox is made of some label for the messages and two buttons: YES and NO;
Now, I want to know if I can use this for various action like cancel,save,exit;
or must I create a single ChoiceBox for each action in which I want to use it?
I had thinked to pass to the choiceBox constructor a parameter to describe the action to do;
so in the YES button method, with an if-else construct I could choose the action to do;
But some action are more complex so that it doesn't seem the best solution.
Can I do something with wait() method...?
Thank and excuse me for my poor english.
-
I don't know what you're thinking about with the wait() method as it's got nothing to do with this, it's to do with inter-thread communication.
I think there's part of the Java libraries that you haven't discovered. There are several static methods on the 'javax.swing.JOptionPane' class which can be used to activate simple dialog boxes:
showConfirmDialog Asks a confirming question, like yes/no/cancel.
showInputDialog Prompt for some input.
showMessageDialog Tell the user about something that has happened.
showOptionDialog The Grand Unification of the above three.
In this case I think you could use showConfirmDialog(...).
(Further details may be found at http://java.sun.com/products/jdk/1.2...ptionPane.html)
ArchAngel.
O:-)
-
Thank you very much Arch..
I didn't have never used JOptionPane.
It's beautiful;
in a few code line I've solve all my problems.
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks