Color red = display.getsystemcolor; font font = display.getsystemfont (); control.setfont (font)
Style Description SWT.WRAP Wrap the text to fit the visible area SWT.LEFT Left-align the label SWT.CENTER Center-align the label SWT.RIGHT Right-align the label SWT.SEPARATOR Draw a separator instead of text or an image SWT . Horizontal Draw The SEPARATOR HORZONTALLY SWT.VERTITICAL DRAW The SEPARATOR VERTITICLY SWT.SHADOW_IN DRAW The SEPARATOR WITH A "Shadow in" Effect Swt.Shadow_out` Draw the Separetor Separators
Keyboard event type
SWT.KEYDOWN a KEY WAS PRESSED SWT.KEYUP a KEY WAS RELEASED
KeyEvent Keylistener (and keyadapter) keypressed (keyevent) keyreleased (KeyEvent)
About the Character special key value in Event
SWT.BS Return ('/ b') SWT.CR Enter ('/ R') SWT.DEL Delete ('/ U007F') SWT.ESC ESC ('/ U001B') SWT.LF Retine ('/ N' ) SWT.TAB TAB jump ('/ t')
SWT.CONTROL
The following code comes from an extract
Listener Listener = New Listener () {
Public void Handleevent (Event Event) {
String string =
Event.Type == SWT.KEYDOWN? "DOWN": "UP";
IF ((Event.Statemask & Swt.ctrl)! = 0)
String = "ctrl";
IF ((Event.Statemask & SWT.Alt)! = 0)
String = "alt";
IF ((Event.Statemask & SWT.SHIFT)! = 0)
String = "shift";
Switch (event.character) {
Case 0: String = "'// 0'"; Break;
Case Swt.bs: String = "'// b';" BREAK;
Case Swt.cr: string = "'// r'"; Break;
Case Swt.del: string = "del"; Break;
Case Swt.esc: string = "ESC"; Break;
Case Swt.lf: string = "'// n'"; Break; Case Swt.Tab: String = "'// T'";
Break;
DEFAULT:
String = "'" event.character "'";
Break;
}
Text.addlistener (SWT.MODIFY, New Listener () {
Public void Handleevent (Event E) {
Modified [0] = true;
}
});
Final ProgressBar Bar = New Progressbar (Shell, Swt.none);
Bar.setsize (200, 32);
New thread () {
Public void run () {
For (int i = 0; i <= maximum; i ) {
Try {
Thread.sleep (100);
} catch (throwable th) {
}
Final Int index = i;
Display.asyncexec (new runnable () {
Public void run () {
Bar.setSelection (Index);
}
});
}
}
} .start ();