本文整理匯總了Java中org.eclipse.swt.SWT.KeyDown方法的典型用法代碼示例。如果您正苦於以下問題:Java SWT.KeyDown方法的具體用法?Java SWT.KeyDown怎麽用?Java SWT.KeyDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.KeyDown方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleEvent
import org.eclipse.swt.SWT; //導入方法依賴的package包/類
/**
* Receives an event when the registered event occurs.
* @param event the event which occurred
*/
@Override
public void handleEvent(Event event) {
boolean cursorMoved = false;
if (event.type == SWT.KeyDown) {
cursorMoved = cursorMoved(event);
} else if (event.type == SWT.MouseDown || event.type == SWT.MouseDoubleClick) {
cursorMoved = true;
}
if (cursorMoved) {
long time = Time.getCurrentTime();
String path = recorder.getPath();
String commandId = "Cursor.position.change";
TriggerMacro trigger = new TriggerMacro(time, commandId, path, TriggerMacro.Kind.CURSOR_CHANGE);
recorder.recordTriggerMacro(trigger);
recorder.setParentMacro(null);
}
}
示例2: keyIDToEmbedKeyType
import org.eclipse.swt.SWT; //導入方法依賴的package包/類
static int keyIDToEmbedKeyType(int id) {
switch (id) {
case SWT.KeyDown:
return AbstractEvents.KEYEVENT_PRESSED;
case SWT.KeyUp:
return AbstractEvents.KEYEVENT_RELEASED;
// case KeyEvent.KEY_TYPED:
// return AbstractEvents.KEYEVENT_TYPED;
}
return 0;
}
示例3: handleEvent
import org.eclipse.swt.SWT; //導入方法依賴的package包/類
@Override
public void handleEvent(Event event) {
switch (event.type) {
case SWT.Dispose:
case SWT.KeyDown:
case SWT.MouseMove: {
if (tip == null)
break;
tip.dispose();
tip = null;
label = null;
break;
}
case SWT.MouseHover: {
TableItem item = table.getItem(new Point(event.x, event.y));
if (item != null) {
if (tip != null && !tip.isDisposed())
tip.dispose();
Shell shell = table.getShell();
Display display = table.getDisplay();
tip = new Shell(shell, SWT.ON_TOP | SWT.TOOL);
tip.setLayout(new FillLayout());
label = new Label(tip, SWT.NONE);
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setData("_TABLEITEM", item);
label.setText("tooltip " + item.getText());
label.addListener(SWT.MouseExit, labelListener);
label.addListener(SWT.MouseDown, labelListener);
Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle rect = item.getBounds(0);
Point pt = table.toDisplay(rect.x, rect.y);
tip.setBounds(pt.x, pt.y, size.x, size.y);
tip.setVisible(true);
}
}
break;
}
}
示例4: handleEvent
import org.eclipse.swt.SWT; //導入方法依賴的package包/類
public void handleEvent(Event event) {
switch (event.type) {
case SWT.KeyDown:
if (event.character == SWT.CR)
controlChanged((Control) event.widget);
break;
case SWT.FocusOut:
controlChanged((Control) event.widget);
break;
}
}
示例5: getListenerType
import org.eclipse.swt.SWT; //導入方法依賴的package包/類
public int getListenerType() {
return SWT.KeyDown;
}