// 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);
};