Solved

Setting color and fonts

Posted on 1998-09-04
1
209 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 10 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

Independent Software Vendors: 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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

691 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