I have a class that extends javax.swing.JFrame built with NetBeans GUI editor. Is there a way to make this JFrame cascade when several of it being opened ?
Use setLocationByPlatform(true)
.
Just keep a variable with the previous such opened JFrame
location and for the next one do:
newFrame.setLocation(previousLocation.x + constant, previoudLocation.y + constant);
The getLocation()
will return you the location on screen of an existing JFrame
.
JFrame
s are top-level components, they don't nest.
If you need nested frames (i.e. frames that can be a child of another frame), use JInternalFrame instead.
If you need to create new frames in the existing application when it is invoked again, use a Socket to send the arguments for the new frame from the new application to the existing one and then exit the new application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With