File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 4523
    
    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: 4523
    
    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

________________________________________
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Font In JDialog Titlepane
 
Similar Threads
Turn Based Strategy Games
LinkedHashMap - trying to use the method removeEldestEntry
iterate problem in struts2
A conundrum with seting Graphics font size
Sprite / Window Collision