FIRST:

        String str = queryTextArea.getText();
        final JTextArea textArea = new JTextArea();
        textArea.setFont(new Font("Sans-Serif", Font.PLAIN, 12));
        textArea.setText(str);
        textArea.setCaretPosition(0);
        JScrollPane scrollPane = new JScrollPane(textArea);     
        scrollPane.setPreferredSize(new Dimension(350, 150));           
        int res = JOptionPane.showConfirmDialog(null,scrollPane,"Query", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
        System.out.println( "showInputDialog: " + res );
        if(res==0)
        queryTextArea.setText(textArea.getText());

Using this I'm unable to resize the document-modal

SECOND:

        String str = queryTextArea.getText();
        final JTextArea textArea = new JTextArea();
        textArea.setFont(new Font("Sans-Serif", Font.PLAIN, 12));
        textArea.setText(str);
        textArea.setCaretPosition(0);
        JScrollPane scrollPane = new JScrollPane(textArea);     
        scrollPane.setPreferredSize(new Dimension(350, 150));           
        JOptionPane pane = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE,JOptionPane.PLAIN_MESSAGE);
        JDialog dialog = pane.createDialog(null, "Query");
        dialog.setResizable(true);
        dialog.setVisible(true);

Using This I'm unable to get which button is pressed (OK/Cancel/Closed using X)

Please Help..

Thanks

This article has been dead for over six months. Start a new discussion instead.