Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在JCalendar的JMonthChooser上以字符串形式获取月份名称_Java_Swing_Date_Jcalendar - Fatal编程技术网

Java 如何在JCalendar的JMonthChooser上以字符串形式获取月份名称

Java 如何在JCalendar的JMonthChooser上以字符串形式获取月份名称,java,swing,date,jcalendar,Java,Swing,Date,Jcalendar,如何在JCalendar toedter.com/JCalendar/的JMonthChooser上以字符串形式获取月份名称,并将其转换为字符串01、02、03、…、12,就像使用SimpleDataFormat一样简单 我会尝试: String mymonth; SimpleDateFormat sdfm = new SimpleDateFormat("MM"); JComboBox combom = (JComboBox)jMonthChooser1.getSpinner(); mymont

如何在JCalendar toedter.com/JCalendar/的JMonthChooser上以字符串形式获取月份名称,并将其转换为字符串01、02、03、…、12,就像使用SimpleDataFormat一样简单

我会尝试:

String mymonth;
SimpleDateFormat sdfm = new SimpleDateFormat("MM");
JComboBox combom = (JComboBox)jMonthChooser1.getSpinner();
mymonth = sdfm.format(((JTextField)combom.getEditor()).getText());
但是没有成功

给定JMonthChooser实例,PropertyChangeListener将看到范围为0的Integer类型的新值。。11与其试图强迫这个日期适合SimpleDateFormat,不如考虑使用合适的

给定JMonthChooser的实例,PropertyChangeListener将看到范围为0.的Integer类型的新值。。11与其试图强迫这个日期适合SimpleDateFormat,不如考虑使用合适的


我得到了我需要的另一种方式: 代码如下:

JCalendar jCalendar1 = new JCalendar();
String mymonth;
SimpleDateFormat sdf1 = new SimpleDateFormat("MM");
Date date1 = jCalendar1.getDate();
mymonth = sdf1.format(date1);

我得到了我需要的另一种方式: 代码如下:

JCalendar jCalendar1 = new JCalendar();
String mymonth;
SimpleDateFormat sdf1 = new SimpleDateFormat("MM");
Date date1 = jCalendar1.getDate();
mymonth = sdf1.format(date1);

JMonthChooser怎么了?我的主要目标是从JCalendar和索引中找到月份名称,格式为字符串01、02、…、12。我很困惑,我猜之前使用JMonthChooser。但这样我就可以得到直接的月份,索引名使用JCalendar。我使用的月份名称:String mymonth;SimpleDataFormat sdf1=新SimpleDataFormatMMM;Date date1=jCalendar1.getDate;mymonth=sdf1.formatdate1;班图和桑加萨是一个很好的例子。泰里玛·卡西。班图和萨亚·阿普雷西斯。泰里玛·卡西。我真的很感激你的帮助。谢谢。它似乎受到支持。请尝试使用新的SimpleDataFormatMMM、新的Localein、ID。JMonthChooser发生了什么事?我的主要目标是从JCalendar和索引中找到月份名称,格式为字符串01、02、…、12。我很困惑,我猜之前使用JMonthChooser。但这样我就可以得到直接的月份,索引名使用JCalendar。我使用的月份名称:String mymonth;SimpleDataFormat sdf1=新SimpleDataFormatMMM;Date date1=jCalendar1.getDate;mymonth=sdf1.formatdate1;班图和桑加萨是一个很好的例子。泰里玛·卡西。班图和萨亚·阿普雷西斯。泰里玛·卡西。我真的很感激你的帮助。谢谢。它似乎受支持。请尝试使用新的SimpleDataFormatMMM、新的Localein、ID。