Apache NetBeans Wiki Index

Note: These pages are being reviewed.

How to provide non-inverted images for dark LookAndFeels like DarkMetal/Darcula?

In short

  • All images will be inverted, when using a DarkLaF with an image filter applied and ImageUtilities is used

  • If you don’t like the inverted image/icon, then provide a image using "_dark" in its name. It will be used without any filter applied.


LaFs like DarkMetal/Darcula "invert" the colors of all the images/icons via an image filter set like UIManager.put("nb.imageicon.filter", new DarkIconFilter())

This filter is used when loading images/icons via org.openide.util.ImageUtilities#loadImageIcon and org.openide.util.ImageUtilities#loadImage.

You do not like the inverted colors? Provide your own images!

But there are cases, you don’t want to get your image inverted.

For example in the following screenshot you do not want the NB logo in the about dialog to be inverted! YouDontwantyourImageinverted

In this case provide an image with a specific name scheme. Add “_dark” to the name. This image is taken as it is and no filter will be applied.


  • about.pngabout_dark.png

  • But be aware of brandings! Then it must be about_dark_BRANDING.png

It still does not work? Migrate from ImageIcon…​

Check that your code really loads the images via org.openide.util.ImageUtilities#loadImageIcon and org.openide.util.ImageUtilities#loadImage!

Dialogs built using the Mantisse GUI Builder often use new javax.swing.ImageIcon constructs.

So here some replacements patterns to migrate such dialogs.

// within *.java
new javax\.swing\.ImageIcon\(getClass\(\)\.getResource\("(.+?)"\)\)
// with
org.openide.util.ImageUtilities.loadImageIcon\("$1", false\)

// within *.form
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
// with
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">

// within *.form
<Image iconType="3" name="(.*?)"/>
<Connection code="org.openide.util.ImageUtilities.loadImageIcon\(&amp;amp;quot;$1&amp;amp;quot;, false\)" type="code"/>


Without Invert:


With Invert enabled and *_dark.png for the logo and startpage images:


Handling Branding

Platform applications using Dark Look And Feels require the following for branding-related image adjustments (as discussed in http://forums.netbeans.org/topic66964.html):

  1. For frame images, the images must be named using the _dark suffix (frame_dark.gif, frame32_dark.gif, and frame48_dark.gif).

  2. For splash images, both a dark and non-dark version are required (splash.gif, splash_dark.gif).

These images are typically found in the branding/core/core.jar/org/netbeans/core/startup folder for the application.

As of Netbeans 8.2, the Branding dialog within the Netbeans IDE is not designed for these dark theme image requirements. Users using a dark theme will want to make image name changes directly within the filesystem to meet these requirements.

Handling textareas/textfields

If you have displaying issues with your controls, try to set the HONOR_DISPLAY_PROPERTIES-clientproperty.


pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
pane.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);


Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqImagesForDarkLaf , that was last modified by NetBeans user Markiewb on 2016-12-19T22:06:17Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.