length得出字串长度无法正常显示?
public void getTime(){
Calendar cal = new GregorianCalendar();
int year=cal.get(Calendar.YEAR);
int month=cal.get(Calendar.MONTH);
int day=cal.get(Calendar.DATE);
int hour=cal.get(Calendar.HOUR_OF_DAY);
int minute=cal.get(Calendar.MINUTE);
int second=cal.get(Calendar.SECOND);
String s = "当前时间: "+String.valueOf(year)+"年"+
String.valueOf(month)+"月"+String.valueOf(day)+"日"+
String.valueOf(hour)+"时"+String.valueOf(minute)+"分"+
String.valueOf(second)+"秒";
showtime.setText(s);
showtime.setColumns(s.length());
大家运行它时会发现showtime这个JTextField显示的长度要比那些字符长度长