0

I have a Java Swing application that has icons in toolbar buttons and menu items. The icons are all 20x20 pixels.

When run on a Mac with retina display, the icons get scaled up and become ugly because the toolbar height turns out to be 50 pixels, so the buttons' are about 40px high.

I would like to use bigger icons on higher resolution displays. What is the recommended Swing strategy to handle this (if any)? If no such strategy exists, what are some of the ways others have handled this?

The code I use to set an icon in a button:

tbtnRun = new JButton();
tbtnRun.setFocusable(false);
tbtnRun.setIcon(new ImageIcon(
    getClass().getResource("/editor/btn_run.png")));
Daniel Gabriel
  • 3,939
  • 2
  • 26
  • 37

0 Answers0