简体   繁体   中英

How To Make a JPanel visible after clicking a JButton on a JFrame

Here we go...My java application's login form has a option called forgot password..when I click that a panel should appear same time login JFrame goes back and keep as a shade window.that new panel come forward.

this.dispose();

this will close the default window is there any method to do that..keep default window open and goes back like a shade, a panel come forword

Dont use .dispose() you only need to hide it.Use

.setVisible(false);

If you want to make it faded out you have to animate it.Use jDialog instead.And play a bit with opacity.Bud in that case dont put set visible to False.Or you wont see it at all.

On new component which you want to have over it

.setAlwaysOnTop(true); // this makes sure that you will see it on top of your main window

after you are done put it away with dispose if you dont need it afterwards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM