List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE
int INFORMATION_MESSAGE
To view the source code for javax.swing JOptionPane INFORMATION_MESSAGE.
Click Source Link
From source file:Main.java
/** * Mostra uma caixa de menssagem para que seja ensirido um valor. * @param frame//from ww w .ja v a2s. c om * @param texto * @param title * @param valorInicial * @param type * @return * @author Thiago Benega * @since 13/04/2009 */ public static String showTextboxDialog(javax.swing.JFrame frame, String texto, String title, String valorInicial, int type) { Object txt = null; JDialog jDialog = new JDialog(); jDialog.setTitle(title); jDialog.setFocusableWindowState(true); if (frame != null) { frame.setExtendedState(Frame.ICONIFIED); frame.pack(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); } switch (type) { case JOptionPane.OK_CANCEL_OPTION: txt = JOptionPane.showInputDialog(jDialog, texto, title, type, null, null, valorInicial);//.toString(); break; case JOptionPane.YES_NO_OPTION: txt = JOptionPane.showConfirmDialog(jDialog, texto, title, type, JOptionPane.INFORMATION_MESSAGE); break; default: JOptionPane.showMessageDialog(jDialog, texto, title, type); break; } jDialog = null; return txt != null ? txt.toString() : null; }
From source file:Dialogs.java
public static void showNotYetImplemented(Component owner) { JOptionPane.showMessageDialog(owner, "Not Yet Implemented", "", JOptionPane.INFORMATION_MESSAGE); }
From source file:br.com.pontocontrol.controleponto.ControlePonto.java
public static void solicitarLogin() { String usuario;/*from w w w . j av a2 s .c o m*/ do { usuario = JOptionPane.showInputDialog(null, "Informe seu usurio:", "Identificao", JOptionPane.INFORMATION_MESSAGE); if (StringUtils.isBlank(usuario)) { JOptionPane.showMessageDialog(null, "Informe um login de usurio.", "Validao falhou.", JOptionPane.ERROR_MESSAGE); } } while (StringUtils.isBlank(usuario)); switch (SessaoManager.getInstance().autenticar(usuario)) { case SessaoManager.LOGIN_STATUS.OK: break; case SessaoManager.LOGIN_STATUS.USUARIO_NAO_EXISTE: int opt = JOptionPane.showConfirmDialog(null, format("O usurio com o login informado \"%s\" no existe, deseja criar um novo usurio?", usuario), "Usurio no encontrado.", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (JOptionPane.YES_OPTION == opt) { ConfiguracoesUsuario configuracoesUsuario = new ConfiguracoesUsuario(usuario); SessaoManager.getInstance().criarUsuario(configuracoesUsuario); SessaoManager.getInstance().autenticar(usuario); } break; default: break; } }
From source file:Main.java
/** * Show input dialog with specified title, message and initial input * content./*from w w w. j av a2s. com*/ * * @param parent * the parent component of the input dialog, set {@code null} if * not has one * @param title * the title of the dialog * @param message * the message to display * @param initial * the initial input content * @return the input string, may be an empty string */ public static String inputDialog(Component parent, String title, String message, String initial) { Object obj = JOptionPane.showInputDialog(parent, message, title, JOptionPane.INFORMATION_MESSAGE, null, null, initial); if (obj == null) return null; else return obj.toString(); }
From source file:com.seanmadden.fast.ldap.main.Main.java
/** * The Main Event./*from w ww . j a v a 2 s . c o m*/ * * @param args */ @SuppressWarnings("static-access") public static void main(String[] args) { BasicConfigurator.configure(); log.debug("System initializing"); try { Logger.getRootLogger().addAppender( new FileAppender(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN), "log.log")); } catch (IOException e1) { log.error("Unable to open the log file..?"); } /* * Initialize the configuration engine. */ XMLConfiguration config = new XMLConfiguration(); config.setListDelimiter('|'); /* * Initialize the Command-Line parsing engine. */ CommandLineParser parser = new PosixParser(); Options opts = new Options(); opts.addOption(OptionBuilder.withLongOpt("config-file").hasArg() .withDescription("The configuration file to load").withArgName("config.xml").create("c")); opts.addOption(OptionBuilder.withLongOpt("profile").hasArg().withDescription("The profile to use") .withArgName("Default").create("p")); opts.addOption(OptionBuilder.withLongOpt("password").hasArg().withDescription("Password to connect with") .withArgName("password").create("P")); opts.addOption(OptionBuilder.withLongOpt("debug").hasArg(false).create('d')); opts.addOption(OptionBuilder.withLongOpt("verbose").hasArg(false).create('v')); File configurationFile = new File("config.xml"); try { // Parse the command-line options CommandLine cmds = parser.parse(opts, args); if (!cmds.hasOption('p')) { Logger.getRootLogger().addAppender(new GuiErrorAlerter(Level.ERROR)); } Logger.getRootLogger().setLevel(Level.ERROR); if (cmds.hasOption('v')) { Logger.getRootLogger().setLevel(Level.INFO); } if (cmds.hasOption('d')) { Logger.getRootLogger().setLevel(Level.DEBUG); } log.debug("Enabling configuration file parsing"); // The user has given us a file to parse. if (cmds.hasOption("c")) { configurationFile = new File(cmds.getOptionValue("c")); } log.debug("Config file: " + configurationFile); // Load the configuration file if (configurationFile.exists()) { config.load(configurationFile); } else { log.error("Cannot find config file"); } /* * Convert the profiles into memory */ Vector<ConnectionProfile> profs = new Vector<ConnectionProfile>(); List<?> profList = config.configurationAt("Profiles").configurationsAt("Profile"); for (Object p : profList) { SubnodeConfiguration profile = (SubnodeConfiguration) p; String name = profile.getString("[@name]"); String auth = profile.getString("LdapAuthString"); String server = profile.getString("LdapServerString"); String group = profile.getString("LdapGroupsLocation"); ConnectionProfile prof = new ConnectionProfile(name, server, auth, group); profs.add(prof); } ConnectionProfile prof = null; if (!cmds.hasOption('p')) { /* * Deploy the profile selector, to select a profile */ ProfileSelector profSel = new ProfileSelector(profs); prof = profSel.getSelection(); if (prof == null) { return; } /* * Empty the profiles and load a clean copy - then save it back * to the file */ config.clearTree("Profiles"); for (ConnectionProfile p : profSel.getProfiles()) { config.addProperty("Profiles.Profile(-1)[@name]", p.getName()); config.addProperty("Profiles.Profile.LdapAuthString", p.getLdapAuthString()); config.addProperty("Profiles.Profile.LdapServerString", p.getLdapServerString()); config.addProperty("Profiles.Profile.LdapGroupsLocation", p.getLdapGroupsString()); } config.save(configurationFile); } else { for (ConnectionProfile p : profs) { if (p.getName().equals(cmds.getOptionValue('p'))) { prof = p; break; } } } log.info("User selected " + prof); String password = ""; if (cmds.hasOption('P')) { password = cmds.getOptionValue('P'); } else { password = PasswordPrompter.promptForPassword("Password?"); } if (password.equals("")) { return; } LdapInterface ldap = new LdapInterface(prof.getLdapServerString(), prof.getLdapAuthString(), prof.getLdapGroupsString(), password); /* * Gather options information from the configuration engine for the * specified report. */ Hashtable<String, Hashtable<String, ReportOption>> reportDataStructure = new Hashtable<String, Hashtable<String, ReportOption>>(); List<?> repConfig = config.configurationAt("Reports").configurationsAt("Report"); for (Object p : repConfig) { SubnodeConfiguration repNode = (SubnodeConfiguration) p; // TODO Do something with the report profile. // Allowing the user to deploy "profiles" is a nice feature // String profile = repNode.getString("[@profile]"); String reportName = repNode.getString("[@report]"); Hashtable<String, ReportOption> reportOptions = new Hashtable<String, ReportOption>(); reportDataStructure.put(reportName, reportOptions); // Loop through the options and add each to the table. for (Object o : repNode.configurationsAt("option")) { SubnodeConfiguration option = (SubnodeConfiguration) o; String name = option.getString("[@name]"); String type = option.getString("[@type]"); String value = option.getString("[@value]"); ReportOption ro = new ReportOption(); ro.setName(name); if (type.toLowerCase().equals("boolean")) { ro.setBoolValue(Boolean.parseBoolean(value)); } else if (type.toLowerCase().equals("integer")) { ro.setIntValue(Integer.valueOf(value)); } else { // Assume a string type here then. ro.setStrValue(value); } reportOptions.put(name, ro); log.debug(ro); } } System.out.println(reportDataStructure); /* * At this point, we now need to deploy the reports window to have * the user pick a report and select some happy options to allow * that report to work. Let's go. */ /* * Deploy the Reports selector, to select a report */ Reports.getInstance().setLdapConnection(ldap); ReportsWindow reports = new ReportsWindow(Reports.getInstance().getAllReports(), reportDataStructure); Report report = reports.getSelection(); if (report == null) { return; } /* * Empty the profiles and load a clean copy - then save it back to * the file */ config.clearTree("Reports"); for (Report r : Reports.getInstance().getAllReports()) { config.addProperty("Reports.Report(-1)[@report]", r.getClass().getCanonicalName()); config.addProperty("Reports.Report[@name]", "Standard"); for (ReportOption ro : r.getOptions().values()) { config.addProperty("Reports.Report.option(-1)[@name]", ro.getName()); config.addProperty("Reports.Report.option[@type]", ro.getType()); config.addProperty("Reports.Report.option[@value]", ro.getStrValue()); } } config.save(configurationFile); ProgressBar bar = new ProgressBar(); bar.start(); report.execute(); ASCIIFormatter format = new ASCIIFormatter(); ReportResult res = report.getResult(); format.format(res, new File(res.getForName() + "_" + res.getReportName() + ".txt")); bar.stop(); JOptionPane.showMessageDialog(null, "The report is at " + res.getForName() + "_" + res.getReportName() + ".txt", "Success", JOptionPane.INFORMATION_MESSAGE); } catch (ParseException e) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("FAST Ldap Searcher", opts); } catch (ConfigurationException e) { e.printStackTrace(); log.fatal("OH EM GEES! Configuration errors."); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Displays a message dialog with given information. *//* w ww. ja v a 2s.c om*/ public static void showInformationDialog(Component component, String message) { final JPanel panel = new JPanel(new BorderLayout(5, 5)); final JLabel messageLabel = new JLabel(message); messageLabel.setFont(new Font("Dialog", Font.BOLD, messageLabel.getFont().getSize())); panel.add(messageLabel, BorderLayout.CENTER); // Adjust stack trace dimensions final Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); screenDimension.setSize(screenDimension.getWidth() * 0.7, screenDimension.getHeight() * 0.7); final Dimension maxStackTraceDimension = new Dimension(500, 500); maxStackTraceDimension.setSize(Math.min(maxStackTraceDimension.getWidth(), screenDimension.getWidth()), Math.min(maxStackTraceDimension.getHeight(), screenDimension.getHeight())); JOptionPane.showMessageDialog(component, panel, "Information", JOptionPane.INFORMATION_MESSAGE); }
From source file:Main.java
public Main() { options.add(createOptionPane("Plain Message", JOptionPane.PLAIN_MESSAGE)); options.add(createOptionPane("Error Message", JOptionPane.ERROR_MESSAGE)); options.add(createOptionPane("Information Message", JOptionPane.INFORMATION_MESSAGE)); options.add(createOptionPane("Warning Message", JOptionPane.WARNING_MESSAGE)); options.add(createOptionPane("Want to do something?", JOptionPane.QUESTION_MESSAGE)); items = new Object[] { "First", "Second", "Third" }; JComboBox choiceCombo = new JComboBox(items); options.add(new JOptionPane(choiceCombo, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION), "Question Message"); JFrame frame = new JFrame("JOptionPane'Options"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(options, BorderLayout.CENTER); frame.pack();//w w w . ja v a 2 s . c om frame.setVisible(true); }
From source file:ShowAction.java
public void actionPerformed(ActionEvent actionEvent) { JOptionPane.showMessageDialog(parentComponent, "About Swing", "About Box V2.0", JOptionPane.INFORMATION_MESSAGE); }
From source file:Dialogs.java
public static void showOk(Component owner, String msg) { JOptionPane.showMessageDialog(owner, msg, "", JOptionPane.INFORMATION_MESSAGE); }
From source file:ShowAction.java
public void actionPerformed(ActionEvent actionEvent) { Runnable runnable = new Runnable() { public void run() { JOptionPane.showMessageDialog(parentComponent, "About Swing", "About Box V2.0", JOptionPane.INFORMATION_MESSAGE); }//from w w w . j a v a 2s .co m }; EventQueue.invokeLater(runnable); }