List of usage examples for javax.swing JOptionPane showInternalMessageDialog
public static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType)
messageType
parameter. From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
/** * *//*from w w w . j a va 2 s. c o m*/ @Action public void saveAction() { lockedToggleButton.setSelected(true); lockTheFields(!lockedToggleButton.isSelected()); buildPDSfromTable(); try { if (pds.getPopulationDatasetID() < 0) { CanRegClientApp.getApplication().saveNewPopulationDataset(pds); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_SAVED_PDS:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); } else { try { CanRegClientApp.getApplication().deletePopulationDataset(pds.getPopulationDatasetID()); } catch (SQLException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } CanRegClientApp.getApplication().saveNewPopulationDataset(pds); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_UPDATED_PDS:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); } } catch (SecurityException | RemoteException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } if (listener != null) { listener.actionPerformed(new ActionEvent(this, 1, "refresh")); } updateSaveAsNewAndDeleteButtons(); lockTheFields(true); }
From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
@Action public void deletePopulationDataSetAction() { int result = JOptionPane.showInternalConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("REALLY_DELETE:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("REALLY_DELETE?"), JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { try {//from w ww .j a va 2 s . c om CanRegClientApp.getApplication().deletePopulationDataset(pds.getPopulationDatasetID()); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_DELETED_PDS:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); if (listener != null) { listener.actionPerformed(new ActionEvent(this, 1, "refresh")); } } catch (SQLException | RemoteException | SecurityException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
@Action public void writeToFile() { if (chooser == null) { chooser = new JFileChooser(); FileFilter filter = new FileFilter() { @Override/*from w w w.java2 s . c o m*/ public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith("json"); //NOI18N } @Override public String getDescription() { return java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("JSON FILES"); } }; chooser.setFileFilter(filter); } chooser.setSelectedFile(new File("CR5POP_" + pds.getPopulationDatasetName().replace(",", "_").replace(" ", "_").replace("__", "_") + ".json")); int returnVal = chooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { buildPDSfromTable(); String fileName = chooser.getSelectedFile().getCanonicalPath(); if (!fileName.toLowerCase().endsWith(".json")) { fileName += ".json"; } canreg.common.database.Tools.writePopulationDatasetToJSON(pds, fileName); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_SAVED_PDS_TO_FILE:_") + fileName + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); } catch (IOException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:org.eshark.dctm.task.ExecuteDQLTask.java
/** * Load the file into a String and return it. The * {@code progress} property is updated as the file is loaded. * <p>// ww w . j a v a2 s . c o m * If this task is cancelled before the entire file has been * read, null is returned. * * @return the contents of the {code file} as a String or null */ @Override protected String doInBackground() throws DfException, PropertyVetoException { JDesktopPane desktop = MainApplication.getApplication().getDesktopPane(); ResourceMap resourceMap = MainApplication.getApplication().getContext() .getResourceMap(MainApplication.class); if (StringUtils.isEmpty(mDQL)) { JOptionPane.showInternalMessageDialog(desktop, resourceMap.getString("ExecuteDQLTask.invalidQuery"), resourceMap.getString("Applicaion.err"), JOptionPane.ERROR_MESSAGE); return "failed"; } //EXECUTE THE QUERY DQLTableModel lModel = new DQLTableModel(); SorterTableModel lSModel = (SorterTableModel) mTable.getModel(); lSModel.setModel(lModel); mTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); lModel.executeQuery(mDQL); //HISTORY HANDLING if (QUERY_LIST.size() == QUERY_LIMIT) { //remove the first element from the Query History QUERY_LIST.remove(0); // add the current query at the end QUERY_LIST.add(mDQL); //System.out.println("Current Index (Delete): " + currentQueryIndx); } else { QUERY_LIST.add(mDQL); } QUERY_CURR_INDX = QUERY_LIST.size() - 1; return "succeeded"; // return your result }
From source file:org.eshark.dctm.task.ExecuteDQLTask.java
@Override protected void failed(Throwable aException) { aException.printStackTrace();/*from w w w . ja va 2 s. c om*/ JDesktopPane desktop = MainApplication.getApplication().getDesktopPane(); ResourceMap resourceMap = MainApplication.getApplication().getContext() .getResourceMap(MainApplication.class); JOptionPane.showInternalMessageDialog(desktop, aException.getMessage(), resourceMap.getString("Applicaion.err"), JOptionPane.ERROR_MESSAGE); }
From source file:org.planetcrypto.bitcoin.PlanetCryptoBitcoinUI.java
private void RemoveCoinbaseUsernameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveCoinbaseUsernameButtonActionPerformed // TODO add your handling code here: PlanetCryptoBitcoinUserConfiguration cfg = new PlanetCryptoBitcoinUserConfiguration(); existing_coinbase = cfg.getCoinbase(); if (existing_coinbase == null) { JOptionPane.showInternalMessageDialog(null, "No Users to delete", "ERROR!", JOptionPane.WARNING_MESSAGE); return;/*from w w w.j a v a 2s . co m*/ } String email = CoinbaseAPIUsernameTextField.getText(); int response; if (email.isEmpty()) { JOptionPane.showMessageDialog(null, "Please enter Coinbase Username", "ERROR: NO PARAMETERS", JOptionPane.WARNING_MESSAGE); } else if (!existing_coinbase.toString().contains(email)) { JOptionPane.showMessageDialog(null, "No such Coinbase Username: " + email + ".", "ERROR: NO SUCH USERNAME", JOptionPane.WARNING_MESSAGE); } else if (!email.isEmpty()) { response = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete " + email + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.NO_OPTION) { return; //System.out.println("User opted out of deleting " + miner + "."); } else if (response == JOptionPane.CLOSED_OPTION) { return; //System.out.println("Dialog box was closed"); } else if (response == JOptionPane.YES_OPTION) { JOptionPane.showMessageDialog(null, cfg.removeCoinbase(email)); CoinbaseAPIUsernameTextField.setText(""); GenericInformationCoinbaseUserSelectionBox .setModel(new DefaultComboBoxModel(existingCoinbase().toArray())); CurrentCoinbaseConfigurationTextPanePropertyChange(null); cfg.closeAll(); } } }
From source file:org.stanwood.nwn2.gui.MainWindow.java
private void displayGUIFile() { File guiFile = getSelectedFile(); FileInputStream fs = null;//from w w w . j ava 2 s .c o m try { fs = new FileInputStream(guiFile); NWN2GUIParser parser = new NWN2GUIParser(fs); parser.parse(); if (guiFile.exists()) { GUIWindow window = new GUIWindow("GUI: " + guiFile.getName(), parser.getGUI()); window.setVisible(true); } else { JOptionPane.showInternalMessageDialog(this, "Unable to find GUI XML file '" + guiFile.getAbsolutePath() + "'", "NWN2GUI Error", JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { log.error(e.getMessage(), e); } finally { if (fs != null) { try { fs.close(); } catch (IOException e) { e.printStackTrace(); } } } }