Skip to content

dheid/fontchooser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Java Swing Font Chooser Logo

✏️ Java Swing Font Chooser Dialog and Panel

Maven Central Java CI with Maven ko-fi

Java does not provide a lightweight font chooser out of the box. This easy to use Java Swing font chooser component allows users to select a font by selecting a font family name and the installed font variants. Users are able to search for a font and insert their own preview text.

  • Compact design
  • Looks good on every operating system
  • Allows to find a font family easily
  • Supports font styles
  • Shows font in preview
  • Allows to change the preview text
  • Compatible with Java 8 and upwards
  • Easy to use
  • Well documented with Javadoc
  • No dependencies

There are translations for the following languages:

  • English
  • German
  • Greek
  • Hungarian
  • Spanish
  • Finnish
  • French
  • Brazilian Portuguese
  • Russian

Font Chooser is an open source project and completely free. I appreciate improvements or extensions. Please contact me if you have questions.

Screenshots

πŸ‘― Cross Platform

Font Chooser (Cross Platform)

🐧 GTK / Linux

Font Chooser (GTK)

🍎 Aqua / Mac

Font Chooser (Aqua)

🏒 Windows

Font Chooser (Windows)

❀️ Third party look and feels

Font Choooser (acryllookandfeel) Font Choooser (aerolookandfeel) Font Choooser (bernsteinlookandfeel) Font Choooser (darklaf) Font Choooser (fastlookandfeel) Font Choooser (flatdarculalaf) Font Choooser (flatdarklaf) Font Choooser (flatintellijlaf) Font Choooser (flatlightlaf) Font Choooser (graphitelookandfeel) Font Choooser (hifilookandfeel) Font Choooser (lunalookandfeel) Font Choooser (mcwinlookandfeel) Font Choooser (mintlookandfeel) Font Choooser (motiflookandfeel) Font Choooser (nimbuslookandfeel) Font Choooser (noirelookandfeel) Font Choooser (smartlookandfeel) Font Choooser (texturelookandfeel)

πŸ”§ Usage

Include the following dependency to your project:

<dependency>
    <groupId>org.drjekyll</groupId>
    <artifactId>fontchooser</artifactId>
    <version>2.5.2</version>
 </dependency>

or Gradle with Groovy DSL:

implementation 'org.drjekyll:fontchooser:2.5.2'

or Gradle with Kotlin DSL:

implementation("org.drjekyll:fontchooser:2.5.2")

If you want to apply a font to a specific component, e.g. a text area, simply use

JTextArea textArea = new JTextArea();
FontDialog.showDialog(textArea);

This will display the modal font dialog and apply the font to the component, if the user clicked OK.

Here is another simple example on how to use the font chooser dialog in your application:

FontDialog dialog = new FontDialog((Frame)null,"Font Dialog Example",true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
if(!dialog.isCancelSelected()){
  System.out.printf("Selected font is: %s%n",dialog.getSelectedFont());
}                                                               

You'll find more examples in the module fontchooser-example:

πŸ”¨ Building

Please use Maven to build and test the project.

mvn install

This will install the version to your local repository. You can now include it:

<dependency>
    <groupId>org.drjekyll</groupId>
    <artifactId>fontchooser</artifactId>
    <version>2.5.3-SNAPSHOT</version>
 </dependency>

or Gradle with Groovy DSL:

implementation 'org.drjekyll:fontchooser:2.5.3-SNAPSHOT'

or Gradle with Kotlin DSL:

implementation("org.drjekyll:fontchooser:2.5.3-SNAPSHOT")

🀝 Contributing and Credits

Please see here: Contributing

This is a major rewrite of the JFontChooser component, originally written by Dr Christos Bohoris (Copyright 2009).

πŸ““ Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

πŸ“œ License

GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 https://www.gnu.org/licenses/lgpl-3.0.en.html

πŸ“’ Release Notes

2.5.2

This version supports Darklaf now.

Styles do not include family name any longer.

2.5.1

  • Introduced Lombok
  • Migrated to JUnit 5
  • Updated dependencies and plugins
  • Migrated to GitHub

About

This easy to use Java Swing font chooser component allows users to select a font by selecting a font family name and the installed font variants.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages