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());