List of usage examples for javax.swing JOptionPane WARNING_MESSAGE
int WARNING_MESSAGE
To view the source code for javax.swing JOptionPane WARNING_MESSAGE.
Click Source Link
From source file:lu.fisch.moenagade.model.Project.java
private boolean saveWithAskingLocation() { String openDir = getContainingDirectoryName(); String lastOpenDir = Ini.get("lastOpenDir", ""); if (lastOpenDir.trim().length() != 0) openDir = lastOpenDir;/*from w w w .ja va 2 s .c o m*/ OpenProject op = new OpenProject(new File(openDir), false); op.setSelectedFile(new File(lastOpenedProject)); //op.setSelectedFile(new File(new File(getDirectoryName()).getName())); //op.set int result = op.showSaveDialog(frame, "Save"); if (result == OpenProject.APPROVE_OPTION) { String dirName = op.getSelectedFile().getAbsolutePath().toString(); lastOpenedProject = dirName; File myDir = new File(dirName); if (myDir.exists()) { JOptionPane.showMessageDialog(frame, "The selected project or directory already exists.\nPlease choose another one ...", "New project", JOptionPane.WARNING_MESSAGE, Moenagade.IMG_WARNING); return false; } else { boolean created = myDir.mkdir(); if (created == false) { JOptionPane.showMessageDialog(frame, "Error while creating the projet directory.\n" + "The project name you specified is probably not valid!\n", "Save project as ...", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); return false; } else { try { //System.out.println(dirName); save(dirName); setChanged(false); return true; } catch (Exception e) { JOptionPane.showMessageDialog(frame, "An unknown error occured while saving your projet!\n", "Save project as ...", JOptionPane.ERROR_MESSAGE, Moenagade.IMG_ERROR); return false; } } } } return false; }
From source file:org.csa.rstb.dat.toolviews.HaAlphaPlotPanel.java
@Override protected boolean checkDataToClipboardCopy() { final int warnLimit = 2000; final int excelLimit = 65536; final int numNonEmptyBins = getNumNonEmptyBins(); if (numNonEmptyBins > warnLimit) { String excelNote = ""; if (numNonEmptyBins > excelLimit - 100) { excelNote = "Note that e.g., Microsoft Excel 2002 only supports a total of " + excelLimit + " rows in a sheet.\n"; /*I18N*/ }//from w w w. ja v a2 s.c om final String message = MessageFormat.format("This scatter plot contains {0} non-empty bins.\n" + "For each bin, a text data row containing an x, y and z value will be created.\n" + "{1}\nPress ''Yes'' if you really want to copy this amount of data to the system clipboard.\n", numNonEmptyBins, excelNote); final int status = JOptionPane.showConfirmDialog(this, message, /*I18N*/ "Copy Data to Clipboard", /*I18N*/ JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (status != JOptionPane.YES_OPTION) { return false; } } return true; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java
/** * Abre uma URL/* w w w. j a v a 2 s . c o m*/ * */ private void abreUrl() { String url; url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://"); PegarPaginaWEB ppw = new PegarPaginaWEB(); if (url != null) { try { String codHtml = ppw.getContent(url); TxtBuffer.setContentOriginal(codHtml, "0"); parentFrame.showPainelFerramentaImgPArq(codHtml, url); EstadoSilvinha.setLinkAtual(url); } catch (HttpException e1) { JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU, TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE); } catch (Exception e1) { JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL, TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE); } } }
From source file:com.nikonhacker.gui.EmulatorUI.java
public EmulatorUI() { super(ApplicationInfo.getNameVersion() + " - (none) / (none)"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); prefs = Prefs.load();//from w w w. j a v a 2s. c om // Apply register label prefs immediately FrCPUState.initRegisterLabels(prefs.getOutputOptions(Constants.CHIP_FR)); TxCPUState.initRegisterLabels(prefs.getOutputOptions(Constants.CHIP_TX)); // Create and set up the Emulation Framework framework = new EmulationFramework(prefs); //Set up the GUI. setJMenuBar(createMenuBar()); toolbarButtonMargin = new Insets(2, 14, 2, 14); JPanel[] contentPane = new JPanel[2]; for (int chip = 0; chip < 2; chip++) { // This is the contentPane that will make one side of the JSplitPane contentPane[chip] = new JPanel(new BorderLayout()); // First we create a toolbar and put it on top toolBar[chip] = createToolBar(chip); contentPane[chip].add(toolBar[chip], BorderLayout.NORTH); // Then we prepare a "desktop" panel and put it at the center // This subclass of JDesktopPane implements Scrollable and has a size which auto-adapts dynamically // to the size and position of its internal frames mdiPane[chip] = new ScrollableDesktop(); mdiPane[chip].setBackground(Constants.CHIP_BACKGROUND_COLOR[chip]); mdiPane[chip].setOpaque(true); // We wrap it inside a panel to force a stretch to the size of the JSplitPane panel // Otherwise, as the size of the panel auto-adapts, it starts at 0,0 if no component is present, // so the background color would only be only visible in the bounding box surrounding the internal frames JPanel forcedStretchPanel = new JPanel(new BorderLayout()); forcedStretchPanel.add(mdiPane[chip], BorderLayout.CENTER); // And we wrap the result in a JScrollPane to take care of the actual scrolling, // before adding it at the center contentPane[chip].add(new JScrollPane(forcedStretchPanel), BorderLayout.CENTER); // Finally, we prepare the status bar and add it at the bottom statusBar[chip] = new JLabel(statusText[chip]); statusBar[chip].setOpaque(true); statusBar[chip].setBackground(STATUS_BGCOLOR_DEFAULT); statusBar[chip].setMinimumSize(new Dimension(0, 0)); contentPane[chip].add(statusBar[chip], BorderLayout.SOUTH); } setIconImages(Arrays.asList( Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_16x16.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_20x20.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_24x24.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_32x32.png")), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_64x64.png")))); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, contentPane[Constants.CHIP_FR], contentPane[Constants.CHIP_TX]); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(0.5); setContentPane(splitPane); applyPrefsToUI(); for (int chip = 0; chip < 2; chip++) { if (imageFile[chip] != null) { // There was a command line argument. if (imageFile[chip].exists()) { initialize(chip); } else { JOptionPane.showMessageDialog(this, "Given " + Constants.CHIP_LABEL[chip] + " firmware file does not exist:\n" + imageFile[chip].getAbsolutePath(), "File not found", JOptionPane.WARNING_MESSAGE); } } else { // Check if a FW file is stored in the prefs String firmwareFilename = prefs.getFirmwareFilename(chip); if (firmwareFilename != null) { File firmwareFile = new File(firmwareFilename); if (firmwareFile.exists()) { imageFile[chip] = firmwareFile; initialize(chip); } else { JOptionPane.showMessageDialog(this, Constants.CHIP_LABEL[chip] + " firmware file stored in preference file cannot be found:\n" + firmwareFile.getAbsolutePath(), "File not found", JOptionPane.WARNING_MESSAGE); } } } } framework.setupCallbacks(getCallbackHandler(0), getCallbackHandler(1)); restoreMainWindowSettings(); pack(); updateStates(); //Make dragging a little faster but perhaps uglier. // mdiPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); // Update title bars with emulator statistics every second new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { updateStatusBar(Constants.CHIP_FR); updateStatusBar(Constants.CHIP_TX); } }).start(); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.DataImportDialog.java
/** * Takes the list of data import errors and displays then to the user * * void/*ww w . ja va 2 s. c o m*/ */ protected void showErrors() { JList listOfErrors = genListOfErrorWhereTableDataDefiesSizeConstraints(model.getColumnNames(), model.getData()); if ((model.getColumnNames() == null) || (model.getData() == null) || (listOfErrors == null) || (listOfErrors.getModel().getSize() == 0)) { JTextArea textArea = new JTextArea(); textArea.setRows(25); textArea.setColumns(60); //String newline = "\n"; //for (int i = 0; i < listOfErrors.getModel().getSize(); i++) //{ textArea.append(getResourceString("WB_PARSE_FILE_ERROR2")); //} textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); textArea.setCaretPosition(0); JScrollPane pane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), pane, getResourceString("DATA_IMPORT_ISSUES"), JOptionPane.WARNING_MESSAGE); okBtn.setEnabled(false); } else if (listOfErrors.getModel().getSize() > 0) { JTextArea textArea = new JTextArea(); textArea.setRows(25); textArea.setColumns(60); String newline = "\n"; for (int i = 0; i < listOfErrors.getModel().getSize(); i++) { textArea.append((String) listOfErrors.getModel().getElementAt(i) + newline + newline); } textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); textArea.setCaretPosition(0); JScrollPane pane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), pane, getResourceString("DATA_IMPORT_ISSUES"), JOptionPane.WARNING_MESSAGE); } }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
public void avaliaUrl(String url) { PegarPaginaWEB ppw = new PegarPaginaWEB(); if (url != null) { arquivo = null;/*w w w . j a v a 2s . c om*/ try { String codHtml = ppw.getContent(url); textAreaSourceCode.setText(codHtml); TxtBuffer.setContentOriginal(codHtml, "0"); reavalia(codHtml); this.painelOriginal.avalia(codHtml); } catch (HttpException e1) { JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU, TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE); } catch (Exception e1) { JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL, TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE); } } }
From source file:net.sf.jabref.JabRef.java
private void setLookAndFeel() { try {/* w w w . j av a 2s .c o m*/ String lookFeel; String systemLnF = UIManager.getSystemLookAndFeelClassName(); if (Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_LOOK_AND_FEEL)) { // Use system Look & Feel by default lookFeel = systemLnF; } else { lookFeel = Globals.prefs.get(JabRefPreferences.WIN_LOOK_AND_FEEL); } // At all cost, avoid ending up with the Metal look and feel: if ("javax.swing.plaf.metal.MetalLookAndFeel".equals(lookFeel)) { Plastic3DLookAndFeel lnf = new Plastic3DLookAndFeel(); Plastic3DLookAndFeel.setCurrentTheme(new SkyBluer()); com.jgoodies.looks.Options.setPopupDropShadowEnabled(true); UIManager.setLookAndFeel(lnf); } else { try { UIManager.setLookAndFeel(lookFeel); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { // specified look and feel does not exist on the classpath, so use system l&f UIManager.setLookAndFeel(systemLnF); // also set system l&f as default Globals.prefs.put(JabRefPreferences.WIN_LOOK_AND_FEEL, systemLnF); // notify the user JOptionPane.showMessageDialog(JabRef.jrf, Localization.lang( "Unable to find the requested Look & Feel and thus the default one is used."), Localization.lang("Warning"), JOptionPane.WARNING_MESSAGE); } } } catch (Exception e) { LOGGER.warn("Look and feel could not be set", e); } // In JabRef v2.8, we did it only on NON-Mac. Now, we try on all platforms boolean overrideDefaultFonts = Globals.prefs.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONTS); if (overrideDefaultFonts) { int fontSize = Globals.prefs.getInt(JabRefPreferences.MENU_FONT_SIZE); UIDefaults defaults = UIManager.getDefaults(); Enumeration<Object> keys = defaults.keys(); Double zoomLevel = null; for (Object key : Collections.list(keys)) { if ((key instanceof String) && ((String) key).endsWith(".font")) { FontUIResource font = (FontUIResource) UIManager.get(key); if (zoomLevel == null) { // zoomLevel not yet set, calculate it based on the first found font zoomLevel = (double) fontSize / (double) font.getSize(); } font = new FontUIResource(font.getName(), font.getStyle(), fontSize); defaults.put(key, font); } } if (zoomLevel != null) { GUIGlobals.zoomLevel = zoomLevel; } } }
From source file:Citas.FrameCita.java
public void actionPerformed(ActionEvent e) { if (e.getSource() == agregarB) { try {/*from ww w . ja va 2 s .co m*/ //Cita JSONObject cita = new JSONObject(); cita.put("fecha", fechaJ.getText()); cita.put("hora", horaJ.getText()); cita.put("paciente", 3); cita.put("medicos", "1"); cita.put("tratamiento", "tratamiento"); cita.put("diagnostico", "diagnostico"); cita.put("motivo", motivosTA.getText()); System.out.print(cita); //Paciente JSONObject paciente = new JSONObject(); paciente.put("cedula", cedulaJ.getText()); paciente.put("nombre", nombreJ.getText()); paciente.put("apellido", apellidoJ.getText()); paciente.put("direccion", direccionJ.getText()); paciente.put("correo", correoJ.getText()); paciente.put("tlfncasa", telefonoCasaJ.getText()); paciente.put("tlfncelular", telefonoCelularJ.getText()); System.out.print(paciente); //rutasAdd.add("http://localhost/API_Citas/public/Pacientes/insertarPaciente", paciente); rutasAdd.add("http://localhost/API_Citas/public/Citas/insertarCita", cita); setCitas(); } catch (IOException ex) { Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex); } catch (JSONException ex) { Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex); } catch (java.text.ParseException ex) { Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex); } return; } if (e.getSource() == modificarB) { return; } if (e.getSource() == eliminarB) { return; } if (e.getSource() == atrasB) { } if (e.getSource() == buscarB) { String[] opciones = { "Aceptar" }; int opcion = JOptionPane.showOptionDialog(null //componente , "Cedula no pertenece a ningun paciente registrado" // Mensaje , "Paciente no encontrado" // Titulo en la barra del cuadro , JOptionPane.DEFAULT_OPTION // Tipo de opciones , JOptionPane.WARNING_MESSAGE // Tipo de mensaje (icono) , null // Icono (ninguno) , opciones // Opciones personalizadas , null // Opcion por defecto ); } }
From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: //check if the supplier has products in the product list if (inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList().size() < 0) { JOptionPane.showMessageDialog(this, "No devices found in the inventory.", "Warning", JOptionPane.WARNING_MESSAGE); return;// w ww .j a va2 s .c o m } MedicalDevice[] product; product = new MedicalDevice[100]; int numberOfProducts = inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList() .size(); DefaultCategoryDataset dataSetProduct = new DefaultCategoryDataset(); for (int i = 0; i < numberOfProducts; i++) { product[i] = inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList().get(i); int soldQuantity = 0; soldQuantity = product[i].getNumUses(); String prodName = product[i].getDeviceName(); dataSetProduct.setValue(soldQuantity, "Medical Device", prodName); } JFreeChart chartProduct = ChartFactory.createBarChart("Device Usage Report", "Device", "Number of times usdr", dataSetProduct, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p1 = chartProduct.getCategoryPlot(); p1.setRangeGridlinePaint(Color.black); ChartFrame frame1 = new ChartFrame("Device Usage Report", chartProduct); frame1.setVisible(true); frame1.setSize(400, 400); Point pt1 = new Point(0, 0); frame1.setLocation(pt1); }
From source file:fitnesserefactor.FitnesseRefactor.java
private void AddTableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddTableActionPerformed ProgressBar.setValue(0);/*from w w w . j av a 2 s .com*/ ProgressBar.setMinimum(0); if (ParentFolder.isSelected()) { if (!"".equals(JtreePath)) { File dir = new File(JtreePath); try { if (dir.getParent() != null && dir.isFile()) { String Testcase = dir.getParent(); File dir1 = new File(Testcase); if (dir1.getParent() != null && dir1.isDirectory()) { String parent = dir1.getParent(); File dir2 = new File(Testcase); if (dir2.getParent() != null) { String GrandParent = dir2.getParent(); File dir3 = new File(GrandParent); File[] allFiles = dir3.listFiles(); ArrayList al = new ArrayList(); for (File file : allFiles) { String TestcaseNames = file.getName(); al.add(TestcaseNames); } if (!fromTxt.getText().isEmpty() && !toTxt.getText().isEmpty()) { int FromTxtInt = Integer.parseInt(fromTxt.getText()); int ToTxtInt = Integer.parseInt(toTxt.getText()); int TotFiles = al.size(); if ((ToTxtInt > FromTxtInt) && (ToTxtInt > 0) && (FromTxtInt > 0) && ToTxtInt <= al.size() - 2) { for (int removeAfterToIndx = (ToTxtInt + 2); removeAfterToIndx < TotFiles; removeAfterToIndx++) { al.remove(ToTxtInt + 2); } if (FromTxtInt > 1) { for (int removeFromIndx = 1; removeFromIndx < FromTxtInt; removeFromIndx++) { al.remove(2); } } } else { JOptionPane.showMessageDialog(null, "FROM test case number cannot be greater/equal to TO test case number.\nFROM and TO test case numbers should be greater than zero. \nTO test case number should not be greater than the testcase count ", "Warning", JOptionPane.WARNING_MESSAGE); } } ProgressBar.setMaximum(al.size() - 2); //ProgressBar.setValue(5); int progressCount = 0; for (int i = 2; i <= al.size(); i++) { System.out.println(dir2.getParent() + "\\" + al.get(i) + "\\content.txt"); File EachFile = new File(dir2.getParent() + "\\" + al.get(i) + "\\content.txt"); for (int j = 0; j < FileUtils.readLines(EachFile).size(); j++) { String line = (String) FileUtils.readLines(EachFile).get(j); if (line.matches("(.*)" + FitnesseTablesList.getSelectedItem().toString() + "(.*)")) { p = j; ReadAllLines(EachFile); int linNum = CountLines(EachFile); int selectTableSize = SizeOfTable(EachFile); AddTable(); int AddedLinesLen = AddedLines.size(); int tblIndex = 1; for (int SetNewLines = 0; SetNewLines < AddedLinesLen; SetNewLines++) { AllLines.add(p + selectTableSize + tblIndex, AddedLines.get(SetNewLines).toString()); tblIndex = tblIndex + 1; } AllLines.add(p + selectTableSize + tblIndex, ""); WriteAllLines(EachFile); break; } else if (line.matches("(.*)" + FitnesseTablesList.getItemAt(1) + "(.*)") && FitnesseTablesList.getSelectedItem().toString() .contains("Select an item")) { p = j; int r = p; ReadAllLines(EachFile); AddTable(); int AddedLinesLen = AddedLines.size(); for (int SetNewLines = 0; SetNewLines < AddedLinesLen; SetNewLines++) { AllLines.add(r, AddedLines.get(SetNewLines).toString()); r = r + 1; } AllLines.add(r, ""); WriteAllLines(EachFile); break; } } progressCount = progressCount + 1; ProgressBar.setValue(progressCount); } } else { JOptionPane.showMessageDialog(null, "There are no testcases under the parent folder", "Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "There are no testcases under the parent folder", "Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "Need to select atleast one content.txt file", "Warning", JOptionPane.WARNING_MESSAGE); } } catch (Exception E) { //JOptionPane.showMessageDialog(null, E, "Java Runtime Error", JOptionPane.ERROR ); } } } }