I'm making a Java Swing application and I want to use icons as a button, I used the following code to make my Icon
/JLabel
instances:
ImageIcon homeIcon = new ImageIcon(ImageIO.read(new File(new File(".").getCanonicalPath() + File.separator + "Icons\\home.png")));
JLabel homeButton = new JLabel( homeIcon,JLabel.CENTER);
homeButton.setBounds(15, 72, 30, 30);
homeButton.setFocusable(false);
add(homeButton);
homeButton.setOpaque(false);
But I'm getting my image as low quality. I don't think it's a scaling problem because the image is 30x30 and so does the JLabel, and resizing the label doesn't seem to change the icon's size, it's just low quality.
I looked for the other answers, mostly to no avail, however, I encountered a high-quality resizing library but I couldn't find documentation for that and I'm not sure whether it is available for commercial use or not.