Example usage for javax.swing JDialog setVisible

List of usage examples for javax.swing JDialog setVisible

Introduction

In this page you can find the example usage for javax.swing JDialog setVisible.

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Dialog depending on the value of parameter b .

Usage

From source file:de.atomfrede.tools.evalutation.util.DialogUtil.java

public void showWizardDialog(final JDialog wizardDialog) {
    SwingUtilities.invokeLater(new Runnable() {

        @Override/*from  w  ww  . j  a v  a  2  s .c o  m*/
        public void run() {
            wizardDialog.setVisible(true);
        }
    });
}

From source file:cz.nn.copytables.gui.CopyTablesGUI.java

private void showDialog(String title, String message) {
    JOptionPane pane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = pane.createDialog(this, title);
    dialog.setAlwaysOnTop(true);//from   w  w w.  j ava2 s.  c  o  m
    dialog.setVisible(true);
    logger.info("setVisible");
}

From source file:br.org.acessobrasil.silvinha.vista.panels.PainelSenha.java

private void getPassword() {
    JDialog dialog = op.createDialog(this, GERAL.SENHA_SOLICITADA_SERVIDOR);
    dialog.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    dialog.setVisible(true);
    Object opcao = op.getValue();
    if (opcao != null) {
        if (opcao.equals(JOptionPane.OK_OPTION)) {
            this.user = txtName.getText();
            this.password = String.valueOf(txtPass.getPassword());
        } else if (opcao.equals(JOptionPane.CANCEL_OPTION)) {
            this.cancelAuth = true;
        }/*from  w ww  . j  a  v  a 2  s  . com*/
    }
}

From source file:cz.nn.copytables.gui.CopyTablesGUI.java

void showErrorPane(String title, String msg) {
    logger.error(msg);//from  w w w.  ja va2 s  .c o m
    JOptionPane pane = new JOptionPane(msg, JOptionPane.ERROR_MESSAGE);
    JDialog dialog = pane.createDialog("Application says: " + title);
    dialog.setAlwaysOnTop(true);
    dialog.setVisible(true);
}

From source file:org.simbrain.plot.piechart.PieChartGui.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("Add")) {
        this.getWorkspaceComponent().getModel().addDataSource();
    } else if (e.getActionCommand().equalsIgnoreCase("dialog")) {
        ReflectivePropertyEditor editor = (new ReflectivePropertyEditor(getWorkspaceComponent().getModel()));
        JDialog dialog = editor.getDialog();
        dialog.setModal(true);//from   w ww .ja v a2s.  c  o  m
        dialog.pack();
        dialog.setLocationRelativeTo(null);
        dialog.setVisible(true);
    } else if (e.getActionCommand().equalsIgnoreCase("Delete")) {
        this.getWorkspaceComponent().getModel().removeDataSource();
    }
}

From source file:eu.delving.sip.Application.java

private static void memoryNotConfigured() {
    String os = System.getProperty("os.name");
    Runtime rt = Runtime.getRuntime();
    int totalMemory = (int) (rt.totalMemory() / 1024 / 1024);
    StringBuilder out = new StringBuilder();
    String JAR_NAME = "SIP-Creator-2014-XX-XX.jar";
    if (os.startsWith("Windows")) {
        out.append(":: SIP-Creator Startup Batch file for Windows (more memory than ").append(totalMemory)
                .append("Mb)\n");
        out.append("java -jar -Xms1024m -Xmx1024m ").append(JAR_NAME);
    } else if (os.startsWith("Mac")) {
        out.append("# SIP-Creator Startup Script for Mac OSX (more memory than ").append(totalMemory)
                .append("Mb)\n");
        out.append("java -jar -Xms1024m -Xmx1024m ").append(JAR_NAME);
    } else {/*from w w w  .j a va 2 s  . com*/
        System.out.println("Unrecognized OS: " + os);
    }
    String script = out.toString();
    final JDialog dialog = new JDialog(null, "Memory Not Configured Yet!",
            Dialog.ModalityType.APPLICATION_MODAL);
    JTextArea scriptArea = new JTextArea(3, 40);
    scriptArea.setText(script);
    scriptArea.setSelectionStart(0);
    scriptArea.setSelectionEnd(script.length());
    JPanel scriptPanel = new JPanel(new BorderLayout());
    scriptPanel.setBorder(BorderFactory.createTitledBorder("Script File"));
    scriptPanel.add(scriptArea, BorderLayout.CENTER);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
    JButton ok = new JButton("OK, Continue anyway");
    ok.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
            EventQueue.invokeLater(LAUNCH);
        }
    });
    buttonPanel.add(ok);
    JPanel centralPanel = new JPanel(new GridLayout(0, 1));
    centralPanel.setBorder(BorderFactory.createEmptyBorder(15, 25, 15, 25));
    centralPanel.add(
            new JLabel("<html><b>The SIP-Creator started directly can have too little default memory allocated."
                    + "<br>It should be started with the following script:</b>"));
    centralPanel.add(scriptPanel);
    centralPanel.add(new JLabel(
            "<html><b>Please copy the above text into a batch or script file and execute that instead.</b>"));
    dialog.getContentPane().add(centralPanel, BorderLayout.CENTER);
    dialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    dialog.pack();
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (int) ((dimension.getWidth() - dialog.getWidth()) / 2);
    int y = (int) ((dimension.getHeight() - dialog.getHeight()) / 2);
    dialog.setLocation(x, y);
    dialog.setVisible(true);
}

From source file:edu.scripps.fl.pubchem.xmltool.gui.GUIComponent.java

public void openPDF(boolean isInternalR, File pdf, Component comp) throws FileNotFoundException {
    if (isInternalR) {
        try {// w  ww. j ava2 s . c o m
            Desktop.getDesktop().open(pdf);
        } catch (Exception ex) {
            log.info(ex.getMessage());
            String msg = "Unable to open PDF format through java. Would you like to save "
                    + pdf.getAbsoluteFile() + " in a new location?";
            JOptionPane pane = new JOptionPane(msg, JOptionPane.QUESTION_MESSAGE,
                    JOptionPane.YES_NO_CANCEL_OPTION, null, null, JOptionPane.YES_OPTION);
            JDialog dialog = pane.createDialog(comp, "Report PDF");
            dialog.setVisible(true);
            Object choice = pane.getValue();
            if (choice.equals(JOptionPane.YES_OPTION)) {
                jfcFiles = new JFileChooser();
                jfcFiles.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                int state = jfcFiles.showSaveDialog(comp);

                if (state == JFileChooser.APPROVE_OPTION) {
                    File file = checkFileExtension(".pdf");
                    log.info("Opening: " + file.getName() + ".");
                    if (file != null)
                        pdf.renameTo(file);
                } else {
                    log.info("Open command cancelled by user.");
                }
            }
        }
    }
}

From source file:org.simbrain.plot.rasterchart.RasterPlotPanel.java

/**
 * Show properties dialog./*from   w w  w  .jav a  2s.  c o  m*/
 */
public void showPropertiesDialog() {
    ReflectivePropertyEditor editor = (new ReflectivePropertyEditor(model));
    JDialog dialog = editor.getDialog();
    dialog.setModal(true);
    dialog.pack();
    dialog.setLocationRelativeTo(null);
    dialog.setVisible(true);
}

From source file:org.simbrain.plot.barchart.BarChartGui.java

/** @see ActionListener */
public void actionPerformed(final ActionEvent arg0) {
    if (arg0.getActionCommand().equalsIgnoreCase("dialog")) {
        ReflectivePropertyEditor editor = (new ReflectivePropertyEditor(getWorkspaceComponent().getModel()));
        JDialog dialog = editor.getDialog();
        dialog.setModal(true);//www. ja  v  a2 s.c om
        dialog.pack();
        dialog.setLocationRelativeTo(null);
        dialog.setVisible(true);
    } else if (arg0.getActionCommand().equalsIgnoreCase("Delete")) {
        this.getWorkspaceComponent().getModel().removeColumn();
    } else if (arg0.getActionCommand().equalsIgnoreCase("Add")) {
        this.getWorkspaceComponent().getModel().addColumn();
    }
}

From source file:com.aw.swing.mvp.JDialogView.java

public void close() {
    JDialog dlg = (JDialog) parentContainer;
    dlg.setVisible(false);
    dlg.dispose();
}