JTextField yourInpuFieldt = new JTextField(16); yourInputField.setText("put your text here"); String x = yourInputField.getText();