JFrames Java Cascading

I have a class that extends javax.swing.JFrame created using the NetBeans GUI editor. Is there a way to make this JFrame cascade when multiple of it opens?

+4
source share
3 answers

Just save the variable with the previous JFrame location so open, and for the following:

 newFrame.setLocation(previousLocation.x + constant, previoudLocation.y + constant); 

getLocation() will return you the location on the screen of an existing JFrame .

+2
source

JFrame are top-level components; they are not nested.

If you need nested frames (i.e. frames that can be children of another frame), use a JInternalFrame instead.

If you need to create new frames in an existing application when you call it again, use Socket to send arguments for the new frame from the new application to the existing one, and then exit the new application.

+2
source

All Articles