Example usage for javax.swing JOptionPane INFORMATION_MESSAGE

List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE

Introduction

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

Prototype

int INFORMATION_MESSAGE

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

Click Source Link

Document

Used for information messages.

Usage

From source file:com.smanempat.controller.ControllerClassification.java

public void saveResultFile(JYearChooser thnAjaran1, JYearChooser thnAjaran2, JTable tableResult)
        throws IOException {
    JFileChooser dirChooser = new JFileChooser();
    dirChooser.setDialogTitle("Save as Excel File");
    String thnAjaran = Integer.toString(thnAjaran1.getYear()) + "-" + Integer.toString(thnAjaran2.getYear());
    String generateFileName = "Data Hasil Penjurusan Siswa Tahun Ajaran " + thnAjaran + ".xlsx";
    dirChooser.setSelectedFile(new File(generateFileName));
    int userSelection = dirChooser.showSaveDialog(null);
    int rowCountData = tableResult.getRowCount();
    if (userSelection == dirChooser.APPROVE_OPTION) {
        File fileToSave = dirChooser.getSelectedFile();
        convertToExcel(tableResult, fileToSave);
        JOptionPane.showMessageDialog(null, "Hasil klasifikasi jurusan berhasil disimpan",
                "Penyimpanan Berhasil", JOptionPane.INFORMATION_MESSAGE,
                new ImageIcon("src/com/smanempat/image/success.png"));
    }//from   w  ww  .  j  av  a 2 s.  c  o  m
}

From source file:burlov.ultracipher.swing.SwingGuiApplication.java

private JMenuBar createMenuBar() {
    JMenuBar bar = new JMenuBar();
    JMenu menu = null;/*from   ww  w  . java 2  s.  c o m*/
    /*
     * 'File' Menue
     */
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    bar.add(menu);

    JMenuItem item = new JMenuItem("Save database");
    item.setAccelerator(KeyStroke.getKeyStroke("control S"));
    item.setMnemonic(KeyEvent.VK_S);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveDatabase();
        }
    });
    menu.add(item);

    item = new JMenuItem("Download database");
    item.setMnemonic(KeyEvent.VK_L);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            downloadAndMergeData();
        }
    });
    menu.add(item);

    item = new JMenuItem("Edit sync account");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editSyncAccount();
        }
    });
    menu.add(item);
    menu.add(new JSeparator());

    JMenu submenu = new JMenu("Import");
    menu.add(submenu);

    item = new JMenuItem("From CSV");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            importCSV();
        }
    });
    submenu.add(item);

    submenu = new JMenu("Export");
    menu.add(submenu);

    item = new JMenuItem("As CSV");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            exportCSV();
        }
    });
    submenu.add(item);
    item = new JMenuItem("Change passphrase");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            changePassword();
        }
    });

    /*
     * 'Edit' Menue
     */
    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    bar.add(menu);
    item = menu.add(mainPanel.getNewEntryAction());
    item.setMnemonic(KeyEvent.VK_N);
    item = menu.add(mainPanel.getDeleteEntryAction());
    item.setMnemonic(KeyEvent.VK_D);

    menu.add(new JSeparator());

    menu = new JMenu("Tools");
    // item = new JMenuItem("Passwort generator");
    // menu.add(item);
    // item.addActionListener(new ActionListener() {
    //
    // @Override
    // public void actionPerformed(ActionEvent e) {
    // passGenerator.setVisible(false);
    // passGenerator.setLocationRelativeTo(getMainFrame());
    // passGenerator.setVisible(true);
    // }
    // });
    item = new JMenuItem("Screen keyboard");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            screenKeyboard.setLocationRelativeTo(getMainFrame());
            screenKeyboard.setVisible(true);

        }
    });
    item = new JMenuItem("File digester");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            digester.setLocationRelativeTo(getMainFrame());
            digester.setVisible(true);

        }
    });
    bar.add(menu);
    /*
     * 'Help' Menue
     */
    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    bar.add(menu);

    item = new JMenuItem("Performance test");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            measurePerformance();
        }
    });
    item = new JMenuItem("System info");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showSystemInfo();
        }
    });
    item = new JMenuItem("About");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            String text = "<html>Ultracipher 6.1<br>(C) Copyright 2015 Paul Burlov<br><br>"
                    + "Encryption strength: 768Bit (6 x 128Bit keys)<br>Cipher cascade: AES/Twofish/Serpent/CAST6/SEED/Camellia"
                    + "<br>Encryption mode: Two pass CBC"
                    + "<br>Key derivation algorithm: SCrypt with N=2^14,P=8,R=1<br><br> "
                    + "This product includes software developed by the<br>"
                    + "<ul><li>Apache Software Foundation "
                    + "<a href='http://www.apache.org'>http://www.apache.org</a>"
                    + "<li>Legion of the Bouncy Castle <a href='http://bouncycastle.org/'>http://bouncycastle.org</a>"
                    + "<li>Project SwingX" + "<li>Bytecode Pty Ltd." + "</ul></html>";
            JOptionPane.showMessageDialog(getMainFrame(), text, "", JOptionPane.INFORMATION_MESSAGE,
                    getAppIcon());
        }
    });
    bar.add(Box.createHorizontalGlue());
    menu = new JMenu("Keyboard");
    ButtonGroup group = new ButtonGroup();
    JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem("System");
    radioitem.setSelected(true);
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.resetMapping();
        }
    });
    menu.add(radioitem);
    radioitem = new JRadioButtonMenuItem("Futhark runes");
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.initForFuthark();
        }
    });
    menu.add(radioitem);
    radioitem = new JRadioButtonMenuItem("Anglo-Saxon runes");
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.initForAngloSaxon();
        }
    });
    menu.add(radioitem);
    bar.add(menu);
    // bar.add(Box.createHorizontalGlue());
    // bar.add(new PassGeneratorPanel());
    return bar;
}

From source file:Display.java

void changeAfterModpackInstall() {
    labelInstall.setText("Instalowanie paczki zakoczone!");
    if (pobierzOryginalnyLauncherMCCheckBox.isSelected()) {
        labelLauncher.setText("Instalowanie Launcher'a w toku: ");
        try {/*from w  ww. j a  v  a2s  . c  o  m*/
            progressBar3.setValue(0);
            DownloadTask task = new DownloadTask(gui, "launcher", Reference.Launcher,
                    XPackInstaller.launcher_path);
            task.addPropertyChangeListener(evt -> {
                if (evt.getPropertyName().equals("progress")) {
                    int progress = (Integer) evt.getNewValue();
                    progressBar3.setValue(progress);
                }
            });
            task.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }

    } else {
        zamknijButton.addActionListener(e -> System.exit(0));
        JOptionPane.showMessageDialog(panel, "Instalacja zakoczona pomylnie!", "Instalacja",
                JOptionPane.INFORMATION_MESSAGE);
        zamknijButton.setEnabled(true);
    }
}

From source file:JModem.java

/** Convenience routine: Show a standard-form information dialog */
void note(String message) {
    JOptionPane.showMessageDialog(this, message, "JModem Notice", JOptionPane.INFORMATION_MESSAGE);
    return;//from  w  w w.  j  av a2 s.c o  m
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Creates a tab pane for the given GridJob.
 * //ww w  .  j  a va  2  s . c  o  m
 * @param jobId JobId
 */
protected void createJobTab(final String jobId) {

    // Request Job Profile
    final InternalClusterJobService jobService = ClusterManager.getInstance().getJobService();
    final GridJobProfile profile = jobService.getProfile(jobId);

    // Job Start Time
    final long startTime = System.currentTimeMillis();

    final JPanel jobPanel = new JPanel();
    jobPanel.setLayout(new BorderLayout(10, 10));

    // Progess Panel
    JPanel progressPanel = new JPanel();
    progressPanel.setLayout(new BorderLayout(10, 10));
    progressPanel.setBorder(BorderFactory.createTitledBorder("Progress"));
    jobPanel.add(progressPanel, BorderLayout.NORTH);

    final JProgressBar progressBar = new JProgressBar();
    progressBar.setStringPainted(true);
    progressPanel.add(progressBar, BorderLayout.CENTER);
    addUIElement("jobs." + jobId + ".progress", progressBar); // Add to components map

    // Buttons Panel
    JPanel buttonsPanel = new JPanel();
    jobPanel.add(buttonsPanel, BorderLayout.SOUTH);
    buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    // Terminate Button
    JButton terminateButton = new JButton("Terminate");
    terminateButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new Thread(new Runnable() {

                public void run() {

                    // Job Name = Class Name
                    String name = profile.getJob().getClass().getSimpleName();

                    // Request user confirmation
                    int option = JOptionPane.showConfirmDialog(ClusterMainUI.this,
                            "Are you sure to terminate GridJob " + name + "?", "Nebula - Terminate GridJob",
                            JOptionPane.YES_NO_OPTION);

                    if (option == JOptionPane.NO_OPTION)
                        return;

                    // Attempt Cancel
                    boolean result = profile.getFuture().cancel();

                    // Notify results
                    if (result) {
                        JOptionPane.showMessageDialog(ClusterMainUI.this,
                                "Grid Job '" + name + "terminated successfully.", "Nebula - Job Terminated",
                                JOptionPane.INFORMATION_MESSAGE);
                    } else {
                        JOptionPane.showMessageDialog(ClusterMainUI.this,
                                "Failed to terminate Grid Job '" + name, "Nebula - Job Termination Failed",
                                JOptionPane.WARNING_MESSAGE);
                    }
                }

            }).start();
        }
    });
    buttonsPanel.add(terminateButton);
    addUIElement("jobs." + jobId + ".terminate", terminateButton); // Add to components map

    // Close Tab Button
    JButton closeButton = new JButton("Close Tab");
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    removeJobTab(jobId);
                }
            });
        }
    });
    closeButton.setEnabled(false);

    buttonsPanel.add(closeButton);
    addUIElement("jobs." + jobId + ".closetab", closeButton); // Add to components map

    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new GridBagLayout());
    jobPanel.add(centerPanel, BorderLayout.CENTER);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weightx = 1.0;

    /* -- Job Information -- */

    JPanel jobInfoPanel = new JPanel();
    jobInfoPanel.setBorder(BorderFactory.createTitledBorder("Job Information"));
    jobInfoPanel.setLayout(new GridBagLayout());
    c.gridy = 0;
    c.ipady = 30;
    centerPanel.add(jobInfoPanel, c);

    GridBagConstraints c1 = new GridBagConstraints();
    c1.fill = GridBagConstraints.BOTH;
    c1.weightx = 1;
    c1.weighty = 1;

    // Name
    jobInfoPanel.add(new JLabel("Name :"), c1);
    JLabel jobNameLabel = new JLabel();
    jobInfoPanel.add(jobNameLabel, c1);
    jobNameLabel.setText(profile.getJob().getClass().getSimpleName());
    addUIElement("jobs." + jobId + ".job.name", jobNameLabel); // Add to components map

    // Gap
    jobInfoPanel.add(new JLabel(), c1);

    // Type
    jobInfoPanel.add(new JLabel("Type :"), c1);
    JLabel jobType = new JLabel();
    jobType.setText(getJobType(profile.getJob()));
    jobInfoPanel.add(jobType, c1);
    addUIElement("jobs." + jobId + ".job.type", jobType); // Add to components map

    // Job Class Name
    c1.gridy = 1;
    c1.gridwidth = 1;
    jobInfoPanel.add(new JLabel("GridJob Class :"), c1);
    c1.gridwidth = GridBagConstraints.REMAINDER;
    JLabel jobClassLabel = new JLabel();
    jobClassLabel.setText(profile.getJob().getClass().getName());
    jobInfoPanel.add(jobClassLabel, c1);
    addUIElement("jobs." + jobId + ".job.class", jobClassLabel); // Add to components map

    /* -- Execution Information -- */

    JPanel executionInfoPanel = new JPanel();
    executionInfoPanel.setBorder(BorderFactory.createTitledBorder("Execution Statistics"));
    executionInfoPanel.setLayout(new GridBagLayout());
    c.gridy = 1;
    c.ipady = 30;
    centerPanel.add(executionInfoPanel, c);

    GridBagConstraints c3 = new GridBagConstraints();
    c3.weightx = 1;
    c3.weighty = 1;
    c3.fill = GridBagConstraints.BOTH;

    // Start Time
    executionInfoPanel.add(new JLabel("Job Status :"), c3);
    final JLabel statusLabel = new JLabel("Initializing");
    executionInfoPanel.add(statusLabel, c3);
    addUIElement("jobs." + jobId + ".execution.status", statusLabel); // Add to components map

    // Status Update Listener
    profile.getFuture().addGridJobStateListener(new GridJobStateListener() {
        public void stateChanged(final GridJobState newState) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    statusLabel.setText(StringUtils.capitalize(newState.toString().toLowerCase()));
                }
            });
        }
    });

    executionInfoPanel.add(new JLabel(), c3); // Space Holder

    // Percent Complete
    executionInfoPanel.add(new JLabel("Completed % :"), c3);
    final JLabel percentLabel = new JLabel("-N/A-");
    executionInfoPanel.add(percentLabel, c3);
    addUIElement("jobs." + jobId + ".execution.percentage", percentLabel); // Add to components map

    c3.gridy = 1;

    // Start Time
    executionInfoPanel.add(new JLabel("Start Time :"), c3);
    JLabel startTimeLabel = new JLabel(DateFormat.getInstance().format(new Date(startTime)));
    executionInfoPanel.add(startTimeLabel, c3);
    addUIElement("jobs." + jobId + ".execution.starttime", startTimeLabel); // Add to components map

    executionInfoPanel.add(new JLabel(), c3); // Space Holder

    // Elapsed Time
    executionInfoPanel.add(new JLabel("Elapsed Time :"), c3);
    JLabel elapsedTimeLabel = new JLabel("-N/A-");
    executionInfoPanel.add(elapsedTimeLabel, c3);
    addUIElement("jobs." + jobId + ".execution.elapsedtime", elapsedTimeLabel); // Add to components map

    c3.gridy = 2;

    // Tasks Deployed (Count)
    executionInfoPanel.add(new JLabel("Tasks Deployed :"), c3);
    JLabel tasksDeployedLabel = new JLabel("-N/A-");
    executionInfoPanel.add(tasksDeployedLabel, c3);
    addUIElement("jobs." + jobId + ".execution.tasks", tasksDeployedLabel); // Add to components map

    executionInfoPanel.add(new JLabel(), c3); // Space Holder

    // Results Collected (Count)
    executionInfoPanel.add(new JLabel("Results Collected :"), c3);
    JLabel resultsCollectedLabel = new JLabel("-N/A-");
    executionInfoPanel.add(resultsCollectedLabel, c3);
    addUIElement("jobs." + jobId + ".execution.results", resultsCollectedLabel); // Add to components map

    c3.gridy = 3;

    // Remaining Tasks (Count)
    executionInfoPanel.add(new JLabel("Remaining Tasks :"), c3);
    JLabel remainingTasksLabel = new JLabel("-N/A-");
    executionInfoPanel.add(remainingTasksLabel, c3);
    addUIElement("jobs." + jobId + ".execution.remaining", remainingTasksLabel); // Add to components map

    executionInfoPanel.add(new JLabel(), c3); // Space Holder

    // Failed Tasks (Count)
    executionInfoPanel.add(new JLabel("Failed Tasks :"), c3);
    JLabel failedTasksLabel = new JLabel("-N/A-");
    executionInfoPanel.add(failedTasksLabel, c3);
    addUIElement("jobs." + jobId + ".execution.failed", failedTasksLabel); // Add to components map

    /* -- Submitter Information -- */
    UUID ownerId = profile.getOwner();
    GridNodeDelegate owner = ClusterManager.getInstance().getClusterRegistrationService()
            .getGridNodeDelegate(ownerId);

    JPanel ownerInfoPanel = new JPanel();
    ownerInfoPanel.setBorder(BorderFactory.createTitledBorder("Owner Information"));
    ownerInfoPanel.setLayout(new GridBagLayout());
    c.gridy = 2;
    c.ipady = 10;
    centerPanel.add(ownerInfoPanel, c);

    GridBagConstraints c2 = new GridBagConstraints();

    c2.fill = GridBagConstraints.BOTH;
    c2.weightx = 1;
    c2.weighty = 1;

    // Host Name
    ownerInfoPanel.add(new JLabel("Host Name :"), c2);
    JLabel hostNameLabel = new JLabel(owner.getProfile().getName());
    ownerInfoPanel.add(hostNameLabel, c2);
    addUIElement("jobs." + jobId + ".owner.hostname", hostNameLabel); // Add to components map

    // Gap
    ownerInfoPanel.add(new JLabel(), c2);

    // Host IP Address
    ownerInfoPanel.add(new JLabel("Host IP :"), c2);
    JLabel hostIPLabel = new JLabel(owner.getProfile().getIpAddress());
    ownerInfoPanel.add(hostIPLabel, c2);
    addUIElement("jobs." + jobId + ".owner.hostip", hostIPLabel); // Add to components map

    // Owner UUID
    c2.gridy = 1;
    c2.gridx = 0;
    ownerInfoPanel.add(new JLabel("Owner ID :"), c2);
    JLabel ownerIdLabel = new JLabel(profile.getOwner().toString());
    c2.gridx = 1;
    c2.gridwidth = 4;
    ownerInfoPanel.add(ownerIdLabel, c2);
    addUIElement("jobs." + jobId + ".owner.id", ownerIdLabel); // Add to components map

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            // Create Tab
            addUIElement("jobs." + jobId, jobPanel);
            JTabbedPane tabs = getUIElement("tabs");
            tabs.addTab(profile.getJob().getClass().getSimpleName(), jobPanel);
            tabs.revalidate();
        }
    });

    // Execution Information Updater Thread
    new Thread(new Runnable() {

        boolean initialized = false;
        boolean unbounded = false;

        public void run() {

            // Unbounded, No Progress Supported
            if ((!initialized) && profile.getJob() instanceof UnboundedGridJob<?>) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        progressBar.setIndeterminate(true);
                        progressBar.setStringPainted(false);

                        // Infinity Symbol
                        percentLabel.setText(String.valueOf('\u221e'));

                    }
                });
                initialized = true;
                unbounded = true;
            }

            // Update Job Info
            while (true) {

                try {
                    // 500ms Interval
                    Thread.sleep(500);

                } catch (InterruptedException e) {
                    log.warn("Interrupted Progress Updater Thread", e);
                }

                final int totalCount = profile.getTotalTasks();
                final int tasksRem = profile.getTaskCount();
                final int resCount = profile.getResultCount();
                final int failCount = profile.getFailedCount();

                showBusyIcon();

                // Task Information
                JLabel totalTaskLabel = getUIElement("jobs." + jobId + ".execution.tasks");
                totalTaskLabel.setText(String.valueOf(totalCount));

                // Result Count
                JLabel resCountLabel = getUIElement("jobs." + jobId + ".execution.results");
                resCountLabel.setText(String.valueOf(resCount));

                // Remaining Task Count
                JLabel remLabel = getUIElement("jobs." + jobId + ".execution.remaining");
                remLabel.setText(String.valueOf(tasksRem));

                // Failed Task Count
                JLabel failedLabel = getUIElement("jobs." + jobId + ".execution.failed");
                failedLabel.setText(String.valueOf(failCount));

                // Elapsed Time
                JLabel elapsedLabel = getUIElement("jobs." + jobId + ".execution.elapsedtime");
                elapsedLabel.setText(TimeUtils.timeDifference(startTime));

                // Job State
                final JLabel statusLabel = getUIElement("jobs." + jobId + ".execution.status");

                // If not in Executing Mode
                if ((!profile.getFuture().isJobFinished())
                        && profile.getFuture().getState() != GridJobState.EXECUTING) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {

                            // Progress Bar
                            progressBar.setIndeterminate(true);
                            progressBar.setStringPainted(false);

                            // Status Text
                            String state = profile.getFuture().getState().toString();
                            statusLabel.setText(StringUtils.capitalize(state.toLowerCase()));

                            // Percentage Label
                            percentLabel.setText(String.valueOf('\u221e'));
                        }
                    });
                } else { // Executing Mode : Progress Information

                    // Job Finished, Stop
                    if (profile.getFuture().isJobFinished()) {
                        showIdleIcon();
                        return;
                    }

                    // Double check for status label
                    if (!statusLabel.getText().equalsIgnoreCase("executing")) {
                        SwingUtilities.invokeLater(new Runnable() {

                            @Override
                            public void run() {
                                String newstate = profile.getFuture().getState().toString();
                                statusLabel.setText(StringUtils.capitalize(newstate.toLowerCase()));
                            }

                        });
                    }

                    if (!unbounded) {

                        final int percentage = (int) (profile.percentage() * 100);

                        //final int failCount = profile.get
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {

                                // If finished at this point, do not update
                                if (progressBar.getValue() == 100) {
                                    return;
                                }

                                // If ProgressBar is in indeterminate
                                if (progressBar.isIndeterminate()) {
                                    progressBar.setIndeterminate(false);
                                    progressBar.setStringPainted(true);
                                }

                                // Update Progress Bar / Percent Label
                                progressBar.setValue(percentage);
                                percentLabel.setText(percentage + " %");

                            }
                        });
                    }
                }

            }
        }
    }).start();

    // Job End Hook to Execute Job End Actions
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {

        public void onServiceEvent(final ServiceMessage event) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {

                    JButton close = getUIElement("jobs." + jobId + ".closetab");
                    JButton terminate = getUIElement("jobs." + jobId + ".terminate");
                    terminate.setEnabled(false);
                    close.setEnabled(true);

                    JProgressBar progress = getUIElement("jobs." + jobId + ".progress");
                    JLabel percentage = getUIElement("jobs." + jobId + ".execution.percentage");

                    progress.setEnabled(false);

                    // If Successfully Finished
                    if (event.getType() == ServiceMessageType.JOB_END) {

                        if (profile.getFuture().getState() != GridJobState.FAILED) {
                            // If Not Job Failed
                            progress.setValue(100);
                            percentage.setText("100 %");
                        } else {
                            // If Failed
                            percentage.setText("N/A");
                        }

                        // Stop (if) Indeterminate Progress Bar
                        if (progress.isIndeterminate()) {
                            progress.setIndeterminate(false);
                            progress.setStringPainted(true);
                        }
                    } else if (event.getType() == ServiceMessageType.JOB_CANCEL) {

                        if (progress.isIndeterminate()) {
                            progress.setIndeterminate(false);
                            progress.setStringPainted(false);
                            percentage.setText("N/A");
                        }
                    }

                    showIdleIcon();
                }
            });
        }

    }, jobId, ServiceMessageType.JOB_CANCEL, ServiceMessageType.JOB_END);
}

From source file:userInteface.Patient.ManageVitalSignsJPanel.java

private void displayDetailsJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_displayDetailsJButtonActionPerformed
    // TODO add your handling code here:
    int selectedRow = viewPatientsJTable.getSelectedRow();
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(this, "Please select a row from table.", "Error",
                JOptionPane.INFORMATION_MESSAGE);
        return;//w w w  . j  a va 2 s.  c  om
    }
    Person person = (Person) viewPatientsJTable.getValueAt(selectedRow, 0);
    Patient patient = person.getPatient();
    if (patient != null) {
        populateVitalSignTable(person);
    } else {
        JOptionPane.showMessageDialog(this, "Patient not created, Please create Patient first.", "Error",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:net.sf.firemox.Magic.java

public void actionPerformed(ActionEvent e) {
    final String command = e.getActionCommand();
    final Object obj = e.getSource();
    if (obj == sendButton) {
        if (sendTxt.getText().length() != 0) {
            MChat.getInstance().sendMessage(sendTxt.getText() + "\n");
            sendTxt.setText("");
        }//from w  w  w. j a v a2s  . c o m
    } else if (command != null && command.startsWith("border-")) {
        for (int i = cardBorderMenu.getComponentCount(); i-- > 0;) {
            ((JRadioButtonMenuItem) cardBorderMenu.getComponent(i)).setSelected(false);
        }
        ((JRadioButtonMenuItem) obj).setSelected(true);
        CardFactory.updateColor(command.substring("border-".length()));
        CardFactory.updateAllCardsUI();
        magicForm.repaint();
    } else if ("menu_help_mailing".equals(command)) {
        try {
            WebBrowser.launchBrowser(
                    "http://lists.sourceforge.net/lists/listinfo/" + IdConst.PROJECT_NAME + "-user");
        } catch (Exception e1) {
            JOptionPane.showOptionDialog(this, LanguageManager.getString("error") + " : " + e1.getMessage(),
                    LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE,
                    UIHelper.getIcon("wiz_update_error.gif"), null, null);
        }
    } else if ("menu_options_settings".equals(command)) {
        // Setting panel
        final Wizard settingsPanel = new Settings();
        settingsPanel.setVisible(true);
    } else if ("menu_help_check-update".equals(command)) {
        VersionChecker.checkVersion(this);
    } else if ("menu_game_new_client".equals(command)) {
        new net.sf.firemox.ui.wizard.Client().setVisible(true);
    } else if ("menu_game_new_server".equals(command)) {
        new net.sf.firemox.ui.wizard.Server().setVisible(true);
    } else if ("menu_tools_log".equals(command)) {
        new net.sf.firemox.ui.wizard.Log().setVisible(true);
    } else if ("menu_tools_featurerequest".equals(command)) {
        new Feature().setVisible(true);
    } else if ("menu_tools_bugreport".equals(command)) {
        new Bug().setVisible(true);
    } else if ("menu_game_skip".equals(command)) {
        if (ConnectionManager.isConnected() && skipButton.isEnabled() && StackManager.idHandedPlayer == 0) {
            StackManager.noReplayToken.take();
            try {
                manualSkip();
            } catch (Throwable t) {
                t.printStackTrace();
            } finally {
                StackManager.noReplayToken.release();
            }
        }
    } else if ("menu_game_disconnect".equals(command)) {
        ConnectionManager.closeConnexions();
    } else if ("menu_tools_jdb".equals(command)) {
        DeckBuilder.loadFromMagic();
    } else if ("menu_game_exit".equals(command)) {
        exitForm(null);
    } else if (obj == autoManaMenu) {
        /*
         * invoked you click directly on the "auto-mana option" of the menu
         * "options". The opponent has to know that we are in "auto colorless mana
         * use", since player will no longer click on the mana icon to define
         * which colored mana active player has used as colorless mana, then the
         * opponent have not to wait for active player choice, but apply the same
         * Algorithm calculating which colored manas are used as colorless manas.
         * This information is not sent immediately, but will be sent with the
         * next action of active player.
         */
        MCommonVars.autoMana = autoManaMenu.isSelected();
    } else if (obj == autoPlayMenu) {
        /*
         * invoked you click directly on the "auto-play option" of the menu
         * "options".
         */
        MCommonVars.autoStack = autoPlayMenu.isSelected();
    } else if ("menu_tools_jcb".equals(command)) {
        // TODO cardBuilderMenu -> not yet implemented
        Log.info("cardBuilderMenu -> not yet implemented");
    } else if ("menu_game_proxy".equals(command)) {
        new ProxyConfiguration().setVisible(true);
    } else if ("menu_help_help".equals(command)) {
        /*
         * Invoked you click directly on youLabel. Opponent will receive this
         * information.
         */
        try {
            WebBrowser.launchBrowser("http://prdownloads.sourceforge.net/" + IdConst.PROJECT_NAME
                    + "/7e_rulebook_EN.pdf?download");
        } catch (Exception e1) {
            JOptionPane.showOptionDialog(this, LanguageManager.getString("error") + " : " + e1.getMessage(),
                    LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE,
                    UIHelper.getIcon("wiz_update_error.gif"), null, null);
        }
    } else if ("menu_help_about".equals(command)) {
        new About(this).setVisible(true);
    } else if ("menu_help_about.tbs".equals(command)) {
        new AboutMdb(this).setVisible(true);
    } else if (obj == reverseArtCheck || obj == reverseSideCheck) {
        Configuration.setProperty("reverseArt", reverseArtCheck.isSelected());
        Configuration.setProperty("reverseSide", reverseSideCheck.isSelected());
        ZoneManager.updateReversed();
        StackManager.PLAYERS[1].updateReversed();
        repaint();
        SwingUtilities.invokeLater(SkinLF.REFRESH_RUNNER);
    } else if (obj == soundMenu) {
        Configuration.setProperty("sound", soundMenu.isSelected());
        soundMenu.setIcon(
                soundMenu.isSelected() ? UIHelper.getIcon("sound.gif") : UIHelper.getIcon("soundoff.gif"));
    } else if ("menu_lf_randomAngle".equals(command)) {
        Configuration.setProperty("randomAngle", ((AbstractButton) e.getSource()).isSelected());
        CardFactory.updateAllCardsUI();
    } else if ("menu_lf_powerToughnessColor".equals(command)) {
        final Color powerToughnessColor = JColorChooser.showDialog(this,
                LanguageManager.getString("menu_lf_powerToughnessColor"), CardFactory.powerToughnessColor);
        if (powerToughnessColor != null) {
            Configuration.setProperty("powerToughnessColor", powerToughnessColor.getRGB());
            CardFactory.updateColor(null);
            repaint();
        }
    } else if (obj == initialdelayMenu) {
        // TODO factor this code with the one of Magic.class
        final ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
        new InputNumber(LanguageManager.getString("initialdelay"),
                LanguageManager.getString("initialdelay.tooltip"), 0, Integer.MAX_VALUE,
                toolTipManager.getInitialDelay()).setVisible(true);
        if (Wizard.optionAnswer == JOptionPane.YES_OPTION) {
            toolTipManager.setEnabled(Wizard.indexAnswer != 0);
            toolTipManager.setInitialDelay(Wizard.indexAnswer);
            initialdelayMenu.setText(LanguageManager.getString("initialdelay")
                    + (toolTipManager.isEnabled() ? " : " + Wizard.indexAnswer + " ms" : "(disabled)"));
            Configuration.setProperty("initialdelay", Wizard.indexAnswer);
        }
    } else if (obj == dismissdelayMenu) {
        // TODO factor this code with the one of Magic.class
        final ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
        new InputNumber(LanguageManager.getString("dismissdelay"),
                LanguageManager.getString("dismissdelay.tooltip"), 0, Integer.MAX_VALUE,
                toolTipManager.getDismissDelay()).setVisible(true);
        if (Wizard.optionAnswer == JOptionPane.YES_OPTION) {
            toolTipManager.setDismissDelay(Wizard.indexAnswer);
            Configuration.setProperty("dismissdelay", Wizard.indexAnswer);
            dismissdelayMenu.setText(LanguageManager.getString("dismissdelay") + Wizard.indexAnswer + " ms");
        }
    }

}

From source file:Display.java

void changeAfterLauncher() {
    labelLauncher.setText("Instalowanie Launcher'a zakoczone!");
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    zamknijButton.addActionListener(e -> System.exit(0));
    zamknijButton.setEnabled(true);/* w  w w . j a v a  2 s.c om*/
    JOptionPane.showMessageDialog(panel, "Instalacja zakoczona pomylnie!", "Instalacja",
            JOptionPane.INFORMATION_MESSAGE);
}

From source file:com.proyecto.vista.MantenimientoUnidadMedida.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    // TODO add your handling code here:
    accion = AbstractControlador.ELIMINAR;
    if (tblUnidad.getSelectedRow() != -1) {

        Integer id = tblUnidad.getSelectedRow();

        UnidadMedida unidad = unidadControlador.buscarPorId(lista.get(id).getId());

        if (unidad != null) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar la Unidad?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                int[] filas = tblUnidad.getSelectedRows();
                for (int i = 0; i < filas.length; i++) {
                    UnidadMedida unidad2 = lista.get(filas[0]);
                    lista.remove(unidad2);
                    unidadControlador.setSeleccionado(unidad2);
                    unidadControlador.accion(accion);
                }//from w ww  . jav a 2  s .co  m
                if (unidadControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Unidad eliminada correctamente", "Mensaje del Sistema",
                            JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Unidad no eliminada", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Unidad no eliminada", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar una Unidad de la lista", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.proyecto.vista.MantenimientoCampo.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    // TODO add your handling code here:
    accion = Controlador.ELIMINAR;/*from w ww .  jav a  2s  .co  m*/
    if (tblclase.getSelectedRow() != -1) {

        Integer id = tblclase.getSelectedRow();

        Campo campo = campoControlador.buscarPorId(lista.get(id).getId());

        if (campo != null) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar el Campo?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                int[] filas = tblclase.getSelectedRows();
                for (int i = 0; i < filas.length; i++) {
                    Campo campo2 = lista.get(filas[0]);
                    lista.remove(campo2);
                    campoControlador.setSeleccionado(campo2);
                    campoControlador.accion(accion);
                }
                if (campoControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Campo eliminada correctamente", "Mensaje del Sistema",
                            JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Campo no eliminada", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Campo no eliminada", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar un Campo de la lista", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}