FlatLaf Documentation

repository·main·Indexed 26 days ago

https://github.com/jformdesigner/flatlaf

A modern, open-source, cross-platform Look and Feel for Java Swing desktop applications. It provides clean, flat themes including Light, Dark, IntelliJ, and Darcula that scale on HiDPI displays. The library includes FlatLaf Extras for components like FlatSVGIcon and FlatTriStateCheckBox, development tools such as FlatInspector and FlatUIDefaultsInspector, and bundled font support for Inter, JetBrains Mono, and Roboto.

Tokens
6.5K
Snippets
22
Records
48
Agent score
88%

What's inside FlatLaf

  1. Overview of FlatLaf Windows 10/11 Native Library

    main
    The flatlaf-natives-windows sub-project provides the source code for the FlatLaf Windows 10/11 native library (DLL). This library enables native Windows features within the FlatLaf look and feel. Pre-built, signed DLLs for various architectures are provided within the flatlaf-core resources to allow usage on any platform without requiring a local C++ compiler.
  2. Use FlatLaf Native Libraries

    main

    FlatLaf provides native libraries to enhance the look and feel on specific operating systems. Depending on your target platform and development needs, you can use the following native library implementations:

    • Windows 10/11: Use the flatlaf-natives-windows library for optimized Windows 10 and 11 support.
    • Linux: Use the flatlaf-natives-linux library for Linux-specific native enhancements.
    • Development/JNA: For development purposes, you can use flatlaf-natives-jna which utilizes JNA (Java Native Access).
  3. Use bundled font sub-projects

    main

    The flatlaf-fonts sub-project provides bundled, redistributable JARs for specific font families. Instead of managing individual font files, you can include these specific sub-projects as dependencies in your project to easily use and redistribute these fonts.

    Available font bundles:

    • Inter (flatlaf-fonts-inter)
    • JetBrains Mono (flatlaf-fonts-jetbrains-mono)
    • Roboto (flatlaf-fonts-roboto)
    • Roboto Mono (flatlaf-fonts-roboto-mono)
  4. Add FlatLaf SwingX support to your project

    main

    The flatlaf-swingx addon provides FlatLaf support for specific SwingX components that use UI delegates. While many SwingX components (like JXButton, JXLabel, and JXList) work with FlatLaf automatically, the following components require this addon for proper FlatLaf styling:

    • JXBusyLabel
    • JXDatePicker
    • JXHeader
    • JXHyperlink
    • JXMonthView
    • JXTaskPaneContainer
    • JXTaskPane
    • JXTipOfTheDay
    • JXTitledPanel
  5. Explore FlatLaf Addons

    main

    FlatLaf provides several specialized addons to extend its functionality:

    • IntelliJ Themes Pack: Bundles many popular open-source 3rd party themes.
    • Extras: Provides SVG icons, tri-state checkboxes, UI inspectors, and more.
    • SwingX: Adds support for SwingX components.
    • JIDE Common Layer: Adds support for JIDE Common Layer components.
    • Fonts: Provides certain font families bundled in easy-to-use and redistributable JARs.
  6. Install the UI Defaults Inspector for development

    main

    The FlatUIDefaultsInspector is a development tool that opens a window displaying all UI defaults used in the current theme (Look and Feel).

    Warning: Do not include this in released production applications.

    To install, call FlatUIDefaultsInspector.install(String keystroke) in your main method. You can then activate the inspector using the specified keystroke.

    FlatUIDefaultsInspector.install( "ctrl shift alt Y" );
  7. Configure FlatLaf to use Inter as the application font

    main

    To set Inter as the default font for your FlatLaf application, call FlatLaf.setPreferredFontFamily (and its variants) before setting up the FlatLaf Look and Feel.

    FlatLaf.setPreferredFontFamily( FlatInterFont.FAMILY );
    FlatLaf.setPreferredLightFontFamily( FlatInterFont.FAMILY_LIGHT );
    FlatLaf.setPreferredSemiboldFontFamily( FlatInterFont.FAMILY_SEMIBOLD );