0
votes

I am making an java swing GUI based application, while running this i want to show a Jframe Containing two buttons as shown below :-

Main Home Jframe containing two Buttons

when clicking on first button that is Name FOrm , it must show a panel containing child components like jlabels etc as shown below :-

Name Form Panel

Along with a button for going back to the main interface that is Home Frame containing two buttons .

Now after clicking back when we click on Second button thats College Form it must show another Jpanel containing College Info as shown below :-

College panel containing college info

So here I have explained what i am trying to implement , one single Frame with button for opening respective panels and hiding previous buttons , and then a Button to go back to the Home Jframe.

Need example based on codes. any help would be appreciated. Thanks

1

1 Answers

2
votes

You can either simply call setVisible() on your various JPanels, or you can look into CardLayout.

How to Use CardLayout

If you're confused about how to take an action when the user clicks a button, you need to look into ActionListeners.

How to Write an Action Listener