Changing Font in a JTextArea

Posted on 2005-04-25
Last Modified: 2013-12-03
I would like to make a window that pops up and lets users choose a font to use in a JTextArea that I have. Does anyone know how I would go about doing this?
Question by:jasoncuevas
    LVL 86

    Expert Comment

    LVL 86

    Accepted Solution

    After importing the correct classes, all you need to do is:

    FontChooser chooser = new FontChooser(frame);;
    // Get the user's selection
    Font font = chooser.getSelectedFont();
    LVL 92

    Expert Comment

    Calling setFont() should be all you need
    LVL 86

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    hash value 2 29
    Is there any core JDK API for PDF Creation? 5 31
    Receive file in Servlet 1 26
    java set up 1 35
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now