Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to print Courier onto the JTextArea?

Posted on 2004-09-29
5
Medium Priority
?
361 Views
Last Modified: 2010-05-18
In my program I will print text onto the JTextArea. The default type is not Courier. How can I set the type as Courier?
0
Comment
Question by:chenwei
  • 3
  • 2
5 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 80 total points
ID: 12180403
Try
        yourTextArea.setFont( new Font("Courier", Font.PLAIN, 10) );
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12180426
jTextArea.setFont( new Font("Courier", Font.PLAIN, 12) );
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12180447
Ok, you have already posted. I am late
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12180510
If you want this font for **all** your JTextArea's you place somewhere at the beginning of your main():

          UIManager.put("TextArea.font", new javax.swing.plaf.FontUIResource("Courier", Font.PLAIN, 10));
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12187840
Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

886 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