Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes How to Center the Message in the JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to Center the Message in the JOptionPane" Watch "How to Center the Message in the JOptionPane" New topic
Author

How to Center the Message in the JOptionPane

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Hi,

I would like to know how to center the message in the JOptionPane. If you do this


or



The message is still not placed in the center and it looks quite ugly. I can simply add some spaces to center the message, but it's not an elegant solution. Do you guys know a much better approach? Thanks in advance.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
may be a bit easier to roll-your-own

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Never thought of that. Thanks Michael
 
 
subject: How to Center the Message in the JOptionPane
 
Similar Threads
Change JOptionPane pop-up location.
How to Save from JTextArea using JFileChooser as a TXT file.
GUI wont show on some systems?
JOptionPane Errors
Implementing scanner into a simple login page