Here's a nasty, hacked, quick fix that will stop nasty cropping by resizing your own Swing icons to 80%.
In main add this:
String[] iconOpts = {"OptionPane.errorIcon", "OptionPane.informationIcon", "OptionPane.warningIcon", "OptionPane.questionIcon"}; for (String key : iconOpts) { ImageIcon icon = (ImageIcon) UIManager.get(key); Image img = icon.getImage(); BufferedImage bi = new BufferedImage( img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); java.awt.Graphics g = bi.createGraphics(); g.drawImage(img, 0, 0, (int) (img.getWidth(null) * 0.8), (int) (img.getHeight(null) * 0.8), null); ImageIcon newIcon = new ImageIcon(bi); UIManager.put(key, newIcon); }
You might want to check first if this is really necessary - for Windows 8/10, the default is 125%, but some people will return it 100%. I have not found an elegant way to do this, but something like that will give you an idea:
java.awt.Font font = (java.awt.Font) UIManager.get("Label.font"); if (font.getSize() != 11) {
rosa source share