So, I created two forms: Input and Output. In the Input form, the user inputs the required information such as name and schedule. Then when the user is finished, he/she will click the "finished" button which brings up the Output form which has all the inputted info from the Input form. Now, I've coded this but, my problem is that when I click the "finished" button on the Input form, the Output form appears but under the Input form. And, I can't click on the Output form. What seems to be the problem?
Here's my "finished" button found on the Input form:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        Output page=new Output();
  	page.setVisible(true);
	
    }

Recommended Answers

All 6 Replies

Thanks a lot James! That really helped me :D

Now, I have another question(sorry if I'm asking too much questions, but I think I'm getting the hang of this). So I made the Output form pop-up in front of the Input form. Now, I've added two features to my Output form: one "edit schedule" button and one "reset" button. I'm currently working on the "reset" button. So, I've successfully coded the "reset" button so that it opens another Input form, but the original Input form window is still open. How do I code this so that the first Input and Output forms closes?

To "close" a window you have 2 main choices. One is to get rid of it completely by using its dispose() method, then create a new one from scratch next time. The other is simply to make it invisible (visibility false), then you can get it back by just setting its visibility back to true. Which you use depends mainly on whether you want to re-open it with its latest state intact or re-open it in its initial state

2nd suggestion by @JamesCherrill is correct way re-open and re-use Container, there isn't, btw dispose() works only in Cartoons, only hide COntainer as setVisible(false); nothing else,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.