List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE
int QUESTION_MESSAGE
To view the source code for javax.swing JOptionPane QUESTION_MESSAGE.
Click Source Link
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Search for text in the assertions text area. If found, the window will * scroll to the text location and the matching text will be highlighted. * // w w w .jav a 2s. c o m * @see #findNextTextInAssertionsTextArea() */ private void findTextInAssertionsTextArea() { String textToFind; boolean found; textToFind = JOptionPane.showInputDialog(this, "Enter the text to find in the assertions editor", "Find Assertions Text", JOptionPane.QUESTION_MESSAGE); if (textToFind != null && textToFind.trim().length() > 0) { // Select the assertions tab SwingUtilities.invokeLater(new Runnable() { public void run() { tabbedPane.setSelectedIndex(TAB_NUMBER_ASSERTIONS); } }); textToFind = textToFind.trim(); found = TextSearch.getInstance().startSearch(assertionsInput, textToFind); if (!found) { JOptionPane.showMessageDialog(this, "The text [" + textToFind + "] was not found", "Not Found", JOptionPane.INFORMATION_MESSAGE); setStatus("Did not find the assertions text: " + textToFind); } else { setStatus("Found matching text at line " + TextSearch.getInstance().getLineOfLastMatch(assertionsInput)); } } else { setStatus("No text entered to find"); } }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Insert standard prefixes in the assertions text area. * //from w w w . ja va 2s. c o m * The user must choose the format (syntax) to use. */ private void insertPrefixes() { String whichFormat; int formatIndex; String[] formatsToChoose; List<String> formatsAvail; StringBuffer prefixesToAdd; JTextArea areaToUpdate; formatsAvail = new ArrayList<String>(); for (int format = 0; format < FORMATS.length; ++format) { if (STANDARD_PREFIXES[format].length > 0) { formatsAvail.add(FORMATS[format]); } } // SPARQL is a special case - not an RDF serialization formatsAvail.add("SPARQL (tab)"); formatsToChoose = new String[formatsAvail.size()]; for (int format = 0; format < formatsAvail.size(); ++format) { formatsToChoose[format] = formatsAvail.get(format); } whichFormat = (String) JOptionPane.showInputDialog(this, "Choose the format for the prefixes", "Choose Format", JOptionPane.QUESTION_MESSAGE, null, formatsToChoose, null); LOGGER.debug("Chosen format for prefixes: " + whichFormat); if (whichFormat != null) { formatIndex = getIndexValue(FORMATS, whichFormat); // SPARQL - special case - not an RDF serialization format if (formatIndex == UNKNOWN) { formatIndex = STANDARD_PREFIXES.length - 1; areaToUpdate = sparqlInput; } else { areaToUpdate = assertionsInput; } LOGGER.debug("Chosen format index for prefixes: " + formatIndex); if (formatIndex >= 0) { String currentData; currentData = areaToUpdate.getText(); prefixesToAdd = new StringBuffer(); for (int prefix = 0; prefix < STANDARD_PREFIXES[formatIndex].length; ++prefix) { prefixesToAdd.append(STANDARD_PREFIXES[formatIndex][prefix]); prefixesToAdd.append('\n'); } areaToUpdate.setText(prefixesToAdd.toString() + currentData); } } }
From source file:edu.ku.brc.specify.dbsupport.SpecifySchemaUpdateService.java
/** * Launches dialog for Importing and Exporting Forms and Resources. *//*from w w w . ja va 2 s . co m*/ public static boolean askToUpdateSchema() { if (SubPaneMgr.getInstance().aboutToShutdown()) { Object[] options = { getResourceString("CONTINUE"), //$NON-NLS-1$ getResourceString("CANCEL") //$NON-NLS-1$ }; return JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(UIRegistry.getTopWindow(), getLocalizedMessage(mkKey("DB_SCH_UP")), //$NON-NLS-1$ getResourceString(mkKey("DB_SCH_UP_TITLE")), //$NON-NLS-1$ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); } return false; }
From source file:lu.fisch.unimozer.Diagram.java
public void jar() { try {/*from w w w. jav a 2 s .c om*/ // compile all if (compile()) if (save()) { // adjust the dirname String dir = getDirectoryName(); if (!dir.endsWith(System.getProperty("file.separator"))) { dir += System.getProperty("file.separator"); } // adjust the filename String name = getDirectoryName(); if (name.endsWith(System.getProperty("file.separator"))) { name = name.substring(0, name.length() - 1); } name = name.substring(name.lastIndexOf(System.getProperty("file.separator")) + 1); /*String[] classNames = new String[classes.size()+1]; Set<String> set = classes.keySet(); Iterator<String> itr = set.iterator(); classNames[0]=null; int c = 1; while (itr.hasNext()) { classNames[c]=itr.next(); c++; }/**/ Vector<String> mains = getMains(); String[] classNames = new String[mains.size()]; for (int c = 0; c < mains.size(); c++) classNames[c] = mains.get(c); // default class to launch String mc = ""; { if (classNames.length == 0) { mc = ""; JOptionPane.showMessageDialog(printOptions, "Unimozer was unable to detect a startable class\n" + "inside your project. The JAR-archive will be created\n" + "but it won't be executable!", "Mainclass", JOptionPane.INFORMATION_MESSAGE, Unimozer.IMG_INFO); } else if (classNames.length == 1) mc = classNames[0]; else mc = (String) JOptionPane.showInputDialog(frame, "Unimozer detected more than one runnable class.\n" + "Please select which one you want to be launched\n" + "automatically with the JAR-archive.", "Autostart", JOptionPane.QUESTION_MESSAGE, Unimozer.IMG_QUESTION, classNames, ""); } // target JVM String target = null; if (Runtime5.getInstance().usesSunJDK() && mc != null) { String[] targets = new String[] { "1.1", "1.2", "1.3", "1.5", "1.6" }; if (System.getProperty("java.version").startsWith("1.7")) targets = new String[] { "1.1", "1.2", "1.3", "1.5", "1.6", "1.7" }; if (System.getProperty("java.version").startsWith("1.8")) targets = new String[] { "1.1", "1.2", "1.3", "1.5", "1.6", "1.7", "1.8" }; target = (String) JOptionPane.showInputDialog(frame, "Please enter version of the JVM you want to target.", "Target JVM", JOptionPane.QUESTION_MESSAGE, Unimozer.IMG_QUESTION, targets, "1.6"); } // make the class-files and all // related stuff if (((Runtime5.getInstance().usesSunJDK() && target != null) || (!Runtime5.getInstance().usesSunJDK())) && (mc != null)) if (makeInteractive(false, target, false) == true) { StringList manifest = new StringList(); manifest.add("Manifest-Version: 1.0"); manifest.add("Created-By: " + Unimozer.E_VERSION + " " + Unimozer.E_VERSION); manifest.add("Name: " + name); if (mc != null) { manifest.add("Main-Class: " + mc); } // compose the filename File fDir = new File(dir + "dist" + System.getProperty("file.separator")); fDir.mkdir(); name = dir + "dist" + System.getProperty("file.separator") + name + ".jar"; String baseName = dir; String libFolderName = dir + "lib"; String distLibFolderName = dir + "dist" + System.getProperty("file.separator") + "lib"; File outFile = new File(name); FileOutputStream bo = new FileOutputStream(name); JarOutputStream jo = new JarOutputStream(bo); String dirname = getDirectoryName(); if (!dirname.endsWith(System.getProperty("file.separator"))) { dirname += System.getProperty("file.separator"); } // add the files to the array addToJar(jo, "", new File(dirname + "bin" + System.getProperty("file.separator"))); // add the files to the array addToJar(jo, "", new File(dirname + "src" + System.getProperty("file.separator")), new String[] { "java" }); /* // define a filter for files that do not start with a dot FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { return !name.startsWith("."); } }; // get the bin directory File binDir = new File(dirname+"bin"+System.getProperty("file.separator")); // get all files File[] files = binDir.listFiles(filter); for(int f=0;f<files.length;f++) { FileInputStream bi = new FileInputStream(files[f]); String entry = files[f].getAbsolutePath(); entry = entry.substring(binDir.getAbsolutePath().length()+1); JarEntry je = new JarEntry(entry); jo.putNextEntry(je); byte[] buf = new byte[1024]; int anz; while ((anz = bi.read(buf)) != -1) { jo.write(buf, 0, anz); } bi.close(); } */ // ask to include another direectory // directory filter /* FilenameFilter dirFilter = new FilenameFilter() { public boolean accept(File dir, String name) { File isDir = new File(dir+System.getProperty("file.separator")+name); return isDir.isDirectory() && !name.equals("bin") && !name.equals("src") && !name.equals("dist") && !name.equals("nbproject") && !name.equals("doc"); } }; // get directories File projectDir = new File(dirname); String[] subDirs = projectDir.list(dirFilter); if(subDirs.length>0) { String subdir = (String) JOptionPane.showInputDialog( frame, "Do you want to include any other resources directory?\n"+ "Click ?Cancel? to not include any resources directory!", "JAR Packager", JOptionPane.QUESTION_MESSAGE, Unimozer.IMG_QUESTION, subDirs, null); if(subdir!=null) { addToJar(jo,subdir+"/",new File(dirname+subdir+System.getProperty("file.separator"))); } } */ /* Set<String> set = classes.keySet(); Iterator<String> itr = set.iterator(); int i = 0; while (itr.hasNext()) { String classname = itr.next(); String act = classname + ".class"; FileInputStream bi = new FileInputStream(dirname+"bin"+System.getProperty("file.separator")+act); JarEntry je = new JarEntry(act); jo.putNextEntry(je); byte[] buf = new byte[1024]; int anz; while ((anz = bi.read(buf)) != -1) { jo.write(buf, 0, anz); } bi.close(); } */ // copy libs File lib = new File(libFolderName); File distLib = new File(distLibFolderName); StringList libs = null; if (lib.exists()) { libs = CopyDirectory.copyFolder(lib, distLib); } String cp = new String(); if (libs != null) { for (int i = 0; i < libs.count(); i++) { String myLib = libs.get(i); myLib = myLib.substring(baseName.length()); if (i != 0) cp = cp + " "; cp = cp + myLib; } //manifest.add("Class-Path: "+cp); } // Let's search for the path of the swing-layout JAR file String cpsw = ""; if (getCompleteSourceCode().contains("org.jdesktop.layout")) { if (Main.classpath != null) { // copy the file String src = Main.classpath; File f1 = new File(src); String dest = distLibFolderName + System.getProperty("file.separator") + f1.getName(); // create folder if not exists File f2 = new File(distLibFolderName); if (!f2.exists()) f2.mkdir(); // copy the file InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } in.close(); out.close(); // add the manifest entry cpsw = "lib" + System.getProperty("file.separator") + f1.getName(); } } manifest.add("Class-Path: " + cp + " " + cpsw); // adding the manifest file manifest.add(""); JarEntry je = new JarEntry("META-INF/MANIFEST.MF"); jo.putNextEntry(je); String mf = manifest.getText(); jo.write(mf.getBytes(), 0, mf.getBytes().length); jo.close(); bo.close(); cleanAll(); JOptionPane.showMessageDialog(frame, "The JAR-archive has been generated ...", "Success", JOptionPane.INFORMATION_MESSAGE, Unimozer.IMG_INFO); } } } /*catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(frame, "There was an error while creating the JAR-archive ...", "Error :: ClassNotFoundException", JOptionPane.ERROR_MESSAGE,Unimozer.IMG_ERROR); }*/ catch (IOException ex) { JOptionPane.showMessageDialog(frame, "There was an error while creating the JAR-archive ...", "Error :: IOException", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); } }
From source file:lu.fisch.unimozer.Diagram.java
public void command() { String cmd = JOptionPane.showInputDialog(frame, "Please enter the command you want to run.", "Run command", JOptionPane.QUESTION_MESSAGE); if (cmd != null) { try {/*from w ww . j a v a2 s . com*/ Runtime5.getInstance().executeCommand(cmd); } catch (EvalError ex) { JOptionPane.showMessageDialog(frame, "Your command returned an error:\n\n" + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); } } }
From source file:ru.apertum.qsystem.client.forms.FAdmin.java
private void buttonRestartServerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRestartServerActionPerformed if (JOptionPane.showConfirmDialog(null, " ? ? ?", " , !", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 1) { return; }/*from w w w . ja v a2 s . com*/ NetCommander.restartServer(new ServerNetProperty()); final ATalkingClock clock = new ATalkingClock(4000, 1) { @Override public void run() { JOptionPane.showConfirmDialog(null, getLocaleMessage("admin.server_restart.title"), getLocaleMessage("admin.server_restart.caption"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); checkServer(); } }; clock.start(); }
From source file:ru.apertum.qsystem.client.forms.FAdmin.java
private void tabbedPaneMainFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tabbedPaneMainFocusLost final CalendarTableModel model = (CalendarTableModel) tableCalendar.getModel(); if (!model.isSaved()) { if (0 == JOptionPane.showConfirmDialog(null, getLocaleMessage("admin.calendar_change.message"), getLocaleMessage("admin.calendar_change.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) { model.save();/*from www .jav a 2 s. c om*/ } } }
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
private void m_jbtnPrintBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnPrintBillActionPerformed logger.info("Start Print Bill Button :" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); String storeLocation = m_App.getProperties().getProperty("machine.storelocation"); try {//from w w w.j a va 2 s. c om if (m_oTicket.getLinesCount() != 0) { boolean updated = checkTicketUpdation(); if (!updated) { dbUpdatedDate = null; //if exist non kot items if (kotaction == 1) { //Method is used for printing non kot items kotDisplay(); } else { Runtime.getRuntime().gc(); } //Method is for setting all the lines to be served status serveAllLines(); if (kotprintIssue == 0) { int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannaPrint"), AppLocal.getIntString("message.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.YES_OPTION) { boolean reasonStatus = true; try { logger.info("Start Printing :" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); logger.info("No. of Line Items during Print Bill : " + m_oTicket.getLinesCount()); reasonStatus = doPrintValidation(); } catch (BasicException ex) { logger.info("Order NO." + m_oTicket.getOrderId() + "exception on clicking print bill doPrintValidation" + ex.getMessage()); Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } if (reasonStatus) { String file; file = "Printer.Bill"; m_jLblBillNo.setText(m_oTicket.getTicketId() == 0 ? "--" : String.valueOf(m_oTicket.getTicketId())); try { taxeslogic.calculateTaxes(m_oTicket); } catch (TaxesException ex) { logger.info("Order NO." + m_oTicket.getOrderId() + "exception on clicking print bill calculateTaxes" + ex.getMessage()); Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } //Based on store location if (storeLocation.equals("BlrIndranagar") || storeLocation.equals("ITPL")) { //Method is used for generic text printer printTicketGeneric(file, m_oTicket, m_oTicketExt); } else { //Method is used for thermal printer printTicket(file, m_oTicket, m_oTicketExt); } logger.info("bill has been printed"); m_oTicket.setPrinted(true); Object[] values = new Object[] { m_oTicket.getPlaceId(), m_oTicket.getName(), m_oTicket, m_oTicket.getSplitSharedId(), m_oTicket.isPrinted(), m_oTicket.isListModified() }; Datas[] datas = new Datas[] { Datas.STRING, Datas.STRING, Datas.SERIALIZABLE, Datas.STRING, Datas.BOOLEAN, Datas.BOOLEAN }; new PreparedSentence(m_App.getSession(), "UPDATE SHAREDTICKETS SET NAME = ?, CONTENT = ?, ISPRINTED = ?, ISMODIFIED = ?, UPDATED=NOW(), ISKDS=0 WHERE ID = ? AND SPLITID=? ", new SerializerWriteBasicExt(datas, new int[] { 1, 2, 4, 5, 0, 3 })) .exec(values); String splitId = m_oTicket.getSplitSharedId(); Object[] record = (Object[]) new StaticSentence(m_App.getSession(), "SELECT UPDATED FROM SHAREDTICKETS WHERE ID = ? AND SPLITID='" + splitId + "'", SerializerWriteString.INSTANCE, new SerializerReadBasic(new Datas[] { Datas.STRING })) .find(m_oTicket.getPlaceId()); if (record != null) { m_oTicket.setObjectUpdateDate(DateFormats.StringToDateTime((String) record[0])); } logger.info("End Printing :" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); } } } } } if (kotprintIssue == 0) { if (roleName.equals("Bartender")) { logger.info("Role Bartender"); IsSteward = 1; JRetailTicketsBagRestaurant.setNewTicket(); m_RootApp = (JRootApp) m_App; m_RootApp.closeAppView(); } } } catch (BasicException ex) { logger.info( "Order NO." + m_oTicket.getOrderId() + "exception on clicking print bill" + ex.getMessage()); Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } logger.info("End Print Bill Button :" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date())); }
From source file:ru.apertum.qsystem.client.forms.FAdmin.java
@Action public void changeServicePriority() { final QPlanService plan = (QPlanService) listUserService.getSelectedValue(); if (plan == null) { return; }//w w w. j a v a 2s.c om // ? , ? ? ? ? . listUserService.requestFocus(); listUserService.requestFocusInWindow(); final String name = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.select_priority.message"), getLocaleMessage("admin.select_priority.title"), JOptionPane.QUESTION_MESSAGE, null, Uses.get_COEFF_WORD().values().toArray(), Uses.get_COEFF_WORD().values().toArray()[plan.getCoefficient()]); //? , if (name != null) { for (int i = 0; i < Uses.get_COEFF_WORD().size(); i++) { if (name.equals(Uses.get_COEFF_WORD().get(i))) { plan.setCoefficient(i); } } } }
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
private void m_jBtnBillOnHoldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnBillOnHoldActionPerformed if (!m_oTicket.isPrinted()) { showMessage(this, "Hold bill is allowed after Bill is Printed"); logger.info("Hold bill is allowed after Bill is Printed"); return;/*from www. ja va2 s .c o m*/ } else if (m_oTicket.isPrinted() & m_oTicket.isListModified()) { showMessage(this, " Bill is Modified after previous print. So please print it again"); logger.info(" Bill is Modified after previous print. So please print it again"); return; } else { int res = JOptionPane.showConfirmDialog(this, "Do you want to hold the Bill", "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.YES_OPTION) { JRetailTicketsBagRestaurant.setHoldTicket(m_oTicket); } } }