Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Font size change for a text in Applet.

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to change the font size of a text that I am passing from HTML to an applet.
Here is how I am setting the background and foreground colors.
public void init() {
setBackground(Color.gray);
setForeground(Color.black);
//setFontsize(10);//Is there any object that I make use of?
}
Similarly I want to control the font size also. Examples would be great.
Could any one throw some light on this.
Thanks,
Thunthu
 
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can do something like this:
import java.awt.Font;
Font myFont = new Font("TimesRoman", Font.BOLD, 18);
// set the component or graphics object like this:
someComponent.setFont(myFont);

Does this help?
Best Regards,
Matt

[This message has been edited by Matt Midcap (edited June 22, 2000).]
 
Thunthu Ganapathy
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt,
Yes. I have included into the init() method and it worked. Thanks a ton.
Thanks,
Thunthu.
 
If you try to please everybody, your progress is limited by the noisiest fool. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic