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:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.filtering.SingleCutOffFilteringController.java
/** * Initialize the main view./*from w ww . j a v a2s .c o m*/ */ private void initMainView() { // make a new view singleCutOffPanel = new SingleCutOffPanel(); singleCutOffPanel.getMedianDisplList().setModel(new DefaultListModel()); // action listeners singleCutOffPanel.getApplyCutOffButton().addActionListener((ActionEvent e) -> { // try to read the user-inserted values for up and down limit // check for number format exception try { cutOff = Double.parseDouble(singleCutOffPanel.getCutOffTextField().getText()); FilterSwingWorker filterSwingWorker = new FilterSwingWorker(); filterSwingWorker.execute(); } catch (NumberFormatException ex) { // warn the user and log the error for info filteringController.showMessage( "Please insert a valid number for the cut-off!" + "\n " + ex.getMessage(), "number format exception", JOptionPane.ERROR_MESSAGE); LOG.error(ex.getMessage()); } }); AlignedTableRenderer alignedTableRenderer = new AlignedTableRenderer(SwingConstants.LEFT); for (int i = 0; i < singleCutOffPanel.getSummaryTable().getColumnModel().getColumnCount(); i++) { singleCutOffPanel.getSummaryTable().getColumnModel().getColumn(i).setCellRenderer(alignedTableRenderer); } singleCutOffPanel.getSummaryTable().getTableHeader() .setDefaultRenderer(new TableHeaderRenderer(SwingConstants.LEFT)); // add view to parent container filteringController.getFilteringPanel().getSingleCutOffParentPanel().add(singleCutOffPanel, gridBagConstraints); }
From source file:com.clough.android.adbv.manager.ADBManager.java
/** * Executing the adb commands given in var-args * @param args adb command in var-args//from ww w . j av a2 s.c o m */ private synchronized void adb(final String... args) { String[] commands = new String[args.length + 1]; commands[0] = adbPath; System.arraycopy(args, 0, commands, 1, args.length); try { Runtime.getRuntime().exec(commands).waitFor(); } catch (IOException ex) { JOptionPane.showMessageDialog(null, ex.getLocalizedMessage(), "Android DB Viewer", JOptionPane.ERROR_MESSAGE); } catch (InterruptedException ex) { JOptionPane.showMessageDialog(null, ex.getLocalizedMessage(), "Android DB Viewer", JOptionPane.ERROR_MESSAGE); } }
From source file:com.emental.mindraider.ui.dialogs.AddTripletJDialog.java
/** * Create a triplet./* ww w .j av a 2s .c o m*/ */ protected void createTriplet() { if (StringUtils.isEmpty(predicateNs.getText())) { predicateNs.setText(MindRaiderConstants.MR_RDF_NS); } if (StringUtils.isEmpty(predicateLocalName.getText())) { predicateLocalName.setText(MindRaiderConstants.MR_RDF_PREDICATE); } if (StringUtils.isEmpty(objectNs.getText())) { objectNs.setText(MindRaiderConstants.MR_RDF_NS); } if (StringUtils.isEmpty(objectLocalName.getText())) { JOptionPane.showMessageDialog(MindRaider.mainJFrame, "You must specify object name.", "Statement Creation Error", JOptionPane.ERROR_MESSAGE); return; } MindRaider.spidersGraph.createStatement(new QName(predicateNs.getText(), predicateLocalName.getText()), new QName(objectNs.getText(), objectLocalName.getText()), literalCheckBox.isSelected()); AddTripletJDialog.this.dispose(); }
From source file:com.sec.ose.osi.sdk.protexsdk.project.ProjectAPIWrapper.java
private static String createProject(String newProjectName, AnalysisSourceLocation newAnalysisSourceLocation, UIResponseObserver observer) {/*from ww w. j a va2s . com*/ if (observer == null) { observer = new DefaultUIResponseObserver(); } if (isExistedProjectName(newProjectName) == true) { observer.setFailMessage("\"" + newProjectName + "\" is already existed."); log.debug("\"" + newProjectName + "\" is already existed."); return null; } String projectID = null; ProjectRequest pRequest = new ProjectRequest(); PolicyCheckResult p = ProjectNamePolicy.checkProjectName(newProjectName); if (p.getResult() != PolicyCheckResult.PROJECT_NAME_OK) { observer.setFailMessage(p.getResultMsg()); return null; } final String DESCRIPTION = "This project is created by OSI - " + DateUtil.getCurrentTime("[%1$tY/%1$tm/%1$te(%1$ta) %1$tl:%1$tM:%1$tS %1$tp]"); pRequest.setName(newProjectName); pRequest.setDescription(DESCRIPTION); if (newAnalysisSourceLocation != null) { pRequest.setAnalysisSourceLocation(newAnalysisSourceLocation); } try { projectID = ProtexSDKAPIManager.getProjectAPI().createProject(pRequest, LicenseCategory.PROPRIETARY); } catch (SdkFault e) { log.warn(e); ErrorCode errorCode = e.getFaultInfo().getErrorCode(); try { Thread.sleep(1000); } catch (InterruptedException ie) { ie.printStackTrace(); } if (errorCode == ErrorCode.DUPLICATE_PROJECT_NAME) { String[] button = { "OK" }; JOptionPane.showOptionDialog( // block null, "The project name \"" + newProjectName + "\" is already created by other user.", "Duplicated project name", JOptionPane.YES_OPTION, JOptionPane.ERROR_MESSAGE, null, button, "OK"); } return null; } if (projectID == null) return null; setScanIgnorePattern(projectID, ProjectNamePolicy.IGNORED_PATTERN, observer); observer.pushMessage("[ok]\n"); return projectID; }
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
private JPanel createChartBottomPanel(final ChartPanel chartPanel) { final AbstractButton zoomAllButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/view-fullscreen.png"), false); zoomAllButton.setToolTipText("Zoom all."); zoomAllButton.setName("zoomAllButton."); zoomAllButton.addActionListener(e -> { chartPanel.restoreAutoBounds();/*from w w w . ja va 2 s.c o m*/ chartPanel.repaint(); }); final AbstractButton propertiesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Edit24.gif"), false); propertiesButton.setToolTipText("Edit properties."); propertiesButton.setName("propertiesButton."); propertiesButton.addActionListener(e -> chartPanel.doEditChartProperties()); final AbstractButton saveButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); saveButton.setToolTipText("Save chart as image."); saveButton.setName("saveButton."); saveButton.addActionListener(e -> { try { chartPanel.doSaveAs(); } catch (IOException e1) { JOptionPane.showMessageDialog(chartPanel, "Could not save chart:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }); final AbstractButton printButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Print24.gif"), false); printButton.setToolTipText("Print chart."); printButton.setName("printButton."); printButton.addActionListener(e -> chartPanel.createChartPrintJob()); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(4, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(4, 1.0); JPanel buttonPanel = new JPanel(tableLayout); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); buttonPanel.add(zoomAllButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(propertiesButton); buttonPanel.add(saveButton); buttonPanel.add(printButton); buttonPanel.add(new JPanel()); buttonPanel.add(getHelpButton()); return buttonPanel; }
From source file:EditorPaneExample9.java
public EditorPaneExample9() { super("JEditorPane Example 9"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/*from w w w .j av a 2 s. com*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String url = textField.getText(); try { // Check if the new page and the old // page are the same. URL newURL = new URL(url); URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(newURL)) { return; } // Try to display the page textField.setEnabled(false); // Disable input textField.paintImmediately(0, 0, textField.getSize().width, textField.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); timeLabel.setText(""); timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height); startTime = System.currentTimeMillis(); // Choose the loading method if (onlineLoad.isSelected()) { // Usual load via setPage pane.setPage(url); loadedType.setText(pane.getContentType()); } else { pane.setContentType("text/html"); loadedType.setText(pane.getContentType()); if (loader == null) { loader = new HTMLDocumentLoader(); } HTMLDocument doc = loader.loadDocument(new URL(url)); loadComplete(); pane.setDocument(doc); displayLoadTime(); } } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); textField.setEnabled(true); setCursor(Cursor.getDefaultCursor()); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); } } }); }
From source file:com.intuit.tank.proxy.settings.ui.ProxyConfigDialog.java
protected void saveConfig(boolean saveAs) throws IOException { int port = getProxyConfigPanel().getPort(); boolean followRedirecs = getProxyConfigPanel().getFollowRedirects(); String outputFile = getProxyConfigPanel().getOutputFileName(); File file = new File(outputFile); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs();//w w w . j ava2 s.c om } if (file.isDirectory()) { file = new File(file, CommonsProxyConfiguration.SUGGESTED_CONFIG_NAME); } else if (!file.getName().toLowerCase().endsWith(".xml")) { String fileName = file.getName(); if (StringUtils.isEmpty(file.getName())) { fileName = CommonsProxyConfiguration.SUGGESTED_CONFIG_NAME; } else { fileName = file.getName() + ".xml"; } file = new File(file.getParentFile(), fileName); } if ((file.exists() && !file.canWrite()) || !file.getParentFile().canWrite()) { JOptionPane.showMessageDialog(this, "Cannot write to file - " + file.getCanonicalPath(), "Error", JOptionPane.ERROR_MESSAGE); return; } outputFile = file.getCanonicalPath(); Set<ConfigInclusionExclusionRule> inclusions = getProxyConfigPanel().getInclusionData(); Set<ConfigInclusionExclusionRule> exclusions = getProxyConfigPanel().getExclusionData(); Set<ConfigInclusionExclusionRule> bodyInclusions = getProxyConfigPanel().getBodyInclusionData(); Set<ConfigInclusionExclusionRule> bodyExclusions = getProxyConfigPanel().getBodyExclusionData(); String configFile = saveAs ? null : configHandler.getConfigFile(); save(port, followRedirecs, outputFile, inclusions, exclusions, bodyInclusions, bodyExclusions, configFile); }
From source file:com.sshtools.shift.FileTransferDialog.java
/** * Creates a new FileTransferDialog object. * * @param frame/*from w ww .j a va 2s . c om*/ * @param title * @param fileCount */ /*public FileTransferDialog(Frame frame, String title) { this(frame, title, op.getNewFiles().size() + op.getUpdatedFiles().size()); this.op = op; }*/ public FileTransferDialog(Frame frame, String title, int fileCount) { super("0% Complete - " + title); this.setIconImage(ShiftSessionPanel.FILE_BROWSER_ICON.getImage()); this.title = title; try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if (cancelled || completed) { setVisible(false); } else { if (JOptionPane.showConfirmDialog(FileTransferDialog.this, "Cancel the file operation(s)?", "Close Window", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE) == JOptionPane.YES_OPTION) { cancelOperation(); hide(); } } } }); }
From source file:appmain.AppMain.java
private void writeCSV(File csv, List<String> content) { BufferedWriter writer = null; try {/*from www. j a va 2 s. c om*/ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(csv, true), "ISO-8859-2")); for (String line : content) { writer.write(line + System.lineSeparator()); } writer.flush(); } catch (IOException | HeadlessException e) { JOptionPane.showMessageDialog(null, "Hiba a CSV fjl rsa kzben!\n" + ExceptionUtils.getStackTrace(e), "Hiba", JOptionPane.ERROR_MESSAGE); } finally { if (writer != null) { try { writer.close(); } catch (IOException ex) { ex.printStackTrace(); } } } }
From source file:javaresturentdesktopclient.UserLogIn.java
private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed // TODO add your handling code here: String username = jTextField1.getText(); // String username = jTextField1.getText(); String password;/*from ww w . j a v a2s . c om*/ password = jPasswordField1.getText(); //List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); //nameValuePairs.add(new BasicNameValuePair("registrationid", "123456789")); List<NameValuePair> paramList = new ArrayList<>(); ServletRequest.setServletRequest(Constant.LOGIN_SERVLET); paramList.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_LOGIN_METHOD)); paramList.add(new BasicNameValuePair(Constant.KEY_USERNAME, username)); paramList.add(new BasicNameValuePair(Constant.KEY_PASSWORD, password)); String response = HttpClientUtil.postRequest(paramList); if (response.equalsIgnoreCase("success")) { JOptionPane.showMessageDialog(null, "Login Success", "Information", JOptionPane.INFORMATION_MESSAGE); Home_page go_for_hmpg = new Home_page(this); go_for_hmpg.setUserNameTextField(getUsername()); go_for_hmpg.setVisible(true); go_for_hmpg.setResizable(false); this.hide(); jPasswordField1.setText(null); } else JOptionPane.showMessageDialog(null, "Login Failed!" + "PLEASE GIVE THE CORRECT USER NAME AND PASSWORD", "Error Message", JOptionPane.ERROR_MESSAGE); }