public void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); if (x >= posX && x < posX + Constant.BATTLEFIELD_WIDTH) { if (y >= posY) { if (y < posY + Constant.BATTLEFIELD_HEIGHT) { return; } else if (y < posY + Constant.BATTLEFIELD_HEIGHT + Constant.CARDPANEL_HEIGHT) { card_panel.dragging(x - posX, y - (posY + Constant.BATTLEFIELD_HEIGHT)); return; } } } }