i am trying to develop desktop application.which reading data from input serial port and send entered keyboard data to serial port and simultaneously display in jtextarea. I am using netBean gui and RXTX for it. It work properly when data entered at console window of netBean. But not take data from keyboard as it run out of IDE.
> how to read perticular line in jtextarea
> and simultaneously display in jtextarea...It work properly when data entered at console window of netBean. But not take data from keyboard as it run out of IDE.
your subject line and post don't match - exactly what's the problem?
Joined: Nov 03, 2012
i am just trying to use jtextarea as display. whatever data send to serial port or read from serial post must be displayed in jtextarea. I am using keyboard input to send data to serial port. I am not able to to display sending data
public static class SerialWriter implements Runnable
public SerialWriter ( OutputStream out )
this.out = out;
public void run ()
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String a = new String("hello");
while( (s = in.readLine()) != null && s.length() != 0)
catch ( IOException e )
System.err.println("Couldn't read from System.in!");
Please UseCodeTags when posting code. Click on the link to understand what it means.
So, what is happening when you run the program? are you able to enter data via keyborad? is it just not reflecting in GUI?
Looks like you have a separate thread to read data from keyboard. Remember that, updates to Swing components should be done via EDT. If not, wrap your calls in SwingUtilities.invokeLater().
For more information, checkout this link