當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyAdapter類代碼示例

本文整理匯總了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;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:21,代碼來源:ListConsole.java

示例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;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:22,代碼來源:ListConsole.java

示例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;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:24,代碼來源:EnhancedErrorDialog.java

示例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 () );
        }
    } );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:18,代碼來源:FilterFreeFormComposite.java

示例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;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:FilterAdvancedComposite.java

示例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;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:17,代碼來源:FilterAdvancedComposite.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:18,代碼來源:KTableCellEditorMultilineWrapText.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:21,代碼來源:KTableCellEditorCombo.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:19,代碼來源:KTableCellEditorText.java

示例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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:18,代碼來源:KTableCellEditorMultilineText.java

示例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();
}
 
開發者ID:nextinterfaces,項目名稱:http4e,代碼行數:20,代碼來源:ParameterizeTextView.java

示例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;
				}
			}
		}
	});
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:22,代碼來源:TGLyricEditor.java

示例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);
}
 
開發者ID:scenarioo,項目名稱:scenarioo-example-swtbot-e4,代碼行數:22,代碼來源:OrderPage.java

示例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);
			}
		}

	});
}
 
開發者ID:scenarioo,項目名稱:scenarioo-example-swtbot-e4,代碼行數:19,代碼來源:OrderDetailsPart.java

示例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()});
					}
				}
			}
		}
	});
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:18,代碼來源:AlertScriptingView.java


注:本文中的org.eclipse.swt.events.KeyAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。