List of usage examples for javax.swing JOptionPane ERROR_MESSAGE
int ERROR_MESSAGE
To view the source code for javax.swing JOptionPane ERROR_MESSAGE.
Click Source Link
From source file:edu.wpi.cs.wpisuitetng.janeway.gui.login.LoginController.java
/** * Method that is called by {@link ProjectSelectRequestObserver} if the login * request was successful./*from w ww . j ava 2s .co m*/ * * @param response the response returned by the server */ public void projectSelectSuccessful(ResponseModel response) { // Save the cookies List<String> cookieList = response.getHeaders().get("Set-Cookie"); String cookieParts[]; String cookieNameVal[]; if (cookieList != null) { // if the server returned cookies for (String cookie : cookieList) { // for each returned cookie cookieParts = cookie.split(";"); if (cookieParts.length >= 1) { cookieNameVal = cookieParts[0].split("="); if (cookieNameVal.length == 2) { NetworkConfiguration config = Network.getInstance().getDefaultNetworkConfiguration(); config.addCookie(cookieNameVal[0], cookieNameVal[1]); Network.getInstance().setDefaultNetworkConfiguration(config); } else { System.err.println("Received unparsable cookie: " + cookie); } } else { System.err.println("Received unparsable cookie: " + cookie); } } System.out.println(Network.getInstance().getDefaultNetworkConfiguration().getRequestHeaders() .get("cookie").get(0)); // Show the main GUI mainGUI.setVisible(true); view.dispose(); } else { JOptionPane.showMessageDialog(view, "Unable to select project: no cookies returned.", "Project Selection Error", JOptionPane.ERROR_MESSAGE); } }
From source file:lu.fisch.moenagade.model.Project.java
public BloxsClass renameEntity(Entity entity) { String name = entity.getName(); boolean result; do {//from w w w . j a v a2s. c om name = (String) JOptionPane.showInputDialog(frame, "Please enter the entitie's name.", "Rename entity", JOptionPane.PLAIN_MESSAGE, null, null, name); if (name == null) return null; result = true; // check if name is OK Matcher matcher = Pattern.compile("^[a-zA-Z_$][a-zA-Z_$0-9]*$").matcher(name); boolean found = matcher.find(); if (!found) { result = false; JOptionPane.showMessageDialog(frame, "Please chose a valid name.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } // check if name is unique else if (entities.containsKey(name)) { result = false; JOptionPane.showMessageDialog(frame, "This name is not unique.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } // check internal name else if (name.trim().equals("Entity")) { result = false; JOptionPane.showMessageDialog(frame, "The name \"Entity\" is already internaly\nused and thus not allowed!", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else if (name.charAt(0) != name.toUpperCase().charAt(0)) { result = false; JOptionPane.showMessageDialog(frame, "The name should start with a capital letter.", "Error", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); } else { // send refresh refresh(new Change(null, -1, "rename.entity", entity.getName(), name)); // switch entities.remove(entity.getName()); entities.put(name, entity); // rename file (if present) File fFrom = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "entities" + System.getProperty("file.separator") + entity.getName() + ".bloxs"); File fTo = new File(directoryName + System.getProperty("file.separator") + "bloxs" + System.getProperty("file.separator") + "entities" + System.getProperty("file.separator") + name + ".bloxs"); if (fFrom.exists()) fFrom.renameTo(fTo); // do the rename entity.setName(name); return entity; } } while (!result); return null; }
From source file:cpsControllers.ConversionController.java
/** * Maksymalna rnica (MD, ang. <i>Maximum Difference</i>) * // ww w. ja v a2 s. c o m * @return */ public double obl_MD(ArrayList<Double> punktyY, ArrayList<Double> _doPorownania) { double wynik = 0; try { if (!punktyY.isEmpty() && !_doPorownania.isEmpty()) { double tmp; wynik = Math.abs(punktyY.get(0) - _doPorownania.get(0)); for (int i = 1; i < _doPorownania.size(); i++) { tmp = Math.abs(punktyY.get(i) - _doPorownania.get(i)); if (wynik < tmp) { wynik = tmp; } } } else { if (punktyY.isEmpty()) { JOptionPane.showMessageDialog(null, "Brak sygnau.", "Bd", JOptionPane.ERROR_MESSAGE); } else if (_doPorownania.isEmpty()) { JOptionPane.showMessageDialog(null, "Brak konwersji sygnau.", "Bd", JOptionPane.ERROR_MESSAGE); } } } catch (Exception exc_MSE) { // JOptionPane.showMessageDialog(null, "Nie mona obliczy:\n" + exc_MSE.getMessage(), // "Bd", JOptionPane.ERROR_MESSAGE); } System.out.println("MD = " + wynik); return wynik; }
From source file:com.sec.ose.osi.thread.ui_related.UserRequestHandler.java
public UIResponseObserver handle(int pRequestCode, UIEntity pEntity, boolean pDisplayProgress, boolean pShowSuccessResult) { final int NUMBER_THREADS = 2; ExecutorService executorService = Executors.newFixedThreadPool(NUMBER_THREADS); UIResponseObserver observer = new DefaultUIResponseObserver(); UserCommandExecutionThread xExecutionThread = new UserCommandExecutionThread(pRequestCode, pEntity, observer);// w ww .ja v a 2 s .c om // Option 1: // in case: pDisplayProgress == true // need to display progress dialog if (pDisplayProgress == true) { // 1-1. create Progress Dialog ProgressDisplayer progressDisplayer = ProgressDisplayerFactory .getProgressDisplayer(UISharedData.getInstance().getCurrentFrame(), pRequestCode); // 1-2. Execute Monitor Thread UserCommandExecutionMonitorThread xMonitorThread = new UserCommandExecutionMonitorThread( progressDisplayer, observer); xExecutionThread.setMonitorThread(xMonitorThread); // 1-3. execute executorService.execute(xMonitorThread); executorService.execute(xExecutionThread); progressDisplayer.setVisible(true); // block here // 1-5. close remained thread if (progressDisplayer.isCancled() == true && xExecutionThread.isDone() == false) { log.debug("canceled"); xExecutionThread.cancel(); log.debug("isDone: " + xExecutionThread.isDone()); xExecutionThread = null; observer.setFailMessage("canceled"); executorService.shutdown(); return observer; } } // Option 2: // in case: pDisplayProgress == false // no need to display progress dialog else { // 2-1. execute executorService.execute(xExecutionThread); // 2-2. waiting for completing execution while (xExecutionThread.isDone() == false) { try { Thread.sleep(100); } catch (InterruptedException e) { log.warn(e); } } } // Mandatory STEP // display result int result = observer.getResult(); // opt1. the execution result is "SUCCESS" if (result == UIResponseObserver.RESULT_SUCCESS) { if (pShowSuccessResult == true) { JOptionPane.showMessageDialog(UISharedData.getInstance().getCurrentFrame(), observer.getSuccessMessage(), ProgressDictionary.getSuccessTitle(pRequestCode), JOptionPane.INFORMATION_MESSAGE); } } // opt2. if the execution result is "FAIL" or else else { if (pShowSuccessResult == true) { JOptionPane.showMessageDialog(UISharedData.getInstance().getCurrentFrame(), observer.getFailMessage(), ProgressDictionary.getErrorTitle(pRequestCode), JOptionPane.ERROR_MESSAGE); } } executorService.shutdown(); return observer; }
From source file:datasoul.util.OnlinePublishFrame.java
private void btnPublishActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPublishActionPerformed if (ServiceListTable.getActiveInstance() == null || ServiceListTable.getActiveInstance().getRowCount() == 0) { JOptionPane.showMessageDialog(this, java.util.ResourceBundle.getBundle("datasoul/internationalize") .getString("YOU CAN NOT PUBLISH AN EMPTY SERVICE."), "Datasoul", JOptionPane.ERROR_MESSAGE); return;//from w ww .j a v a 2s . c o m } String content = ServiceListTable.getActiveInstance().getJSon(); String title = txtTitle.getText(); String locale = System.getProperty("user.language"); HttpClient client = new HttpClient(); client.getParams().setParameter("http.protocol.content-charset", "UTF-8"); PostMethod method = new PostMethod(OnlineUpdateCheck.ONLINE_BASE_URL + "/service/"); try { System.out.println(URLEncoder.encode(title, "UTF-8")); method.addParameter("title", URLEncoder.encode(title, "UTF-8")); method.addParameter("content", URLEncoder.encode(content, "UTF-8")); method.addParameter("locale", URLEncoder.encode(locale, "UTF-8")); method.addParameter("description", URLEncoder.encode(txtDescription.getText(), "UTF-8")); client.executeMethod(method); String url = method.getResponseBodyAsString().trim(); lblUrl.setText("<html><a href='url'>" + url + "</a></html>"); btnPublish.setEnabled(false); txtDescription.setEnabled(false); txtTitle.setEnabled(false); java.awt.Desktop.getDesktop().browse(new URI(url)); } catch (Exception e) { e.printStackTrace(); } finally { method.releaseConnection(); } }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton createUnrepaginateButton() { JButton b = new JButton("<html><center>Click to<br>un-repaginate", UNREPAGINATE_ICON); b.setHorizontalTextPosition(SwingConstants.RIGHT); b.setIconTextGap(25);//from w w w . j a va 2 s .co m b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { int[] documentsPages = repaginator.unrepaginate(); JOptionPane.showMessageDialog( RepaginateFrame.this, "Unrepaginated " + documentsPages[0] + " documents with " + documentsPages[1] + " pages.", "Unrepagination Complete", JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(RepaginateFrame.this, ex.toString(), "Error During Unrepagination", JOptionPane.ERROR_MESSAGE); } } }); return b; }
From source file:de.fhg.iais.asc.ui.parts.HarvesterPanel.java
private JTextField createSetsTextField() { final JTextField textField = new JTextField(30); textField.addFocusListener(new FocusAdapter() { @Override// ww w .j a v a2 s. c o m public void focusGained(FocusEvent e) { e.getOppositeComponent().requestFocus(); // get the frame the panel is embedded in Component currentComponent = HarvesterPanel.this; while (currentComponent.getParent() != null && !(currentComponent instanceof JFrame)) { currentComponent = currentComponent.getParent(); } final JFrame parentFrame = currentComponent instanceof JFrame ? (JFrame) currentComponent : null; if (HarvesterPanel.this.availableSets == null) { LocalizedOptionPane.showMessageDialog(parentFrame, "No_setnames_retrieved", JOptionPane.ERROR_MESSAGE); return; } String[] selectedSets = textField.getText().split(","); //$NON-NLS-1$ for (int i = 0; i < selectedSets.length; i++) { selectedSets[i] = selectedSets[i].trim(); } SetSelectionWindow ssw = new SetSelectionWindow(parentFrame, HarvesterPanel.this.availableSets, selectedSets); ssw.setVisible(true); textField.setText(StringUtils.join(ssw.getSelectedSets(), ", ")); } }); return textField; }
From source file:org.martus.client.swingui.FxInSwingMainWindow.java
@Override public void rawError(String errorText) { JOptionPane.showMessageDialog(null, errorText, "ERROR", JOptionPane.ERROR_MESSAGE); }
From source file:com.titan.storagepanel.DownloadImageDialog.java
public DownloadImageDialog(final Frame frame) { super(frame, true); setTitle("Openstack vm os image"); setBounds(100, 100, 947, 706);//from www .ja v a2 s . c o m getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.NORTH); panel.setLayout(new MigLayout("", "[41px][107.00px][27px][95.00px][24px][95.00px][]", "[27px]")); { JLabel lblSearch = new JLabel("Search"); panel.add(lblSearch, "cell 0 0,alignx left,aligny center"); } { searchTextField = new JSearchTextField(); searchTextField.setPreferredSize(new Dimension(150, 40)); panel.add(searchTextField, "cell 1 0,growx,aligny center"); } { JLabel lblType = new JLabel("Type"); panel.add(lblType, "cell 2 0,alignx left,aligny center"); } { typeComboBox = new JComboBox( new String[] { "All", "Ubuntu", "Fedora", "Redhat", "CentOS", "Gentoo", "Windows" }); panel.add(typeComboBox, "cell 3 0,growx,aligny top"); } { JLabel lblSize = new JLabel("Size"); panel.add(lblSize, "cell 4 0,alignx left,aligny center"); } { sizeComboBox = new JComboBox(new String[] { "0-700MB", ">700MB" }); panel.add(sizeComboBox, "cell 5 0,growx,aligny top"); } { JButton btnSearch = new JButton("Search"); btnSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { d.setVisible(true); } }); panel.add(btnSearch, "cell 6 0"); } } { JScrollPane scrollPane = new JScrollPane(); contentPanel.add(scrollPane, BorderLayout.CENTER); { table = new JTable(); table.setModel(tableModel); table.addMouseListener(new JTableButtonMouseListener(table)); table.addMouseMotionListener(new JTableButtonMouseListener(table)); scrollPane.setViewportView(table); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); { JButton downloadButton = new JButton("Download"); downloadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (table.getSelectedRowCount() == 1) { JFileChooser jf = new JFileChooser(); int x = jf.showSaveDialog(frame); if (x == JFileChooser.APPROVE_OPTION) { DownloadImage p = (DownloadImage) table.getValueAt(table.getSelectedRow(), 0); DownloadFileDialog d = new DownloadFileDialog(frame, "Downloading image", true, p.file, jf.getSelectedFile()); CommonLib.centerDialog(d); d.setVisible(true); } } } }); panel.add(downloadButton); } } d = new JProgressBarDialog(frame, true); d.progressBar.setIndeterminate(true); d.progressBar.setStringPainted(true); d.thread = new Thread() { public void run() { InputStream in = null; tableModel.columnNames.clear(); tableModel.columnNames.add("image"); tableModel.editables.clear(); tableModel.editables.put(0, true); Vector<Object> col1 = new Vector<Object>(); try { d.progressBar.setString("connecting to titan image site"); in = new URL("http://titan-image.kingofcoders.com/titan-image.xml").openStream(); String xml = IOUtils.toString(in); NodeList list = TitanCommonLib.getXPathNodeList(xml, "/images/image"); for (int x = 0; x < list.getLength(); x++) { DownloadImage downloadImage = new DownloadImage(); downloadImage.author = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/author/text()"); downloadImage.authorEmail = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/authorEmail/text()"); downloadImage.License = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/License/text()"); downloadImage.description = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/description/text()"); downloadImage.file = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/file/text()"); downloadImage.os = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/os/text()"); downloadImage.osType = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/osType/text()"); downloadImage.uploadDate = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse( TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/uploadDate/text()")); downloadImage.size = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/size/text()"); downloadImage.architecture = TitanCommonLib.getXPath(xml, "/images/image[" + (x + 1) + "]/architecture/text()"); col1.add(downloadImage); } } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(frame, "Unable to connect titan image site !", "Error", JOptionPane.ERROR_MESSAGE); } finally { IOUtils.closeQuietly(in); } tableModel.values.clear(); tableModel.values.add(col1); tableModel.fireTableStructureChanged(); table.getColumnModel().getColumn(0).setCellRenderer(new DownloadImageTableCellRenderer()); // table.getColumnModel().getColumn(0).setCellEditor(new DownloadImageTableCellEditor()); for (int x = 0; x < table.getRowCount(); x++) { table.setRowHeight(x, 150); } } }; d.setVisible(true); }
From source file:com.sshtools.common.vomanagementtool.common.VOHelper.java
public static boolean addVOToFavourites(String voName, String fromGroup) { boolean isAdded = false; //First check if VO is already in Favourites TreeMap allFavVOs = getVOGroup(FAVOURITES); if (allFavVOs.containsKey(voName)) { JOptionPane.showMessageDialog(null, "VO '" + voName + "' is already in " + FAVOURITES + ".", "Error: Add VO to " + FAVOURITES, JOptionPane.ERROR_MESSAGE); } else {/*from w w w . j ava 2 s . c o m*/ TreeMap groupVOs = getVOGroup(fromGroup); if (groupVOs.containsKey(voName)) { List voDetails = (List) groupVOs.get(voName); allFavVOs.put(voName, voDetails); String newContent = createStringFromTreeMap(allFavVOs); try { writeToFile(favouritesFile, newContent); isAdded = true; } catch (IOException e) { JOptionPane.showMessageDialog( null, "Cannot add VO '" + voName + "' to " + FAVOURITES + ". Write to file '" + favouritesFile + "' failed", "Error: Add VO to " + FAVOURITES, JOptionPane.ERROR_MESSAGE); } } } return isAdded; }