?
Solved

Setting color and fonts

Posted on 1998-09-04
1
Medium Priority
?
210 Views
Last Modified: 2013-12-03

 I have created a window that opens up when a button is
 clicked in my applet.It has a textarea, a label and
 2 buttons.How do i set different fonts and color to each
 of these buttons and textarea?
 
0
Comment
Question by:kans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
sailwind earned 40 total points
ID: 1223593

Let's say you have:

TextArea ta = new TextArea();
Label label = new Label();
Button button1 = new Button();
Button button2 = new Button();

You can set the font by doing:

Font f1 = new Font(name1, style, size);
Font f2 = new Font(name2, style, size);
Font f3 = new Font(name3, style, size);

ta.setFont(f1);
label.setFont(f2);
button1.setFont(f3);

You can set the color by:

ta.setForeground(Color.red);
label.setForeground(Color.blue);
button1.setForeground(Color.yellow);
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question