Java Swing mousePressed and getSource() not showing drawed shapes on JPanel
问题 I am currently trying to develop a puzzle. All I got is my application with my playing-field and gaming-pieces. Next step is to click on one of my gaming-piece to select it and be able to move it with the arrow-keys (furthermore I want to them only to move, if the next step - which will be 100 pixels - does not contain any other gaming-piece). The problem I'm currently running into: Using addMouseListener() on my main JPanel and then using getSource() only returns my playing-field (called