Как обработать код полученный с JTextField?
Проблема в том, что мне нужно обработать текст получаемый с окна ввода JTextField. Ошибка Incompatible types. Found: 'java.lang.String', required: 'javax.swing.JTextField'. На ввод подаются цифры от 0 до 9 и дальше я должен их закинуть в код. Думал обработать в Char, но не вышло.
Если строго указывать на ошибку то она здесь jta = reader.readLine();
class alkashSP extends JFrame {
JTextField jta = new JTextField(10);
Font fnt = new Font("Times new roman", Font.BOLD, 25);
alkashSP() {
super("Input your cards. Like 2 5 6...");
setLayout(new FlowLayout());
setSize(300, 125);
add(jta);
jta.setForeground(Color.BLACK);
jta.setFont(fnt);
JButton contButton = new JButton("Continue");
contButton.setBounds(10, 40, 0, 10);
add(contButton);
jta.getText();
contButton.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
var sp = new Stack<Integer>();
var reader = new BufferedReader(new InputStreamReader(System.in));
String input = null;
try {
jta = reader.readLine();
} catch (IOException ioException) {
ioException.printStackTrace();
}
var split = input.split(" ");
for (var t : split)
{
sp.push(Integer.parseInt(t));
}
}
@Override
public void mousePressed(MouseEvent e) { }
@Override
public void mouseReleased(MouseEvent e) { }
@Override
public void mouseEntered(MouseEvent e) { }
@Override
public void mouseExited(MouseEvent e) { }
});
}
}