• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Font In JDialog Titlepane

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow Darryl! Thank you so much for your help. I really appreciate it. This works alright.

 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

________________________________________
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic