views:

294

answers:

2

Hi,i'm reading data from serial port for that i've created one window.when i click connect button i'll get another window showing message as "connected" with ok option and at the same time data starts coming but it wont dump until i click ok button of the front window,i want data should dump without clicking the ok button of the front window,how can i do that plz help me.

thanks for reply

+2  A: 

You need to read the data from the serial port in a different thread to that used to display the dialog box. I'd recommend reading the Concurrency in Swing lesson from Sun.

David Grant
A: 

A JOptionPane is a modal dialog, and can not be tuned. A modal dialog blocks the invoking thread.

If you don't want to create another thread (which seems indeed to be the best method), you must create your own dialog window, with JDialog class.

You can watch JDialog tutorial.

Jérôme