Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/05/2013, 11:11
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
Puntos: 1360
Respuesta: Cómo ocultar un JButton pero dejándolo activo

Hubieras puesto algo al menos que se pudiera ejecutar.

Espero que este ejemplo te pueda ayudar.
Código Java:
Ver original
  1. import javax.swing.JFrame;
  2. import javax.swing.JButton;
  3. import javax.swing.ImageIcon;
  4. import javax.swing.BorderFactory;
  5.  
  6. public class Main extends JFrame {
  7.  
  8.     public static void main(String args[]) {
  9.         new Main();
  10.     }
  11.    
  12.     Main() {
  13.         JButton imgBttn = new JButton();
  14.         imgBttn.setBorder(BorderFactory.createEmptyBorder());
  15.         ImageIcon img = new ImageIcon("/ruta/a/tu/imagen.png");
  16.         imgBttn.setIcon(img);
  17.         imgBttn.setContentAreaFilled(false);
  18.         imgBttn.setFocusPainted(false);
  19.        
  20.        
  21.         add(imgBttn);
  22.        
  23.         setSize(400, 400);
  24.         setVisible(true);
  25.     }
  26. }

Fuente: http://stackoverflow.com/questions/7...to-emptyborder