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


Java KeyListener類代碼示例

本文整理匯總了Java中org.eclipse.swt.events.KeyListener的典型用法代碼示例。如果您正苦於以下問題:Java KeyListener類的具體用法?Java KeyListener怎麽用?Java KeyListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


KeyListener類屬於org.eclipse.swt.events包,在下文中一共展示了KeyListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * TODO summary sentence for createControl ...
 * 
 * @param parent
 * @param kListener
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener kListener) {
	final Composite part = AbstractSimpleConfigurator.subpart(parent, "Fill:");

	this.on = new Button(part, SWT.CHECK);
	this.on.addSelectionListener(this.sync);

	this.chooser = new StolenColorEditor(part, this.sync);

	this.percent = new Combo(part, SWT.DROP_DOWN);
	this.percent.setItems(new String[] { "0%", "25%", "50%", "75%", "100%" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
	this.percent.setTextLimit(4);
	this.percent.addKeyListener(kListener);
	this.percent.setToolTipText("Fill opacity");
	return part;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:23,代碼來源:FillViewer.java

示例2: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * TODO summary sentence for createControl ...
 * 
 * @param parent
 * @param kListener
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener kListener) {
	final String labelId = type == MIN ? "Min scale:" : "Max scale:";
	final Composite part = AbstractSimpleConfigurator.subpart(parent, labelId);

	this.on = new Button(part, SWT.CHECK);
	this.on.addSelectionListener(this.sync);

	this.scaleEditor = new Combo(part, SWT.DROP_DOWN);
	this.scaleEditor.setItems(new String[] { "100", "1000", "10000", "100000", "1000000", "10000000" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
	this.scaleEditor.setTextLimit(10);
	this.scaleEditor.addKeyListener(kListener);
	final String tooltip = type == MIN ? "Minimum scale denominator" : "Maximum scale denominator";
	this.scaleEditor.setToolTipText(tooltip);
	return part;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:23,代碼來源:ScaleViewer.java

示例3: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * TODO summary sentence for createControl ...
 * 
 * @param parent
 * @param klisten
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener klisten) {
	final Composite part = AbstractSimpleConfigurator.subpart(parent, "Line");

	this.on = new Button(part, SWT.CHECK);

	this.chooser = new StolenColorEditor(part, this.sync);

	this.size = new Combo(part, SWT.DROP_DOWN);
	this.size.setItems(new String[] { "1", "2", "3", "5", "10" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
	this.size.setTextLimit(2);
	this.size.addKeyListener(klisten);
	this.size.setToolTipText("Line width");

	this.percent = new Combo(part, SWT.DROP_DOWN);
	this.percent.setItems(new String[] { "0%", "25%", "50%", "75%", "100%" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
	this.percent.setTextLimit(3);
	this.percent.addKeyListener(klisten);
	this.percent.setToolTipText("Line opacity");
	return part;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:28,代碼來源:StrokeViewer.java

示例4: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * TODO summary sentence for createControl ...
 * 
 * @param parent
 * @param klisten
 * @param build
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener klisten, final StyleBuilder build) {
	final Composite part = AbstractSimpleConfigurator.subpart(parent, "Point");

	this.on = new Button(part, SWT.CHECK);
	// this.on.addSelectionListener( this.sync );

	this.size = new Combo(part, SWT.DROP_DOWN);
	this.size.setItems(new String[] { "1", "2", "3", "5", "10", "15" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
	this.size.setTextLimit(2);
	this.size.addKeyListener(klisten);
	this.size.setToolTipText("Graphic size");

	this.name = new Combo(part, SWT.DROP_DOWN);
	this.name.setItems(build.getWellKnownMarkNames());
	this.name.setTextLimit(9);
	this.name.addKeyListener(klisten);
	this.name.setToolTipText("Shape type");
	return part;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:28,代碼來源:GraphicViewer.java

示例5: removeKeyListener

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#removeKeyListener(org.eclipse.swt.events.KeyListener)
 */
public void removeKeyListener(KeyListener keyListener)
{
	if (fContentAssistSubjectControl != null)
	{
		fContentAssistSubjectControl.removeKeyListener(keyListener);
	}
	else
	{
		StyledText textWidget = fViewer.getTextWidget();
		
		if (Helper.okToUse(textWidget))
		{
			textWidget.removeKeyListener(keyListener);
		}
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:20,代碼來源:ContentAssistSubjectControlAdapter.java

示例6: createKeyListener

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
private KeyListener createKeyListener() {
	return new KeyAdapter() {
		@Override
		public void keyReleased(KeyEvent event) {
			if (event.stateMask == 0) {
				if (event.keyCode == SWT.F5) {
					ITypeHierarchy hierarchy= fHierarchyLifeCycle.getHierarchy();
					if (hierarchy != null) {
						fHierarchyLifeCycle.typeHierarchyChanged(hierarchy);
						doTypeHierarchyChangedOnViewers(null);
					}
					updateHierarchyViewer(false);
					return;
				}
				}
		}
	};
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:19,代碼來源:TypeHierarchyViewPart.java

示例7: getDeviceManagers

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * Return the array of DeviceManagers that are available per the
 * constructor parameters. The InputDevices instantiated will be
 * initialized with SWT UI toolkit event listeners.
 *
 * @return the array of DeviceManagers. If no DeviceManagers are
 * available, an empty (size 0) array is returned.
 */
public DeviceManager[] getDeviceManagers( ) {
    List managerList = createDevices( );
    DeviceManager[] manager =
        (DeviceManager[])managerList.toArray( new DeviceManager[managerList.size( )] );
    Control control = (Control)canvas;
    for ( int i = 0; i < manager.length; i++ ) {
        InputDevice[] device = manager[i].getDevices( );
        for ( int j = 0; j < device.length; j++ ) {
            InputDevice dev = device[j];
            if ( dev instanceof MouseListener ) {
                control.addMouseListener( (MouseListener)dev );
            }
            if ( dev instanceof MouseMoveListener ) {
                control.addMouseMoveListener( (MouseMoveListener)dev );
            }
            if ( dev instanceof Listener ) {
                control.addListener( SWT.MouseWheel, (Listener)dev );
            }
            if ( dev instanceof KeyListener ) {
                control.addKeyListener( (KeyListener)dev );
            }
        }
    }
    return( manager );
}
 
開發者ID:Norkart,項目名稱:NK-VirtualGlobe,代碼行數:34,代碼來源:SWTDeviceFactory.java

示例8: fromKeyListener

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
public static Observable<KeyEvent> fromKeyListener(Control control) {
    Observable<KeyEvent> observable = Observable.create(subscriber -> {
        KeyListener keyListener = new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                subscriber.onNext(e);
            }
        };
        control.addKeyListener(keyListener);
        subscriber.setDisposable(Disposables.fromAction(() -> control.removeKeyListener(keyListener)));
    });
    return wrap(control, observable);
}
 
開發者ID:zakgof,項目名稱:rxswt,代碼行數:14,代碼來源:SwtObservers.java

示例9: getKeyListener

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
@Override
KeyListener getKeyListener() {
    return new KeyAdapter() {
        public void keyReleased(KeyEvent event) {
            // Text field has changed: make editor dirty if not already
            if (!BabelUtils.equals(focusGainedText, textBox.getText())) {
                // Make the editor dirty if not already. If it is,
                // we wait until field focus lost (or save) to
                // update it completely.
                if (!editor.isDirty()) {
                    // textEditor.isDirty();
                    updateModel();
                    // int caretPosition = eventBox.getCaretPosition();
                    // updateBundleOnChanges();
                    // eventBox.setSelection(caretPosition);
                }
                // autoDetectRequiredFont(eventBox.getText());
            }
        }
    };
    // Eric Fettweis : new listener to automatically change the font
    // textBox.addModifyListener(new ModifyListener() {
    //
    // public void modifyText(ModifyEvent e) {
    // String text = textBox.getText();
    // Font f = textBox.getFont();
    // String fontName = getBestFont(f.getFontData()[0].getName(), text);
    // if(fontName!=null){
    // f = getSWTFont(f, fontName);
    // textBox.setFont(f);
    // }
    // }
    //
    // });
    // }
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:37,代碼來源:I18NEntry.java

示例10: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * TODO summary sentence for createControl ...
 * 
 * @param parent
 * @param listener1
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener listener1) {
	final Composite part = AbstractSimpleConfigurator.subpart(parent, "Raster");

	this.percent = new Combo(part, SWT.DROP_DOWN);
	this.percent.setItems(new String[] { "0%", "25%", "50%", "75%", "100%" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
	this.percent.setTextLimit(4);
	this.percent.addKeyListener(listener1);
	this.percent.setToolTipText("Percent opacity");
	return part;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:18,代碼來源:OpacityViewer.java

示例11: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
public Composite createControl(final Composite parent, final KeyListener klisten) {
	this.part = AbstractSimpleConfigurator.subpart(parent, "Label:");
	this.klisten = klisten;

	this.on = new Button(part, SWT.CHECK);

	this.field = new Combo(part, SWT.DROP_DOWN | SWT.READ_ONLY);
	this.field.addKeyListener(klisten);
	if ( this.schema != null ) {
		final List<AttributeDescriptor> types = this.schema.getAttributeDescriptors();
		final List<String> typeStrings = new ArrayList<String>();
		for ( final AttributeDescriptor attributeDescriptor : types ) {
			typeStrings.add(attributeDescriptor.getLocalName());
		}
		this.field.setItems(typeStrings.toArray(new String[0]));
	}
	this.field.setToolTipText("Label field");

	this.fonter = new FontEditor(part);

	// determine which placement to use
	if ( schema != null ) {
		if ( SLDs.isLine(schema) ) {
			pointPlacement = false;
		} else {
			pointPlacement = true;
		}
		if ( pointPlacement ) {
			// point placement (3 combos: AnchorPoint (Horiz, Vert) + Rotation)
			initPlacementContentsPoint();
		} else {
			// line placement (1 combo: Perpendicular Offset)
			initPlacementContentsLine();
		}
	}

	listen(true);

	return part;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:41,代碼來源:LabelViewer.java

示例12: addKeyListener

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#addKeyListener(org.eclipse.swt.events.KeyListener)
 */
public void addKeyListener(KeyListener keyListener)
{
	if (fContentAssistSubjectControl != null)
	{
		fContentAssistSubjectControl.addKeyListener(keyListener);
	}
	else
	{
		fViewer.getTextWidget().addKeyListener(keyListener);
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:15,代碼來源:ContentAssistSubjectControlAdapter.java

示例13: initializeTypesViewer

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
private void initializeTypesViewer(final TypeHierarchyViewer typesViewer, KeyListener keyListener, String cotextHelpId) {
	typesViewer.getControl().setVisible(false);
	typesViewer.getControl().addKeyListener(keyListener);
	typesViewer.initContextMenu(new IMenuListener() {
		public void menuAboutToShow(IMenuManager menu) {
			fillTypesViewerContextMenu(typesViewer, menu);
		}
	}, cotextHelpId,	getSite());
	typesViewer.addPostSelectionChangedListener(fSelectionChangedListener);
	typesViewer.setQualifiedTypeName(isQualifiedTypeNamesEnabled());
	typesViewer.setWorkingSetFilter(fWorkingSetActionGroup.getWorkingSetFilter());
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:13,代碼來源:TypeHierarchyViewPart.java

示例14: createControl

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
/**
 * Create and setup the control.
 * 
 * @param table parent for the control
 */
private void createControl(JaretTable table) {
    if (_text == null) {
        _table = table;
        _text = new Text(table, SWT.BORDER | SWT.RIGHT);
        _doubleField = new DoubleField();
        _doubleField.setText(_text);

        _text.addKeyListener(new KeyListener() {

            public void keyPressed(KeyEvent event) {
                if (event.keyCode == SWT.TAB) {
                    event.doit = false;
                    stopEditing(true);
                    _table.forceFocus();
                    _table.focusRight();
                } else if (event.keyCode == SWT.CR) {
                    event.doit = false;
                    stopEditing(true);
                    _table.forceFocus();
                    _table.focusDown();
                } else if (event.keyCode == SWT.ESC) {
                    event.doit = false;
                    stopEditing(false);
                    _column.setValue(_row, _oldVal);
                    _table.forceFocus();
                }
            }

            public void keyReleased(KeyEvent arg0) {
            }

        });

        _text.addFocusListener(this);
    }
}
 
開發者ID:heartsome,項目名稱:translationstudio8,代碼行數:42,代碼來源:DoubleCellEditor.java

示例15: createText

import org.eclipse.swt.events.KeyListener; //導入依賴的package包/類
private Text createText(final Composite parent,
        final FocusListener focusListener,
        final KeyListener keyListener) {
    final Text text = new Text(parent, SWT.BORDER);
    text.setEditable(false);
    text.addFocusListener(focusListener);
    text.addKeyListener(keyListener);
    return text;
}
 
開發者ID:fabric8io,項目名稱:data-mapper,代碼行數:10,代碼來源:MappingRow.java


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