List of usage examples for javax.swing JOptionPane OK_CANCEL_OPTION
int OK_CANCEL_OPTION
To view the source code for javax.swing JOptionPane OK_CANCEL_OPTION.
Click Source Link
showConfirmDialog
. From source file:gui.DownloadManagerGUI.java
public DownloadManagerGUI(String name) { super(name);/*from ww w . j a v a2s. c o m*/ setLayout(new BorderLayout()); preferences = Preferences.userRoot().node("db"); final PreferencesDTO preferencesDTO = getPreferences(); LookAndFeel.setLaf(preferencesDTO.getPreferencesInterfaceDTO().getLookAndFeelName()); createFileHierarchy(); mainToolbar = new MainToolBar(); categoryPanel = new CategoryPanel( preferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs()); downloadPanel = new DownloadPanel(this, preferencesDTO.getPreferencesSaveDTO().getDatabasePath(), preferencesDTO.getPreferencesConnectionDTO().getConnectionTimeOut(), preferencesDTO.getPreferencesConnectionDTO().getReadTimeOut()); messagePanel = new MessagePanel(this); JTabbedPane mainTabPane = new JTabbedPane(); mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, categoryPanel, mainTabPane); mainSplitPane.setOneTouchExpandable(true); statusPanel = new StatusPanel(); addNewDownloadDialog = new AddNewDownloadDialog(this); mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.downloadPanel"), downloadPanel); mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.messagePanel"), messagePanel); preferenceDialog = new PreferenceDialog(this, preferencesDTO); aboutDialog = new AboutDialog(this); categoryPanel.setCategoryPanelListener((fileExtensions, downloadCategory) -> downloadPanel .setDownloadsByDownloadPath(fileExtensions, downloadCategory)); // preferenceDialog.setDefaults(preferencesDTO); addNewDownloadDialog.setAddNewDownloadListener(textUrl -> { Objects.requireNonNull(textUrl, "textUrl"); if (textUrl.equals("")) throw new IllegalArgumentException("textUrl is empty"); String downloadName; try { downloadName = ConnectionUtil.getRealFileName(textUrl); } catch (IOException e) { logger.error("Can't get real name of file that you want to download." + textUrl); messageLogger.error("Can't get real name of file that you want to download." + textUrl); downloadName = ConnectionUtil.getFileName(textUrl); } String fileExtension = FilenameUtils.getExtension(downloadName); File downloadPathFile = new File( preferencesDTO.getPreferencesSaveDTO().getPathByFileExtension(fileExtension)); File downloadRangeFile = new File(preferencesDTO.getPreferencesSaveDTO().getTempDirectory()); int maxNum = preferencesDTO.getPreferencesConnectionDTO().getMaxConnectionNumber(); Download download = null; List<Download> downloads = downloadPanel.getDownloadList(); String properDownloadName = getProperNameForDownload(downloadName, downloads, downloadPathFile); // todo must set stretegy pattern switch (ProtocolType.valueOfByDesc(textUrl.getProtocol())) { case HTTP: download = new HttpDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum, downloadPathFile, downloadRangeFile, ProtocolType.HTTP); break; case FTP: // todo must be created ... break; case HTTPS: download = new HttpsDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum, downloadPathFile, downloadRangeFile, ProtocolType.HTTPS); break; } downloadPanel.addDownload(download); }); // Add panels to display. add(mainToolbar, BorderLayout.PAGE_START); add(mainSplitPane, BorderLayout.CENTER); add(statusPanel, BorderLayout.PAGE_END); setJMenuBar(initMenuBar()); mainToolbar.setMainToolbarListener(new MainToolbarListener() { @Override public void newDownloadEventOccured() { addNewDownloadDialog.setVisible(true); addNewDownloadDialog.onPaste(); } @Override public void pauseEventOccured() { downloadPanel.actionPause(); mainToolbar.setStateOfButtonsControl(false, false, false, false, false, true); // canceled } @Override public void resumeEventOccured() { downloadPanel.actionResume(); } @Override public void pauseAllEventOccured() { downloadPanel.actionPauseAll(); } @Override public void clearEventOccured() { downloadPanel.actionClear(); } @Override public void clearAllCompletedEventOccured() { downloadPanel.actionClearAllCompleted(); } @Override public void reJoinEventOccured() { downloadPanel.actionReJoinFileParts(); } @Override public void reDownloadEventOccured() { downloadPanel.actionReDownload(); } @Override public void propertiesEventOccured() { downloadPanel.actionProperties(); } @Override public void preferencesEventOccured() { preferenceDialog.setVisible(true); } }); downloadPanel.setDownloadPanelListener(new DownloadPanelListener() { @Override public void stateChangedEventOccured(DownloadStatus downloadState) { updateButtons(downloadState); } @Override public void downloadSelected(Download download) { statusPanel.setStatus(download.getDownloadName()); } }); preferenceDialog.setPreferencesListener(new PreferencesListener() { @Override public void preferencesSet(PreferencesDTO preferenceDTO) { setPreferencesOS(preferenceDTO); } @Override public void preferenceReset() { PreferencesDTO resetPreferencesDTO = getPreferences(); preferenceDialog.setPreferencesDTO(resetPreferencesDTO); categoryPanel.setTreeModel( resetPreferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs()); } @Override public void preferenceDefaults() { PreferencesDTO defaultPreferenceDTO = new PreferencesDTO(); resetAndSetPreferencesDTOFromConf(defaultPreferenceDTO); preferenceDialog.setPreferencesDTO(defaultPreferenceDTO); categoryPanel.setTreeModel( defaultPreferenceDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs()); } }); // Handle window closing events. addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { int action = JOptionPane.showConfirmDialog(DownloadManagerGUI.this, "Do you realy want to exit the application?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION); if (action == JOptionPane.OK_OPTION) { logger.info("Window Closing"); downloadPanel.actionPauseAll(); dispose(); System.gc(); } } }); Authenticator.setDefault(new DialogAuthenticator(this)); setIconImage( Utils.createIcon(messagesBundle.getString("downloadManagerGUI.mainFrame.iconPath")).getImage()); setMinimumSize(new Dimension(640, 480)); // Set window size. pack(); setSize(900, 580); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setVisible(true); }
From source file:com.paniclauncher.data.Instance.java
public void launch() { final Account account = App.settings.getAccount(); if (account == null) { String[] options = { App.settings.getLocalizedString("common.ok") }; JOptionPane.showOptionDialog(App.settings.getParent(), App.settings.getLocalizedString("instance.noaccount"), App.settings.getLocalizedString("instance.noaccountselected"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); App.settings.setMinecraftLaunched(false); } else {// w w w . j a va 2s. c o m String username = account.getUsername(); String password = account.getPassword(); if (!account.isRemembered()) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel passwordLabel = new JLabel( App.settings.getLocalizedString("instance.enterpassword", account.getMinecraftUsername())); JPasswordField passwordField = new JPasswordField(); panel.add(passwordLabel, BorderLayout.NORTH); panel.add(passwordField, BorderLayout.CENTER); int ret = JOptionPane.showConfirmDialog(App.settings.getParent(), panel, App.settings.getLocalizedString("instance.enterpasswordtitle"), JOptionPane.OK_CANCEL_OPTION); if (ret == JOptionPane.OK_OPTION) { password = new String(passwordField.getPassword()); } else { App.settings.setMinecraftLaunched(false); return; } } boolean loggedIn = false; String url = null; String sess = null; String auth = null; if (!App.settings.isInOfflineMode()) { if (isNewLaunchMethod()) { String result = Utils.newLogin(username, password); if (result == null) { loggedIn = true; sess = "token:0:0"; } else { JSONParser parser = new JSONParser(); try { Object obj = parser.parse(result); JSONObject jsonObject = (JSONObject) obj; if (jsonObject.containsKey("accessToken")) { String accessToken = (String) jsonObject.get("accessToken"); JSONObject profile = (JSONObject) jsonObject.get("selectedProfile"); String profileID = (String) profile.get("id"); sess = "token:" + accessToken + ":" + profileID; loggedIn = true; } else { auth = (String) jsonObject.get("errorMessage"); } } catch (ParseException e1) { App.settings.getConsole().logStackTrace(e1); } } } else { try { url = "https://login.minecraft.net/?user=" + URLEncoder.encode(username, "UTF-8") + "&password=" + URLEncoder.encode(password, "UTF-8") + "&version=999"; } catch (UnsupportedEncodingException e1) { App.settings.getConsole().logStackTrace(e1); } auth = Utils.urlToString(url); if (auth == null) { loggedIn = true; sess = "0"; } else { if (auth.contains(":")) { String[] parts = auth.split(":"); if (parts.length == 5) { loggedIn = true; sess = parts[3]; } } } } } else { loggedIn = true; sess = "token:0:0"; } if (!loggedIn) { String[] options = { App.settings.getLocalizedString("common.ok") }; JOptionPane .showOptionDialog(App.settings.getParent(), "<html><center>" + App.settings.getLocalizedString("instance.errorloggingin", "<br/><br/>" + auth) + "</center></html>", App.settings.getLocalizedString("instance.errorloggingintitle"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]); App.settings.setMinecraftLaunched(false); } else { final String session = sess; Thread launcher = new Thread() { public void run() { try { long start = System.currentTimeMillis(); if (App.settings.getParent() != null) { App.settings.getParent().setVisible(false); } Process process = null; if (isNewLaunchMethod()) { process = NewMCLauncher.launch(account, Instance.this, session); } else { process = MCLauncher.launch(account, Instance.this, session); } App.settings.showKillMinecraft(process); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { App.settings.getConsole().logMinecraft(line); } App.settings.hideKillMinecraft(); if (App.settings.getParent() != null) { App.settings.getParent().setVisible(true); } long end = System.currentTimeMillis(); if (App.settings.isInOfflineMode()) { App.settings.checkOnlineStatus(); } App.settings.setMinecraftLaunched(false); if (!App.settings.isInOfflineMode()) { if (App.settings.isUpdatedFiles()) { App.settings.reloadLauncherData(); } } } catch (IOException e1) { App.settings.getConsole().logStackTrace(e1); } } }; launcher.start(); } } }
From source file:be.agiv.security.demo.Main.java
private void secConvIssueToken() { GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); JPanel contentPanel = new JPanel(gridBagLayout); JLabel urlLabel = new JLabel("URL:"); gridBagConstraints.gridx = 0;//from w w w .ja va 2 s.c o m gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.ipadx = 5; gridBagLayout.setConstraints(urlLabel, gridBagConstraints); contentPanel.add(urlLabel); JTextField urlTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_SC_LOCATION, 60); gridBagConstraints.gridx++; gridBagLayout.setConstraints(urlTextField, gridBagConstraints); contentPanel.add(urlTextField); JLabel warningLabel = new JLabel( "This operation can fail if the web service does not support WS-SecurityConversation."); gridBagConstraints.gridx = 0; gridBagConstraints.gridy++; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagLayout.setConstraints(warningLabel, gridBagConstraints); contentPanel.add(warningLabel); int result = JOptionPane.showConfirmDialog(this, contentPanel, "Secure Conversation Issue Token", JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION) { return; } String location = urlTextField.getText(); SecureConversationClient secConvClient = new SecureConversationClient(location); try { this.secConvSecurityToken = secConvClient.getSecureConversationToken(this.rStsSecurityToken); this.secConvViewMenuItem.setEnabled(true); this.secConvCancelMenuItem.setEnabled(true); secConvViewToken(); } catch (Exception e) { showException(e); } }
From source file:kevin.gvmsgarch.App.java
private static String getPassword() { String retval = null;//w ww.j a v a 2s .com JPasswordField pwd = new JPasswordField(20); int optionSelected = JOptionPane.showConfirmDialog(null, pwd, "Enter Password", JOptionPane.OK_CANCEL_OPTION); if (optionSelected == JOptionPane.OK_OPTION) { retval = new String(pwd.getPassword()); } return retval; }
From source file:com.freedomotic.jfrontend.PluginConfigure.java
private void uninstallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uninstallButtonActionPerformed Plugin item = (Plugin) cmbPlugin.getSelectedItem(); File boundleRootFolder = item.getFile().getParentFile(); String uninstallCandidates = clients.getClients().stream().filter(client -> client instanceof Plugin) .map(plugin -> (Plugin) plugin) .filter(plugin -> plugin.getFile().getParentFile().equals(boundleRootFolder)) .map(plugin -> "'" + plugin.getName() + "'").collect(Collectors.joining(" ")); String localizedMessage = api.getI18n().msg("confirm_plugin_delete", new Object[] { uninstallCandidates }); int result = JOptionPane.showConfirmDialog(null, new JLabel(localizedMessage), api.getI18n().msg("confirm_deletion_title"), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { pluginsManager.uninstallBundle(item); dispose();/*from w w w . java 2 s . c om*/ } }
From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java
private ReferenceFormat formatChooser(Collection<ReferenceFormat> formats) { ReferenceFormat[] formatsArray = formats.toArray(new ReferenceFormat[0]); String[] options = new String[formats.size()]; for (int i = 0; i < formats.size(); i++) { options[i] = formatsArray[i].getDescription(); }/* w w w. j a v a 2s .c om*/ int result = JOptionPane.showOptionDialog(frame, "Please choose a reference format.", "Choose a reference format", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); if (result == JOptionPane.CLOSED_OPTION) return null; return formatsArray[result]; }
From source file:view.App.java
private void initGUI() { try {/*from w w w.j ava 2 s. c om*/ { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.setPreferredSize(new java.awt.Dimension(901, 398)); { jPanel2 = new JPanel(); BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.Y_AXIS); jPanel2.setLayout(jPanel2Layout); jPanel1.add(jPanel2, BorderLayout.WEST); jPanel2.setPreferredSize(new java.awt.Dimension(292, 446)); { jPanel5 = new JPanel(); jPanel2.add(jPanel5); jPanel5.setPreferredSize(new java.awt.Dimension(292, 109)); { { jTextArea1 = new JTextArea(); jTextArea1.setWrapStyleWord(true); jTextArea1.setLineWrap(true); DefaultCaret caret = (DefaultCaret) jTextArea1.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); jTextArea1.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { if (jTable1.getModel().getRowCount() == 0 && !jButton1.isEnabled()) { jButton1.setEnabled(true); jTextArea1.setText(""); } } }); JScrollPane sp = new JScrollPane(); sp.setPreferredSize(new java.awt.Dimension(281, 97)); sp.setViewportView(jTextArea1); jPanel5.add(sp, BorderLayout.CENTER); } } } { jPanel4 = new JPanel(); jPanel2.add(jPanel4); FlowLayout jPanel4Layout = new FlowLayout(); jPanel4Layout.setAlignment(FlowLayout.RIGHT); jPanel4.setPreferredSize(new java.awt.Dimension(292, 45)); jPanel4.setSize(102, 51); jPanel4.setLayout(jPanel4Layout); { jButton1 = new JButton(); jPanel4.add(jButton1); jButton1.setText("Get Quotes"); jButton1.setSize(100, 50); jButton1.setPreferredSize(new java.awt.Dimension(100, 26)); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // String tickerStr = jTextArea1.getText(); if (tickerStr.equals("") || tickerStr.equals(null) || tickerStr.equals(" ")) { jTextArea1.setText(" "); return; } StringTokenizer tokenizer = new StringTokenizer(tickerStr, " "); String[] tickers = new String[tokenizer.countTokens()]; int i = 0; while (tokenizer.hasMoreTokens()) { tickers[i] = tokenizer.nextToken(); i++; } try { Controller.getQuotes(tickers); } catch (CloneNotSupportedException e) { JOptionPane.showMessageDialog(jPanel1, " "); } jButton1.setEnabled(false); } }); } } { jPanel6 = new JPanel(); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); jPanel2.add(jPanel6); { jScrollPane1 = new JScrollPane(); jPanel6.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(292, 341)); { TableModel jTable1Model = new DefaultTableModel(null, new String[] { "", "MA Value", "", "MA Value" }); jTable1 = new JTable(); jScrollPane1.setViewportView(jTable1); jTable1.setModel(jTable1Model); jTable1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } } } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jPanel1.add(jPanel3, BorderLayout.CENTER); { // chart = ChartFactory.createLineChart(" ", "dates", "correlation ratio", null, // PlotOrientation.VERTICAL, true, true, false); // ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setPreferredSize( new java.awt.Dimension( 560 , 367 ) ); // jPanel3.add(chartPanel); } { } } } this.setSize(966, 531); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenu3.setText("File"); { // newFileMenuItem = new JMenuItem(); // jMenu3.add(newFileMenuItem); // newFileMenuItem.setText("New"); // newFileMenuItem.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent evt) { //// jTextArea1.setText(""); //// DefaultTableModel model = (DefaultTableModel)jTable1.getModel(); //// model.setRowCount(0); //// Controller.clearPortfolio(); // } // }); } { jSeparator2 = new JSeparator(); jMenu3.add(jSeparator2); } { exitMenuItem = new JMenuItem(); jMenu3.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int action = JOptionPane.showConfirmDialog(jPanel1, " ?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION); if (action == JOptionPane.OK_OPTION) System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { cutMenuItem = new JMenuItem(); jMenu4.add(cutMenuItem); cutMenuItem.setText("Cut"); cutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String txt = jTextArea1.getText(); StringSelection selection = new StringSelection(txt); Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); clp.setContents(selection, null); jTextArea1.setText(""); } }); } { copyMenuItem = new JMenuItem(); jMenu4.add(copyMenuItem); copyMenuItem.setText("Copy"); copyMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String txt = jTextArea1.getText(); StringSelection selection = new StringSelection(txt); Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); clp.setContents(selection, null); } }); } { pasteMenuItem = new JMenuItem(); jMenu4.add(pasteMenuItem); pasteMenuItem.setText("Paste"); pasteMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard(); try { String data = (String) clp.getData(DataFlavor.stringFlavor); jTextArea1.setText(data); } catch (UnsupportedFlavorException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("About"); helpMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(jPanel1, " . r.zhumagulov@gmail.com", "About", JOptionPane.PLAIN_MESSAGE); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.konifar.material_icon_generator.MaterialDesignIconGenerateDialog.java
private void create() { if (model.isMdpi()) createIcon(checkBoxMdpi.getText()); if (model.isHdpi()) createIcon(checkBoxHdpi.getText()); if (model.isXhdpi()) createIcon(checkBoxXhdpi.getText()); if (model.isXxhdpi()) createIcon(checkBoxXxhdpi.getText()); if (model.isXxxhdpi()) createIcon(checkBoxXxxhdpi.getText()); JOptionPane.showConfirmDialog(panelMain, "Icon created successfully.", "Material design icon created", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(getClass().getResource(ICON_DONE))); }
From source file:Import.pnl_import_vcf.java
private void btn_importActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_importActionPerformed // TODO add your handling code here: String[] singleColumns = singleColumns(); String[] selectedFamilies = selectedFamilies(); CheckBoxList checkList = new CheckBoxList(); DefaultListModel model = new DefaultListModel(); for (String a : singleColumns) { model.addElement(a);/*w w w. j a v a 2 s . c o m*/ } checkList.setModel(model); String filePath = filePathField.getText(); if (rbt_existing_tbl.isSelected()) { try { String[] selectedTableFamilies = tableFamilies(); JTable tableMap = new JTable(); DefaultTableModel tableMapModel = (DefaultTableModel) tableMap.getModel(); setMapTable(tableMap, tableMapModel, selectedFamilies, selectedTableFamilies); int map = JOptionPane.showConfirmDialog(null, tableMap, "Please map to column", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null); if (map == 2) { return; } Object[] o = getMapPair(tableMapModel); String selectTableName = tbl_hbase_tables.getValueAt(tbl_hbase_tables.getSelectedRow(), 0) .toString(); String[] mappedFamilies = (String[]) o[1]; String[] mappedTableFamilies = (String[]) o[0]; String[] keys = getKey(selectTableName); importToTable.importDataJob importData = new importDataJob(); importData.importData(filePath, selectTableName, mappedTableFamilies, mappedFamilies, keys); } catch (Exception ex) { Logger.getLogger(pnl_import_vcf.class.getName()).log(Level.SEVERE, null, ex); } } else { try { int key = JOptionPane.showConfirmDialog(null, checkList, "Please choose Key", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null); if (key == 2) { return; } Object[] selectedKey = checkList.getCheckBoxListSelectedValues(); File f = new File(filePath); String fname = f.getName(); String tableName = FilenameUtils.removeExtension(fname); writeKey(selectedKey, tableName); writeType(tableName); createColumnsTxt(tableName); ArrayList<String> list = new ArrayList<>(); for (Object o : selectedKey) { list.add(o.toString()); } String[] keys = list.toArray(new String[list.size()]); importToNewTable.createDataJob importData = new createDataJob(); importData.importData(filePath, selectedFamilies, keys); } catch (Exception ex) { Logger.getLogger(pnl_import_vcf.class.getName()).log(Level.SEVERE, null, ex); } } filePathField.setText(null); DefaultDualListModel dualModel = new DefaultDualListModel(); list_dual_hbase_column_family.setModel(dualModel); pnl_import_vcf.showHBaseTables runabletask = new pnl_import_vcf.showHBaseTables(); new Thread(runabletask).start(); }
From source file:kevin.gvmsgarch.App.java
public static void showErrorDialog(final Exception text) { try {/*from w ww . j av a 2s . c o m*/ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JPanel panel = new JPanel(); JTextArea textArea = new JTextArea(); JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scroll.setMinimumSize(new Dimension(800, 240)); panel.add(scroll); panel.setMinimumSize(new Dimension(800, 240)); ByteArrayOutputStream baos; text.printStackTrace(new PrintStream(baos = new ByteArrayOutputStream())); textArea.setText(new String(baos.toByteArray())); JOptionPane.showConfirmDialog(null, panel, "Why did this happen?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); } }); } catch (Exception ex) { System.err.println("ermmm...?"); ex.printStackTrace(); } }