Here you can find the source of displayEditor(Component parent, String title, String msg)
public static String displayEditor(Component parent, String title, String msg)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class Main { public static String displayEditor(Component parent, String title, String msg) { JTextArea editArea = new JTextArea(msg, 5, 30); editArea.setEditable(true);//w w w . j a v a 2 s .c o m editArea.setLineWrap(true); JScrollPane scroll = new JScrollPane(editArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); final JOptionPane optionPane = new JOptionPane(scroll, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = optionPane.createDialog(parent, title); dialog.setResizable(true); dialog.show(); Object iValue = optionPane.getValue(); if (iValue == null) { return null; } int value = ((Integer) optionPane.getValue()).intValue(); if (value == JOptionPane.OK_OPTION) { return editArea.getText(); } return null; } }