Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

Is there a C# type MessageBox in Java

Thread view: 
MS - 21 Feb 2005 22:17 GMT
Hi,

Is there a C# type MessageBox() in Java? That is a standard notification
dialog box to which some text and buttons like 'OK', 'OK and Cancel', 'Yes
or No', etc. can be displayed quickly.

In C# you would do this:

DialogResult res = MessageBox.Show(text, title,
MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);

I've been trawling through the API and can't find such a thing.

Thanks,

MS
Thomas Kellerer - 21 Feb 2005 22:23 GMT
MS wrote on 21.02.2005 23:17:

> Hi,
>
[quoted text clipped - 8 lines]
>
> I've been trawling through the API and can't find such a thing.

Seems you overlooked this one :)

http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.html

especially:

<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.html#showConfirm
Dialog(java.awt.Component,%20java.lang.Object,%20java.lang.String,%20int
)>

Your example would be:

int choice = JOptionPane.showConfirmDialog(parent,
                "The message",
                "The title",
                JOptionPane.YES_NO_OPTION);
if (choice == JOptionPane.YES_OPTION)
{
...
}

Thomas
MS - 21 Feb 2005 23:11 GMT
> int choice = JOptionPane.showConfirmDialog(parent,
>                 "The message",
>                 "The title",
>                 JOptionPane.YES_NO_OPTION);
> if (choice == JOptionPane.YES_OPTION)

Looks like just the thing. Many thanks.
MS - 22 Feb 2005 19:52 GMT
MS emailed this:
>> int choice = JOptionPane.showConfirmDialog(parent,
>>                 "The message",
[quoted text clipped - 3 lines]
>
> Looks like just the thing. Many thanks.

It is -- useful class.

Thanks again.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.