I have a bit of a problem. I'm trying to compare a string to an array. The array is built up after receiving strings on a serial line.
I use several voids and pass the strings and arrays between them so every thing must be static.
// button is set
public static Button btnRS_1;
// inside Create contense:
btnRS_1 = new Button(shlSioMiniTest, SWT.TOGGLE);
btnRS_1.setEnabled(false);
btnRS_1.setSelection(false);;
btnRS_1.setFont(SWTResourceManager.getFont("Tahoma", 10, SWT.NORMAL));
btnRS_1.setBounds(29, 130, 76, 16);
btnRS_1.setText("RS232 0");
if (RStest[0].equals("1")){
btnRS_1.setSelection(true);
}
I get errors. A lot of them too. And if I comment out the setSelection
bit and just print out a string to see it works.
Exception in thread "Thread-9" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4361)
at org.eclipse.swt.SWT.error(SWT.java:4276)
at org.eclipse.swt.SWT.error(SWT.java:4247)
at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:359)
at org.eclipse.swt.widgets.Button.setSelection(Button.java:1047)
at SioTest.Sio_test.fillChecks(Sio_test.java:604)
at SioTest.Sio_test.testParameters(Sio_test.java:592)
at SioTest.Sio_test$ProtocolImpl.onMessage(Sio_test.java:968)
at SioTest.Sio_test$ProtocolImpl.onReceive(Sio_test.java:946)
at SioTest.Sio_test$SerialReader.run(Sio_test.java:882)
at java.lang.Thread.run(Unknown Source)
Can someone advice me on what to do?