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:Main.java

public Main() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JButton openDialog = new JButton("Click here");
    JPanel myPanel = new JPanel();
    myPanel.add(new JButton(new AbstractAction("Click here") {
        @Override/*from ww  w  .  j  a v  a2s. co  m*/
        public void actionPerformed(ActionEvent e) {
            JDialog dialog = new JDialog(myFrame, true);
            JTextField myField = new JTextField(10);
            JPanel innerPanel = new JPanel();
            innerPanel.add(myField);
            dialog.add(innerPanel);
            dialog.pack();
            dialog.setSize(new Dimension(160, 120));
            dialog.setLocationRelativeTo(myFrame);
            dialog.setVisible(true);
        }
    }));
    add(myPanel);
    pack();
    setSize(new Dimension(320, 240));
    setLocationRelativeTo(null);
    setVisible(true);
}

From source file:de.juwimm.cms.http.AuthenticationStreamSupportingHttpInvokerRequestExecutor.java

@Override
protected void executePostMethod(HttpInvokerClientConfiguration config, HttpClient httpClient,
        PostMethod postMethod) throws IOException {
    HttpClientWrapper.getInstance().setHostConfiguration(super.getHttpClient(),
            new URL(config.getServiceUrl()));
    try {/*from   w w w.j  a va  2s  . c  o  m*/
        super.executePostMethod(config, httpClient, postMethod);
        //if call succeeds 
        isErrorMessageShown = false;
    } catch (IOException e) {
        if ((e instanceof SocketException && e.getMessage().equals("Connection reset"))
                || (e instanceof ConnectException && e.getMessage().equals("Connection refused"))) {
            if (!isErrorMessageShown) {
                isErrorMessageShown = true;
                JOptionPane errorOptionPane = new JOptionPane(
                        Constants.rb.getString("exception.connectionToServerLost"),
                        JOptionPane.INFORMATION_MESSAGE);
                JDialog errorDialogPane = errorOptionPane.createDialog(UIConstants.getMainFrame(),
                        rb.getString("dialog.title"));
                errorDialogPane.setModalityType(ModalityType.MODELESS);
                errorDialogPane.setVisible(true);
                errorDialogPane.setEnabled(true);
                errorDialogPane.addWindowListener(new WindowAdapter() {
                    public void windowDeactivated(WindowEvent e) {
                        if (((JDialog) e.getSource()).isVisible() == false) {
                            isErrorMessageShown = false;
                        }
                    }
                });

            }
            log.error("server is not reachable");
        } else {
            e.printStackTrace();
        }
    }
    System.out.println(postMethod.getResponseHeaders());
}

From source file:org.cds06.speleograph.GraphPanel.java

private void editDateAxis() {
    JDialog dialog = (new DateAxisEditor(dateAxis));
    dialog.setLocation(getX() + (getWidth() / 2 - dialog.getWidth() / 2),
            getY() + (getHeight() / 2 - dialog.getHeight() / 2));
    dialog.setVisible(true);
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanLaunchPanel.java

private void displayDefinitionDialog(ScanDefinition selectedItem) {
    Window parent = SwingUtilities.getWindowAncestor(this.getParent());
    JDialog scanDefinitionDialog = this.dialogFactory.createScanDefinitionDialogInstance(parent,
            ModalityType.APPLICATION_MODAL, this, selectedItem);
    scanDefinitionDialog.setVisible(true);
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanPathMappingPanel.java

private void displayExclusionDialog(FileReference selectedItem) {
    Window parent = SwingUtilities.getWindowAncestor(this.getParent());
    JDialog exclusionDialog = this.dialogFactory.createExclusionDialogInstance(parent,
            ModalityType.APPLICATION_MODAL, this, selectedItem);
    exclusionDialog.setVisible(true);
}

From source file:kenh.xscript.elements.Debug.java

/**
 * a dialog use to debug./*from   w w w  . ja  va 2s.co m*/
 */
public void process() {

    JDialog dialog = new JDialog((Frame) null, true);
    dialog.setTitle("Debugger");
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setSize(750, 200);
    initial(dialog.getContentPane());
    dialog.setVisible(true);

    this.result = null;

}

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

public void show() {
    if (pst.isEmbeddedView()) {
        return;/*  w w  w. j  a  v  a 2  s.com*/
    }

    TimeObserver time = new TimeObserver("Show Dialog");
    time.empezar();
    JDialog dlg = (JDialog) parentContainer;

    time.terminar();

    if (dialogFixture == null) {
        dlg.setModal(true);
        dlg.setVisible(true);
    }
}

From source file:ColorPicker3.java

public ColorPicker3() {
    super("JColorChooser Test Frame");
    setSize(200, 100);//from www . j  a  v a 2  s .  co  m
    final JButton go = new JButton("Show JColorChoser");
    final Container contentPane = getContentPane();
    go.addActionListener(new ActionListener() {
        final JColorChooser chooser = new JColorChooser();

        boolean first = true;

        public void actionPerformed(ActionEvent e) {
            if (first) {
                first = false;
                GrayScalePanel gsp = new GrayScalePanel();
                chooser.addChooserPanel(gsp);
                chooser.setPreviewPanel(new CustomPane());
            }
            JDialog dialog = JColorChooser.createDialog(ColorPicker3.this, "Demo 3", true, chooser,
                    new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            c = chooser.getColor();
                        }
                    }, null);
            dialog.setVisible(true);
            contentPane.setBackground(c);
        }
    });
    contentPane.add(go, BorderLayout.SOUTH);
    // addWindowListener(new BasicWindowMonitor()); // 1.1 & 1.2
    setDefaultCloseOperation(EXIT_ON_CLOSE);
}

From source file:net.automatalib.visualization.jung.JungGraphVisualizationProvider.java

@Override
public <N, E> void visualize(Graph<N, E> graph, GraphDOTHelper<N, ? super E> helper, boolean modal,
        Map<String, String> options) {

    DirectedGraph<NodeVisualization, EdgeVisualization> visGraph = createVisualizationGraph(graph, helper);

    Layout<NodeVisualization, EdgeVisualization> layout = new KKLayout<>(visGraph);

    VisualizationViewer<NodeVisualization, EdgeVisualization> vv = new VisualizationViewer<>(layout);
    setupRenderContext(vv.getRenderContext());
    vv.setGraphMouse(mouse);/*w w  w .j  a  v a  2s .  c o  m*/

    final JDialog frame = new JDialog((Dialog) null, "Visualization", modal);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.getContentPane().add(vv);
    frame.pack();
    frame.setVisible(true);
}

From source file:medsavant.uhn.cancer.UserCommentApp.java

private void newComment(VariantRecord vr) {
    JDialog acd = new AddNewCommentDialog(MedSavantFrame.getInstance(), vr);
    acd.setVisible(true);
}