After inserting a good quality image into the JLabel, the final image quality is less detailed (as if it had a lower resolution).original image JFrame screen after inserting. The difference may not be so visible in the images presented, but in reality it is very noticeable that the quality in JFrame is lower.
My setup: 1. Java 17 version, 2. Windows 11 Pro 23H2 (125% scaling factor), 3. Display has 141 ppi, 4. Image has 911x406 dimension and 96 dpi.
My code:
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(null);
frame.setSize(1300, 800);
frame.setLocationRelativeTo(null);
frame.getContentPane().setBackground(new Color(255, 255, 255));
BufferedImage image = ImageIO.read(new File("src/main/resources/scheme.jpg"));
JLabel schemeLabel = new JLabel(new ImageIcon(image));
schemeLabel.setBounds(0, 0, image.getWidth(), image.getHeight());
frame.add(schemeLabel);
frame.setVisible(true);
frame.repaint();