title: How to set a button background to transparent?
body: <p>I have a list of buttons inside a JLabel. The buttons are images and the background of that image is transparent, however the button iself is bigger than the image and it covers the background image, here's what I mean:</p>
  
  <p><img src="https://i.stack.imgur.com/Zrznz.png" alt="http://i.imgur.com/uSBouqO.png"></p>
  
  <p>This is the code I have:</p>
  
  <pre><code>JPanel buttons = new JPanel(new GridLayout(0, 1));
          JButton butoMapa = null;
          try {
              butoMapa = new JButton(new ImageIcon(ImageIO.read(new File("imatges/Mapa.png"))));
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          butoMapa.setOpaque(false);
          butoMapa.setContentAreaFilled(false);
          butoMapa.setBorderPainted(false);
          butoMapa.addActionListener(this);
  
          JButton butoEtnies = null;
          try {
              butoEtnies = new JButton(new ImageIcon(ImageIO.read(new File("imatges/Etnies.png"))));
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          butoEtnies.addActionListener(this);
  
          JButton butoComandes = null;
          try {
              butoComandes = new JButton(new ImageIcon(ImageIO.read(new File("imatges/Comandes.png"))));
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          butoComandes.addActionListener(this);
  
          JButton butoSurtir = null;
          try {
              butoSurtir = new JButton(new ImageIcon(ImageIO.read(new File("imatges/Surtir.png"))));
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          butoSurtir.addActionListener(this);
  
          SomePanel label2 = new SomePanel();
          label2.add(buttons);
  
          frame.add(label2, BorderLayout.EAST);
          buttons.add(butoMapa);
          buttons.add(butoEtnies);
          buttons.add(butoComandes);
          buttons.add(butoSurtir);
  
          //JPanel right = new JPanel(new BorderLayout());
         // right
          //right.add(buttons, BorderLayout.NORTH);
  
  
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
  </code></pre>
  
  <p>SomePanel code:</p>
  
  <pre><code>class SomePanel extends JPanel {
      private BufferedImage image;
  
      public SomePanel() {
          try {
              image = ImageIO.read(getClass().getResource("imatges/costat.png"));
          } catch (IOException ex) {}
          //add(new JButton("Hello"));
      }
      @Override
      protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
      }
  }
  </code></pre>
  
  <p>Note that I tested those commands with the first map but it still doesn't show the background of the label on the right. What am I missing?</p>