0

Hi guys,

This is me, novice programmer to Java.
i have a very simple question.

can i change Font of a Label?
for example i have a label:

Label l1 = new Label("Welcome To Java");

now what i want is to be able to change the text(Welcome to Java) to BOLD, ITALIC.

and another question:

i have used GridBagLayout in my applet program. so i have positioned all the components accordingly.
now assume my applet size is 300,300 and i would like to draw a string using paint method in the position 150,150.
if i maximum or resize the applet will the position of drawString change.

if yes, how to make it avoid changing.

thanks alot

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by c_skyscraper
0

Font for Label

Label label = new Label("Welcome To Java"); 
Font curFont = label.getFont();
label.setFont(new Font(curFont.getFontName(), Font.BOLD, 20));

About second question I'm not sure. Maybe somebody else can answer that

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.