-
Bug
-
Resolution: Fixed
-
P3
-
17, 18, 19
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8300231 | 17.0.13-oracle | Alexey Ivanov | P3 | Resolved | Fixed | b01 |
JDK-8333701 | 17.0.13 | Martin Doerr | P3 | Resolved | Fixed | b01 |
Windows 10, jdk-19 and jdk-17
A DESCRIPTION OF THE PROBLEM :
I used the javax.swing.filechooser.FileSystemView.getSystemIcon(File) method to get the icon from system. When the file has the default icon, the method returns an icon that looks cropped.
With Java 8 everything is ok. I reproduced the problem with Java 17 and Java 19
I attached a sample in the "Source code for an executable test case" section.
REGRESSION : Last worked in version 8u321
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create the "D:\\toDelete\\abc.bla" file into your system. (it has to have an unknown extension)
2. Run the code from the "Source code for an executable test case" section with Java 19.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The icon from the second button should be well painted.
ACTUAL -
The icon from the second button is cropped on the north side.
---------- BEGIN SOURCE ----------
import java.io.File;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.filechooser.FileSystemView;
public class SwingDemo {
public static void main(String[] args) {
JButton button1 = new JButton("text");
Icon icon = FileSystemView.getFileSystemView().getSystemIcon(new File("D:\\toDelete\\abc.bla"));
JButton button2 = new JButton(icon);
Box box = Box.createVerticalBox();
box.add(button1);
box.add(button2);
JFrame frame = new JFrame();
frame.add(box);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationByPlatform(true);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I didn't find a workaround.
FREQUENCY : always
- backported by
-
JDK-8300231 Default icon is not painted properly
- Resolved
-
JDK-8333701 Default icon is not painted properly
- Resolved
- relates to
-
JDK-8289705 Handle the case where IExtractIconW::Extract returns S_FALSE
- Open
-
JDK-8289756 Do not always request 16x16 icon
- Open
-
JDK-8289707 Use LookupIconIdFromDirectoryEx to extract only available sizes of icon
- Open
-
JDK-8182043 Access to Windows Large Icons
- Resolved
-
JDK-8320692 Null icon returned for .exe without custom icon
- Resolved
-
JDK-8293862 javax/swing/JFileChooser/8046391/bug8046391.java failed with 'Cannot invoke "java.awt.Image.getWidth(java.awt.image.ImageObserver)" because "retVal" is null'
- Resolved
-
JDK-8289708 Extract only the requested icon size
- Open
- links to
-
Commit openjdk/jdk17u-dev/d23f4d66
-
Commit openjdk/jdk/6c8d0e61
-
Review openjdk/jdk17u-dev/2538
-
Review openjdk/jdk/7805