Java Swing How to - Get Font object used by JTextArea








Question

We would like to know how to get Font object used by JTextArea.

Answer

//from w w w. j a  v  a  2  s  .  com
import java.awt.Font;

import javax.swing.JTextArea;

public class Main {
  public static void main(String[] argv) {
    JTextArea textarea = new JTextArea();


    Font font = textarea.getFont();
    System.out.println(font);
  }
}