Java Code Examples for javax.swing.JOptionPane#setDefaultLocale()

The following examples show how to use javax.swing.JOptionPane#setDefaultLocale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GUIMain.java    From PacketProxy with Apache License 2.0 6 votes vote down vote up
private void setLookandFeel() throws Exception {
	for (LookAndFeelInfo clInfo : UIManager.getInstalledLookAndFeels()) {
		if ("Nimbus".equals(clInfo.getName())) {
			UIManager.setLookAndFeel(clInfo.getClassName());
			break;
		}
	}

	// フォントの設定
	UIManager.getLookAndFeelDefaults().put("defaultFont", FontManager.getInstance().getUIFont());
	// OptionPaneのロケール
	JOptionPane.setDefaultLocale(I18nString.getLocale());

	setIconForWindows();
	addShortcutForWindows();
	addShortcutForMac();
	addDockIconForMac();
}
 
Example 2
Source File: ReqTabPanel.java    From rest-client with Apache License 2.0 5 votes vote down vote up
private void menuPerformed(Object src)
{
    if (!(src instanceof JMenuItem))
    {
        return;
    }
    JMenuItem item = (JMenuItem) (src);
    if (RESTConst.RM_SEL.equals(item.getName()))
    {
        int rc = tab.getSelectedRowCount();
        if (rc < 1)
        {
            return;
        }

        int[] rows = tab.getSelectedRows();
        tabMdl.deleteRow(rows);
        return;
    }

    if (RESTConst.RM_ALL.equals(item.getName()))
    {
        JOptionPane.setDefaultLocale(Locale.US);
        int ret = JOptionPane.showConfirmDialog(RESTView.getView(),
                                                RESTConst.CONFIRM_RM_ALL, 
                                                RESTConst.RM_ALL,
                                                JOptionPane.YES_NO_OPTION);
        if (0 == ret)
        {
            tabMdl.clear();
        }
        return;
    }
}
 
Example 3
Source File: UIUtil.java    From rest-client with Apache License 2.0 5 votes vote down vote up
/**
* @Title      : showMessage 
* @Description: If it is not CLI running, 
*             : require a message dialog to tell user where is the file.
* @Param      : @param msg
* @Param      : @param title 
* @Return     : void
* @Throws     :
 */
public static void showMessage(final String msg, final String title)
{
    if (!RESTCache.isCLIRunning())
    {
        JOptionPane.setDefaultLocale(Locale.US);
        JOptionPane.showMessageDialog(RESTView.getView(), 
                                      msg, 
                                      title, 
                                      JOptionPane.INFORMATION_MESSAGE);
    }
}
 
Example 4
Source File: MenuBarView.java    From rest-client with Apache License 2.0 5 votes vote down vote up
/**
* 
* @Title: editPerformed 
* @Description: Edit Menu Item Performed 
* @param @param item 
* @return void 
* @throws
 */
private void editPerformed(JMenuItem item)
{
    if (RESTConst.RESET_REQ.equals(item.getText()))
    {
        RESTView.getView().getReqView().reset();
        return;
    }

    if (RESTConst.RESET_RSP.equals(item.getText()))
    {
        RESTView.getView().getRspView().reset();
        return;
    }

    if (RESTConst.RESET_ALL.equals(item.getText()))
    {
        RESTView.getView().getReqView().reset();
        RESTView.getView().getRspView().reset();
        return;
    }

    if (RESTConst.RM_ALL.equals(item.getText()))
    {
        JOptionPane.setDefaultLocale(Locale.US);
        int ret = JOptionPane.showConfirmDialog(RESTView.getView(), 
                                                RESTConst.CONFIRM_RM_ALL, 
                                                RESTConst.RM_ALL, 
                                                JOptionPane.YES_NO_OPTION);
        if (0 == ret)
        {
            RESTCache.getHists().clear();
            RESTView.getView().getHistView().getTabMdl().clear();
        }
        return;
    }
}
 
Example 5
Source File: HistView.java    From rest-client with Apache License 2.0 4 votes vote down vote up
public void actionPerformed(ActionEvent e)
{
    JMenuItem item = (JMenuItem) (e.getSource());
    if (RESTConst.RM_SEL.equals(item.getName()))
    {
        UIUtil.rmRows(tab, tabMdl);
        return;
    }

    if (RESTConst.RM_ALL.equals(item.getName()))
    {
        JOptionPane.setDefaultLocale(Locale.US);
        int ret = JOptionPane.showConfirmDialog(RESTView.getView(),
                                                RESTConst.CONFIRM_RM_ALL, 
                                                RESTConst.RM_ALL,
                                                JOptionPane.YES_NO_OPTION);
        if (0 == ret)
        {
            RESTCache.getHists().clear();
            tabMdl.clear();
        }
        return;
    }
    
    if (RESTConst.MOVE_UP.equals(item.getName()))
    {
        UIUtil.move(tab, tabMdl, true);
        return;
    }

    if (RESTConst.MOVE_DOWN.equals(item.getName()))
    {
        UIUtil.move(tab, tabMdl, false);
        return;
    }

    if (RESTConst.EDIT.equals(item.getName()))
    {
        HttpHist hist = UIUtil.getSelectedHist(tab, tabMdl);
        if (null == hist)
        {
            return;
        }

        histFrame.setFrame(hist);
        histFrame.setVisible(true);
        UIUtil.setLocation(histFrame);
        return;
    }

    if (RESTConst.REFRESH.equals(item.getName()))
    {
        Collection<HttpHist> hists = RESTCache.getHists().values();
        UIUtil.refreshHistView(hists, tabMdl);
        return;
    }
}