Hi,
I want the user to input their name etc into a Jtextfield and it will return their details, but I keep getting an error saying cannot find symbol getText()
Here is my code
public void deliveryWindow(){ JFrame newFrame = new JFrame("Delivery Details"); Container pane = getContentPane(); newFrame.setLayout(new FlowLayout()); newFrame.setSize(new Dimension(250, 250)); //newFrame.getContentPane().add(panel); newFrame.setLocation(300,300); newFrame.setSize(250,250); newFrame.setVisible(true); JButton submitButton = new JButton("submit"); newFrame.add(submitButton); ButtonEventHandler handler = new ButtonEventHandler(); submitButton.addActionListener(handler); JPanel name = new JPanel(); JLabel nameLabel = new JLabel(); nameLabel.setText("Name :"); JTextField nameField = new JTextField(15); String deliveryName = nameField.getText(); name.add(nameLabel); newFrame.add(nameLabel); newFrame.add(nameField); JPanel address1 = new JPanel(); JLabel addressLabel = new JLabel(); addressLabel.setText("House :"); JTextField address1Field = new JTextField(15); String deliveryAddress1 = address1Field.getText(); address1.add(addressLabel); address1.add(address1Field); newFrame.add(addressLabel); newFrame.add(address1Field); JPanel street = new JPanel(); JLabel streetLabel = new JLabel(); streetLabel.setText("Street :"); JTextField streetField = new JTextField(15); String deliveryAddress2 = streetField.getText(); street.add(streetLabel); street.add(streetField); newFrame.add(streetLabel); newFrame.add(streetField); JPanel phone = new JPanel(); JLabel phoneLabel = new JLabel(); phoneLabel.setText("Phone :"); JTextField phoneField = new JTextField(15); String phoneNumber = streetField.getText(); phone.add(phoneLabel); phone.add(phoneField); newFrame.add(phoneLabel); newFrame.add(phoneField); } private class ButtonEventHandler implements ActionListener { String nameField; public void actionPerformed(ActionEvent e) { String name1; name1 = nameField.getText(); if (e.getActionCommand().equals("submit")) { JOptionPane.showMessageDialog(null,"Your name is" + name1,"Message",JOptionPane.INFORMATION_MESSAGE); } else JOptionPane.showMessageDialog(null,"Nothing"); }}