/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// relocate only works on defualt monitor /*If this function is called, it will relocate the window to a new random position on the screen */ // Find Screen size // use the Dimension find and reset width and height int x = r.nextInt(d.width - getWidth()); int y = r.nextInt(d.height - getHeight()); f.setLocation(x,y); };