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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup window questino

Status
Not open for further replies.

jeremytaffy

Technical User
Sep 6, 2001
75
US
I am trying to get an actionlistener to open up a new window to display a JTextField.
the code is as follows:

delete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
super("framename");
setSize(200, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
popup frame = new popup();
frame.add(JTextfield);
}
});

when compiling, this gives me an "illegal start of expression" and points to the public parrt of public popup()

WHY????

thanx in advance

j

 
I don't see the code for your class popup.

You might want to avoid reinventing the wheel and just use the JOptionPane.

String input = JOptionPane.showInputDialog("Give me input");
...
 
Use the overloaded CTOR:

JTextField field = new JTextField();
Object [] messages =
{
"Enter the data dummy:",
field,
};

int option = JOptionPane.showConfirmDialog(null, messages, "Enter some input", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);

if (option == JOptionPane.OK_OPTION)
{
String input = field.getText();
// do something with it
}
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top