[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Setting color and fonts

Posted on 1998-09-04
1
Medium Priority
?
211 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

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 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…
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 …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

656 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