Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable text highlighting in swing message-box

Say i'm using the following code to prompt an error message in my simple swing application:

JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE);

Is there any way I could make it possible for the user to highlight text sections (for copy/paste purpose)?

Many thanks.

like image 237
sgrossman Avatar asked Jan 06 '13 14:01

sgrossman


1 Answers

try this

 JTextArea textarea= new JTextArea("add your message here");
 textarea.setEditable(true);
 JOptionPane.showMessageDialog(null, textarea, "Error", JOptionPane.ERROR_MESSAGE);
like image 120
Alya'a Gamal Avatar answered Sep 28 '22 06:09

Alya'a Gamal