Results 1 to 3 of 3
- 08-25-2010, 09:53 AM #1
Member
- Join Date
- Aug 2010
- Posts
- 14
- Rep Power
- 0
Gui Blocked after selected a Jcheckbox
Hi guys ,
i wrote a progamm to print msesage while the Jchekbox is selected , but the problem is : my gui completely blocked when i check my box (also my jCheckBox is no more selectable). can someone tell me how to resolve the problem ? . here is my code : The red marked code block the gui ( i think)
private void jCheckBox1ItemStateChanged(java.awt.event.ItemEven t evt) {
boolean state = jCheckBox1.isSelected();
if(state ){
try {
send("start tick");
} catch (IOException ex) {
Logger.getLogger(DiagClient.class.getName()).log(L evel.SEVERE, null, ex);
}
try {
do{
socket.receive(buffer);
recvMsg = new String (inData ,0 ,buffer.getLength());
System.out.println(recvMsg);
}
while(buffer.getLength() !=0);
} catch (IOException ex) {
Logger.getLogger(DiagClient.class.getName()).log(L evel.SEVERE, null, ex);
}
}
-
You're blocking the EDT, the main thread used by Swing to do user interaction and painting. Best to do your long-running process in a background thread such as a SwingWorker. Check out the Sun/Oracle tutorial on this for more information: Concurrency in Swing
- 09-03-2010, 10:04 AM #3
Member
- Join Date
- Aug 2010
- Posts
- 14
- Rep Power
- 0
Similar Threads
-
How to add a jcheckbox in jtable
By lakshayghai in forum AWT / SwingReplies: 9Last Post: 04-14-2010, 11:32 PM -
How to interrupt threads blocked in a RMI operation
By sky in forum Advanced JavaReplies: 2Last Post: 03-19-2010, 08:24 AM -
How can I add JCheckBox to each row?
By batya in forum AWT / SwingReplies: 1Last Post: 11-04-2009, 09:25 PM -
JCheckbox in Jtree
By shajuantony in forum AWT / SwingReplies: 10Last Post: 09-09-2009, 10:42 AM -
blocked between server and clients
By ibtehal in forum NetworkingReplies: 6Last Post: 07-17-2008, 12:30 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks