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 6569233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:36:03+00:00 2026-05-25T14:36:03+00:00

Say I have a Swing JComponent and I set a Font for the text

  • 0

Say I have a Swing JComponent and I set a Font for the text of that JComponent. I build the project and create a .jar file of my project. Now, If I run this jar file from another computer where the Font is not install, what will be happen? Will the jar automatically install the Font or I need to make some kind of checking to do that? Thank you.

  • 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-25T14:36:03+00:00Added an answer on May 25, 2026 at 2:36 pm

    If you need to use that specific font, you’ll have to make sure it’s installed on the machine before your jar file is run, or load it yourself. There’s nothing that will automatically install the font for you. You can retrieve the list of available fonts using this code:

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String [] fonts = ge.getAvailableFontFamilyNames();
    

    Alternatively, you can load and register the font yourself using

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font f = Font.createFont(Font.TRUETYPE_FONT, new File(pathToYourTTFFile));
    ge.registerFont(f);
    

    You should check the return code of registerFont and catch/deal with the exceptions thrown by createFont.

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

Sidebar

Related Questions

Say I have the following file structure: app/ app.py controllers/ __init__.py project.py plugin.py If
I have two JList on a swing GUI. Now I want that when a
I have a Java Swing application that i want to create a nice component
Say I have a standard Swing component like JSlider, but I want to slightly
I have a question about laying out some swing components. Say, I have a
In Java (Swing), say I've got a 2D game where I have various types
I've a text field which extends javax.swing.JTextField and also have document listener like this
I have a Java Swing UI that isn't updating/repainting as I thought it should.
Say I have a swing GUI, and I want to listen MouseEvents . Who
I have a simple Jython GUI that displays an XML file in a JTree.

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.