X

Geertjan's Blog

  • September 24, 2014

Icon Sets for NetBeans IDE

Geertjan Wielenga
Product Manager

It's really pretty cool how you're able to configure fonts and colors for NetBeans IDE, export them to a ZIP file, and share them with others. That's how brilliant sites likes netbeansthemes.com have popped up in various places.

Wouldn't it be cool if the same thing could be done with the icons in NetBeans? You'd go to the Options window and be presented with all the icons and then you'd be able to replace each of them with your own. Or, better still, you'd be able to right-click on any icon and replace each of them one by one. Or all at once.

Many different implementations are imaginable. But the starting point is to figure out whether it is possible to create a NetBeans plugin that is able to replace NetBeans icons. Below, you can see I have succeeded. You can see two instances of NetBeans. The one at the top (or, in fact, behind the other one) is where I have created a module named "IconReplacer". It has the standard "New File" icon, while the second instance  shows that I have replaced that icon with my own.

The icons in NetBeans are found all over the source code, which makes sense, since NetBeans is modular. I.e., each feature is provided by a set of modules, including the icons used by the feature. However, many of the icons are found in the 'projectui' module, that's a good place to start if you want to go down this road.

And here's all the code I added into my "IconReplacer" module to change the New File icon:

import javax.swing.Action;
import org.openide.filesystems.FileUtil;
import org.openide.windows.OnShowing;
@OnShowing
public class Replacer implements Runnable {
@Override
public void run() {
Action newFileAction =
FileUtil.getConfigObject(
"Actions/Project/org-netbeans-modules-project-ui-NewFile.instance",
Action.class);
newFileAction.putValue("iconBase","org/netbeans/icon/replacer/resources/newFile.png");
}
}

Therefore, you'd need to find the location of all the icons, provide some kind of user interface so the user can change the icons to different ones, and then code like the above for actually doing the replacement.

Join the discussion

Comments ( 7 )
  • Kovica Wednesday, September 24, 2014

    It would be cool if you could set colors/fonts also for other windows not only the editor.


  • ChrisLE Wednesday, September 24, 2014

    Very nice. It would be cool if you can combine it with Ui Editor: http://plugins.netbeans.org/plugin/55618/ui-editor (https://github.com/jbisanti/Netbeans-UI-Editor-Plugin) I created a ticket for, add option to change icons (I think ^^, because he deactivated the issue tracking :/). It will be very cool if the Ui-Editor can handle those things like change Icons, Change branding of the running netbeans instance and so on.

    Regards

    Chris


  • Willan Thursday, September 25, 2014

    Perfect thank you,

    Now could you help me with the following:

    How to set an icon on a DialogDisplayer eg a login

    DialogDisplayer dialogoMostrar=DialogDisplayer.getDefault();

    dialogoDescripcion=panel.createDialogDescriptor();

    dialogoDescripcion.setModal(true);

    dialogoMostrar.notifyLater(dialogoDescripcion);


  • guest Thursday, September 25, 2014

    Perfect thank you,

    Now could you help me with the following:

    How to set an icon on a DialogDisplayer eg a login


  • Neil C Smith Thursday, September 25, 2014

    Even better would be to allow icons to be provided by other than image files. How awesome(!) to allow for icon implementations based on fonts for example.

    Things like - http://icedtea.classpath.org/people/neugens/SwingUIPatterns/file/f4528c35cc0c/src/main/java/org/icedtea/ui/patterns/swing/images/FontAwesomeIcon.java

    You might have noticed from the Praxis LIVE UI that I quite like monochrome icons, so not for everyone, but a way of dealing with colour and scale issues.

    Best wishes, Neil


  • ChrisLE Wednesday, August 5, 2015

    Any plans to implement an option to change each icon?

    Regards

    Chris


  • Alan Coldwell Thursday, June 16, 2016

    Thanks for putting this out there!

    Did this plugin ever get fully developed by yourself or someone else? If not, is there anything in 8.1 that would prevent it from happening now?

    Assuming such a plug in was made using the steps you described above, do you think it would also be possible to replace the icons in the project window?

    Sincerely,

    Alan


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.