Auto-resizing JButton Icon
问题 so I have this JButtons to which I add Icons. The Icons are too large initially, so I resize them beforehand, and it works fine. Except that when I resize the window, the JButtons change size, but not the Icons, which is problematic. Is there a way to have an Icon just fill the JButton it is attached to? Bit of code to make it clearer: public JewelClass(){ setBackground (new Color (30,30,30)); addActionListener(this); setLayout(new GridLayout()); ImageIcon icon = new ImageIcon(src/carre.jpg);