• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dialog box Swing  RSS feed

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I display simple dialog box without yes/no button and words "hello world" in it?
 
Ranch Hand
Posts: 115
11
Eclipse IDE Hibernate Java Netbeans IDE Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean, a simple box with a message and an OK button?

You could use JOptionPane class, like this

Where the parent is the Frame in which the dialog is displayed (may be null, check the documentation here)
You have to import the JOptionPane class from the javax.swing package in order to use it.

Here you can find some examples.
 
Marshal
Posts: 58463
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look in the Java™ Tutorials.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!