Created
November 18, 2017 03:23
-
-
Save lanarods/a8789af8cfdfd8bd7422cc30f986f65c to your computer and use it in GitHub Desktop.
Java Swing Moving Undecorated jFrame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int xx=0; | |
int yy=0; | |
private void jPanel1MousePressed(java.awt.event.MouseEvent evt) { | |
xx=evt.getX(); | |
yy=evt.getY(); | |
} | |
private void jPanel1MouseDragged(java.awt.event.MouseEvent evt) { | |
int x=evt.getXOnScreen(); | |
int y=evt.getYOnScreen(); | |
this.setLocation(x-xx, y-yy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment