Solved

How to print Courier onto the JTextArea?

Posted on 2004-09-29
5
347 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 20 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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…

705 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

14 Experts available now in Live!

Get 1:1 Help Now