如何从JCalendar
(toedter.com/jcalendar/)获取JMonthChooser
字符串中的月份名称并将其转换为字符串“01”,“02”,“03”, ...,“12”就像使用SimpleDateFormat
一样简单。如何从JCalendar获取JMonthChooser上的字符串月份名称
我会尝试:
String mymonth;
SimpleDateFormat sdfm = new SimpleDateFormat("MM");
JComboBox combom = (JComboBox)jMonthChooser1.getSpinner();
mymonth = sdfm.format(((JTextField)combom.getEditor()).getText());
但没有成功
发生了什么事'JMonthChooser'? – trashgod
我的主要目标是从JCalendar中找到月份的名称和格式字符串“01”,“02”,...,“12”中的索引。我很困惑,我想早些时候使用JMonthChooser。但是,然后我可以得到连续的月份和索引名称使用JCalendar。 我使用的月份的名称: String mymonth; SimpleDateFormat sdf1 = new SimpleDateFormat(“MMMM”); 日期date1 = jCalendar1.getDate(); mymonth = sdf1.format(date1); Bantuan Anda sangat saya apresiasi。 Terima kasih。 – repot
你想要的Locale不支持? – trashgod