本文整理汇总了Java中org.eclipse.swt.events.KeyEvent类的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent类的具体用法?Java KeyEvent怎么用?Java KeyEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyEvent类属于org.eclipse.swt.events包,在下文中一共展示了KeyEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
@Override
public void keyPressed(KeyEvent event) {
switch (event.keyCode) {
case SWT.SHIFT:
this.keyShiftState = true;
break;
case SWT.CTRL:
this.keyCtrlState = true;
break;
case SWT.ALT:
this.keyAltState = true;
break;
default:
// uncaught key, transmit it to lower level for handling.
scene.uncaughtKey(event, keyCtrlState, keyAltState,
keyShiftState);
}
}
示例2: createComponents
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
private void createComponents ()
{
final FillLayout layout = new FillLayout ( SWT.VERTICAL );
layout.marginHeight = 12;
layout.marginWidth = 12;
setLayout ( layout );
final Text filterTextField = new Text ( this, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL );
filterTextField.setText ( this.filter );
filterTextField.addKeyListener ( new KeyAdapter () {
@Override
public void keyReleased ( final KeyEvent e )
{
verifyFilter ( filterTextField.getText () );
}
} );
}
示例3: createAttributeText
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
private Text createAttributeText ( final String attribute )
{
final Text t = new Text ( this, SWT.BORDER );
final Fields field = Fields.byField ( attribute );
if ( field == null )
{
t.setEditable ( true );
t.setMessage ( Messages.custom_field );
}
else
{
t.setEditable ( false );
t.setText ( field.getName () );
}
t.addKeyListener ( new KeyAdapter () {
@Override
public void keyReleased ( final KeyEvent e )
{
AssertionComposite.this.orCondition.updateFilter ();
};
} );
final RowData rowData = new RowData ();
rowData.width = 132;
t.setLayoutData ( rowData );
return t;
}
示例4: createValueText
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
private Text createValueText ()
{
final Text t = new Text ( this, SWT.BORDER );
t.setMessage ( Messages.argument );
t.addKeyListener ( new KeyAdapter () {
@Override
public void keyReleased ( final KeyEvent e )
{
AssertionComposite.this.orCondition.updateFilter ();
}
} );
final RowData rowData = new RowData ();
rowData.width = 132;
t.setLayoutData ( rowData );
return t;
}
示例5: createControl
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
protected Control createControl() {
m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
m_Text.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
try {
onKeyPressed(e);
} catch (Exception ex) {
}
}
});
m_Text.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent arg0) {
onTraverse(arg0);
}
});
return m_Text;
}
示例6: createControl
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
protected Control createControl() {
m_Combo = new CCombo(m_Table, SWT.READ_ONLY);
m_Combo.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_LIST_BACKGROUND));
if (m_Items != null)
m_Combo.setItems(m_Items);
m_Combo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
try {
onKeyPressed(e);
} catch (Exception ex) {
}
}
});
/*
* m_Combo.addTraverseListener(new TraverseListener() { public void
* keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } });
*/
return m_Combo;
}
示例7: createControl
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
protected Control createControl() {
// System.out.println("Created a new one.");
m_Text = new Text(m_Table, SWT.NONE);
m_Text.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
try {
onKeyPressed(e);
} catch (Exception ex) {
}
}
});
m_Text.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent arg0) {
onTraverse(arg0);
}
});
return m_Text;
}
示例8: createControl
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
protected Control createControl() {
m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL);
m_Text.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
try {
onKeyPressed(e);
} catch (Exception ex) {
}
}
});
m_Text.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent arg0) {
onTraverse(arg0);
}
});
return m_Text;
}
示例9: makeXPathKeyAccelerator
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
public KeyAccelerator makeXPathKeyAccelerator(final boolean overwrite) {
return new KeyAccelerator() {
public boolean doAction(TwsDomTree tree, KeyEvent e) {
boolean doNext = true;
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
if (tree.getSelection().length > 0) {
Node node = (Node)tree.getSelection()[0].getData();
if ((e.stateMask & SWT.SHIFT) == 0) {//without SHIFT > relative
if (canGenerateSelectionXpath(overwrite, node)) {
generateSelectionXpath(overwrite, tree);
doNext = false;
}
} else {//with SHIFT > absolute
generateAbsoluteXpath(overwrite, node);
doNext = false;
}
}
}
return doNext;
}
};
}
示例10: showComponentCreationOnCanvas
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
/**
* Creation of content assist
* @param event
* @param viewer
* @param paletteRoot
*/
public void showComponentCreationOnCanvas(KeyEvent event, GraphicalViewer viewer, PaletteRoot paletteRoot) {
this.graphicViewer = viewer;
this.graphicControl = viewer.getControl();
this.triggerChar = event.character;
this.paletteRoot = paletteRoot;
Point cursorRelativePosition = calculatePosition();
if (cursorRelativePosition == null) {
return;
}
disposeAssistText();
createAssistText(cursorRelativePosition);
initializeListneres();
activateAssist(triggerChar);
}
示例11: getBounds
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
protected void getBounds(KeyEvent event,
org.eclipse.draw2d.geometry.Rectangle bounds) {
switch (event.keyCode){
case SWT.ARROW_UP:
bounds.setLocation(bounds.x , bounds.y - 10);
break;
case SWT.ARROW_DOWN:
bounds.setLocation(bounds.x , bounds.y + 10);
break;
case SWT.ARROW_RIGHT:
bounds.setLocation(bounds.x + 10, bounds.y);
break;
case SWT.ARROW_LEFT:
bounds.setLocation(bounds.x - 10 , bounds.y);
break;
}
}
示例12: keyPressed
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
@Override
public void keyPressed(final KeyEvent e) {
if (e.keyCode == SWT.ARROW_LEFT) {
selectedDate.add(Calendar.DAY_OF_MONTH, -1);
drawSelectedMonth();
} else if (e.keyCode == SWT.ARROW_RIGHT) {
selectedDate.add(Calendar.DAY_OF_MONTH, 1);
drawSelectedMonth();
} else if (e.keyCode == SWT.ARROW_UP) {
selectedDate.add(Calendar.DAY_OF_MONTH, -7);
drawSelectedMonth();
} else if (e.keyCode == SWT.ARROW_DOWN) {
selectedDate.add(Calendar.DAY_OF_MONTH, 7);
drawSelectedMonth();
} else if (e.keyCode == '\r') {
notifyListeners(SWT.Selection, new Event());
} else {
final Event notifier = new Event();
notifier.keyCode = e.keyCode;
notifyListeners(SWT.KeyUp, notifier);
}
}
示例13: buildEditorText
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
private StyledText buildEditorText( Composite parent){
final SourceViewer sourceViewer = new SourceViewer(parent, null, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
final HConfiguration sourceConf = new HConfiguration(HContentAssistProcessor.PARAM_PROCESSOR);
sourceViewer.configure(sourceConf);
sourceViewer.setDocument(DocumentUtils.createDocument1());
sourceViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed( KeyEvent e){
// if ((e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0)) {
if (Utils.isAutoAssistInvoked(e)) {
IContentAssistant ca = sourceConf.getContentAssistant(sourceViewer);
ca.showPossibleCompletions();
}
}
});
return sourceViewer.getTextWidget();
}
示例14: isAutoAssistInvoked
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
public static boolean isAutoAssistInvoked( KeyEvent e){
if ((e.keyCode == 32) && ((e.stateMask & SWT.CTRL) != 0)) {
return true;
} else if (((e.keyCode == 32) && ((e.stateMask & SWT.COMMAND) != 0))) {
return true;
} else if ((e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0)) {
return true;
} else if ((e.character == ' ') && ((e.stateMask & SWT.COMMAND) != 0)) {
return true;
}
return false;
}
示例15: loadLyricText
import org.eclipse.swt.events.KeyEvent; //导入依赖的package包/类
private void loadLyricText(Composite parent){
Composite composite = new Composite(parent,SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
this.text = new Text(composite,SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
this.text.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
this.text.setFocus();
this.text.setText(this.track.getLyrics().getLyrics());
this.text.addModifyListener(this.listener);
this.text.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
for( int i = 0 ; i < KB_ACTIONS.length ; i ++ ){
if( event.keyCode == KB_ACTIONS[i].getKeyBinding().getKey() && event.stateMask == KB_ACTIONS[i].getKeyBinding().getMask() ){
new TGActionProcessorListener(TGLyricEditor.this.context, KB_ACTIONS[i].getAction()).processEvent(event);
return;
}
}
}
});
}