About 865,000 results
Open links in new tab
  1. How can I use a custom font in Java? - Stack Overflow

    Apr 13, 2011 · If you include a font file (otf, ttf, etc.) in your package, you can use the font in your application via the method described here: Oracle Java SE 6: java.awt.Font. There is a tutorial available from Oracle that shows this example:

  2. Java Load Custom Font File (.ttf) - Stack Overflow

    Dec 12, 2015 · Simply use the documentation here, which details how to load custom fonts into a GraphicsEnvironment. It should look something like the following: GraphicsEnvironment ge = null; try{ ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

  3. How to Use a Custom Font in Java - Baeldung

    Jan 24, 2024 · In this tutorial, we’ll еxplorе how you can use a custom font in our Java applications. 2. Configuring Custom Fonts. Java supports thе intеgration of TruеTypе fonts (TTF) and OpеnTypе fonts (OTF) for custom font usagе.

  4. Font.createFont (..) set color and size (java.awt.Font)

    May 26, 2013 · According to this link, the createFont() method creates a new Font object with a point size of 1 and style PLAIN. So, if you want to increase the size of the Font, you need to do this: Font font = Font.createFont(Font.TRUETYPE_FONT, new File("A.ttf")); return font.deriveFont(12f);

  5. Fonts Available in Java AWT - GeeksforGeeks

    Nov 15, 2023 · We know that AWT stands for ABSTRACT WINDOW TOOLKIT. For, Example when we want to draw a string in the AWT in Frame we use the method Graphics.drawString (String str, int x_coordinate, int y_coordinate). Now use the Font class for the string to display in the type of font you want.

  6. How to Use Custom Fonts in Java Applications: A Comprehensive …

    In this tutorial, we've explored how to incorporate custom fonts into Java applications using the Swing framework. By following these steps, you can enhance your application's visual appeal and create a more engaging user experience. Q. Can I use any font file for my Java application? A.

  7. How to Use a Custom Font in Java: Step-by-Step Guide

    Use the `Font.createFont()` method to load a custom font from a file. Ensure that the font file (e.g., .ttf or .otf) is accessible within your application's directory. Utilize `GraphicsEnvironment` to register the font for use in your application.

  8. [Java Code Sample] How to use a custom font - RyiSnow's Programming Blog

    Apr 14, 2021 · Here's the sample code to use a custom font in Java: *Prepare ttf font and put it in your project folder package p1; import java.awt....

  9. How to Change Font in Java? Easy Steps - wordscr.com

    Jan 25, 2025 · In this blog post, we have explored the various ways to change the font in Java, including the use of font families, font sizes, and font styles. By using these methods, developers can create visually appealing and user-friendly applications that are easy to read and understand.

  10. Java Program to Display Text in Different Fonts - Sanfoundry

    For displaying text in different fonts, we can have the following set of input and output. To View the Texts: it is expected that texts with different fonts are displayed. 1. Get the list of all fonts available in the system using GraphicsEnvironment. 2. Create random fonts using the list generated. 3. Set the created font to the graphics object.

  11. Some results have been removed
Refresh