Jump to content

How to close a jframe using a class?

i have a jframe and a class.the class has some equations.i have called the class by creating a object in the jframe.in the class i have to to write a code to close the jframe and go to a another jframe.How can i do this?

Link to comment
Share on other sites

Link to post
Share on other sites

// Hide current window
this.setVisible(false)
// Show other window
new otherFrame.setVisible(true);

Of course, rename "otherFrame" to the name of the other class file you want to open to.

Blue Jay

CPU: Intel Core i7 6700k (OC'd 4.4GHz) Cooler: CM Hyper 212 Evo Mobo: MSI Z170A Gaming Pro Carbon GPU: EVGA GTX 950 SSC RAM: Crucial Ballistix Sport 8GB (1x8GB) SSD: Samsung 850 EVO 250 GB HDD: Seagate Barracuda 1TB Case: NZXT S340 Black/Blue PSU: Corsair CX430M

 

Other Stuff

Monitor: Acer H236HL BID Mouse: Logitech G502 Proteus Spectrum Keyboard: I don't even know Mouse Pad: SteelSeries QcK Headset: Turtle Beach X12

 

GitHub

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, evilarceus said:

// Hide current window
this.setVisible(false);

 

this code gives me a error.it asks me to create a method called this.setVisible in my class

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×