如何从JSpinner解析为String?

时间:2016-11-16 21:24:30

标签: string jspinner

我试图从JSpinner的输入中获取一个String。

我如何解析String的输入?

我试过了:

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

1 个答案:

答案 0 :(得分:0)

现在有点简单了。

我补充说:

' Debug issue #3
If Target.Value = "" Then
' do nothing
Else
    LastRow = Worksheets(Target.Value).Cells(Worksheets(Target.Value).Rows.Count, "A").End(xlUp).Row
    Debug.Print Target.Row
    Debug.Print LastRow

    If Sheets("Master").Cells(Target.Row, 3) = Sheets(Target.Value).Cells(LastRow, 2) Then
        MsgBox "Error #3"
    End If
End If