我想爲圖像實現DragAndDrop,但似乎無法使Swing重繪功能在特定圖像上工作。Java Swing重繪圖像
代碼:
public class playerFrame extends JFrame{
...
private void destroyerImageMouseDragged(java.awt.event.MouseEvent evt)
}
repaintCurrentPosition(evt);
}
public void repaintCurrentPosition(MouseEvent e){
this.setLocation(e.getX(), e.getY());
this.repaint();
}
this.repaint < - 此功能重新繪製整個幀,而不僅僅是圖片,我想它重新繪製,這是50×50左右大小。 如何在不創建新類的情況下重新繪製特定的JPEG圖像?
謝謝。