2016-11-16 2 views
0

JSpinner의 입력에서 String을 가져 오려고했습니다.JSpinner에서 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()); 

답변

0

이제 작동 어떻게 든 간단했다.

나는 추가 :

String nt = df.format(dates); 
관련 문제