当前位置: 首页>>代码示例>>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;未经允许,请勿转载。