public void mousePressed(java.awt.event.MouseEvent e) {
      isClick = true;
      JButton b = (JButton) e.getSource();
      // check to see if the target button can be moved
      if (!solved && check(buttons.indexOf(b))) {
        // hide the target button
        b.setVisible(false);

        // Figure out the bounds of the areas where source
        // and target buttons are located
        int menuOffset = getJMenuBar().getHeight();
        dragSourceArea = b.getBounds();
        dragTargetArea = ((JButton) buttons.get(hiddenIndex)).getBounds();
        dragSourceArea.translate(0, menuOffset);
        dragTargetArea.translate(0, menuOffset);

        // setup the bounds of the panel to limit the locations on the drag
        // layer
        panelArea = new Rectangle(0, menuOffset, getJPanel().getWidth(), getJPanel().getHeight());

        // Setup and show the drag button on the upper layer
        getDragButton().setText(b.getText());
        getDragButton().setBounds(dragSourceArea);
        getDragButton().setVisible(true);

        // Offset when repositioning the drag button later
        cursorOffset = new Point(e.getX(), e.getY());
      }
    }