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

Answers


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.


Need Your Help

Emulating a Java Enum in C++

java c++ enums c++11 migration

I have been porting an application that I wrote some time ago from Java over to C++. One thing that I quickly realized was that Java's rich Enum's (which were introduced in Java 5) were far superio...