Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDialog Title gets truncated

 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

In my JDialog, when the title is too long the tile gets truncated and gets displayed as 'THIS IS MY T..'.
I just want to set the width of my JDialog corresponding to my TITLE STRING Length.

Any help on this is appreciated.
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good usability dictates, the the Title should be short and concise. Like "Error" or "Open" or "Confirm". If you want to display more detailed information, you can make it a part of the message being displayed in the dialog.
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Sorry for the late response. I managed to get this done.
I get the font used to paint the FRAME TITLE from the Look And Feel used. With the font create the Font Metrics. From the Font Metrics, get the width.
Below is the piece of code that I have used.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic