List of usage examples for java.util Locale SIMPLIFIED_CHINESE
Locale SIMPLIFIED_CHINESE
To view the source code for java.util Locale SIMPLIFIED_CHINESE.
Click Source Link
From source file:org.ayound.js.debug.ui.DebugMainFrame.java
private void initAction() { actionOpen = new AbstractAction(Messages.getString("DebugMainFrame.Open")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { JFileChooser fileDialog = new JFileChooser(); // fileDialog.setFileFilter(new FileFilter() { @Override/*from www .j a v a 2 s. c om*/ public boolean accept(File f) { String fileName = f.getName().toLowerCase(); if (fileName.endsWith(".htm") //$NON-NLS-1$ || fileName.endsWith(".html") //$NON-NLS-1$ || fileName.endsWith(".js") || f.isDirectory()) { //$NON-NLS-1$ return true; } else { return false; } } @Override public String getDescription() { return ".htm,.html,.js"; //$NON-NLS-1$ } }); int result = fileDialog.showOpenDialog(DebugMainFrame.this); if (result == JFileChooser.APPROVE_OPTION) { openHtmlFile(fileDialog.getSelectedFile()); } } }; actionClose = new AbstractAction(Messages.getString("DebugMainFrame.Close")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { int index = mainPane.getSelectedIndex(); if (index > -1) { mainPane.remove(index); } } }; actionExit = new AbstractAction(Messages.getString("DebugMainFrame.Exit")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { System.exit(0); } }; ImageIcon startIcon = new ImageIcon(DebugMainFrame.class.getResource("icons/launch_run.gif")); //$NON-NLS-1$ actionDebugStart = new AbstractAction(Messages.getString("DebugMainFrame.Start"), startIcon) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { startDebug(); } }; ImageIcon endIcon = new ImageIcon(DebugMainFrame.class.getResource("icons/terminate_co.gif")); //$NON-NLS-1$ actionDebugEnd = new AbstractAction(Messages.getString("DebugMainFrame.End"), endIcon) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { endDebug(); } }; actionDebugEnd.setEnabled(false); actionHelp = new AbstractAction(Messages.getString("DebugMainFrame.Content")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { String locale = DebugMainFrame.this.getLocale().toString(); String helpPath = "help/index_" + locale + ".html"; File testFile = new File(new File(getBaseDir()), helpPath); //$NON-NLS-1$ final String url = "file:///" + testFile.getAbsolutePath().replace('\\', '/'); //$NON-NLS-1$ SwingUtilities.invokeLater(new Runnable() { public void run() { try { // TODO Auto-generated method stub JFrame someWindow = new JFrame(); JEditorPane htmlPane = new JEditorPane(url); htmlPane.setEditable(false); someWindow.setSize(800, 600); someWindow.setExtendedState(JFrame.MAXIMIZED_BOTH); someWindow.setVisible(true); someWindow.add(new JScrollPane(htmlPane)); } catch (IOException ioe) { System.err.println(Messages.getString("DebugMainFrame.ErrorDisplay") + url); //$NON-NLS-1$ } } }); } }; actionAbout = new AbstractAction(Messages.getString("DebugMainFrame.About")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(DebugMainFrame.this, Messages.getString("DebugMainFrame.AboutContent"), //$NON-NLS-1$ Messages.getString("DebugMainFrame.ApplicationName"), JOptionPane.INFORMATION_MESSAGE); //$NON-NLS-1$ } }; actionLanguageChinese = new AbstractAction("Chinese") { public void actionPerformed(ActionEvent e) { DebugUIUtil.updateUI(Locale.SIMPLIFIED_CHINESE); } }; actionLanguageEnglish = new AbstractAction("English") { public void actionPerformed(ActionEvent e) { DebugUIUtil.updateUI(Locale.ENGLISH); } }; }
From source file:net.quduo.pixel.interfaces.android.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // #?//from www . j a va2s . c o m // getWindow().requestFeature(Window.FEATURE_PROGRESS); // // ? // this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); // // // ??? // // this.requestWindowFeature(Window.FEATURE_NO_TITLE); // // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // setContentView(R.layout.activity_main); // this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.activity_title); setContentView(R.layout.activity_main); // #Application mApp = (MainApplication) getApplication(); // ????? if (DEBUG) Log.d(TAG, "Application ?:" + mApp.getValue()); // ? mApp.setValue("Harvey Ren"); // ????? if (DEBUG) Log.d(TAG, "Application ?:" + mApp.getValue()); // #???, // a.? String able = getResources().getConfiguration().locale.getCountry(); // b.able.equals("CN") // c.? Configuration config = getResources().getConfiguration(); DisplayMetrics dm = getResources().getDisplayMetrics(); config.locale = Locale.SIMPLIFIED_CHINESE; getResources().updateConfiguration(config, dm); // # NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.cancel(0); // #?/? if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { // TODO ?...... } else { // TODO ?...... } // setupActionBar(); /* // #drawer mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); // Set up the drawer. mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); */ initViews(); if (savedInstanceState != null && savedInstanceState.containsKey("main_status")) { mSelectPosition = savedInstanceState.getInt("main_status"); } preferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); /* // ???? SharedPreferences.Editor editor = preferences.edit(); // ? editor.putInt("main_toolbar_selected_index", 0); // ?? editor.commit(); */ mPopupWindowListItem = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object> map1 = new HashMap<String, Object>(); // map1.put("item_image", R.drawable.icon_message); map1.put("item_icon", R.string.icon_chat_add_group); // map1.put("item_text", "" + i + ""); map1.put("item_title", "??"); mPopupWindowListItem.add(map1); HashMap<String, Object> map2 = new HashMap<String, Object>(); // map2.put("item_image", R.drawable.icon_message); map2.put("item_icon", R.string.icon_friend_add); // map2.put("item_text", "" + i + ""); map2.put("item_title", "?"); mPopupWindowListItem.add(map2); HashMap<String, Object> map3 = new HashMap<String, Object>(); // map3.put("item_image", R.drawable.icon_message); map3.put("item_icon", R.string.icon_scan); // map3.put("item_text", "" + i + ""); // map3.put("item_title", "???"); mPopupWindowListItem.add(map3); HashMap<String, Object> map4 = new HashMap<String, Object>(); // map4.put("item_image", R.drawable.icon_message); map4.put("item_icon", R.string.icon_mail); // map4.put("item_text", "" + i + ""); map4.put("item_title", "??"); mPopupWindowListItem.add(map4); }
From source file:org.talend.dataquality.standardization.phone.PhoneNumberHandlerBaseTest.java
@Test public void testGetCarrierNameForNumber() { assertEquals(StringUtils.EMPTY,/*from ww w. j a v a 2s .c o m*/ phoneNumberHandlerBase.getCarrierNameForNumber(CN_NUM_1, REGCODE_CN, Locale.SIMPLIFIED_CHINESE)); assertEquals("China Unicom", //$NON-NLS-1$ phoneNumberHandlerBase.getCarrierNameForNumber(CN_NUM_1, REGCODE_CN, Locale.UK)); assertEquals("China Mobile", //$NON-NLS-1$ phoneNumberHandlerBase.getCarrierNameForNumber(CN_NUM_2, REGCODE_CN, Locale.UK)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getCarrierNameForNumber(FR_NUM_3, REGCODE_FR, Locale.UK)); assertEquals("Bouygues", phoneNumberHandlerBase.getCarrierNameForNumber(FR_NUM_5, REGCODE_FR, Locale.UK)); //$NON-NLS-1$ assertEquals("Bouygues", //$NON-NLS-1$ phoneNumberHandlerBase.getCarrierNameForNumber(FR_NUM_5, REGCODE_FR, Locale.FRENCH)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getCarrierNameForNumber(US_NUM_1, REGCODE_US, Locale.UK)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getCarrierNameForNumber(DE_NUM_1, REGCODE_DE, Locale.UK)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getCarrierNameForNumber(DE_NUM_1, REGCODE_DE, Locale.GERMANY)); }
From source file:org.talend.dataquality.standardization.phone.PhoneNumberHandlerBaseTest.java
@Test public void testgetGeocoderDescriptionForNumber() { assertEquals("", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_3, REGCODE_CN, Locale.SIMPLIFIED_CHINESE)); assertEquals("Beijing", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_3, REGCODE_CN, Locale.UK)); // assertEquals("??", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_4, REGCODE_CN, Locale.SIMPLIFIED_CHINESE)); assertEquals("Jiujiang, Jiangxi", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_4, REGCODE_CN, Locale.UK)); assertEquals("France", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_1, REGCODE_FR, Locale.FRANCE)); assertEquals("Paris", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_2, REGCODE_FR, Locale.FRANCE)); assertEquals(StringUtils.EMPTY,/*from ww w. j a v a 2s.c o m*/ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_3, REGCODE_FR, Locale.FRANCE)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_4, REGCODE_FR, Locale.FRANCE)); assertEquals("France", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_5, REGCODE_FR, Locale.FRANCE)); assertEquals("Corvallis, OR", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_1, REGCODE_US, Locale.US)); assertEquals("Corvallis, OR", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_2, REGCODE_US, Locale.US)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_3, REGCODE_US, Locale.US)); assertEquals("Corvallis, OR", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_4, REGCODE_US, Locale.US)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_5, REGCODE_US, Locale.US)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_6, REGCODE_US, Locale.US)); assertEquals("Pennsylvania", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_7, REGCODE_US, Locale.US)); assertEquals("Mnchen", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_1, REGCODE_DE, Locale.GERMANY)); assertEquals("Munich", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_1, REGCODE_DE, Locale.ENGLISH)); assertEquals(StringUtils.EMPTY, phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_2, REGCODE_DE, Locale.GERMANY)); assertEquals("Mnchen", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_3, REGCODE_DE, Locale.GERMANY)); assertEquals("Nubach Pfalz", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_4, REGCODE_DE, Locale.GERMANY)); assertEquals("Nussbach Pfalz", //$NON-NLS-1$ phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_4, REGCODE_DE, Locale.ENGLISH)); }
From source file:com.borax12.materialdaterangepicker.date.MonthView.java
protected void drawMonthDayLabels(Canvas canvas) { int y = getMonthHeaderSize() - (MONTH_DAY_LABEL_TEXT_SIZE / 2); int dayWidthHalf = (mWidth - mEdgePadding * 2) / (mNumDays * 2); for (int i = 0; i < mNumDays; i++) { int x = (2 * i + 1) * dayWidthHalf + mEdgePadding; int calendarDay = (i + mWeekStart) % mNumDays; mDayLabelCalendar.set(Calendar.DAY_OF_WEEK, calendarDay); Locale locale = Locale.getDefault(); String localWeekDisplayName = mDayLabelCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, locale);//from www . j av a2 s.c o m String weekString = localWeekDisplayName.toUpperCase(locale).substring(0, 1); if (locale.equals(Locale.CHINA) || locale.equals(Locale.CHINESE) || locale.equals(Locale.SIMPLIFIED_CHINESE) || locale.equals(Locale.TRADITIONAL_CHINESE)) { int len = localWeekDisplayName.length(); weekString = localWeekDisplayName.substring(len - 1, len); } if (locale.getLanguage().equals("he") || locale.getLanguage().equals("iw")) { if (mDayLabelCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { int len = localWeekDisplayName.length(); weekString = localWeekDisplayName.substring(len - 2, len - 1); } else { // I know this is duplication, but it makes the code easier to grok by // having all hebrew code in the same block weekString = localWeekDisplayName.toUpperCase(locale).substring(0, 1); } } canvas.drawText(weekString, x, y, mMonthDayLabelPaint); } }
From source file:com.customdatepicker.date.MonthView.java
/** * Return a 1 or 2 letter String for use as a weekday label * * @param day The day for which to generate a label * @return The weekday label//from w w w .j a va 2 s . com */ private String getWeekDayLabel(Calendar day) { Locale locale = Locale.getDefault(); // Localised short version of the string is not available on API < 18 if (Build.VERSION.SDK_INT < 18) { String dayName = new SimpleDateFormat("E", locale).format(day.getTime()); String dayLabel = dayName.toUpperCase(locale).substring(0, 1); // Chinese labels should be fetched right to left if (locale.equals(Locale.CHINA) || locale.equals(Locale.CHINESE) || locale.equals(Locale.SIMPLIFIED_CHINESE) || locale.equals(Locale.TRADITIONAL_CHINESE)) { int len = dayName.length(); dayLabel = dayName.substring(len - 1, len); } // Most hebrew labels should select the second to last character if (locale.getLanguage().equals("he") || locale.getLanguage().equals("iw")) { if (mDayLabelCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { int len = dayName.length(); dayLabel = dayName.substring(len - 2, len - 1); } else { // I know this is duplication, but it makes the code easier to grok by // having all hebrew code in the same block dayLabel = dayName.toUpperCase(locale).substring(0, 1); } } // Catalan labels should be two digits in lowercase if (locale.getLanguage().equals("ca")) dayLabel = dayName.toLowerCase().substring(0, 2); // Correct single character label in Spanish is X if (locale.getLanguage().equals("es") && day.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) dayLabel = "X"; return dayLabel; } // Getting the short label is a one liner on API >= 18 if (weekDayLabelFormatter == null) { weekDayLabelFormatter = new SimpleDateFormat("EEEEE", locale); } return weekDayLabelFormatter.format(day.getTime()); }
From source file:com.borax12.materialdaterangepicker.single.date.MonthView.java
/** * Return a 1 or 2 letter String for use as a weekday label * @param day The day for which to generate a label * @return The weekday label/*from ww w .j ava 2 s .co m*/ */ private String getWeekDayLabel(Calendar day) { Locale locale = Locale.getDefault(); // Localised short version of the string is not available on API < 18 if (Build.VERSION.SDK_INT < 18) { String dayName = new SimpleDateFormat("E", locale).format(day.getTime()); String dayLabel = dayName.toUpperCase(locale).substring(0, 1); // Chinese labels should be fetched right to left if (locale.equals(Locale.CHINA) || locale.equals(Locale.CHINESE) || locale.equals(Locale.SIMPLIFIED_CHINESE) || locale.equals(Locale.TRADITIONAL_CHINESE)) { int len = dayName.length(); dayLabel = dayName.substring(len - 1, len); } // Most hebrew labels should select the second to last character if (locale.getLanguage().equals("he") || locale.getLanguage().equals("iw")) { if (mDayLabelCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { int len = dayName.length(); dayLabel = dayName.substring(len - 2, len - 1); } else { // I know this is duplication, but it makes the code easier to grok by // having all hebrew code in the same block dayLabel = dayName.toUpperCase(locale).substring(0, 1); } } // Catalan labels should be two digits in lowercase if (locale.getLanguage().equals("ca")) dayLabel = dayName.toLowerCase().substring(0, 2); // Correct single character label in Spanish is X if (locale.getLanguage().equals("es") && day.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) dayLabel = "X"; return dayLabel; } // Getting the short label is a one liner on API >= 18 return new SimpleDateFormat("EEEEE", locale).format(day.getTime()); }
From source file:com.jarklee.materialdatetimepicker.date.MonthView.java
/** * Return a 1 or 2 letter String for use as a weekday label * * @param day The day for which to generate a label * @return The weekday label/*from w w w . ja v a 2 s . co m*/ */ private String getWeekDayLabel(Calendar day) { Locale locale = getLocale(); // Localised short version of the string is not available on API < 18 if (Build.VERSION.SDK_INT < 18) { String dayName = new SimpleDateFormat("E", locale).format(day.getTime()); String dayLabel = dayName.toUpperCase(locale).substring(0, 1); // Chinese labels should be fetched right to left if (locale.equals(Locale.CHINA) || locale.equals(Locale.CHINESE) || locale.equals(Locale.SIMPLIFIED_CHINESE) || locale.equals(Locale.TRADITIONAL_CHINESE)) { int len = dayName.length(); dayLabel = dayName.substring(len - 1, len); } // Most hebrew labels should select the second to last character if (locale.getLanguage().equals("he") || locale.getLanguage().equals("iw")) { if (mDayLabelCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { int len = dayName.length(); dayLabel = dayName.substring(len - 2, len - 1); } else { // I know this is duplication, but it makes the code easier to grok by // having all hebrew code in the same block dayLabel = dayName.toUpperCase(locale).substring(0, 1); } } // Catalan labels should be two digits in lowercase if (locale.getLanguage().equals("ca")) dayLabel = dayName.toLowerCase().substring(0, 2); // Correct single character label in Spanish is X if (locale.getLanguage().equals("es") && day.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) dayLabel = "X"; return dayLabel; } // Getting the short label is a one liner on API >= 18 return new SimpleDateFormat("EEEEE", locale).format(day.getTime()); }
From source file:org.yccheok.jstock.gui.PortfolioManagementJPanel.java
public boolean openAsStatements(Statements statements, File file) { assert (statements != null); if (statements.getType() == Statement.Type.PortfolioManagementBuy || statements.getType() == Statement.Type.PortfolioManagementSell || statements.getType() == Statement.Type.PortfolioManagementDeposit || statements.getType() == Statement.Type.PortfolioManagementDividend) { final GUIBundleWrapper guiBundleWrapper = statements.getGUIBundleWrapper(); // We will use a fixed date format (Locale.English), so that it will be // easier for Android to process. ///*from w ww .j a v a 2 s .c o m*/ // "Sep 5, 2011" - Locale.ENGLISH // "2011-9-5" - Locale.SIMPLIFIED_CHINESE // "2011/9/5" - Locale.TRADITIONAL_CHINESE // 05.09.2011 - Locale.GERMAN // // However, for backward compatible purpose (Able to read old CSV), // we perform a for loop to determine the best date format. DateFormat dateFormat = null; final int size = statements.size(); switch (statements.getType()) { case PortfolioManagementBuy: { final List<Transaction> transactions = new ArrayList<Transaction>(); for (int i = 0; i < size; i++) { final Statement statement = statements.get(i); final String _code = statement.getValueAsString(guiBundleWrapper.getString("MainFrame_Code")); final String _symbol = statement .getValueAsString(guiBundleWrapper.getString("MainFrame_Symbol")); final String _date = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Date")); final Double units = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_Units")); final Double purchasePrice = statement.getValueAsDouble( guiBundleWrapper.getString("PortfolioManagementJPanel_PurchasePrice")); final Double broker = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_Broker")); final Double clearingFee = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_ClearingFee")); final Double stampDuty = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_StampDuty")); final String _comment = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Comment")); Stock stock = null; if (_code.length() > 0 && _symbol.length() > 0) { stock = org.yccheok.jstock.engine.Utils.getEmptyStock(Code.newInstance(_code), Symbol.newInstance(_symbol)); } else { log.error("Unexpected empty stock. Ignore"); // stock is null. continue; } Date date = null; if (dateFormat == null) { // However, for backward compatible purpose (Able to read old CSV), // we perform a for loop to determine the best date format. // For the latest CSV, it should be Locale.ENGLISH. Locale[] locales = { Locale.ENGLISH, Locale.SIMPLIFIED_CHINESE, Locale.GERMAN, Locale.TRADITIONAL_CHINESE, Locale.ITALIAN }; for (Locale locale : locales) { dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale); try { date = dateFormat.parse((String) _date); } catch (ParseException exp) { log.error(null, exp); date = null; dateFormat = null; continue; } // We had found our best dateFormat. Early break. break; } } else { // We already determine our best dateFormat. try { date = dateFormat.parse((String) _date); } catch (ParseException exp) { log.error(null, exp); } } if (date == null) { log.error("Unexpected wrong date. Ignore"); continue; } // Shall we continue to ignore, or shall we just return false to // flag an error? if (units == null) { log.error("Unexpected wrong units. Ignore"); continue; } if (purchasePrice == null || broker == null || clearingFee == null || stampDuty == null) { log.error("Unexpected wrong purchasePrice/broker/clearingFee/stampDuty. Ignore"); continue; } final SimpleDate simpleDate = new SimpleDate(date); final Contract.Type type = Contract.Type.Buy; final Contract.ContractBuilder builder = new Contract.ContractBuilder(stock, simpleDate); final Contract contract = builder.type(type).quantity(units).price(purchasePrice).build(); final Transaction t = new Transaction(contract, broker, stampDuty, clearingFee); t.setComment(org.yccheok.jstock.portfolio.Utils.replaceCSVLineFeedToSystemLineFeed(_comment)); transactions.add(t); } // We allow empty portfolio. //if (transactions.size() <= 0) { // return false; //} // Is there any exsiting displayed data? if (this.getBuyTransactionSize() > 0) { final String output = MessageFormat.format( MessagesBundle.getString("question_message_load_file_for_buy_portfolio_template"), file.getName()); final int result = javax.swing.JOptionPane.showConfirmDialog(JStock.instance(), output, MessagesBundle.getString("question_title_load_file_for_buy_portfolio"), javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); if (result != javax.swing.JOptionPane.YES_OPTION) { // Assume success. return true; } } this.buyTreeTable.setTreeTableModel(new BuyPortfolioTreeTableModelEx()); final BuyPortfolioTreeTableModelEx buyPortfolioTreeTableModel = (BuyPortfolioTreeTableModelEx) buyTreeTable .getTreeTableModel(); buyPortfolioTreeTableModel.bind(this.portfolioRealTimeInfo); buyPortfolioTreeTableModel.bind(this); Map<String, String> metadatas = statements.getMetadatas(); for (Transaction transaction : transactions) { final Code code = transaction.getStock().code; TransactionSummary transactionSummary = this.addBuyTransaction(transaction); if (transactionSummary != null) { String comment = metadatas.get(code.toString()); if (comment != null) { transactionSummary.setComment( org.yccheok.jstock.portfolio.Utils.replaceCSVLineFeedToSystemLineFeed(comment)); } } } // Only shows necessary columns. initGUIOptions(); expandTreeTable(buyTreeTable); updateRealTimeStockMonitorAccordingToPortfolioTreeTableModels(); updateExchangeRateMonitorAccordingToPortfolioTreeTableModels(); // updateWealthHeader will be called at end of switch. refreshStatusBarExchangeRateVisibility(); } break; case PortfolioManagementSell: { final List<Transaction> transactions = new ArrayList<Transaction>(); for (int i = 0; i < size; i++) { final Statement statement = statements.get(i); final String _code = statement.getValueAsString(guiBundleWrapper.getString("MainFrame_Code")); final String _symbol = statement .getValueAsString(guiBundleWrapper.getString("MainFrame_Symbol")); final String _referenceDate = statement.getValueAsString( guiBundleWrapper.getString("PortfolioManagementJPanel_ReferenceDate")); // Legacy file handling. PortfolioManagementJPanel_PurchaseBroker, PortfolioManagementJPanel_PurchaseClearingFee, // and PortfolioManagementJPanel_PurchaseStampDuty are introduced starting from 1.0.6x Double purchaseBroker = statement.getValueAsDouble( guiBundleWrapper.getString("PortfolioManagementJPanel_PurchaseBroker")); if (purchaseBroker == null) { // Legacy file handling. PortfolioManagementJPanel_PurchaseFee is introduced starting from 1.0.6s purchaseBroker = statement.getValueAsDouble( guiBundleWrapper.getString("PortfolioManagementJPanel_PurchaseFee")); if (purchaseBroker == null) { purchaseBroker = new Double(0.0); } } Double purchaseClearingFee = statement.getValueAsDouble( guiBundleWrapper.getString("PortfolioManagementJPanel_PurchaseClearingFee")); if (purchaseClearingFee == null) { purchaseClearingFee = new Double(0.0); } Double purchaseStampDuty = statement.getValueAsDouble( guiBundleWrapper.getString("PortfolioManagementJPanel_PurchaseStampDuty")); if (purchaseStampDuty == null) { purchaseStampDuty = new Double(0.0); } final String _date = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Date")); final Double units = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_Units")); final Double sellingPrice = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_SellingPrice")); final Double purchasePrice = statement.getValueAsDouble( guiBundleWrapper.getString("PortfolioManagementJPanel_PurchasePrice")); final Double broker = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_Broker")); final Double clearingFee = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_ClearingFee")); final Double stampDuty = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_StampDuty")); final String _comment = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Comment")); Stock stock = null; if (_code.length() > 0 && _symbol.length() > 0) { stock = org.yccheok.jstock.engine.Utils.getEmptyStock(Code.newInstance(_code), Symbol.newInstance(_symbol)); } else { log.error("Unexpected empty stock. Ignore"); // stock is null. continue; } Date date = null; Date referenceDate = null; if (dateFormat == null) { // However, for backward compatible purpose (Able to read old CSV), // we perform a for loop to determine the best date format. // For the latest CSV, it should be Locale.ENGLISH. Locale[] locales = { Locale.ENGLISH, Locale.SIMPLIFIED_CHINESE, Locale.GERMAN, Locale.TRADITIONAL_CHINESE, Locale.ITALIAN }; for (Locale locale : locales) { dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale); try { date = dateFormat.parse((String) _date); referenceDate = dateFormat.parse((String) _referenceDate); } catch (ParseException exp) { log.error(null, exp); date = null; referenceDate = null; dateFormat = null; continue; } // We had found our best dateFormat. Early break. break; } } else { // We already determine our best dateFormat. try { date = dateFormat.parse((String) _date); referenceDate = dateFormat.parse((String) _referenceDate); } catch (ParseException exp) { log.error(null, exp); } } if (date == null || referenceDate == null) { log.error("Unexpected wrong date/referenceDate. Ignore"); continue; } // Shall we continue to ignore, or shall we just return false to // flag an error? if (units == null) { log.error("Unexpected wrong units. Ignore"); continue; } if (purchasePrice == null || broker == null || clearingFee == null || stampDuty == null || sellingPrice == null) { log.error( "Unexpected wrong purchasePrice/broker/clearingFee/stampDuty/sellingPrice. Ignore"); continue; } final SimpleDate simpleDate = new SimpleDate(date); final SimpleDate simpleReferenceDate = new SimpleDate(referenceDate); final Contract.Type type = Contract.Type.Sell; final Contract.ContractBuilder builder = new Contract.ContractBuilder(stock, simpleDate); final Contract contract = builder.type(type).quantity(units).price(sellingPrice) .referencePrice(purchasePrice).referenceDate(simpleReferenceDate) .referenceBroker(purchaseBroker).referenceClearingFee(purchaseClearingFee) .referenceStampDuty(purchaseStampDuty).build(); final Transaction t = new Transaction(contract, broker, stampDuty, clearingFee); t.setComment(org.yccheok.jstock.portfolio.Utils.replaceCSVLineFeedToSystemLineFeed(_comment)); transactions.add(t); } // for // We allow empty portfolio. //if (transactions.size() <= 0) { // return false; //} // Is there any exsiting displayed data? if (this.getSellTransactionSize() > 0) { final String output = MessageFormat.format( MessagesBundle.getString("question_message_load_file_for_sell_portfolio_template"), file.getName()); final int result = javax.swing.JOptionPane.showConfirmDialog(JStock.instance(), output, MessagesBundle.getString("question_title_load_file_for_sell_portfolio"), javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); if (result != javax.swing.JOptionPane.YES_OPTION) { // Assume success. return true; } } this.sellTreeTable.setTreeTableModel(new SellPortfolioTreeTableModelEx()); final SellPortfolioTreeTableModelEx sellPortfolioTreeTableModel = (SellPortfolioTreeTableModelEx) sellTreeTable .getTreeTableModel(); sellPortfolioTreeTableModel.bind(this.portfolioRealTimeInfo); sellPortfolioTreeTableModel.bind(this); Map<String, String> metadatas = statements.getMetadatas(); for (Transaction transaction : transactions) { final Code code = transaction.getStock().code; TransactionSummary transactionSummary = this.addSellTransaction(transaction); if (transactionSummary != null) { String comment = metadatas.get(code.toString()); if (comment != null) { transactionSummary.setComment( org.yccheok.jstock.portfolio.Utils.replaceCSVLineFeedToSystemLineFeed(comment)); } } } // Only shows necessary columns. initGUIOptions(); expandTreeTable(this.sellTreeTable); updateExchangeRateMonitorAccordingToPortfolioTreeTableModels(); // updateWealthHeader will be called at end of switch. refreshStatusBarExchangeRateVisibility(); } break; case PortfolioManagementDeposit: { final List<Deposit> deposits = new ArrayList<Deposit>(); for (int i = 0; i < size; i++) { Date date = null; final Statement statement = statements.get(i); final String object0 = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Date")); assert (object0 != null); if (dateFormat == null) { // However, for backward compatible purpose (Able to read old CSV), // we will perform a for loop to determine the best date format. // For the latest CSV, it should be Locale.ENGLISH. Locale[] locales = { Locale.ENGLISH, Locale.SIMPLIFIED_CHINESE, Locale.GERMAN, Locale.TRADITIONAL_CHINESE, Locale.ITALIAN }; for (Locale locale : locales) { dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale); try { date = dateFormat.parse(object0); } catch (ParseException exp) { log.error(null, exp); date = null; dateFormat = null; continue; } // We had found our best dateFormat. Early break. break; } } else { // We already determine our best dateFormat. try { date = dateFormat.parse(object0); } catch (ParseException exp) { log.error(null, exp); } } // Shall we continue to ignore, or shall we just return false to // flag an error? if (date == null) { log.error("Unexpected wrong date. Ignore"); continue; } final Double cash = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_Cash")); // Shall we continue to ignore, or shall we just return false to // flag an error? if (cash == null) { log.error("Unexpected wrong cash. Ignore"); continue; } final Deposit deposit = new Deposit(cash, new SimpleDate(date)); final String comment = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Comment")); if (comment != null) { // Possible to be null. As in version <=1.0.6p, comment // is not being saved to CSV. deposit.setComment( org.yccheok.jstock.portfolio.Utils.replaceCSVLineFeedToSystemLineFeed(comment)); } deposits.add(deposit); } // We allow empty portfolio. //if (deposits.size() <= 0) { // return false; //} // Is there any exsiting displayed data? if (this.depositSummary.size() > 0) { final String output = MessageFormat.format( MessagesBundle.getString("question_message_load_file_for_cash_deposit_template"), file.getName()); final int result = javax.swing.JOptionPane.showConfirmDialog(JStock.instance(), output, MessagesBundle.getString("question_title_load_file_for_cash_deposit"), javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); if (result != javax.swing.JOptionPane.YES_OPTION) { // Assume success. return true; } } this.depositSummary = new DepositSummary(); for (Deposit deposit : deposits) { depositSummary.add(deposit); } } break; case PortfolioManagementDividend: { final List<Dividend> dividends = new ArrayList<Dividend>(); for (int i = 0; i < size; i++) { Date date = null; StockInfo stockInfo = null; final Statement statement = statements.get(i); final String object0 = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Date")); assert (object0 != null); if (dateFormat == null) { // However, for backward compatible purpose (Able to read old CSV), // we will perform a for loop to determine the best date format. // For the latest CSV, it should be Locale.ENGLISH. Locale[] locales = { Locale.ENGLISH, Locale.SIMPLIFIED_CHINESE, Locale.GERMAN, Locale.TRADITIONAL_CHINESE, Locale.ITALIAN }; for (Locale locale : locales) { dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale); try { date = dateFormat.parse(object0); } catch (ParseException exp) { log.error(null, exp); date = null; dateFormat = null; continue; } // We had found our best dateFormat. Early break. break; } } else { // We already determine our best dateFormat. try { date = dateFormat.parse(object0); } catch (ParseException exp) { log.error(null, exp); } } // Shall we continue to ignore, or shall we just return false to // flag an error? if (date == null) { log.error("Unexpected wrong date. Ignore"); continue; } final Double dividend = statement .getValueAsDouble(guiBundleWrapper.getString("PortfolioManagementJPanel_Dividend")); // Shall we continue to ignore, or shall we just return false to // flag an error? if (dividend == null) { log.error("Unexpected wrong dividend. Ignore"); continue; } final String codeStr = statement.getValueAsString(guiBundleWrapper.getString("MainFrame_Code")); final String symbolStr = statement .getValueAsString(guiBundleWrapper.getString("MainFrame_Symbol")); if (codeStr.isEmpty() == false && symbolStr.isEmpty() == false) { stockInfo = StockInfo.newInstance(Code.newInstance(codeStr), Symbol.newInstance(symbolStr)); } else { log.error("Unexpected wrong stock. Ignore"); // stock is null. continue; } assert (stockInfo != null); assert (dividend != null); assert (date != null); final Dividend d = new Dividend(stockInfo, dividend, new SimpleDate(date)); final String comment = statement .getValueAsString(guiBundleWrapper.getString("PortfolioManagementJPanel_Comment")); if (comment != null) { // Possible to be null. As in version <=1.0.6p, comment // is not being saved to CSV. d.setComment( org.yccheok.jstock.portfolio.Utils.replaceCSVLineFeedToSystemLineFeed(comment)); } dividends.add(d); } // We allow empty portfolio. //if (dividends.size() <= 0) { // return false; //} if (this.dividendSummary.size() > 0) { final String output = MessageFormat.format( MessagesBundle.getString("question_message_load_file_for_dividend_template"), file.getName()); final int result = javax.swing.JOptionPane.showConfirmDialog(JStock.instance(), output, MessagesBundle.getString("question_title_load_file_for_dividend"), javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); if (result != javax.swing.JOptionPane.YES_OPTION) { // Assume success. return true; } } this.dividendSummary = new DividendSummary(); for (Dividend dividend : dividends) { dividendSummary.add(dividend); } } break; default: assert (false); } // End of switch this.updateWealthHeader(); } else if (statements.getType() == Statement.Type.RealtimeInfo) { /* Open using other tabs. */ return JStock.instance().openAsStatements(statements, file); } else { return false; } return true; }
From source file:org.yccheok.jstock.gui.MainFrame.java
/** This method is called from within the constructor to * initialize the form./*from ww w. j a va 2s .co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); buttonGroup2 = new javax.swing.ButtonGroup(); buttonGroup3 = new javax.swing.ButtonGroup(); jComboBox1 = new AutoCompleteJComboBox(); jPanel6 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel8 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel10 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jMenuBar2 = new javax.swing.JMenuBar(); jMenu3 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem9 = new javax.swing.JMenuItem(); jSeparator7 = new javax.swing.JPopupMenu.Separator(); jMenuItem11 = new javax.swing.JMenuItem(); jMenuItem10 = new javax.swing.JMenuItem(); jSeparator8 = new javax.swing.JPopupMenu.Separator(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu5 = new javax.swing.JMenu(); jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem7 = new javax.swing.JMenuItem(); jSeparator4 = new javax.swing.JPopupMenu.Separator(); jMenuItem15 = new javax.swing.JMenuItem(); jMenu6 = new javax.swing.JMenu(); jMenu10 = new javax.swing.JMenu(); jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem(); jRadioButtonMenuItem2 = new javax.swing.JRadioButtonMenuItem(); jRadioButtonMenuItem4 = new javax.swing.JRadioButtonMenuItem(); jRadioButtonMenuItem6 = new javax.swing.JRadioButtonMenuItem(); jRadioButtonMenuItem3 = new javax.swing.JRadioButtonMenuItem(); jRadioButtonMenuItem5 = new javax.swing.JRadioButtonMenuItem(); jMenu7 = new javax.swing.JMenu(); jMenuItem8 = new javax.swing.JMenuItem(); jMenu9 = new javax.swing.JMenu(); jMenu8 = new javax.swing.JMenu(); jMenu1 = new javax.swing.JMenu(); jMenuItem6 = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem16 = new javax.swing.JMenuItem(); jMenuItem12 = new javax.swing.JMenuItem(); jSeparator6 = new javax.swing.JPopupMenu.Separator(); jMenuItem13 = new javax.swing.JMenuItem(); jMenuItem14 = new javax.swing.JMenuItem(); jSeparator5 = new javax.swing.JPopupMenu.Separator(); jMenuItem5 = new javax.swing.JMenuItem(); jMenu11 = new javax.swing.JMenu(); jMenuItem17 = new javax.swing.JMenuItem(); jComboBox1.setEditable(true); jComboBox1.setPreferredSize(new java.awt.Dimension(150, 24)); ((AutoCompleteJComboBox) this.jComboBox1).attachStockInfoObserver(getStockInfoObserver()); ((AutoCompleteJComboBox) this.jComboBox1).attachResultObserver(getResultObserver()); ((AutoCompleteJComboBox) this.jComboBox1).attachMatchObserver(getMatchObserver()); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N setTitle(bundle.getString("MainFrame_Application_Title")); // NOI18N setIconImage(getMyIconImage()); addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { formMouseClicked(evt); } }); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { formWindowClosed(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } public void windowDeiconified(java.awt.event.WindowEvent evt) { formWindowDeiconified(evt); } public void windowIconified(java.awt.event.WindowEvent evt) { formWindowIconified(evt); } }); getContentPane().setLayout(new java.awt.BorderLayout(5, 5)); jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); jPanel6.setLayout(new java.awt.BorderLayout(5, 5)); this.jPanel6.add(statusBar, java.awt.BorderLayout.SOUTH); getContentPane().add(jPanel6, java.awt.BorderLayout.SOUTH); jTabbedPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jTabbedPane1StateChanged(evt); } }); jPanel8.setLayout(new java.awt.BorderLayout(5, 5)); jTable1.setAutoCreateRowSorter(true); jTable1.setFont(jTable1.getFont().deriveFont(jTable1.getFont().getStyle() | java.awt.Font.BOLD, jTable1.getFont().getSize() + 1)); jTable1.setModel(new StockTableModel()); jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); this.jTable1.setDefaultRenderer(Number.class, new StockTableCellRenderer(SwingConstants.RIGHT)); this.jTable1.setDefaultRenderer(Double.class, new StockTableCellRenderer(SwingConstants.RIGHT)); this.jTable1.setDefaultRenderer(Object.class, new StockTableCellRenderer(SwingConstants.LEFT)); this.jTable1.setDefaultEditor(Double.class, new NonNegativeDoubleEditor()); this.jTable1.getModel().addTableModelListener(this.getTableModelListener()); this.jTable1.getTableHeader().addMouseListener(new TableColumnSelectionPopupListener(1)); this.jTable1.addMouseListener(new TableRowPopupListener()); this.jTable1.addKeyListener(new TableKeyEventListener()); jTable1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jTable1KeyPressed(evt); } }); jScrollPane1.setViewportView(jTable1); jPanel8.add(jScrollPane1, java.awt.BorderLayout.CENTER); jLabel1.setText(bundle.getString("MainFrame_Stock")); // NOI18N jPanel1.add(jLabel1); jPanel8.add(jPanel1, java.awt.BorderLayout.NORTH); jPanel10.setPreferredSize(new java.awt.Dimension(328, 170)); jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 10, 5)); jPanel3.setBackground(new java.awt.Color(255, 255, 255)); jPanel3.setPreferredSize(new java.awt.Dimension(170, 160)); jPanel3.setBorder(new org.jdesktop.swingx.border.DropShadowBorder(true)); jPanel3.setLayout(new java.awt.BorderLayout()); jPanel10.add(jPanel3); EMPTY_DYNAMIC_CHART.getChartPanel().addMouseListener(dynamicChartMouseAdapter); jPanel3.add(EMPTY_DYNAMIC_CHART.getChartPanel(), java.awt.BorderLayout.CENTER); jPanel8.add(jPanel10, java.awt.BorderLayout.SOUTH); jTabbedPane1.addTab(bundle.getString("MainFrame_Title"), jPanel8); // NOI18N getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); jPanel2.setLayout(new java.awt.GridLayout(2, 1)); getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH); jMenu3.setText(bundle.getString("MainFrame_File")); // NOI18N jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/project_open.png"))); // NOI18N jMenuItem2.setText(bundle.getString("MainFrame_Open...")); // NOI18N jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu3.add(jMenuItem2); jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filesave.png"))); // NOI18N jMenuItem9.setText(bundle.getString("MainFrame_SaveAs...")); // NOI18N jMenuItem9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem9ActionPerformed(evt); } }); jMenu3.add(jMenuItem9); jMenu3.add(jSeparator7); jMenuItem11.setIcon( new javax.swing.ImageIcon(getClass().getResource("/images/16x16/download_from_cloud.png"))); // NOI18N jMenuItem11.setText(bundle.getString("MainFrame_OpenFromCloud...")); // NOI18N jMenuItem11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem11ActionPerformed(evt); } }); jMenu3.add(jMenuItem11); jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/upload_to_cloud.png"))); // NOI18N jMenuItem10.setText(bundle.getString("MainFrame_SaveToCloud...")); // NOI18N jMenuItem10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem10ActionPerformed(evt); } }); jMenu3.add(jMenuItem10); jMenu3.add(jSeparator8); jMenuItem1.setText(bundle.getString("MainFrame_Exit")); // NOI18N jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu3.add(jMenuItem1); jMenuBar2.add(jMenu3); jMenu5.setText(bundle.getString("MainFrame_Edit")); // NOI18N jMenuItem4.setText(bundle.getString("MainFrame_AddStocks...")); // NOI18N jMenuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem4ActionPerformed(evt); } }); jMenu5.add(jMenuItem4); jMenuItem7.setText(bundle.getString("MainFrame_ClearAllStocks")); // NOI18N jMenuItem7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem7ActionPerformed(evt); } }); jMenu5.add(jMenuItem7); jMenu5.add(jSeparator4); jMenuItem15.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem15.setText(bundle.getString("MainFrame_RefreshStockPrices")); // NOI18N jMenuItem15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem15ActionPerformed(evt); } }); jMenu5.add(jMenuItem15); jMenuBar2.add(jMenu5); jMenu6.setText(bundle.getString("MainFrame_Country")); // NOI18N jMenuBar2.add(jMenu6); jMenu10.setText(bundle.getString("MainFrame_Language")); // NOI18N buttonGroup3.add(jRadioButtonMenuItem1); jRadioButtonMenuItem1.setSelected(true); jRadioButtonMenuItem1.setText(Locale.ENGLISH.getDisplayLanguage(Locale.getDefault())); jRadioButtonMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonMenuItem1ActionPerformed(evt); } }); jMenu10.add(jRadioButtonMenuItem1); buttonGroup3.add(jRadioButtonMenuItem2); jRadioButtonMenuItem2.setText(Locale.SIMPLIFIED_CHINESE.getDisplayName(Locale.getDefault())); jRadioButtonMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonMenuItem2ActionPerformed(evt); } }); jMenu10.add(jRadioButtonMenuItem2); buttonGroup3.add(jRadioButtonMenuItem4); jRadioButtonMenuItem4.setText(Locale.TRADITIONAL_CHINESE.getDisplayName(Locale.getDefault())); jRadioButtonMenuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonMenuItem4ActionPerformed(evt); } }); jMenu10.add(jRadioButtonMenuItem4); buttonGroup3.add(jRadioButtonMenuItem6); jRadioButtonMenuItem6.setText(Locale.FRENCH.getDisplayLanguage(Locale.getDefault())); jRadioButtonMenuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonMenuItem6ActionPerformed(evt); } }); jMenu10.add(jRadioButtonMenuItem6); buttonGroup3.add(jRadioButtonMenuItem3); jRadioButtonMenuItem3.setText(Locale.GERMAN.getDisplayLanguage(Locale.getDefault())); jRadioButtonMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonMenuItem3ActionPerformed(evt); } }); jMenu10.add(jRadioButtonMenuItem3); buttonGroup3.add(jRadioButtonMenuItem5); jRadioButtonMenuItem5.setText(Locale.ITALIAN.getDisplayLanguage(Locale.getDefault())); jRadioButtonMenuItem5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonMenuItem5ActionPerformed(evt); } }); jMenu10.add(jRadioButtonMenuItem5); jMenuBar2.add(jMenu10); jMenu7.setText(bundle.getString("MainFrame_Database")); // NOI18N jMenuItem8.setText(bundle.getString("MainFrame_StockDatabase...")); // NOI18N jMenuItem8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem8ActionPerformed(evt); } }); jMenu7.add(jMenuItem8); jMenuBar2.add(jMenu7); jMenu9.setText(bundle.getString("MainFrame_Watchlist")); // NOI18N jMenu9.addMenuListener(new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { } public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu9MenuSelected(evt); } }); jMenuBar2.add(jMenu9); jMenu8.setText(bundle.getString("MainFrame_Portfolio")); // NOI18N jMenu8.addMenuListener(new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { } public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu8MenuSelected(evt); } }); jMenuBar2.add(jMenu8); jMenu1.setText(bundle.getString("MainFrame_Options")); // NOI18N jMenuItem6.setText(bundle.getString("MainFrame_Options...")); // NOI18N jMenuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem6ActionPerformed(evt); } }); jMenu1.add(jMenuItem6); jMenuBar2.add(jMenu1); jMenu4.setText(bundle.getString("MainFrame_LooknFeel")); // NOI18N jMenuBar2.add(jMenu4); jMenu2.setText(bundle.getString("MainFrame_Help")); // NOI18N jMenuItem3.setText(bundle.getString("MainFrame_OnlineHelp")); // NOI18N jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem3ActionPerformed(evt); } }); jMenu2.add(jMenuItem3); jMenuItem16.setText(bundle.getString("MainFrame_KeyboardShortcuts")); // NOI18N jMenuItem16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem16ActionPerformed(evt); } }); jMenu2.add(jMenuItem16); jMenuItem12.setText(bundle.getString("MainFrame_Calculator")); // NOI18N jMenuItem12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem12ActionPerformed(evt); } }); jMenu2.add(jMenuItem12); jMenu2.add(jSeparator6); jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/smile2.png"))); // NOI18N jMenuItem13.setText(bundle.getString("MainFrame_DonateToJStock")); // NOI18N jMenuItem13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem13ActionPerformed(evt); } }); jMenu2.add(jMenuItem13); jMenuItem14.setText(bundle.getString("MainFrame_ContributeToJStock")); // NOI18N jMenuItem14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem14ActionPerformed(evt); } }); jMenu2.add(jMenuItem14); jMenu2.add(jSeparator5); jMenuItem5.setText(bundle.getString("MainFrame_About...")); // NOI18N jMenuItem5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem5ActionPerformed(evt); } }); jMenu2.add(jMenuItem5); jMenuBar2.add(jMenu2); jMenu11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/android-small.png"))); // NOI18N jMenu11.setText(bundle.getString("MainFrame_Android")); // NOI18N jMenu11.setFont(jMenu11.getFont().deriveFont(jMenu11.getFont().getStyle() | java.awt.Font.BOLD)); jMenuItem17.setText(bundle.getString("MainFrame_DownloadJStockAndroid")); // NOI18N jMenuItem17.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem17ActionPerformed(evt); } }); jMenu11.add(jMenuItem17); jMenuBar2.add(jMenu11); setJMenuBar(jMenuBar2); setSize(new java.awt.Dimension(952, 478)); setLocationRelativeTo(null); }