FlatLaf | Swing Look and Feel ( with Darcula/IntelliJ themes support | Theme library
kandi X-RAY | FlatLaf Summary
kandi X-RAY | FlatLaf Summary
FlatLaf is a modern open-source cross-platform Look and Feel for Java Swing desktop applications. It looks almost flat (no shadows or gradients), clean, simple and elegant. FlatLaf comes with Light, Dark, IntelliJ and Darcula themes, scales on HiDPI displays and runs on Java 8 or newer. The look is heavily inspired by Darcula and IntelliJ themes from IntelliJ IDEA 2019.2+ and uses almost the same colors and icons.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Called when the tab has changed .
- Sets the default values for the given theme .
- Apply properties to the UI defaults .
- Initialize Mac input maps .
- Paint the row .
- Get all keys from the editor .
- Handles mouse wheel move .
- update the themes list
- Paint the shadow .
- Initialize the components .
FlatLaf Key Features
FlatLaf Examples and Code Snippets
Community Discussions
Trending Discussions on FlatLaf
QUESTION
I have implemented a Dark Mode for my Java application (using flatlaf) but the title bar has light appearance even when MacOS itself it set to use Dark Mode. The possible solution is to set NSRequiresAquaSystemAppearance to false in the Info.plist file. I have done this as part of building the appbundle (with TheInfiniteKind fork of appbundler) but it is not working for me
This is the contents of the generated Info.plist file
...ANSWER
Answered 2022-Mar-30 at 08:25Things seem to have moved on, I found this issue fixed in Java 14 - https://bugs.openjdk.java.net/browse/JDK-8235363
I found setting
QUESTION
I am using swingx
library, on Windows I am now moving towards using the Flatlaf light and dark look and feel on all platforms
This looks fine on MacOS, but on Windows the status bar looks like it did with Windows look and feel and doesn't look right.
It is because I'm using the swingx JXStatusBar
component and this has some look and feel enhancements including some Windows specific images used for the background
e.g. swingx\swingx-core\src\main\resources\org\jdesktop\swingx\plaf\windows\resources\silver-statusbar-left.png
Trying to change the background colour of the component or the labels I add to it has no effect.
So I thought the best thing to do was move away from using JXStatusBar
and just use a JPanel, but continue adding the components in same way using JXStatusBar.Constraint
ANSWER
Answered 2022-Mar-06 at 13:50Add flatlaf-swingx.jar
to your project, then JXStatusBar
works fine with FlatLaf:
See FlatLaf addon for SwingX and issue #492
QUESTION
I'm having an error while compiling proguard. I'm using flatlaf-1.6.4.jar for GUI Java Aplication
...ANSWER
Answered 2021-Dec-26 at 22:39You haven't provided any details about your environment, but based on the error message ("Unsupported class version number [53.0] (maximum 52.0, Java 1.8)") it looks like your code was compiled using JRE 9 (i.e. version 53.0).
There is an old Proguard feature request on this. See #181 Java 9 major number 53 support
:
Proguard does not support Java 9 class file format. The major version number for the class file in Java 9 is 53 and in Java 8 it was 52. Please enhance Proguard to support Java 9 class files.
The request was submitted on 12/21/16, and closed on 2018-03-29. Presumably you are using ProGuard 5.x (or earlier), right? If so, your solution is to use Proguard 6.0 or later. From the Proguard 6.0 release documentation:
Added backporting and support for Java 9 code
However, if you are already using a version of Proguard > 5.x then update your question to provide full details of the compiled version of your code, and your versions of Proguard, Java and NetBeans.
Also see the old SO question Error Proguard Unsupported class version number. Though not a duplicate of your question, it details a similar issue on earlier versions of Java and Proguard.
QUESTION
I'm currently working on a Netbeans Platform application that uses com.formdev.flatlaf.FlatLightLaf as the Look and Feel. The application is using Java 11 and running under Windows 10.
I would now like to change the color of the TitlePane. Changing the color of specific elements (like jPanels etc.) globally for the entire application can be done by changing properties within the UIManager.
So I tried changing many of the background-color specific settings from UIManager.getDefaults()
as well as UIManager.getLookAndFeelDefaults()
. For example changing the TitlePane.background property to something like UIManager.put("TitlePane.background", new ColorUIResource(100, 100, 100));
.
However none of the dozens of properties I changed worked at all.
The color can be changed though as evidenced by the changed color of the TitlePane when using the com.formdev.flatlaf.FlatDarkLaf (darkmode).
If anyone has any idea which properties need to be changed in order to change the color of the title pane in a Netbeans Platform application I would very much appreciate any form of help!
...ANSWER
Answered 2021-Aug-24 at 06:46I believe I found the culprit.
In a recent release of Netbeans the option to set "TitlePane.unifiedBackground" for FlatLaF was introduced.
However when setting UIManager.put("TitlePane.unifiedBackground", true);
the problem described above will occur and I effectively can't set the background color of the TitlePane.
As seen in the method updateUnifiedBackground()
of class FlatLFCustoms
(https://github.com/apache/netbeans/blob/12.4/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLFCustoms.java) in the Netbeans source code, the color of the titlePane should be set by adjusting the property "Panel.background".
This however doesn't seem to work properly.
A workaround seems to be to set UIManager.put("TitlePane.unifiedBackground", false);
and then just set the "TitlePane.background" to the desired color.
If you still want the unified TitlePane look you can achieve that by also setting "Panel.background" and "Toolbar.background" to the same color.
In effect this will look identical to setting the unifiedBackground for the TitlePane only now you can change the color. Hope this helps someone who stumbles upon the same Problem.
QUESTION
I'm using the Flatlaf Look and Feel for my GUI in Java swing. There's a pre-made theme in Flatlaf which I imported, but I'd like to change one of the colors in the color scheme slightly. It's the color that is used to highlight JComponents and selected tabs. Is there any way to do this?
The standard way to customize a L&F is:
...ANSWER
Answered 2021-Nov-14 at 10:00I don't know how to do this in FlatLaf, but there is another library called material-ui-swing that gives you more power on the material theme, and after it is the library that works with the UIManager.
You can do somethings like that:
QUESTION
Environment:
Linux + JDK 11 + Gradle 5.0
I have several gradle projects which must build from sources without Internet connection/ For example this one git clone --depth 1 --branch 3.0.0 https://github.com/bobbylight/RSyntaxTextArea.git
for that first of all I built this project online then copy ~/.gradle to $PROJECT_DIR/grdl , next I want to test this build offine. I perform gradle --stop
, clear whole ~/.gradle directory then turn off Internet and run following script:
ANSWER
Answered 2021-Sep-13 at 14:01I think you are hitting this issue: https://github.com/gradle/gradle/issues/1338
That is, cache items are non relocatable. Copying the whole ~/.gradle
folder may not be enough, especially if ~
resolves to a different path than in the original machine (i.e. different user). The full path needs to be exactly the same (with Gradle 5.0).
The issue suggests however that version 6.1 makes the cache relocatable, so perhaps you'll have more luck with a recent version (7.2 is the latest at this point in time).
EDIT: The release notes and these docs confirm that the cache can be copied across deployments as of version 6.1.1.
QUESTION
I'm using Ikonli Packs for my element icons and adding it to a JLabel
works fine.
I want to implement a hover feature but when I do, nothing happens unless I try to call the .setText()
method of my JLabel
.
I thought it might be obligatory to have text in order to detect the cursor, but the JLabel
doesn't have text initially, yet it still detects it, but as I mentioned, if I don't have the .setText()
as well, the icon color will not change.
There are many examples here and on other websites on how to implement hover for labels/buttons/etc., but they all have text in one shape or form.
There's also this example which hovers over images, but yet again, changes the text, not the images themselves.
(The elements seen in the MyForm.java
file have been added via the Swing Palette.)
ANSWER
Answered 2021-Jun-27 at 12:27As suggested by Andrew Thompson, I used a JButton
instead of JLabel
.
QUESTION
I have a single cell (column) per row based table and the cell is a panel with 2 buttons on it. TableCellRenderer and TableCellEditor are implemented correctly to allow render and edit the cell. But when i click the row or even the button, the shape of the buttons change. It looks like the size of the button shrinks to fit the button text. Please see the attached images.
If I set a preferred size of the buttons then the size doesn't seem to change but the button text shift towards right. Below is the code of the table cell panel. Running this panel from a main in the same class like shown below dosn't show this behavior. This behavior is only visible when using this panel as a cell in the single column table row. Don't know which property of what to set/change.
...ANSWER
Answered 2021-May-24 at 04:38According to the source code, the border inset of the table cell editor is 0 according to the FlatBorder
specification.
com/formdev/flatlaf/ui/FlatBorder.java
QUESTION
I'm currently using FlatLaf UI as look&feel for my Swing application.
FlatLaf offers a user scale mechanism based on the font size, e.g.:
ANSWER
Answered 2021-Apr-18 at 12:40A neat solution is extending the standard Swing components, e.g.
QUESTION
I am creating a JFrame
, using a custom look and feel named FlatLaf. But I am experiencing weird behavior when I resize the window. I can replicate the exact same problem with this snippet:
ANSWER
Answered 2021-Apr-05 at 20:54The problem is when I resize from the left and the top of the frame, it starts to move in that direction
This effect happens because you are setting the minimum size of the JFrame
, together with the fact that you clear the frame decorations. So don't set the minimum size, or just leave the decorations enabled. If you leave the decorations enabled and still set the minimum size, then the user will be able to resize the frame until it reaches the minimum corresponding dimension where, instead of moving, the frame will stay in place.
As for the title bar, in case you need all of its good characteristics (such as the 3 buttons on the right, the title and icon of the frame on the left and the bar in the middle which can be actually dragged by the user to move the frame), but you also want it to have a specific color, then don't undecorate it and only change the color of the title bar component, which can be done like so:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install FlatLaf
FlatLaf snapshot binaries are available on [Sonatype OSSRH](https://oss.sonatype.org/content/repositories/snapshots/com/formdev/flatlaf/). To access the latest snapshot, change the FlatLaf version in your dependencies to <version>-SNAPSHOT (e.g. 0.27-SNAPSHOT) and add the repository https://oss.sonatype.org/content/repositories/snapshots/ to your build (see [Maven](https://maven.apache.org/guides/mini/guide-multiple-repositories.html) and [Gradle](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:declaring_custom_repository) docs).
To use FlatLaf, add following code to your main method before you create any Swing component:.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page