• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dialog box Swing  RSS feed

 
Stribor Kab
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?
 
João Victor Gomes
Ranch Hand
Posts: 110
11
Eclipse IDE 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.
 
Campbell Ritchie
Marshal
Posts: 56199
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look in the Java™ Tutorials.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!