I have a JOptionPane.showConfirmDialog
. It has to display a very long string. They length varies. So what I did was create a textArea, add the string to text area. I don't want to do setColumns
, setRows
.
Is there a way dynamically adjust the size? Do advice . Thanks!
String longString="asdas";//Long string.
JTextArea textArea = new JTextArea(longString);
/*want to avoid setting the size*/
//textArea.setColumns(70);
// textArea.setRows(5);
textArea.setLineWrap( true );
textArea.setBackground(null);
textArea.setFont(null);
textArea.setWrapStyleWord( true );
int l_iResult = JOptionPane.showConfirmDialog( this, textArea , "Confirm Delete",
JOptionPane.YES_NO_OPTION );