Label Flashing [message #444645] |
Mon, 18 October 2004 18:38  |
Eclipse User |
|
|
|
I created a label that contains a string. The string represents a map. I
have a "Next" button and everytime I press it the objects on the map
should move. So when I press "Next" I change my string ( str =
modify_string(str) ) and and then call label.setText(str) to update my
label. However, the screen flashes everytime I update my label. Is there a
way I can avoid the flashing? Maybe I should not use a label for what I
want to accomplish?
|
|
|
|
|
Re: Label Flashing [message #444675 is a reply to message #444660] |
Wed, 20 October 2004 08:45  |
Eclipse User |
|
|
|
public class Main {
static int index = 0;
public static void main(String[] args) {
final String[] strings = {"first label contents","contents of second
label"};
Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10, 10, 200, 200);
final Label label = new Label(shell, SWT.NONE);
label.setBounds(10,10,180,150);
label.setText(strings[index++ % 2]);
label.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
label.setText(strings[index++ % 2]);
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"Atanas" <ata_vla@yahoo.com> wrote in message
news:cl3u8q$lm0$1@eclipse.org...
> Thank you for the answer. Can you send me your trivial snippet so I can
> test it on my machine?
>
|
|
|
Powered by
FUDForum. Page generated in 0.04354 seconds