- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to get JTextArea font information
Let’s say the following is our JTextArea −
JTextArea textArea = new JTextArea("This is demo text.");
Now, get the font using the Font class getFont() method as shown below −
Font font = textArea.getFont(); System.out.println("Font = "+font);
The following is an example to get JTextArea font information in Java −
Example
package my; import java.awt.Font; import java.awt.GridLayout; import javax.swing.*; public class SwingDemo { SwingDemo(){ JFrame frame = new JFrame(); JTextArea textArea = new JTextArea("This is demo text."); Font font = textArea.getFont(); System.out.println("Font = "+font); frame.add(textArea); frame.setSize(550,300); frame.setLayout(new GridLayout(2, 2)); frame.setVisible(true); } public static void main(String args[]) { new SwingDemo (); } }
Output
The Font info is displayed in Console −
- Related Articles
- Java Program to paste clipboard text to JTextArea
- C# Program to get information about a file
- Java Program to display the contents in JTextArea
- How to get the Tab Size of a JTextArea in Java?
- Java Program to replace the first 10 characters in JTextArea
- Java Program to set JTextArea to wrap by word in Java
- How to get XKCD font working in Matplotlib?
- How to get programmatically android host information?
- How to get complete drive information using C#?
- How to get android application last update information?
- How to get programmatically android Radio version information?
- How to get Sim service information in android?
- How to get root directory information in android?
- How to get thread group information in android?
- How to get the disk information using PowerShell?

Advertisements