Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Dialog or Form

Status
Not open for further replies.

bradcom

ISP
Aug 12, 2003
17
CA
I'm having a problem attempting to create a basic form/dialog. I've read about the built-in dialogs, however I would like a dialog that allows a person to input a bunch of information (username, password, port number, etc). To do this I assume you have to use a JDialog, however I'm having problems finding examples of passing the information back.
I've created a modal JDialog that uses a separate class as the Content Pane (text fields and ok button), but how do I get the data back to the original class/frame that calls the JDialog. This may be easy, but I'm pretty new to Java and can't find documentation/examples of this. Maybe I'm doing it completely wrong. Below is the function I created, which may help. I want the JLabel's in my LoginPanel class passed back to this function, then returned by the function:

private void Login(){
logginDialog = new JDialog(this, true);
logginDialog.setResizable(false);
logginDialog.setSize(450,250);
logginDialog.getContentPane().add(new LoginPanel());

logginDialog.show();
}

Any help would be appreciated.
 
Why not use a bunch of JTextFields [in JPanels] in a JFrame ?

--------------------------------------------------
Free Database Connection Pooling Software
 
How would I do that? My first class file extends a JFrame, therefore would I setVisible=false, then call a new class which shows a new JFrame (containing the JPanel and JLabels)? I assume I would have to stop execution of the parent class, then pass the information from the child class back to the parent class once the user has clicked the okay button on the login JPanel.

If that's correct please let me know.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top