Example usage for javax.swing JOptionPane WARNING_MESSAGE

List of usage examples for javax.swing JOptionPane WARNING_MESSAGE

Introduction

In this page you can find the example usage for javax.swing JOptionPane WARNING_MESSAGE.

Prototype

int WARNING_MESSAGE

To view the source code for javax.swing JOptionPane WARNING_MESSAGE.

Click Source Link

Document

Used for warning messages.

Usage

From source file:GUI.VentanaPrincipal.java

public void SalirPrograma() {
    if ((JOptionPane.showConfirmDialog(this, "Realmente desea salir de la aplicacin?",
            "Salir del Monitor 1 de Bases de Datos", JOptionPane.YES_NO_OPTION,
            JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION)) {
        System.exit(0);/*  w  w w.  jav a 2s.co m*/
    }
}

From source file:org.argouml.application.Main.java

/**
 * The main entry point of ArgoUML./* ww w.ja v a  2 s  . co  m*/
 * @param args command line parameters
 */
public static void main(String[] args) {
    try {
        LOG.info("ArgoUML Started.");

        SimpleTimer st = new SimpleTimer();
        st.mark("begin");

        initPreinitialize();

        st.mark("arguments");
        parseCommandLine(args);

        // Register our last chance exception handler
        AwtExceptionHandler.registerExceptionHandler();

        // Get the splash screen up as early as possible
        st.mark("create splash");
        SplashScreen splash = null;
        if (!batch) {
            // We have to do this to set the LAF for the splash screen
            st.mark("initialize laf");
            LookAndFeelMgr.getInstance().initializeLookAndFeel();
            if (theTheme != null) {
                LookAndFeelMgr.getInstance().setCurrentTheme(theTheme);
            }
            if (doSplash) {
                splash = initializeSplash();
            }
        }

        // main initialization happens here
        ProjectBrowser pb = initializeSubsystems(st, splash);

        // Needs to happen after initialization is done & modules loaded
        st.mark("perform commands");
        if (batch) {
            // TODO: Add an "open most recent project" command so that 
            // command state can be decoupled from user settings?
            performCommandsInternal(commands);
            commands = null;

            System.out.println("Exiting because we are running in batch.");
            new ActionExit().doCommand(null);
            return;
        }

        if (reloadRecent && projectName == null) {
            projectName = getMostRecentProject();
        }

        URL urlToOpen = null;
        if (projectName != null) {
            projectName = PersistenceManager.getInstance().fixExtension(projectName);
            urlToOpen = projectUrl(projectName, urlToOpen);
        }

        openProject(st, splash, pb, urlToOpen);

        st.mark("perspectives");
        if (splash != null) {
            splash.updateProgress(75);
        }

        st.mark("open window");
        updateProgress(splash, 95, "statusmsg.bar.open-project-browser");
        ArgoFrame.getFrame().setVisible(true);

        st.mark("close splash");
        if (splash != null) {
            splash.setVisible(false);
            splash.dispose();
            splash = null;
        }

        // Aufrufen der Aufgabenstellung
        if (taskID != null) {
            ActionShowTask task = new ActionShowTask();
            task.showTask();
            if (projectName == null && ActionShowTask.taskDescription != null
                    && (ActionShowTask.taskDescription.toLowerCase().contains("aktivittsdiagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitts-diagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitätsdiagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitäts-diagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("activity diagram")
                            || ActionShowTask.taskDescription.toLowerCase().contains("activity-diagram"))) {
                new ActionActivityDiagram().actionPerformed(null);
            }
        }

        performCommands(commands);
        commands = null;

        st.mark("start critics");
        Runnable startCritics = new StartCritics();
        Main.addPostLoadAction(startCritics);

        st.mark("start loading modules");
        Runnable moduleLoader = new LoadModules();
        Main.addPostLoadAction(moduleLoader);

        PostLoad pl = new PostLoad(postLoadActions);
        Thread postLoadThead = new Thread(pl);
        postLoadThead.start();

        LOG.info("");
        LOG.info("profile of load time ############");
        for (Enumeration i = st.result(); i.hasMoreElements();) {
            LOG.info(i.nextElement());
        }
        LOG.info("#################################");
        LOG.info("");

        st = null;
        ArgoFrame.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

        // Andreas: just temporary: a warning dialog for uml2...
        if (showUml2warning && Model.getFacade().getUmlVersion().startsWith("2")) {
            JOptionPane.showMessageDialog(ArgoFrame.getFrame(),
                    "You are running an experimental version not meant for productive work!",
                    "UML2 pre-alpha warning", JOptionPane.WARNING_MESSAGE);
        }

        //ToolTipManager.sharedInstance().setInitialDelay(500);
        ToolTipManager.sharedInstance().setDismissDelay(50000000);
    } catch (Throwable t) {
        try {
            LOG.fatal("Fatal error on startup.  ArgoUML failed to start", t);
        } finally {
            System.out.println("Fatal error on startup.  " + "ArgoUML failed to start.");
            t.printStackTrace();
            System.exit(1);
        }
    }
}

From source file:dbseer.gui.actions.OpenDirectoryAction.java

@Override
public void actionPerformed(ActionEvent actionEvent) {
    if (profile.getLive()) {
        JOptionPane.showMessageDialog(null, "You cannot import a directory for the live dataset.", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return;//from w  ww. ja va  2  s  .  co  m
    }
    //DBSeerConfiguration config = DBSeerGUI.config;
    loadDialog.createFileDialog("Import from Directory", DBSeerFileLoadDialog.DIRECTORY_ONLY);
    loadDialog.showDialog();

    if (loadDialog.getFile() != null) {
        profile.setPath(loadDialog.getFile().getAbsolutePath());
        profile.loadDataset(true);
    }

    // old implementation
    //      if (loadDialog.getFile() != null)
    //      {
    //         profile.clearTransactionTypes();
    //         String[] files = loadDialog.getFile().list();
    //         String directory = loadDialog.getFile().getAbsolutePath();
    //         if (files != null)
    //         {
    //            for (String file : files)
    //            {
    //               String fileLower = file.toLowerCase();
    //
    //               file = directory + "/" + file;
    //               if (fileLower.contains("mon"))
    //               {
    //                  profile.setMonitoringDataPath(file);
    //               }
    //               else if (fileLower.contains("alllogs-t"))
    //               {
    //                  profile.setTransactionFilePath(file);
    //               }
    //               else if (fileLower.contains("alllogs-q"))
    //               {
    //                  profile.setQueryFilePath(file);
    //               }
    //               else if (fileLower.contains("alllogs-s"))
    //               {
    //                  profile.setStatementFilePath(file);
    //               }
    //               else if (fileLower.contains("header"))
    //               {
    //                  profile.setHeaderPath(file);
    //               }
    //               else if (fileLower.contains("avg") || fileLower.contains("average"))
    //               {
    //                  profile.setAverageLatencyPath(file);
    //                  File avgLatencyFile = new File(file);
    //                  try
    //                  {
    //                     BufferedReader reader = new BufferedReader(new FileReader(avgLatencyFile));
    //                     String line = reader.readLine(); // read first line.
    //                     String[] tokens = line.trim().split("\\s+");
    //                     int numTransactionType = tokens.length - 1;
    //                     for (int i = 0; i < numTransactionType; ++i)
    //                     {
    //                        profile.addTransactionType("Type " + (i+1));
    //                     }
    //                  }
    //                  catch (FileNotFoundException e)
    //                  {
    //                     JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    //                  }
    //                  catch (IOException e)
    //                  {
    //                     JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    //                  }
    //               }
    //               else if (fileLower.contains("trans_count"))
    //               {
    //                  profile.setTransCountPath(file);
    //               }
    //               else if (fileLower.contains("prctile_latencies.mat"))
    //               {
    //                  profile.setPercentileLatencyPath(file);
    //               }
    //               else if (fileLower.contains("stmt_count"))
    //               {
    //                  profile.setStatementStatPath(file);
    //               }
    //               else if (fileLower.contains("page"))
    //               {
    //                  profile.setPageInfoPath(file);
    //               }
    ////               else if( fileLower.contains("trans_types"))
    ////               {
    ////                  File typeFile = new File(file);
    ////                  try
    ////                  {
    ////                     BufferedReader reader = new BufferedReader(new FileReader(typeFile));
    ////                     String line = reader.readLine(); // read first line.
    ////                     String[] tokens = line.trim().split(",");
    ////                     for (String type : tokens)
    ////                     {
    ////
    ////                     }
    ////                     int numTransactionType = tokens.length;
    ////                     profile.setNumTransactionTypes(numTransactionType);
    ////                  }
    ////                  catch (FileNotFoundException e)
    ////                  {
    ////                     JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    ////                  }
    ////                  catch (IOException e)
    ////                  {
    ////                     JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    ////                  }
    ////               }
    //            }
    //         }
    //
    //         File dir = loadDialog.getFile();
    //         FileFilter filter = new WildcardFileFilter("prctile_latency_*");
    //         File[] latencies = dir.listFiles(filter);
    //         if (latencies.length > profile.getNumTransactionTypes())
    //         {
    //            for (int i = profile.getNumTransactionTypes(); i < latencies.length; ++i)
    //            {
    //               profile.addTransactionType("Type " + (i+1));
    //            }
    //         }
    //         profile.addTransactionRows();
    //      }
}

From source file:com.dragoniade.deviantart.deviation.SearchResources.java

public List<Deviation> search(ProgressDialog progress, Collection collection) {
    if (user == null) {
        throw new IllegalStateException("You must set the user before searching.");
    }//ww  w . j ava  2s  . c om
    if (search == null) {
        throw new IllegalStateException("You must set the search type before searching.");
    }
    JOptionPane.showMessageDialog(owner, "The resource Searcher hasn't been implemented yet.",
            "Not implemented yet", JOptionPane.WARNING_MESSAGE);
    return null;
}

From source file:com.dragoniade.deviantart.deviation.SearchHelloWorld.java

public List<Deviation> search(ProgressDialog progress, Collection collection) {
    if (user == null) {
        throw new IllegalStateException("You must set the user before searching.");
    }//from   w  w  w  .  j  a v  a2s  . c om
    if (search == null) {
        throw new IllegalStateException("You must set the search type before searching.");
    }
    JOptionPane.showMessageDialog(owner,
            "<html>Hello world!<br/> Because there has to be an Hello World script everywhere :)</html>", user,
            JOptionPane.WARNING_MESSAGE);
    return null;
}

From source file:mobac.program.EnvironmentSetup.java

public static void checkMemory() {
    Runtime r = Runtime.getRuntime();
    long maxHeap = r.maxMemory();
    String heapMBFormatted = String.format(Locale.ENGLISH, "%3.2f MiB", maxHeap / 1048576d);
    log.info("Total available memory to MOBAC: " + heapMBFormatted);
    if (maxHeap < 200000000) {
        String msg = "<html><b>WARNING:</b> Mobile Atlas Creator has been started "
                + "with a very small amount of memory assigned.<br>"
                + "The current maximum usable amount of memory to Mobile Atlas Creator is <b>" + heapMBFormatted
                + "</b>.<br><br>Please make sure to start Mobile Atlas Creator in "
                + "the future via the provided start scripts <i>Mobile Atlas Creator.exe</i><br>"
                + "on Windows or <i>start.sh</i> on Linux/Unix/OSX or add the "
                + "parameter <b>-Xmx 512M</b> to your startup command.<br><br>"
                + "Example: <i>java -Xmx512M -jar Mobile_Atlas_Creator.jar</i><br>"
                + "<br><center>Press OK to continue and start Mobile Atlas Creator</center></html>";
        JOptionPane.showMessageDialog(null, msg, "Warning: low memory", JOptionPane.WARNING_MESSAGE);
    }/* w w w  .  j  a  v  a 2 s .  c om*/
}

From source file:MainClass.java

protected void showMessage(Object source) {
    if (source instanceof Component) {
        JOptionPane.showMessageDialog((Component) source, errorMessage, errorTitle,
                JOptionPane.WARNING_MESSAGE);
    } else {//from   w w w  .j  a v a 2s. com
        System.err.println(errorMessage);
    }
}

From source file:ca.sqlpower.wabit.swingui.action.DeleteWabitServerWorkspaceAction.java

public void actionPerformed(ActionEvent e) {
    try {/*from   w  ww.  j  a  va 2  s  . co m*/
        WabitSwingSessionImpl activeSwingSession = (WabitSwingSessionImpl) context.getActiveSwingSession();
        if (activeSwingSession == null) {
            JOptionPane.showMessageDialog(context.getFrame(), "That button refreshes the current workspace,\n"
                    + "but there is no workspace selected right now.");
            return;
        }
        int choice = JOptionPane.showConfirmDialog(context.getFrame(),
                "By deleting this workspace, " + "you will not be able to recover any of its contents.\n"
                        + "Are you sure you want to delete it?",
                "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);

        if (choice == JOptionPane.YES_OPTION) {
            activeSwingSession.delete();
        }
    } catch (ClientProtocolException ex) {
        throw new RuntimeException(ex);
    } catch (URISyntaxException ex) {
        throw new RuntimeException(ex);
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}

From source file:com.moneydance.modules.features.importlist.io.DeleteOneOperation.java

@Override
public void showWarningAndExecute(final List<File> files) {
    final File file = files.iterator().next();
    final String message = this.localizable.getConfirmationMessageDeleteOneFile(file.getName());
    final Object confirmationLabel = new JLabel(message);
    final Image image = Helper.INSTANCE.getSettings().getIconImage();
    Icon icon = null;/*  ww  w  . j  a v  a 2  s.com*/
    if (image != null) {
        icon = new ImageIcon(image);
    }
    final Object[] options = { this.localizable.getOptionDeleteFile(), this.localizable.getOptionCancel() };

    final int choice = JOptionPane.showOptionDialog(null, // no parent component
            confirmationLabel, null, // no title
            JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, icon, options, options[1]);

    if (choice == 0) {
        this.execute(files);
    } else {
        LOG.info(String.format("Canceled deleting file %s", file.getAbsoluteFile()));
    }
}

From source file:biz.wolschon.finance.jgnucash.actions.ToolPluginMenuAction.java

@Override
public void actionPerformed(final ActionEvent e) {
    try {/*ww w .j a  va 2s .com*/
        GnucashWritableFile wModel = myJGnucashEditor.getWritableModel();
        if (wModel == null) {
            JOptionPane.showMessageDialog(myJGnucashEditor, "No open file.",
                    "Please open a gnucash-file first!", JOptionPane.WARNING_MESSAGE);
            return;
        }

        // Activate plug-in that declares extension.
        myJGnucashEditor.getPluginManager().activatePlugin(ext.getDeclaringPluginDescriptor().getId());
        // Get plug-in class loader.
        ClassLoader classLoader = myJGnucashEditor.getPluginManager()
                .getPluginClassLoader(ext.getDeclaringPluginDescriptor());
        // Load Tool class.
        Class toolCls = classLoader.loadClass(ext.getParameter("class").valueAsString());
        // Create Tool instance.
        Object o = toolCls.newInstance();
        if (!(o instanceof ToolPlugin)) {
            LOGGER.error("Plugin '" + pluginName + "' does not implement ToolPlugin-interface.");
            JOptionPane.showMessageDialog(myJGnucashEditor, "Error",
                    "Plugin '" + pluginName + "' does not implement ToolPlugin-interface.",
                    JOptionPane.ERROR_MESSAGE);
            return;

        }
        ToolPlugin importer = (ToolPlugin) o;
        try {
            myJGnucashEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            GnucashWritableAccount selectedAccount = (GnucashWritableAccount) myJGnucashEditor
                    .getSelectedAccount();
            String message = importer.runTool(wModel, selectedAccount);
            if (message != null && message.length() > 0) {
                JOptionPane.showMessageDialog(myJGnucashEditor, "Tool OK",
                        "The tool-use was a success:\n" + message, JOptionPane.INFORMATION_MESSAGE);
            }
        } catch (Exception e1) {
            LOGGER.error("Tool-use via Plugin '" + pluginName + "' failed.", e1);
            JOptionPane
                    .showMessageDialog(
                            myJGnucashEditor, "Error", "Tool-use via Plugin '" + pluginName + "' failed.\n"
                                    + "[" + e1.getClass().getName() + "]: " + e1.getMessage(),
                            JOptionPane.ERROR_MESSAGE);
        } finally {
            myJGnucashEditor.setCursor(Cursor.getDefaultCursor());
        }
    } catch (Exception e1) {
        LOGGER.error("Could not activate requested Tool-plugin '" + pluginName + "'.", e1);
        JOptionPane
                .showMessageDialog(
                        myJGnucashEditor, "Error", "Could not activate requested Tool-plugin '" + pluginName
                                + "'.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(),
                        JOptionPane.ERROR_MESSAGE);
    }
}