javax.swing.JTextField has two uses.
If you need a component that displays or allows entry of more than one line, use
a JTextArea.
| JTextField | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
JTextField yourInpuFieldt = new JTextField(16);
content.add(yourInputField);or to add it to a
JPanel p
p.add(yourInputField);
getText().
yourTextField.getText() method
whenever you need it. This is probably the most common way.
String x = yourInputField.getText();