Revision: 68327
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 2, 2015 04:10 by oakdragon
Initial Code
// relocate only works on defualt monitor public void relocate(JFrame f){ /*If this function is called, it will relocate the window to a new random position on the screen */ Random r = new Random(); // Find Screen size Toolkit tk = Toolkit.getDefaultToolkit(); Dimension d = tk.getScreenSize(); // 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); };
Initial URL
Initial Description
Initial Title
JFrame Relocate
Initial Tags
Initial Language
Java