0

I am making project with GUI. The thing is, that I have a button and what I need to do is that after clicking this button I need to change Frame layout. For example, like when you are installing some program and you click "next" button, the Frame layout changes and you can see some different content. Basicly, dynamic wizard. I have tried use another Frame, but it opens in another window and that is not what I want. I want to open it in the same window. Another thing I have tried is set visibility of these components I don't want to be displayed to false, but I find it unprofessional and it is overlook in making a desing, when I have components over themselfs.

So do you guys have any idea? Thank you.

John Greg
  • 152
  • 1
  • 2
  • 12
  • See if this will help you: http://stackoverflow.com/questions/2340566/creating-wizards-for-windows-forms-in-c-sharp – Eugene S. Jan 27 '16 at 19:40

1 Answers1

0

Most of the times for a wizard like GUI, you should have JFrame and a set of JPanels. In each step you can pass the shared data as constructor arguments to each panel, and when you are making one of them invisible and make another one visible, you can get some date from the previous step panel and pass it to the next step panel(if needed).

It is very common that your panels extend the JPanel and have some argument in their constructor(s). You use these data for initializing your panel and managing the state of the overall progress.

There is no a total plan for all situations. So you should decide what to do which is best fit for your case.

Try not to have multiple JFrames.

Hope this would be helpful.

STaefi
  • 4,297
  • 1
  • 25
  • 43
  • I have tried this, but I can't put panels over other components – John Greg Jan 27 '16 at 21:01
  • Ok, I cant find out what you mean by put panels over other components. Normally you may have some panels with some components on every panel. And you should make each panel visible/invisible due to which step your wizard in. You can not put panels(containers) on the components like JButtons, JTextFields. Panels can be put on other panels or other containers like JFrames or JDialog, JSplitpane, etc. – STaefi Jan 28 '16 at 05:18
  • In this stage you should try some codes. If you had problems, you can post your code here. Then we can find out whats the matter with your code which is not doing what you want. At this moment we cannot find out whats the matter on the fly. – STaefi Jan 28 '16 at 07:20