MENU

Extract Java system icons

TOC

Java system iconExtracting the

JavaThe following is a sample program that extracts icons from a specified file into a png format image file. The specified file can be an executable file with exe extension, dll, xls, doc, or any other file.

I have looked on the Internet for similar methods, but have not found any.
However, we have found a really easy way to get it, so we will introduce it here.
This method is also available on Chat & Messenger,Ability to attach files to stickiesWe are using this service in the following areas.

Sample program operation check

Run a sample

If a jar file is associated, it can be executed.

  1. Get the sample source, compile and run it.
  2. When launched, the main window will open. Drag and drop the icon you wish to extract directly into the window.
    Icon Acquisition

  3. A png-format image file is output to the same location as the original eincon.
    Icon Acquisition


Sample Program Explanation

The process of extracting icons in Java is realized in the following way.

  1. Set Look & Feel to Windows.
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

  2. Drag-and-drop retrieved files. JFileChooser.getIcon() method. Icon object.

  3. ImageIO.write() method outputs the Icon object to a png image file.

sample program

TOC