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:hr.fer.zemris.vhdllab.platform.manager.simulation.DefaultSimulationManager.java
@Override public void compile(File file) { Validate.notNull(file, "File can't be null"); if (!file.getType().isCompilable()) { logger.info(file.getName() + " isn't compilable"); return;/*w ww . j ava 2 s . c o m*/ } Project project = file.getProject(); EditorManager em = editorManagerFactory.getAllAssociatedWithProject(project); boolean shouldCompile = em.save(true, SaveContext.COMPILE_AFTER_SAVE); if (shouldCompile) { List<CompilationMessage> messages; try { messages = simulator.compile(file.getId()); } catch (SimulatorTimeoutException e) { String message = localizationSource.getMessage("simulator.compile.timout", new Object[] { file.getName() }); messages = Collections.singletonList(new CompilationMessage(message)); } catch (NoAvailableProcessException e) { String message = localizationSource.getMessage("simulator.compile.no.processes", new Object[] { file.getName() }); messages = Collections.singletonList(new CompilationMessage(message)); } catch (CompilationException e) { if (e.getMessage().endsWith("Neither compilation nor simulation can be run.")) { Frame frame = Application.instance().getActiveWindow().getControl(); JOptionPane.showMessageDialog(frame, e.getMessage(), "Couldn't run complation", JOptionPane.ERROR_MESSAGE); return; } throw e; } lastCompiledFile = file; fireCompiled(file, messages); logger.info(localizationSource.getMessage(COMPILED_MESSAGE, new Object[] { file.getName(), project.getName() })); } }
From source file:gate.Main.java
/** Run the user interface. */ protected static void runGui() throws GateException { Thread.currentThread().setPriority(Thread.MIN_PRIORITY); // initialise the library and load user CREOLE directories try {//from ww w .j ava 2 s .c o m Gate.init(); } catch (Throwable t) { log.error("Problem while initialising GATE", t); int selection = JOptionPane.showOptionDialog(null, "Error during initialisation:\n" + t.toString() + "\nDo you still want to start GATE?", "GATE", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, new String[] { "Cancel", "Start anyway" }, "Cancel"); if (selection != 1) { System.exit(1); } } //create the main frame, show it SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration(); //this needs to run before any GUI component is constructed. applyUserPreferences(); //all the defaults tables have been updated; build the GUI frame = MainFrame.getInstance(gc); if (DEBUG) Out.prln("constructing GUI"); // run the GUI frame.setTitleChangable(true); frame.setTitle(name + " " + version + " build " + build); // Set title from Java properties String title = System.getProperty(GateConstants.TITLE_JAVA_PROPERTY_NAME); if (title != null) { frame.setTitle(title); } // if frame.setTitleChangable(false); // Set icon from Java properties // iconName could be absolute or "gate:/img/..." String iconName = System.getProperty(GateConstants.APP_ICON_JAVA_PROPERTY_NAME); if (iconName != null) { try { frame.setIconImage(Toolkit.getDefaultToolkit().getImage(new URL(iconName))); } catch (MalformedURLException mue) { log.warn("Could not load application icon.", mue); } } // if // Validate frames that have preset sizes frame.validate(); // Center the window Rectangle screenBounds = gc.getBounds(); Dimension screenSize = screenBounds.getSize(); Dimension frameSize = frame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); frame.setVisible(true); //load session if required and available; //do everything from a new thread. Runnable runnable = new Runnable() { @Override public void run() { try { File sessionFile = Gate.getUserSessionFile(); if (sessionFile.exists()) { MainFrame.lockGUI("Loading saved session..."); PersistenceManager.loadObjectFromFile(sessionFile); } } catch (Exception e) { log.warn("Failed to load session data", e); } finally { MainFrame.unlockGUI(); } } }; Thread thread = new Thread(Thread.currentThread().getThreadGroup(), runnable, "Session loader"); thread.setPriority(Thread.MIN_PRIORITY); thread.start(); } }); registerCreoleUrls(); }
From source file:net.aepik.alasca.gui.util.LoadFileFrame.java
/** * Perform action on event for this object. *//* w w w . j a va 2 s .c o m*/ public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == boutonOpenFile) { JFileChooser jfcProgramme = new JFileChooser("."); jfcProgramme.setMultiSelectionEnabled(false); jfcProgramme.setDialogTitle("Selectionner un fichier"); jfcProgramme.setApproveButtonText("Selectionner"); jfcProgramme.setApproveButtonToolTipText("Cliquer apres avoir selectionn un fichier"); jfcProgramme.setAcceptAllFileFilterUsed(false); if (jfcProgramme.showDialog(this, null) == JFileChooser.APPROVE_OPTION) { try { filename.setText(jfcProgramme.getSelectedFile().getCanonicalPath()); } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Erreur de nom de fichier.", "Erreur", JOptionPane.ERROR_MESSAGE); } } } if (o == boutonOk && filename.getText().length() != 0) { if (!this.loadFile(filename.getText(), (String) this.syntaxes.getSelectedItem())) { JOptionPane.showMessageDialog(this, this.getErrorMessage(), "Erreur", JOptionPane.ERROR_MESSAGE); } else { windowClosing(null); } } if (o == boutonAnnuler) { windowClosing(null); } }
From source file:userinterface.graph.PrismErrorRenderer.java
/** * Sets the alpha transparency for the background shading, and sends a * RendererChangeEvent to all registered listeners. * * @param alpha the alpha (in the range 0.0f to 1.0f). * * @see #getAlpha()/*from w w w . j a v a 2 s . c o m*/ */ public void setAlpha(double alpha) { if (alpha < 0.0 || alpha > 1.0) { JOptionPane.showMessageDialog(GUIPrism.getGUI(), "Requires 'alpha' in the range 0.0 to 1.0.", "Error", JOptionPane.ERROR_MESSAGE); return; } this.alpha = alpha; fireChangeEvent(); }
From source file:org.apache.commons.httpclient.contrib.proxy.PluginProxyTestApplet.java
private void detectProxy() { String urlString = urlTextField.getText(); if (urlString == null || "".equals(urlString)) { JOptionPane.showMessageDialog(super.getRootPane(), "URL can't be empty", "Missing URL", JOptionPane.ERROR_MESSAGE); return;//w w w . j av a2s .c om } if (!urlString.startsWith("http://")) { urlString = "http://" + urlString; } try { URL url = new URL(urlString); HttpHost hostInfo = PluginProxyUtil.detectProxy(url); if (hostInfo != null) { hostLabel.setText(hostInfo.getHostName()); portLabel.setText("" + hostInfo.getPort()); } else { hostLabel.setText("none"); portLabel.setText("none"); } grid.validate(); } catch (ProxyDetectionException e) { JOptionPane.showMessageDialog(getRootPane(), e.getMessage(), "Proxy Detection Failed", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } catch (Exception e) { JOptionPane.showMessageDialog(getRootPane(), e.getMessage(), "Unexpected Exception", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }
From source file:com.antelink.sourcesquare.gui.controller.SourceSquareController.java
public void bind() { this.view.getSelectButtonLabel().addMouseListener(new MouseListener() { @Override// ww w . j ava 2s .c o m public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileHidingEnabled(false); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int showDialog = fileChooser.showDialog(SourceSquareController.this.view, "Select directory"); if (showDialog == JFileChooser.APPROVE_OPTION) { SourceSquareController.this.view.getTextField() .setText(fileChooser.getSelectedFile().getAbsolutePath()); } } }); this.view.getScanButtonLabel().addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent arg0) { File toScan = new File(SourceSquareController.this.view.getTextField().getText()); if (!toScan.exists() || toScan.list().length == 0) { JOptionPane.showMessageDialog(SourceSquareController.this.view, "Choose a valid and not empty directory", null, JOptionPane.ERROR_MESSAGE); return; } SourceSquareController.this.view.setVisible(false); SourceSquareController.this.eventBus.fireEvent(new StartScanEvent(toScan)); } }); }
From source file:net.mumie.coursecreator.xml.GraphXMLizer.java
/** * Describe <code>recodeUmlauts</code> method here. * * @param theText a <code>Text</code> value * @deprecated method considered harmful as its result confuses the transformer *//*from w w w .ja v a2 s.c o m*/ public static void recodeUmlauts(Text theText) { String txt = theText.getData(); // FIXME(4): one might want to allow HTML entities to appear in the // Text node someday. These must be weeded out beforehand. String xmlString = StringEscapeUtils.escapeXml(txt); // xmlString = StringUtils.replace(xmlString, "&#", "&#"); try { theText.setData(xmlString); } catch (RuntimeException re) { CCController.dialogErrorOccured("GraphXMLizer: RuntimeException", "GraphXMLizer: RuntimeException: " + re, JOptionPane.ERROR_MESSAGE); // nothing -- leave theText as-is } // end of try-catch }
From source file:com.emr.schemas.ForeignDataMover.java
private List getTableColumns(String tableName, Connection con) { List columns = new ArrayList(); try {//from ww w .ja v a 2s . c o m DatabaseMetaData dbmd = con.getMetaData(); ResultSet rs = dbmd.getColumns(null, null, tableName, "%"); while (rs.next()) { String colName = rs.getString(4); columns.add(colName); } } catch (SQLException e) { String stacktrace = org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e); JOptionPane.showMessageDialog(this, "Could not fetch Tables for the Database. Error Details: " + stacktrace, "Table Names Error", JOptionPane.ERROR_MESSAGE); } return columns; }
From source file:au.com.jwatmuff.eventmanager.util.GUIUtils.java
public static void displayError(Component parent, String string) { JOptionPane.showMessageDialog(parent, string, "Error", JOptionPane.ERROR_MESSAGE); }
From source file:MainClass.java
public void actionPerformed(ActionEvent e) { JTextPane editor = (JTextPane) getEditor(e); if (editor == null) { JOptionPane.showMessageDialog(null, "You need to select the editor pane before you can change the color.", "Error", JOptionPane.ERROR_MESSAGE); return;/*from w w w .j a v a2 s .co m*/ } int p0 = editor.getSelectionStart(); StyledDocument doc = getStyledDocument(editor); Element paragraph = doc.getCharacterElement(p0); AttributeSet as = paragraph.getAttributes(); fg = StyleConstants.getForeground(as); if (fg == null) { fg = Color.BLACK; } colorChooser.setColor(fg); JButton accept = new JButton("OK"); accept.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { fg = colorChooser.getColor(); dialog.dispose(); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { cancelled = true; dialog.dispose(); } }); JButton none = new JButton("None"); none.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { noChange = true; dialog.dispose(); } }); JPanel buttons = new JPanel(); buttons.add(accept); buttons.add(none); buttons.add(cancel); dialog.getContentPane().setLayout(new BorderLayout()); dialog.getContentPane().add(colorChooser, BorderLayout.CENTER); dialog.getContentPane().add(buttons, BorderLayout.SOUTH); dialog.setModal(true); dialog.pack(); dialog.setVisible(true); if (!cancelled) { MutableAttributeSet attr = null; if (editor != null) { if (fg != null && !noChange) { attr = new SimpleAttributeSet(); StyleConstants.setForeground(attr, fg); setCharacterAttributes(editor, attr, false); } } } // end if color != null noChange = false; cancelled = false; }