title: Can't get MouseListener to work on Hexagon (a generated polygon)
body: <p>I'm generating a hexagon grid and am able to do so but when I add a MouseListener to the individual hexagons (when they're created) it's almost as if they're behind something because hovering/clicking on a hexagon will not register or do anything for that matter. I want to be able to eventually interact with the hexagons but can't do that if I can't get this to work.</p>
  
  <p>My main GUI elements:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class Game2
  {
      public Game2(int radius,int num_hexes)
      {
      if(num_hexes%2==0) throw new AssertionError("Can't generate map with 
      an even number of hexagons.");
  
      JFrame frame=new JFrame();
      JPanel panel=new JPanel();
  
      panel.setBorder(BorderFactory.createLineBorder(Color.RED));
      panel.setLayout(new BoxLayout(panel,1));
  
      frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
      frame.setTitle("HexGame");
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.setLayout(new BorderLayout());
  
      Rectangle r=frame.getBounds();
      int screen_height=r.height;
      int screen_width=r.width;
  
      Hexes2 hexes2=new Hexes2(num_hexes,radius,screen_width,screen_height);
  
      panel.add(hexes2);
      JScrollPane scroll_pane=new JScrollPane(panel);
      frame.getContentPane().add(scroll_pane);
      panel.setOpaque(false);
      frame.pack();
      frame.setVisible(true);
  }
  
  public static void main(String[] args)
  {
      Runnable r=new Runnable()
      {
          @Override
          public void run()
          {
              new Game2(100,11);
          }
      };
      SwingUtilities.invokeLater(r);
  }
  }
  </code></pre>
  
  <p>My multiple hexagons:</p>
  
  <pre><code>import java.awt.*;
  import java.util.LinkedList;
  import java.util.List;
  import javax.swing.JPanel;
  
  public class Hexes2 extends JPanel
  {
  private static final long serialVersionUID=1L;
  private static List&lt;Polygon&gt; hexagons;
  private static int[] rows;
  private int radius;
  
  public Hexes2(int num_columns,int radius,int screen_width,int screen_height)
  {
      super();
  
      this.radius=radius;
      hexagons=new LinkedList&lt;Polygon&gt;();
      rows=Functions.columns(num_columns);
  
      int x=screen_width/6;
      int y=screen_height/2;
  
      double height=radius*Math.sqrt(3);
      double range=num_columns-rows[0];
  
      //build by columns, first
      for(int j=0;j&lt;num_columns;j++)
      {
          x+=((3/2)*radius)*1.5015;
  
          if(j&lt;=Math.floor(num_columns/2)) y=(int) (100-(j*(height/2)));
          else y=(int) ((100-(height*(range/2))+(num_columns-rows[j])*(height/2)));
  
          for(int i=0;i&lt;rows[j];i++)
          {
              y+=height;
              Hex2 hex=new Hex2(i,radius,x,y);
              hexagons.add(hex.getHex());
          }
      }
  }
  
  protected void paintComponent(Graphics g)
  {
      super.paintComponent(g);
      Graphics2D g2=(Graphics2D) g;
      setOpaque(false);
  
      for(int i=0;i&lt;hexagons.size();i++)
      {
          Stroke stroke=new BasicStroke(radius/20, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
          g2.setStroke(stroke);
  
          g2.setColor(Color.BLACK);
          g2.drawPolygon(hexagons.get(i));
      }
  }
  };
  </code></pre>
  
  <p>My singular hexagon class:</p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.MouseEvent;
  import java.awt.event.MouseListener;
  import javax.swing.JLabel;
  
  public class Hex2 extends JLabel implements MouseListener
  {
  private static final long serialVersionUID = 1L;
  private int ID;
  private Polygon hexagon;
  
  public Hex2(int ID,int r,int x,int y)
  {
      super();
      this.ID=ID;
  
      hexagon=generateHex(r,x,y);
  
      addMouseListener(this);
  }
  
  public Polygon generateHex(int r, int x, int y)
  {
      Polygon hexagon=new Polygon();
  
      for(int i=0;i&lt;6;i++)
      {
  
         /*int _x=(int) (x + r*Math.cos(Math.PI / 3.0 * i));
         int _y=(int) (y + r*Math.sin(Math.PI / 3.0 * i));*/
  
          int _x=(int) (x + r*Math.cos(i*2*Math.PI/6));
          int _y=(int) (y + r*Math.sin(i*2*Math.PI/6));
  
         hexagon.addPoint(_x,_y);
      }
  
      return hexagon;
  }
  
  public int getID()
  {
      return ID;
  }
  
  public Polygon getHex()
  {
      return hexagon;
  }
  
  @Override
  public void mouseClicked(MouseEvent arg0) {
      System.out.println("Clicked on hexagon "+ID);
  
  }
  
  @Override
  public void mouseEntered(MouseEvent arg0) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void mouseExited(MouseEvent arg0) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void mousePressed(MouseEvent arg0) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void mouseReleased(MouseEvent arg0) {
      // TODO Auto-generated method stub
  
  }
  };
  </code></pre>
  
  <p>Functions:</p>
  
  <pre><code>import java.awt.Dimension;
  
  public class Functions
  {
  //takes in the max width, n (# hexagons), of the largest row (in the middle)
  public static int[] columns(int n)
  {
      int[] columns=new int[n];
      int deviation=(int) java.lang.Math.floor(n/2);
  
      for(int i=0;i&lt;n;i++)
      {
          columns[i]=n-(java.lang.Math.abs(i-deviation));
      }
  
      return columns;
  }
  
  public static Dimension getScreenSize()
  {
      return java.awt.Toolkit.getDefaultToolkit().getScreenSize();
  }
  }
  </code></pre>
  
  <p>I apologize for the long code, just wanted to be thorough. Any help greatly appreciated, thanks in advance.</p>