Imagen de fondo de JButton
Hola, estoy tratando de implementar Action Listener para JButton y el código tiene el siguiente aspecto:
ImageIcon imageForOne = new ImageIcon(getClass().getResource("resources//one.png"));
one = new JButton("",imageForOne);
one.setPreferredSize( new Dimension(78, 76));
one.addActionListener(myButtonHandler);
Usando el JButton anterior se ve bien
Cuando agrego un valor específico al botón para, por ejemplo,
ImageIcon imageForOne = new ImageIcon(getClass().getResource("resources//one.png"));
//Check this
one = new JButton("one",imageForOne);
one.setPreferredSize( new Dimension(78, 76));
one.addActionListener(myButtonHandler);
Se parece a la siguiente imagen.
¿Hay alguna forma en que pueda evitar esto y establecer el valor también.
Gracias por su ayuda por adelantado.