combine multiple windows to a single window

2019-09-02 17:04发布

问题:

I am developing an application which have the following windows

If the information entered in the windows are correct than only the user will be prompted with the windows in the above sequence. Now the customer has demanded me with this user interface.

Now I have to add all these windows in the last window format, with the specification's as the user will be allowed in the 2nd portion of the last image if the first information entered is correct.And the user when launches this app see the last image and can change the values as any time in the respective portions of the last window. I have coded it in Swing Java.I am new to Java. I am working in Netbeans 7.1.2 I have three files as 1)Login.java -containing my LoginDemo class which have main and form object of extended Jframe class -Login class extending J frame and implementing action listener(this class creates an J frame of next file Enter the information. 2)Algorithm.java creates new J frame object of next file if information is correct. 3)TravellingSalesmanProblem.java gives the output as shown in Optimal Travel Route window. I am accessing the information using REST call to a website. So can anyone help me in this?

回答1:

This will depend on how you structured you code. If you simply placed components directly onto the the windows/frames themselves, then you might be in for some work.

Alternatively, if you used panels, which you then placed onto windows, this might save you some time.

Anyway. Assuming you only have windows.

for each window do
    myLastWindow.add(window.getContentPane());

This is pretty simple, but you'll also need to know the layout you want. I'd suggest something like GridLayout or VerticalLayout from the SwingX project.