• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pressing a button to open a new window

 
Ilh Oleo
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i�m developing an application about a repair shop for automotive vehicles with a connection to a DB.
Waht i want to do is this :i have my button "New Client" and i�m trying to do that when i press the button , it opens a new window (i think it would be a new JFrame) where it will be the application form to fill it with the name,last name, address, telephone and so on but i don�t know what component i have to use.
 
matt eggbeers
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use either a JFrame or a JInternalFrame.
 
Ilh Oleo
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but how can i implement it??
what kind of method can i sue to open a window when i do click with the mouse over the button?? that is what i want to know
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
usually a JDialog is used, similar to a JFrame, but used modally,
meaning execution of the calling method is paused until the dialog closes,
and, if it's the way you want to do it, return the input data.
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you...

1) ...created and added a listener for your button?
2) ...created your new client window by using the new operator?
3) ...set your layout manager for your client window?
4) ...added the components to your new client window?
5) ...called setVisible(true) for your new client window? Do this last of all.
6) ...are you using more than a single thread? this requires extra care.

Kaydell
 
Ilh Oleo
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this

........more code above....



And this is what it should appear at clicking the button



But nothing appears, by the way it�s OK to post all that rude code? (i mean the part of the init components)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic