panel.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
while(){
}
}
}
panel.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
while(){
}
}
}
judge that it should be OK to press and release the mouse