File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JDialog Title gets truncated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JDialog Title gets truncated" Watch "JDialog Title gets truncated" New topic

JDialog Title gets truncated

Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
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.

Karthick D V
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10733

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.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
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.

I agree. Here's the link:
subject: JDialog Title gets truncated
It's not a secret anymore!