JDK 17 | JDK 20 |
---|---|
17.0.13-oracleFixed | 20 b07Fixed |
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
ADDITIONAL SYSTEM INFORMATION : 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
|