Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:38:25+00:00 2026-05-31T13:38:25+00:00

I am working on Java GUI project. I have several components on the swing-based

  • 0

I am working on Java GUI project. I have several components on the swing-based GUI. I want to change the font settings for all the components, rather than changing font for each component one by one.

Is there a way to change the font type and size of all the components on a JPanel on a JFrame.

Edit:

This is how my code looks:

public class Test extends JFrame{
   public Test(){

     //all components are initialized here. (some buttons and text fields) and added to this
      this.setVisible(true);
   }

   public static void main(String []args){
     new Test();
   } 

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:38:26+00:00Added an answer on May 31, 2026 at 1:38 pm
    public static void setUIFont(javax.swing.plaf.FontUIResource f)
    {   
        java.util.Enumeration keys = UIManager.getDefaults().keys();
        while(keys.hasMoreElements())
        {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if(value instanceof javax.swing.plaf.FontUIResource) UIManager.put(key, f);
        }
    }
    
    // ...
    
    try
    {
        setUIFont(new javax.swing.plaf.FontUIResource("Tahoma",Font.PLAIN,12));
    }
    catch(Exception e){}
    

    PS: I just copied this from old project of mine, and I am not sure from where I got it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on Java Swing project. Its design is pretty poor. I
We are working on Java web project based on JPA 2, Hibernate, Spring 3
I have created a couple of java working sets for a project in my
I am currently working on a project for school, it is Java based and
I'm working on a project about graph-coloring (with GUI). I have a map divided
I am working on a Java GUI, in which i have a JTable in
I was making a java gui application through netbeans IDE. All was working fine
I'm working on a Java GUI project; in one of its property screen I
I'm really new to Java, especially working with GUI in Java. I want to
When working with Java from Scala, we have to account for null. HttpServletRequest getters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.