Example usage for javax.swing JDialog JDialog

List of usage examples for javax.swing JDialog JDialog

Introduction

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

Prototype

public JDialog(Window owner) 

Source Link

Document

Creates a modeless dialog with the specified Window as its owner and an empty title.

Usage

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame(Main.class.getSimpleName());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final JButton button = new JButton("Click me to open dialog");
    button.addActionListener(e -> {//from www  . j  a  v  a2 s  .  c o  m
        Window parentWindow = SwingUtilities.windowForComponent(button);
        JDialog dialog = new JDialog(parentWindow);
        dialog.setLocationRelativeTo(button);
        dialog.setModal(true);
        dialog.add(new JLabel("A dialog"));
        dialog.pack();
        dialog.setVisible(true);
    });
    frame.add(button);
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    int result = JOptionPane.showConfirmDialog(null, "Show over parent?");
    for (int i = 1; i < 4; i++) {
        JFrame f = new JFrame("Frame " + i);
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        Component parent = (JOptionPane.OK_OPTION == result ? f : null);

        f.setSize(400, 300);// ww w.ja  va 2s.  c  o  m
        f.setLocationByPlatform(true);
        f.setVisible(true);

        JDialog d = new JDialog(f);
        d.setTitle("Dialog " + i);
        d.setSize(300, 200);
        d.setLocationRelativeTo(parent);
        d.setVisible(true);
    }
}

From source file:Main.java

private static JButton newButton(String label) {
    final JButton button = new JButton(label);
    button.addActionListener(e -> {/*  w w w .j  a v  a  2s.c o  m*/
        Window parentWindow = SwingUtilities.windowForComponent(button);
        JDialog dialog = new JDialog(parentWindow);
        dialog.setLocationRelativeTo(button);
        dialog.setModal(true);
        dialog.add(newPane("Label"));
        dialog.pack();
        dialog.setVisible(true);
    });
    return button;
}

From source file:IHM.GialogGraph.java

public void Show() {
    VisualizationViewer<String, String> vv;
    vv = new VisualizationViewer<>(new CircleLayout<String, String>(JungGraph), dim);

    Transformer<String, String> transformer = new Transformer<String, String>() {
        @Override/*from w  w w  .j  a v  a  2s. c  om*/
        public String transform(String arg0) {
            return arg0;
        }
    };
    vv.getRenderContext().setVertexLabelTransformer(transformer);
    transformer = new Transformer<String, String>() {
        @Override
        public String transform(String arg0) {
            return arg0;
        }
    };
    vv.getRenderContext().setEdgeLabelTransformer(transformer);
    vv.getRenderer().setVertexRenderer(new MyRenderer());
    DefaultModalGraphMouse<String, Number> graphMouse = new DefaultModalGraphMouse<String, Number>();
    vv.setGraphMouse(graphMouse);
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);

    JDialog frame = new JDialog(MymainWidow);
    frame.getContentPane().add(vv);
    frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    frame.addWindowListener(new WindowListener() {

        @Override
        public void windowOpened(WindowEvent e) {

        }

        @Override
        public void windowClosing(WindowEvent e) {
            MymainWidow.enable();
        }

        @Override
        public void windowClosed(WindowEvent e) {
            MymainWidow.enable();
        }

        @Override
        public void windowIconified(WindowEvent e) {

        }

        @Override
        public void windowDeiconified(WindowEvent e) {

        }

        @Override
        public void windowActivated(WindowEvent e) {

        }

        @Override
        public void windowDeactivated(WindowEvent e) {

        }
    });
    frame.pack();
    frame.setLocationRelativeTo(MymainWidow);
    frame.setResizable(true);
    frame.setVisible(true);
}

From source file:biomine.bmvis2.pipeline.sources.QueryGraphSource.java

@Override
public BMGraph getBMGraph() throws GraphOperationException {
    try {//from   ww  w.  j  a  v a2s  .  c o  m
        if (fetch == null) {
            fetch = new CrawlerFetch(query, neighborhood, database);
        }
        if (ret == null) {
            final JDialog dial = new JDialog((JFrame) null);

            dial.setTitle("BMVIS II - Query to database");
            dial.setSize(400, 200);
            dial.setMinimumSize(new Dimension(400, 200));
            dial.setResizable(false);
            final JTextArea text = new JTextArea();
            text.setEditable(false);

            dial.add(text);
            text.setText("...");

            class Z {
                Exception runExc = null;
            }

            final Z z = new Z();
            Runnable fetchThread = new Runnable() {
                public void run() {
                    try {
                        long startTime = System.currentTimeMillis();
                        while (!fetch.isDone()) {
                            fetch.update();
                            Thread.sleep(500);
                            long time = System.currentTimeMillis();
                            long elapsed = time - startTime;

                            if (elapsed > 30000) {
                                throw new GraphOperationException("Timeout while querying " + query);
                            }
                            final String newText = fetch.getState() + ":\n" + fetch.getMessages();
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    text.setText(newText);
                                }
                            });
                        }

                        SwingUtilities.invokeAndWait(new Runnable() {
                            public void run() {
                                dial.setVisible(false);
                            }
                        });

                    } catch (Exception e) {
                        z.runExc = e;
                    }

                }

            };

            new Thread(fetchThread).start();
            dial.setModalityType(ModalityType.APPLICATION_MODAL);
            dial.setVisible(true);
            ret = fetch.getBMGraph();
            if (ret == null)
                throw new GraphOperationException(fetch.getMessages());
            if (z.runExc != null) {
                if (z.runExc instanceof GraphOperationException)
                    throw (GraphOperationException) z.runExc;
                else
                    throw new GraphOperationException(z.runExc);
            }
        }

    } catch (IOException e) {
        throw new GraphOperationException(e);
    }
    updateInfo();
    return ret;
}

From source file:fxts.stations.util.preferences.EditAction.java

public void actionPerformed(ActionEvent aEvent) {
    JButton okButton = UIManager.getInst().createButton();
    JButton cancelButton = UIManager.getInst().createButton();
    final JDialog dialog = new JDialog(mEditorPanel.getParentDialog());
    dialog.setTitle(mEditorPanel.getTitle());
    JPanel editPanel = new JPanel();
    JPanel buttonPanel = new JPanel();
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(UIFrontEnd.getInstance().getSideLayout());
    //mainPanel.setLayout(new SideLayout());

    //sets button panel
    buttonPanel.setLayout(UIFrontEnd.getInstance().getSideLayout());
    okButton.setText(mResMan.getString("IDS_OK_BUTTON"));
    //okButton.setPreferredSize(new Dimension(80, 27));
    GridBagConstraints sideConstraints = UIFrontEnd.getInstance().getSideConstraints();
    sideConstraints.insets = new Insets(10, 10, 10, 10);
    sideConstraints.gridx = 0;/*from   ww w. j  a va2  s .c  o  m*/
    sideConstraints.gridy = 0;
    ResizeParameterWrapper resizeParameter = UIFrontEnd.getInstance().getResizeParameter();
    resizeParameter.init(0.5, 0.0, 0.5, 0.0);
    resizeParameter.setToConstraints(sideConstraints);
    buttonPanel.add(okButton, sideConstraints);
    cancelButton.setText(mResMan.getString("IDS_CANCEL_BUTTON"));
    //cancelButton.setPreferredSize(new Dimension(80, 27));
    sideConstraints = UIFrontEnd.getInstance().getSideConstraints();
    sideConstraints.insets = new Insets(10, 10, 10, 10);
    sideConstraints.gridx = 1;
    sideConstraints.gridy = 0;
    resizeParameter = UIFrontEnd.getInstance().getResizeParameter();
    resizeParameter.init(0.5, 0.0, 0.5, 0.0);
    resizeParameter.setToConstraints(sideConstraints);
    buttonPanel.add(cancelButton, sideConstraints);

    //adds button panel
    sideConstraints = UIFrontEnd.getInstance().getSideConstraints();
    sideConstraints.insets = new Insets(10, 10, 10, 10);
    sideConstraints.gridx = 0;
    sideConstraints.gridy = 1;
    resizeParameter = UIFrontEnd.getInstance().getResizeParameter();
    resizeParameter.init(0.0, 1.0, 1.0, 1.0);
    resizeParameter.setToConstraints(sideConstraints);
    mainPanel.add(buttonPanel, sideConstraints);

    //sets edit panel
    final IEditor editor = mType.getEditor();
    editor.setValue(mValue);
    editPanel.setLayout(UIFrontEnd.getInstance().getSideLayout());
    sideConstraints = UIFrontEnd.getInstance().getSideConstraints();
    resizeParameter = UIFrontEnd.getInstance().getResizeParameter();
    resizeParameter.init(0.0, 0.0, 1.0, 1.0);
    resizeParameter.setToConstraints(sideConstraints);
    Component editComp = editor.getComponent();

    //Mar 25 2004 - kav: added for right tab order at Font Chooser at java 1.4.
    if (editComp instanceof FontChooser) {
        FontChooser fc = (FontChooser) editComp;
        fc.setNextFocusedComp(okButton);
    }
    editPanel.add(editComp, sideConstraints);

    //adds editor panel
    sideConstraints = UIFrontEnd.getInstance().getSideConstraints();
    sideConstraints.gridx = 0;
    sideConstraints.gridy = 0;
    resizeParameter = UIFrontEnd.getInstance().getResizeParameter();
    resizeParameter.init(0.0, 0.0, 1.0, 1.0);
    resizeParameter.setToConstraints(sideConstraints);
    mainPanel.add(editPanel, sideConstraints);

    //adds main panel
    dialog.getContentPane().setLayout(UIFrontEnd.getInstance().getSideLayout());
    //dialog.getContentPane().setLayout(new SideLayout());
    sideConstraints = UIFrontEnd.getInstance().getSideConstraints();
    sideConstraints.fill = GridBagConstraints.BOTH;
    resizeParameter = UIFrontEnd.getInstance().getResizeParameter();
    resizeParameter.init(0.0, 0.0, 1.0, 1.0);
    resizeParameter.setToConstraints(sideConstraints);
    dialog.getContentPane().add(mainPanel, sideConstraints);

    //adds listeners to buttons
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            if (editor.getValue().equals(mValue)) {
                //
            } else {
                mValue = editor.getValue();
                mEditorPanel.setValue(mValue);
                mEditorPanel.refreshControls();
                mEditorPanel.setValueChanged(true);
            }
            dialog.setVisible(false);
            dialog.dispose();
        }
    });
    okButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            "ExitAction");
    okButton.getActionMap().put("ExitAction", new AbstractAction() {
        /**
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent aEvent) {
            editor.setValue(mValue);
            dialog.setVisible(false);
            dialog.dispose();
        }
    });
    okButton.requestFocus();
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent aEvent) {
            editor.setValue(mValue);
            dialog.setVisible(false);
            dialog.dispose();
        }
    });
    //dialog.setResizable(false);
    dialog.setModal(true);
    dialog.pack();

    //sets minimal sizes for components
    Dimension dim = mainPanel.getSize();
    mainPanel.setMinimumSize(dim);
    mainPanel.setPreferredSize(dim);

    //sets size of buttons
    Dimension dimOkButton = okButton.getSize();
    Dimension dimCancelButton = cancelButton.getSize();
    int nMaxWidth = dimOkButton.getWidth() > dimCancelButton.getWidth() ? (int) dimOkButton.getWidth()
            : (int) dimCancelButton.getWidth();
    okButton.setPreferredSize(new Dimension(nMaxWidth, (int) dimOkButton.getHeight()));
    okButton.setSize(new Dimension(nMaxWidth, (int) dimOkButton.getHeight()));
    cancelButton.setPreferredSize(new Dimension(nMaxWidth, (int) dimCancelButton.getHeight()));
    cancelButton.setSize(new Dimension(nMaxWidth, (int) dimCancelButton.getHeight()));
    dialog.setLocationRelativeTo(dialog.getOwner());
    dialog.setVisible(true);
}

From source file:com.moss.appprocs.swing.ProgressDialog.java

private static JDialog makeDialogFor(Component c) {
    Window w = SwingUtilities.windowForComponent(c);
    if (w == null) {
        throw new RuntimeException(
                "The component heirarchy for the passed component does not end at a window:" + c);
    } else if (w instanceof Frame) {
        return new JDialog((Frame) w);
    } else if (w instanceof Dialog) {
        return new JDialog((Dialog) w);
    } else {/*from   ww w .ja  va 2s  .c  om*/
        throw new RuntimeException("Unsupported window type:" + w.getClass().getName());
    }
}

From source file:net.redstonelamp.gui.RedstoneLampGUI.java

private static void installCallback(JFrame frame, File selected) {
    JDialog dialog = new JDialog(frame);
    JLabel status = new JLabel("Downloading build...");
    JProgressBar progress = new JProgressBar();
    dialog.pack();/* w  w  w  . j av a2 s  . c  o  m*/
    dialog.setVisible(true);
    try {
        URL url = new URL("http://download.redstonelamp.net/?file=LatestBuild");
        InputStream is = url.openStream();
        int size = is.available();
        progress.setMinimum(0);
        progress.setMaximum(size);
        int size2 = size;
        OutputStream os = new FileOutputStream(new File(selected, "RedstoneLamp.jar"));
        while (size2 > 0) {
            int length = Math.min(4096, size2);
            byte[] buffer = new byte[length];
            size2 -= length;
            is.read(buffer);
            progress.setValue(size2);
            os.write(buffer);
        }
        is.close();
        os.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:misc.ModalityDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method is invoked from the//from  ww w  . j a va 2s  .  co  m
 * event-dispatching thread.
 */
private void createAndShowGUI() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    Insets ins = Toolkit.getDefaultToolkit().getScreenInsets(gc);
    int sw = gc.getBounds().width - ins.left - ins.right;
    int sh = gc.getBounds().height - ins.top - ins.bottom;

    // first document

    // frame f1

    f1 = new JFrame("Book 1 (parent frame)");
    f1.setBounds(32, 32, 300, 200);
    f1.addWindowListener(closeWindow);
    // create radio buttons
    rb11 = new JRadioButton("Biography", true);
    rb12 = new JRadioButton("Funny tale", false);
    rb13 = new JRadioButton("Sonnets", false);
    // place radio buttons into a single group
    ButtonGroup bg1 = new ButtonGroup();
    bg1.add(rb11);
    bg1.add(rb12);
    bg1.add(rb13);
    JButton b1 = new JButton("OK");
    b1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // get label of selected radiobutton
            String title = null;
            if (rb11.isSelected()) {
                title = rb11.getText();
            } else if (rb12.isSelected()) {
                title = rb12.getText();
            } else {
                title = rb13.getText();
            }
            // prepend radio button label to dialogs' titles
            d2.setTitle(title + " (modeless dialog)");
            d3.setTitle(title + " (document-modal dialog)");
            d2.setVisible(true);
        }
    });
    Container cp1 = f1.getContentPane();
    // create three containers to improve layouting
    cp1.setLayout(new GridLayout(1, 3));
    // an empty container
    Container cp11 = new Container();
    // a container to layout components
    Container cp12 = new Container();
    // an empty container
    Container cp13 = new Container();
    // add a button into a separate panel
    JPanel p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(b1);
    // add radio buttons and the OK button one after another into a single column
    cp12.setLayout(new GridLayout(4, 1));
    cp12.add(rb11);
    cp12.add(rb12);
    cp12.add(rb13);
    cp12.add(p1);
    // add three containers
    cp1.add(cp11);
    cp1.add(cp12);
    cp1.add(cp13);

    // dialog d2

    d2 = new JDialog(f1);
    d2.setBounds(132, 132, 300, 200);
    d2.addWindowListener(closeWindow);
    JLabel l2 = new JLabel("Enter your name: ");
    l2.setHorizontalAlignment(SwingConstants.CENTER);
    tf2 = new JTextField(12);
    JButton b2 = new JButton("OK");
    b2.setHorizontalAlignment(SwingConstants.CENTER);
    b2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //pass a name into the document modal dialog
            l3.setText("by " + tf2.getText());
            d3.setVisible(true);
        }
    });
    Container cp2 = d2.getContentPane();
    // add label, text field and button one after another into a single column
    cp2.setLayout(new BorderLayout());
    cp2.add(l2, BorderLayout.NORTH);
    cp2.add(tf2, BorderLayout.CENTER);
    JPanel p2 = new JPanel();
    p2.setLayout(new FlowLayout());
    p2.add(b2);
    cp2.add(p2, BorderLayout.SOUTH);

    // dialog d3

    d3 = new JDialog(d2, "", Dialog.ModalityType.DOCUMENT_MODAL);
    d3.setBounds(232, 232, 300, 200);
    d3.addWindowListener(closeWindow);
    JTextArea ta3 = new JTextArea();
    l3 = new JLabel();
    l3.setHorizontalAlignment(SwingConstants.RIGHT);
    Container cp3 = d3.getContentPane();
    cp3.setLayout(new BorderLayout());
    cp3.add(new JScrollPane(ta3), BorderLayout.CENTER);
    JPanel p3 = new JPanel();
    p3.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p3.add(l3);
    cp3.add(p3, BorderLayout.SOUTH);

    // second document

    // frame f4

    f4 = new JFrame("Book 2 (parent frame)");
    f4.setBounds(sw - 300 - 32, 32, 300, 200);
    f4.addWindowListener(closeWindow);
    // create radio buttons
    rb41 = new JRadioButton("Biography", true);
    rb42 = new JRadioButton("Funny tale", false);
    rb43 = new JRadioButton("Sonnets", false);
    // place radio buttons into a single group
    ButtonGroup bg4 = new ButtonGroup();
    bg4.add(rb41);
    bg4.add(rb42);
    bg4.add(rb43);
    JButton b4 = new JButton("OK");
    b4.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // get label of selected radiobutton
            String title = null;
            if (rb41.isSelected()) {
                title = rb41.getText();
            } else if (rb42.isSelected()) {
                title = rb42.getText();
            } else {
                title = rb43.getText();
            }
            // prepend radiobutton label to dialogs' titles
            d5.setTitle(title + " (modeless dialog)");
            d6.setTitle(title + " (document-modal dialog)");
            d5.setVisible(true);
        }
    });
    Container cp4 = f4.getContentPane();
    // create three containers to improve layouting
    cp4.setLayout(new GridLayout(1, 3));
    Container cp41 = new Container();
    Container cp42 = new Container();
    Container cp43 = new Container();
    // add the button into a separate panel
    JPanel p4 = new JPanel();
    p4.setLayout(new FlowLayout());
    p4.add(b4);
    // add radiobuttons and the OK button one after another into a single column
    cp42.setLayout(new GridLayout(4, 1));
    cp42.add(rb41);
    cp42.add(rb42);
    cp42.add(rb43);
    cp42.add(p4);
    //add three containers
    cp4.add(cp41);
    cp4.add(cp42);
    cp4.add(cp43);

    // dialog d5

    d5 = new JDialog(f4);
    d5.setBounds(sw - 400 - 32, 132, 300, 200);
    d5.addWindowListener(closeWindow);
    JLabel l5 = new JLabel("Enter your name: ");
    l5.setHorizontalAlignment(SwingConstants.CENTER);
    tf5 = new JTextField(12);
    tf5.setHorizontalAlignment(SwingConstants.CENTER);
    JButton b5 = new JButton("OK");
    b5.setHorizontalAlignment(SwingConstants.CENTER);
    b5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //pass a name into the document modal dialog
            l6.setText("by " + tf5.getText());
            d6.setVisible(true);
        }
    });
    Container cp5 = d5.getContentPane();
    // add label, text field and button one after another into a single column
    cp5.setLayout(new BorderLayout());
    cp5.add(l5, BorderLayout.NORTH);
    cp5.add(tf5, BorderLayout.CENTER);
    JPanel p5 = new JPanel();
    p5.setLayout(new FlowLayout());
    p5.add(b5);
    cp5.add(p5, BorderLayout.SOUTH);

    // dialog d6

    d6 = new JDialog(d5, "", Dialog.ModalityType.DOCUMENT_MODAL);
    d6.setBounds(sw - 500 - 32, 232, 300, 200);
    d6.addWindowListener(closeWindow);
    JTextArea ta6 = new JTextArea();
    l6 = new JLabel();
    l6.setHorizontalAlignment(SwingConstants.RIGHT);
    Container cp6 = d6.getContentPane();
    cp6.setLayout(new BorderLayout());
    cp6.add(new JScrollPane(ta6), BorderLayout.CENTER);
    JPanel p6 = new JPanel();
    p6.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p6.add(l6);
    cp6.add(p6, BorderLayout.SOUTH);

    // third document

    // frame f7

    f7 = new JFrame("Classics (excluded frame)");
    f7.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
    f7.setBounds(32, sh - 200 - 32, 300, 200);
    f7.addWindowListener(closeWindow);
    JLabel l7 = new JLabel("Famous writers: ");
    l7.setHorizontalAlignment(SwingConstants.CENTER);
    // create radio buttons
    rb71 = new JRadioButton("Burns", true);
    rb72 = new JRadioButton("Dickens", false);
    rb73 = new JRadioButton("Twain", false);
    // place radio buttons into a single group
    ButtonGroup bg7 = new ButtonGroup();
    bg7.add(rb71);
    bg7.add(rb72);
    bg7.add(rb73);
    Container cp7 = f7.getContentPane();
    // create three containers to improve layouting
    cp7.setLayout(new GridLayout(1, 3));
    Container cp71 = new Container();
    Container cp72 = new Container();
    Container cp73 = new Container();
    // add the label into a separate panel
    JPanel p7 = new JPanel();
    p7.setLayout(new FlowLayout());
    p7.add(l7);
    // add a label and radio buttons one after another into a single column
    cp72.setLayout(new GridLayout(4, 1));
    cp72.add(p7);
    cp72.add(rb71);
    cp72.add(rb72);
    cp72.add(rb73);
    // add three containers
    cp7.add(cp71);
    cp7.add(cp72);
    cp7.add(cp73);

    // fourth document

    // frame f8

    f8 = new JFrame("Feedback (parent frame)");
    f8.setBounds(sw - 300 - 32, sh - 200 - 32, 300, 200);
    f8.addWindowListener(closeWindow);
    JButton b8 = new JButton("Rate yourself");
    b8.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showConfirmDialog(null, "I really like my book", "Question (application-modal dialog)",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        }
    });
    Container cp8 = f8.getContentPane();
    cp8.setLayout(new FlowLayout(FlowLayout.CENTER, 8, 8));
    cp8.add(b8);
}

From source file:com.intuit.tank.proxy.ProxyApp.java

private void createDetailsDialog() {
    detailsDialog = new JDialog(this);
    detailsDialog.setModal(true);// w  w w.  j  a  va 2s.  c om
    detailsDialog.setLayout(new BorderLayout());

    detailsTF = new JTextArea();
    detailsTF.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(detailsTF);
    detailsDialog.add(scrollPane, BorderLayout.CENTER);
    detailsDialog.setModal(true);
    detailsDialog.setSize(new Dimension(500, 300));
    detailsDialog.setBounds(new Rectangle(getSize()));
    detailsDialog.setPreferredSize(getSize());
    WindowUtil.centerOnScreen(detailsDialog);
}