• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple forms inside jpanels

 
Nicholas Bogart
Greenhorn
Posts: 2
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been creating new windows and using dispose for a personal project I am working on. It is a bill management program and when you enter a new bill it has been through a form in another window. I was looking at putting these forms inside jpanels instead.

I would like to be able to push the button for a new bill/credit card/etc and have it blank or certain default settings. So I figure I won't be able to just hide and unhide the form unless I manually delete/reset the fields. So what I am looking for is creating the layout for the jpanel and creating it when I want it and disposing of it when I don't need it.

I figure I am over complicating something in my head. Relatively new to Java and more importantly to GUI development. I tend to be more of a command line application / scripter and sometimes a web developer. So I am open to some suggestions.



NickyB
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Multiple frames for one application is bad usability. Use a dialog instead.
Check out JOptionPane which provides many convenient showXXXDialog methods. These methods accept an Object message so you can safely pass your input JPanel instance as a message
Recommended reading : http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
 
Nicholas Bogart
Greenhorn
Posts: 2
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The window opening is a dialog. I think I understand what you mean with the rest of it. I appreciate the information and will read through the link.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!