Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Center the Message in the JOptionPane

 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may be a bit easier to roll-your-own

 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never thought of that. Thanks Michael
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic