0
我试图从JSpinner的输入中获取一个字符串。如何从JSpinner解析为字符串?
我怎样才能解析输入到字符串?
我想:
JSpinner jSpinner = (JSpinner) e.getSource();
dates = (Date) jSpinner.getValue();
DateFormat df = new SimpleDateFormat("HH:mm dd-MM-yyyy");
ta2.setText(df.parse((String)jSpinner.getValue()));
// or this, which works but it throws an exception because of date.
ta2.setText((String)jSpinner.getValue());