wood burning stoves 2.0*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Center the Message in the JOptionPane