本文整理汇总了Java中org.eclipse.swt.SWT.KeyUp方法的典型用法代码示例。如果您正苦于以下问题:Java SWT.KeyUp方法的具体用法?Java SWT.KeyUp怎么用?Java SWT.KeyUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.KeyUp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
public void handleEvent(Event event) {
if (event.type == SWT.KeyUp && (event.stateMask & SWT.CTRL) != 0) {
switch (event.character) {
case 0x01: // CTRL+A
showAboutAppleCommander();
break;
case 0x03: // CTRL+C
createDiskImage();
break;
case 0x0f: // CTRL+O
openFile();
break;
case 0x05: // CTRL+E
compareDiskImages();
break;
}
}
}
示例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: createToolbarCommandHandler
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
/**
* The toolbar command handler contains the global toolbar
* actions. The intent is that the listener is then added to
* multiple visual components.
*/
public Listener createToolbarCommandHandler() {
return new Listener() {
public void handleEvent(Event event) {
if (event.type == SWT.KeyUp) {
if ((event.stateMask & SWT.CTRL) != 0) { // CTRL+key
switch (event.character) {
case CTRL_C:
getContentTypeAdapter().copy();
break;
case CTRL_A:
getContentTypeAdapter().selectAll();
break;
case CTRL_P:
getContentTypeAdapter().print();
break;
}
} else if ((event.stateMask & SWT.ALT) == 0) { // key alone
switch (event.keyCode) {
case SWT.F2: // the "native" file format (image, text, etc)
getNativeFilterAdapter().display();
setFilterToolItemSelection(true, false, false);
break;
case SWT.F3: // Hex format
getHexFilterAdapter().display();
setFilterToolItemSelection(false, true, false);
break;
case SWT.F4: // "Raw" hex format
getRawDumpFilterAdapter().display();
setFilterToolItemSelection(false, false, true);
break;
}
}
}
}
};
}
示例4: createDirectoryKeyboardHandler
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
/**
* Create the keyboard handler for the directory pane.
* These are keys that are <em>only</em> active in the directory
* viewer. See createToolbarCommandHandler for the general application
* keyboard handler.
* @see #createToolbarCommandHandler
*/
private Listener createDirectoryKeyboardHandler() {
return new Listener() {
public void handleEvent(Event event) {
if (event.type == SWT.KeyUp) {
TreeItem[] treeItem = null;
if ((event.stateMask & SWT.CTRL) != 0) {
switch (event.character) {
case '-':
treeItem = getDirectoryTree().getSelection();
setDirectoryExpandedStates(treeItem[0], false);
break;
case '+':
treeItem = getDirectoryTree().getSelection();
setDirectoryExpandedStates(treeItem[0], true);
break;
}
} else { // assume no control and no alt
switch (event.character) {
case '-':
treeItem = getDirectoryTree().getSelection();
treeItem[0].setExpanded(false);
break;
case '+':
treeItem = getDirectoryTree().getSelection();
treeItem[0].setExpanded(true);
break;
}
}
}
}
};
}
示例5: createFileKeyboardHandler
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
/**
* Create the keyboard handler for the file pane.
* These are keys that are <em>only</em> active in the file
* viewer. See createToolbarCommandHandler for the general application
* keyboard handler.
* @see #createToolbarCommandHandler
*/
private Listener createFileKeyboardHandler() {
return new Listener() {
public void handleEvent(Event event) {
FileEntry fileEntry = getSelectedFileEntry();
if (fileEntry != null && event.type == SWT.KeyUp && (event.stateMask & SWT.CTRL) != 0) {
switch (event.character) {
case CTRL_C: // Compile Wizard
if (getCompileToolItem().isEnabled()) {
compileFileWizard();
}
break;
case CTRL_D: // Delete file
if (getDeleteToolItem().isEnabled()) {
deleteFile();
}
break;
case CTRL_E: // Export Wizard
exportFileWizard();
break;
case CTRL_V: // View file
viewFile(null);
break;
}
}
}
};
}
示例6: createToolbarCommandHandler
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
/**
* The toolbar command handler contains the global toolbar
* actions. This does not include file-specific actions.
* The intent is that the listener is then added to multiple
* visual components (i.e., the file listing as well as the
* directory listing).
*/
private Listener createToolbarCommandHandler() {
return new Listener() {
public void handleEvent(Event event) {
if (event.type == SWT.KeyUp) {
if ((event.stateMask & SWT.CTRL) != 0) { // CTRL key held
if ((event.stateMask & SWT.SHIFT) != 0) { // SHIFT key held
switch (event.character) {
case CTRL_S: // Save As...
saveAs();
break;
}
} else {
switch (event.character) {
case CTRL_I: // Import Wizard
importFiles();
break;
case CTRL_P: // Print...
print();
break;
case CTRL_S: // Save
if (getSaveToolItem().isEnabled()) {
save();
}
break;
}
}
} else { // No CTRL key
if ((event.stateMask & SWT.ALT) != SWT.ALT) { // Ignore ALT key combinations like alt-F4!
switch (event.keyCode) {
case SWT.F2: // Standard file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_STANDARD);
break;
case SWT.F3: // Native file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_NATIVE);
break;
case SWT.F4: // Detail file display
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_DETAIL);
break;
case SWT.F5: // Show deleted files
setShowDeletedFiles(!getShowDeletedFilesToolItem().getSelection());
getShowDeletedFilesToolItem().setSelection(isShowDeletedFiles());
fillFileTable(getCurrentFileList());
break;
}
}
}
}
}
};
}