本文整理匯總了Java中org.eclipse.swt.events.KeyAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java KeyAdapter類的具體用法?Java KeyAdapter怎麽用?Java KeyAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
KeyAdapter類屬於org.eclipse.swt.events包,在下文中一共展示了KeyAdapter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createSelectAllMenuItem
import org.eclipse.swt.events.KeyAdapter; //導入依賴的package包/類
protected MenuItem createSelectAllMenuItem(final List list) {
final MenuItem selectAll = new MenuItem(contextMenu, SWT.PUSH);
selectAll.setText(JFaceMessages.get("lbl.menu.item.select.all") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_SELECT_ALL));
selectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent se) {
list.selectAll();
}
});
list.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent ke) {
if (ke.stateMask == SWT.MOD1 && ke.keyCode == SwtUtils.KEY_SELECT_ALL) {
ke.doit = false;
list.selectAll();
}
}
});
return selectAll;
}
示例2: createCopyMenuItem
import org.eclipse.swt.events.KeyAdapter; //導入依賴的package包/類
protected MenuItem createCopyMenuItem(final List list) {
final MenuItem copy = new MenuItem(contextMenu, SWT.PUSH);
copy.setText(JFaceMessages.get("lbl.menu.item.copy") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_COPY));
copy.setAccelerator(SWT.MOD1 | SwtUtils.KEY_COPY);
copy.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent se) {
copy(list);
}
});
list.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
if (e.stateMask == SWT.MOD1 && e.keyCode == SwtUtils.KEY_COPY) {
e.doit = false; // avoids unwanted scrolling
copy(list);
}
}
});
return copy;
}
示例3: createDropDownList
import org.eclipse.swt.events.KeyAdapter; //導入依賴的package包/類
@Override
protected List createDropDownList(final Composite parent) {
final List list = super.createDropDownList(parent);
if (list.getMenu() != null) {
for (final MenuItem item : list.getMenu().getItems()) {
if (item.getText().equals(JFaceResources.getString("copy"))) {
item.setText(JFaceMessages.get("lbl.menu.item.copy") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_COPY));
item.setAccelerator(SWT.MOD1 | SwtUtils.KEY_COPY);
list.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
if (SWT.MOD1 == e.stateMask && SwtUtils.KEY_COPY == e.keyCode) {
e.doit = false; // avoids unwanted scrolling
item.notifyListeners(SWT.Selection, null);
}
}
});
break;
}
}
}
return list;
}
示例4: createComponents
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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 () );
}
} );
}
示例5: createAttributeText
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
示例6: createValueText
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
示例7: createControl
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
示例8: createControl
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
示例9: createControl
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
示例10: createControl
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
示例11: buildEditorText
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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();
}
示例12: loadLyricText
import org.eclipse.swt.events.KeyAdapter; //導入依賴的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;
}
}
}
});
}
示例13: createControl
import org.eclipse.swt.events.KeyAdapter; //導入依賴的package包/類
@Override
public void createControl(final Composite parent) {
this.orderDetailPanel = new OrderDetailView(parent, order);
this.orderDetailPanel.addOrderNumberKeyListener(
new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
if (orderDetailPanel.mandatoryFieldsNonEmpty()) {
setPageComplete(true);
} else {
setPageComplete(false);
}
}
});
// required to avoid an error in the system
setControl(orderDetailPanel.getControl());
setPageComplete(false);
}
示例14: createControls
import org.eclipse.swt.events.KeyAdapter; //導入依賴的package包/類
@PostConstruct
public void createControls(final Composite parent, final ESelectionService selectionService) {
this.order = (Order) selectionService.getSelection();
this.orderDetailPanel = new OrderDetailView(parent, order);
this.orderDetailPanel.addOrderNumberKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
if (orderNumberHasChanged()) {
dirtyable.setDirty(true);
} else {
dirtyable.setDirty(false);
}
}
});
}
示例15: addApiDescTableKeyListener
import org.eclipse.swt.events.KeyAdapter; //導入依賴的package包/類
private void addApiDescTableKeyListener() {
table.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if(e.stateMask == SWT.CTRL || e.stateMask == SWT.COMMAND){
if (e.keyCode == 'c' || e.keyCode == 'C') {
StructuredSelection selection = (StructuredSelection)viewer.getSelection();
if(selection == null)
return;
ApiDesc apiObject = (ApiDesc)selection.getFirstElement();
if(apiObject != null){
clipboard.setContents(new Object[] {apiObject.fullSignature}, new Transfer[] {TextTransfer.getInstance()});
}
}
}
}
});
}