Solved

Setting color and fonts

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now