Ayuda con el JButton
Modifique la clase JButton para cambiar su apariencia. El boton funciona como es de esperar, salvo por un detalle, no se le pueden asignar iconos, me gustaria saber si alguien sabe como solucionar esto. Creo que el problema viene por que modifique el metodo paintComponent() abajo les pongo un ejemplo:
public void paintComponent(Graphics g)
{
// Seteo las propiedades graficas
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(this.getBackground());
g2.fillRect(0,0,this.getWidth(),this.getHeight());
// Seteo un valor para calcular los gradientes
float scale = (50f/30f)* this.getFont().getSize2D();
// Llamo al metodo que dibuja el botón entero
dibujarBoton(this.getForeground(), this.getWidth(), this.getHeight(), getText(), scale, g2);
}
deberia agregar una linea con el metodo g2.drawimage() pero no se como hacerlo, probe y no funciona :(
public void paintComponent(Graphics g)
{
// Seteo las propiedades graficas
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(this.getBackground());
g2.fillRect(0,0,this.getWidth(),this.getHeight());
// Seteo un valor para calcular los gradientes
float scale = (50f/30f)* this.getFont().getSize2D();
// Llamo al metodo que dibuja el botón entero
dibujarBoton(this.getForeground(), this.getWidth(), this.getHeight(), getText(), scale, g2);
}
deberia agregar una linea con el metodo g2.drawimage() pero no se como hacerlo, probe y no funciona :(
