
Here are examples of toolWindowStructure. The IconLoader class will load the icon that matches the best depending on the current environment.

IconName_dark.png W x H pixels (Will be used on non-Retina devices with Darcula 2*W x 2*H pixels (Will be used on Retina devices with Darcula theme) IconName.png W x H pixels (Will be used on non-Retina devices with default 2*W x 2*H pixels (Will be used on Retina devices with default theme) Please consider using SVG icons for optimal results if your plugin targets 2018.2+.Īll icon files must be placed in the same directory following this naming pattern (replace. If the icon graphics are simple enough so that it renders perfectly in every scale, then the version can be omitted.įor generating the SVG icons suited for the IntelliJ-based IDEs, you may also use the third-party web tool IntelliJ Icon Generator. The icon graphics of such an icon can be expressed in more details via double precision. 6 Criticism 7 Class libraries 8 Documentation. However, the version of an SVG icon should still provide the same base size. 5.1 Applet 5.2 Servlet 5.3 JavaServer Pages 5.4 Swing application 5.5 JavaFX application 5.6 Generics. The naming notation used for PNG icons (see below) is still relevant. Syntax of drawImage() method: public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer): is used draw the specified image. Then define a class/interface in a top-level package called icons holding icon constants as static fields: For displaying image, we can use the method drawImage() of Graphics class. The path to the icon passed in as argument to IconLoader.getIcon() must start with leading /. The getIcon() method of IconLoader can be used to access the icons. The best way to deal with icons and other image resources is to put them to a dedicated source root marked as Resources Root, say icons or resources. See Action Basics sample plugin as reference. If custom icons are required, please refer to detailed design guide. Icons from plugins are located in corresponding Icons class (e.g., GithubIcons). Plugins should reuse existing platform icons whenever possible. For more information see the Plugin Logo. Plugin Logos, which represent a plugin itself, have different requirements than icons and images used within a plugin. Plugins need icons mostly for actions, custom components renderers, tool windows, and so on. SwingUtilities.Icons and images are used widely by IntelliJ Platform plugins.

Return FileSystemView.getFileSystemView().getSystemIcon(f) If you need more generic image, you use a JFileChooser and extract the image for a file or directory. getSystemIcon() method which takes a file and gives the method (static) of FileSystemView class. Get a FileSystemView object using getFileSystemView() Override the getIcon() method and return the is abstract, anonymous inner class is written SetTitle("Default System icon for JFileChooser")

Public DefaultSystemIconForJFileChooser() public Image getImage() - returns an Icons image. One more thing, which I will stress out here is setting system icons in a different look and feel.Ĭlass DefaultSystemIconForJFileChooser extends JFrame When working in Swing, GIF, PNG, and JPG image formats work best. One is giving the default system icon for files using the WindowsLookAndFeel or the WindowsClassicLookAndFeel. Here are there are two things to talk about. I previously, posted this on Stackoverflow, and now I am happy to share it here. It's nothing more than single line code!.
Swing set icon image how to#
Here is how to set default system icon for files and directories in JFileChooser using the simple FileView.
