Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Font  RSS feed

 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Reader,
I have a JPanel which contains many components (JButton, JTextField, JRadioButton, etc). how to set all to them to a desired font.
Now a set each component individually.
Thank you
Garandi
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
the UI classes define the font for Components (for example LabelUI). If you implement your own ui classes for the JLabel and JTextField, they will use the specified font anywhere in your GUI.
To learn more about that, you could download an open source pluggable LookAndFeel (e.g. Metouia or Kunststoff etc. see www.javootoo.com) and read its sources.
otherwise:
define the font at one place in your code and implement in the specific panel a method that sets this font for all the respective components. this will be basically what you are doing now.
Chantal

(Nathan Pruett - fixed link.)
[ February 04, 2003: Message edited by: Nathan Pruett ]
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chantal, thank you for your help.
Garandi
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!