SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.
Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg
by mehdi » Wed Jul 06, 2005 11:43 pm
Hi,
I would like to run a thread to simulate a clock on my application SWT
so i tried to write this code :
- Code: Select all
public class Clock implements Runnable {
private Label label;
/**
* @param l
*
*/
public Horloge(Label l) {
this.label = l;
run();
}
public void run() {
label.getDisplay().asyncExec(new Runnable() {
public void run() {
Calendar c = Calendar.getInstance();
int h = c.get(Calendar.HOUR);
int m = c.get(Calendar.MINUTE);
int s = c.get(Calendar.SECOND);
label.setText(h + ":" + m + ":" + s);
try {
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
and in a shell : label_clock with my thread
- Code: Select all
Clock c = new Clock(label_horloge);
while (!shell.isDisposed()) {
shell.getDisplay().asyncExec(h);
if (!display.readAndDispatch())
display.sleep();
}
But it takes too many memory on my machine, i don't find my probelme please help me.....
-
mehdi
-
- Posts: 5
- Joined: Tue Jul 05, 2005 5:24 am
by Eric Clayberg » Thu Jul 07, 2005 4:00 am
I'm not entirely sure what problem you are asking for help on. Is this a runtime issue or design time issue?
If it is a design time issue, please provide us with any exception log details as well as a complete example (not a fragment).
If it is a runtime issue, you should post your question to the Eclispe SWT newsgroup.
-
Eric Clayberg
- Moderator
-
- Posts: 4503
- Joined: Tue Sep 30, 2003 6:39 am
- Location: Boston, MA USA
-
by mehdi » Thu Jul 07, 2005 7:47 am
Eric Clayberg wrote:I'm not entirely sure what problem you are asking for help on. Is this a runtime issue or design time issue?
If it is a design time issue, please provide us with any exception log details as well as a complete example (not a fragment).
If it is a runtime issue, you should post your question to the Eclispe SWT newsgroup.
sorry, it's a runtime issue, i will try to find an answer on eclipse newsgroup .
thank's a lot for your help
-
mehdi
-
- Posts: 5
- Joined: Tue Jul 05, 2005 5:24 am
Return to SWT Designer
Who is online
Users browsing this forum: No registered users and 1 guest