List of usage examples for java.util Locale CHINA
Locale CHINA
To view the source code for java.util Locale CHINA.
Click Source Link
From source file:com.qawaa.gui.EventWebScanGUI.java
/** * ??/*from w ww . java 2s . co m*/ */ private static void setConsoleRight() { consoleRight = new JPopupMenu(); consoleRight.setBorderPainted(true); consoleRight.setPopupSize(new Dimension(105, 135)); JMenuItem clear = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.clear", null, Locale.CHINA), KeyEvent.VK_L); JMenuItem copy = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.copy", null, Locale.CHINA), KeyEvent.VK_C); JMenuItem cut = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.cut", null, Locale.CHINA), KeyEvent.VK_X); JMenuItem font = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.font", null, Locale.CHINA), KeyEvent.VK_F); JMenuItem choose = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.choose", null, Locale.CHINA), KeyEvent.VK_O); JMenuItem saveas = new JMenuItem(CONTEXT.getMessage("gobal.right.menu.saveas", null, Locale.CHINA), KeyEvent.VK_S); consoleRight.add(clear); consoleRight.add(copy); consoleRight.add(cut); consoleRight.add(font); consoleRight.add(choose); consoleRight.add(saveas); clear.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { consolePane.setText(""); jConsole.clear(); } }); copy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (consolePane.getText() != null && !consolePane.getText().trim().isEmpty()) { Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable tText = new StringSelection(consolePane.getText()); clip.setContents(tText, null); } } }); cut.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (consolePane.getText() != null && !consolePane.getText().trim().isEmpty()) { Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable tText = new StringSelection(consolePane.getText()); clip.setContents(tText, null); } consolePane.setText(""); jConsole.clear(); } }); saveas.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); int option = fileChooser.showSaveDialog(null); if (option == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { if (file.exists() == false) { file.createNewFile(); } FileWriter writer = new FileWriter(file); char[] arry = consolePane.getText().toCharArray(); writer.write(arry); writer.flush(); writer.close(); LOG.info(CONTEXT.getMessage("gobal.right.menu.saveas.success", null, Locale.CHINA)); } catch (IOException ioe) { } } } }); }
From source file:iqq.app.core.service.impl.SkinServiceImpl.java
@Override public void setDefaultFont(Font vFont) { UIManager.put("ToolTip.font", vFont); UIManager.put("Table.font", vFont); UIManager.put("TableHeader.font", vFont); UIManager.put("TextField.font", vFont); UIManager.put("ComboBox.font", vFont); UIManager.put("TextField.font", vFont); UIManager.put("PasswordField.font", vFont); UIManager.put("TextArea.font", vFont); UIManager.put("TextPane.font", vFont); UIManager.put("EditorPane.font", vFont); UIManager.put("FormattedTextField.font", vFont); UIManager.put("Button.font", vFont); UIManager.put("CheckBox.font", vFont); UIManager.put("RadioButton.font", vFont); UIManager.put("ToggleButton.font", vFont); UIManager.put("ProgressBar.font", vFont); UIManager.put("DesktopIcon.font", vFont); UIManager.put("TitledBorder.font", vFont); UIManager.put("Label.font", vFont); UIManager.put("List.font", vFont); UIManager.put("TabbedPane.font", vFont); UIManager.put("MenuBar.font", vFont); UIManager.put("Menu.font", vFont); UIManager.put("MenuItem.font", vFont); UIManager.put("PopupMenu.font", vFont); UIManager.put("CheckBoxMenuItem.font", vFont); UIManager.put("RadioButtonMenuItem.font", vFont); UIManager.put("Spinner.font", vFont); UIManager.put("Tree.font", vFont); UIManager.put("ToolBar.font", vFont); UIManager.put("OptionPane.messageFont", vFont); UIManager.put("OptionPane.buttonFont", vFont); UIManager.put("Tree.paintLines", false); // Tree UIManager.put("Tree.leftChildIndent", 0); // UIManager.put("Tree.arrowDown", getIconByKey("main/arrowDown")); // Tree UIManager.put("Tree.arrowLeft", getIconByKey("main/arrowLeft")); // WebLookAndFeel.globalControlFont = vFont; WebLookAndFeel.globalTextFont = vFont; WebLookAndFeel.globalTitleFont = vFont; WebLookAndFeel.globalTooltipFont = vFont; WebLookAndFeel.globalAcceleratorFont = vFont; WebLookAndFeel.menuItemAcceleratorFont = vFont; WebLookAndFeel.globalAlertFont = vFont; WebLookAndFeel.globalMenuFont = vFont; // ?weblaf/*from ww w . j a va 2 s .c o m*/ WebLookAndFeel.setDecorateAllWindows(false); WebLookAndFeel.install(); Locale.setDefault(Locale.CHINA); }
From source file:com.fengduo.bee.commons.util.DateViewTools.java
public static Date convertDate(String adateStrteStr, String format) { if (StringUtils.isBlank(adateStrteStr)) { return new Date(); }/*from ww w. j av a2s. co m*/ java.util.Date date = null; try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA); date = simpleDateFormat.parse(adateStrteStr); return date; } catch (Exception ex) { ex.printStackTrace(); } return new Date(); }
From source file:com.suning.mobile.ebuy.lottery.network.util.Caller.java
/** * //from ww w .ja va 2 s. c o m * @Description:SuBean * @Author 11076392 * @Date 2012-12-18 */ private NetworkBean parseStringToSuBean(NetworkBean subean, String result) { try { if (TextUtils.isEmpty(result)) { return subean; } JSONObject json = new JSONObject(result); if (json.has("xml")) { JSONObject jsonXml = json.getJSONObject("xml"); if (null != jsonXml && jsonXml.has("@errorCode")) { subean.setErrorCode(jsonXml.getString("@errorCode")); } } if (json.has("@desc")) { subean.setMessage(json.getString("@desc")); } if (json.has("@code")) { subean.setResult(json.getInt("@code")); } if (json.has("@date")) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); try { subean.setDate(dateFormat.parse(json.getString("@date"))); mApplication.setDate(dateFormat.parse(json.getString("@date"))); synchronized (this) { mBase = mApplication.getDate().getTime(); } if (isFirst) { updateRunning(); } } catch (ParseException e) { LogUtil.logException(e); } } // if ("common.2.userNotLoggedIn".equals(subean.getErrorCode()) || "common.2.userMultiLoggedIn".equals(subean.getErrorCode())) { mApplication.resetUserBean(); subean.setResult(NetworkBean.RESULT_CODE); } subean.setJson(json); } catch (JSONException e) { LogUtil.logException(e); subean.setResult(2); subean.setMessage(""); } return subean; }
From source file:com.pizidea.imagepicker.AndroidImagePicker.java
/** * create a file to save photo/*ww w .ja v a 2 s. c o m*/ * * @param ctx * @return */ private File createImageSaveFile(Context ctx) { if (Util.isStorageEnable()) { // File pic = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); if (!pic.exists()) { pic.mkdirs(); } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA).format(new Date()); String fileName = "IMG_" + timeStamp; File tmpFile = new File(pic, fileName + ".jpg"); mCurrentPhotoPath = tmpFile.getAbsolutePath(); Log.i(TAG, "=====camera path:" + mCurrentPhotoPath); return tmpFile; } else { //File cacheDir = ctx.getCacheDir(); File cacheDir = Environment.getDataDirectory(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA).format(new Date()); String fileName = "IMG_" + timeStamp; File tmpFile = new File(cacheDir, fileName + ".jpg"); mCurrentPhotoPath = tmpFile.getAbsolutePath(); Log.i(TAG, "=====camera path:" + mCurrentPhotoPath); return tmpFile; } }
From source file:com.hihframework.core.utils.DateUtils.java
public static Date DateFormat(String format, String datetime) { SimpleDateFormat sdf = null;//www. ja v a 2 s . co m Date d = null; try { sdf = new SimpleDateFormat(format, Locale.CHINA); d = (java.sql.Date) sdf.parse(datetime); } catch (Exception e) { log.info(e); } return d; }
From source file:com.alibaba.citrus.service.requestcontext.parser.ParserRequestContextTests.java
private void initMockRequest(String method, String queryString, String charset, Map<String, String[]> engineDecodedParams) { request = createMock(HttpServletRequest.class); response = createMock(HttpServletResponse.class); request.setAttribute(org.easymock.EasyMock.<String>anyObject(), anyObject()); expectLastCall().anyTimes();//from w w w . j av a 2s . c o m expect(request.getLocale()).andReturn(Locale.CHINA).anyTimes(); expect(request.getContentType()).andReturn(null).anyTimes(); expect(request.getMethod()).andReturn(method).anyTimes(); expect(request.getQueryString()).andReturn(queryString).anyTimes(); expect(request.getCharacterEncoding()).andReturn(charset).anyTimes(); if (engineDecodedParams != null) { expect(request.getParameterMap()).andReturn(engineDecodedParams).anyTimes(); } replay(request, response); }
From source file:org.kepler.configuration.SerializationComparisonTest.java
/** * test locale support//from w ww. java 2 s . c o m */ public void testCommonsLocaleSerialization() { try { Module m = getModule("configuration-manager"); File f = new File(m.getConfigurationsDir(), "test.xml"); Locale l = Locale.GERMANY; //we ask to load test.xml with a german locale. there's a german test.xml //(test_de_DE.xml) so we should not load test.xml CommonsConfigurationReader ccr = new CommonsConfigurationReader(); ConfigurationProperty cp = ccr.loadConfiguration(m, f, l); assertTrue(cp == null); //we should load test_de_DE.xml when using the locale de_DE f = new File(m.getConfigurationsDir(), "test_de_DE.xml"); cp = ccr.loadConfiguration(m, f, l); assertTrue(cp != null); //we should not load this file because we want a chinese locale, but we're //trying to load a german file when another default file exists l = Locale.CHINA; cp = ccr.loadConfiguration(m, f, l); assertTrue(cp == null); //this file should load because we're asking for chinese and there is //no chinese file and we're asking to load a file with no locale //designator. f = new File(m.getConfigurationsDir(), "test.xml"); cp = ccr.loadConfiguration(m, f, l); assertTrue(cp != null); } catch (Exception e) { fail("No exception should have been thrown in testCommonsLocaleSerialization: " + e.getMessage()); } }
From source file:com.qawaa.gui.EventWebScanGUI.java
/** * ???// www . java 2 s . co m */ private void windowsClosed() { if (RUNNING) { int response = JOptionPane.showConfirmDialog(null, CONTEXT.getMessage("gobal.quit.dialog.msg", null, Locale.CHINA), CONTEXT.getMessage("gobal.quit.dialog.title", null, Locale.CHINA), JOptionPane.YES_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { System.exit(0); } } else { System.exit(0); } }
From source file:com.qawaa.gui.PointAnalysisGUI.java
/** * ?/*from w w w .j a va 2 s . c om*/ * @param evt * @throws InterruptedException */ private static void submitActionPerformed(ActionEvent evt) throws InterruptedException { EventDailyPointAnalysisThread edpaThread = EventDailyPointAnalysisThread.Instance(); EventHourlyPointAnalysisThread ehpaThread = EventHourlyPointAnalysisThread.Instance(); EventRealTimePointAnalysisThread erpaThread = EventRealTimePointAnalysisThread.Instance(); if (RUNNING) { JOptionPane.showConfirmDialog(null, CONTEXT.getMessage("gobal.stop.dialog.msg", null, Locale.CHINA), CONTEXT.getMessage("gobal.stop.dialog.title", null, Locale.CHINA), JOptionPane.CLOSED_OPTION, JOptionPane.CLOSED_OPTION); return; } submit.setText(CONTEXT.getMessage("gobal.gui.button.init", null, Locale.CHINA)); submit.setEnabled(false); LOG.info(CONTEXT.getMessage("gobal.db.connect", null, Locale.CHINA)); Thread.sleep(1000L); WebScanControl c = WebScanControl.getInstance(); try { if (!HibernateDataBaseCheck.check()) { LOG.error(CONTEXT.getMessage("gobal.db.connect.fail", null, Locale.CHINA)); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setEnabled(true); return; } } catch (Exception e) { LOG.error(CONTEXT.getMessage("gobal.db.connect.fail", null, Locale.CHINA)); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setEnabled(true); return; } LOG.info(CONTEXT.getMessage("gobal.db.connect.success", null, Locale.CHINA)); Thread.sleep(500L); LOG.info(CONTEXT.getMessage("point.event.check", null, Locale.CHINA)); if (c.isExistEventList()) { LOG.error(CONTEXT.getMessage("point.event.null", null, Locale.CHINA)); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setEnabled(true); return; } else { LOG.info(CONTEXT.getMessage("point.event.check.success", null, Locale.CHINA)); } LOG.info(CONTEXT.getMessage("point.start", null, Locale.CHINA)); Thread.sleep(1000L); submit.setText(CONTEXT.getMessage("gobal.gui.button.stop", null, Locale.CHINA)); submit.setEnabled(true); RUNNING = true; RunTimeListener runTimeListener = new RunTimeListener(runtime_value); runTimeListener.start(); edpaThread.start(); ehpaThread.start(); erpaThread.start(); }