1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | public ULocale setLocale(ActionEvent ev) { int type = lcList.getSelectedIndex(); ULocale lc = null; if (type == 0) { lc = new ULocale("ja_JP@calendar=japanese"); } else if (type == 1) { lc = new ULocale("th_TH@calendar=buddhist"); } else if (type == 2) { lc = new ULocale("ar_SA@calendar=islamic"); } else if (type == 3) { lc = new ULocale("he_IL@calendar=hebrew"); } else if (type == 4) { lc = new ULocale("hi_IN@calendar=indian"); } else if (type == 5) { lc = new ULocale("zh_TW@calendar=roc"); } else { lc = new ULocale("en_US@calendar=coptic"); } return lc; } private Calendar setCalendar(ULocale lc, Date date) { int type = lcList.getSelectedIndex(); Calendar ngCalendar; if (type == 0) { ngCalendar = JapaneseCalendar.getInstance(lc); } else if (type == 1) { ngCalendar = BuddhistCalendar.getInstance(lc); } else if (type == 2) { ngCalendar = IslamicCalendar.getInstance(lc); } else if (type == 3) { ngCalendar = HebrewCalendar.getInstance(lc); } else if (type == 4) { ngCalendar = IndianCalendar.getInstance(lc); } else if (type == 5) { ngCalendar = TaiwanCalendar.getInstance(lc); } else if (type == 6) { ngCalendar = CopticCalendar.getInstance(lc); } else { ngCalendar = GregorianCalendar.getInstance(lc); } ngCalendar.setTime(date); return ngCalendar; } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |