An other problem with my JDialogBox (ChoiceBox)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: An other problem with my JDialogBox (ChoiceBox)

  1. #1
    Join Date
    Jun 2003
    Posts
    17

    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.



    anonimocampano@katamail.com
    (capienza 2,5 Mb)

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  3. #3
    Join Date
    Jun 2003
    Posts
    17
    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.



    anonimocampano@katamail.com
    (capienza 2,5 Mb)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center