This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Getting Font In JDialog Titlepane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Getting Font In JDialog Titlepane" Watch "Getting Font In JDialog Titlepane" New topic
Author

Getting Font In JDialog Titlepane

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

I need to access the Font in the TitlePane of my JDialog so as to measure the text in pixels as it increases after setText() method, in case it gets longer than the width of the Titlepane in which case I can resize the width of the JDialog programatically. There is not getFont() method for getTitle() method of JDialog.



Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Windows only: Toolkit#getDesktopProperty("win.frame.captionFont")

From Windows Desktop Property Support.

edit Or use the LaF decorations. See Resize JDialog to fit dialog title


luck, db
There are no new questions, but there may be new answers.
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Wow Darryl! Thank you so much for your help. I really appreciate it. This works alright.

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

You're welcome. This isn't a new question (are there any?), just a new twist on an old one.
Keeping a JDialog Title Centered.
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Thanks for this too.

I am using 3 of the many Look And Feel classes available with a Synthetica license (which I highly recommend) and all 3 of these display the text in the centre of the JDialog title pane which I think is more elegant.

I will have a look at your link nevertheless, and I am sure I can learn something new from that.

http://www.jyloo.com

________________________________________
 
 
subject: Getting Font In JDialog Titlepane