1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| public class ApplicationButton extends JButton
{
/**
*
*/
private static final long serialVersionUID = 1L;
private JButton button;
public ApplicationButton(String imagePath, String name)
{
this.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints(0, 0,
1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0);
this.button = new JButton(new ImageIcon(imagePath));
this.button.setPreferredSize(new Dimension(90, 90));
this.add(this.button, constraints);
}
} |
Partager