I have two versions of an image: logo.png (265x150) and [email protected] (530x300). The second one is the retina-version.
In my Java application I have a JLabel on which I'm setting the background to an image like so:
contentPane = new JPanel();
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setBackground(Color.WHITE);
lblNewLabel.setBounds(9, 6, 265, 150);
lblNewLabel.setIcon(new ImageIcon("login_logo.png"));
contentPane.add(lblNewLabel);
This works fine, but I'm not sure how to display the retina-version properly on my Macbook Pro Retina. The retina image isn't scaled resulting in an image that is only partially visible.
My personal opinion would be, first check for retina display, then set the image
The above line will return 2.0 on retina displays. On non-retina macs it will returns 1.0 and on all other platforms null
try following code