⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keylistenerexample.java

📁 《基于Eclipse的开源框架技术与实战》[第2章]随书源码
💻 JAVA
字号:
package com.free.refactor;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
 * <p>Title: Eclipse Plugin Development</p>
 * <p>Description: Free download</p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: Free</p>
 * @author gan.shu.man
 * @version 1.0
 */

public class KeyListenerExample {

	private final class TestKeyListener implements KeyListener {
		public void keyPressed(KeyEvent e) {
		
			System.out.println("key Pressed -" + e.character);
		}

		public void keyReleased(KeyEvent e) {
			System.out.println("key Released -" + e.character);
		}
	}
	
	SubClass subClass = new SubClass();
	
	Display display;

	Shell shell;

	KeyListenerExample() {

		display = new Display();
		shell = new Shell(display);

		shell.setSize(250, 200);
		shell.setText("A KeyListener Example");
		Text text = new Text(shell, SWT.BORDER);
		text.setBounds(50, 50, 100, 20);

		text.addKeyListener(new TestKeyListener());
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		String localExpression = "gan"+"shuman";
		String exp = localExpression;
	}
	
	String aaa = "gan"+"shuman";
	
	public void test(String string){
		System.out.println("");
		
		String exp = "gan"+string;
		
		System.out.println(exp);
	}
	
	

	public static void main(String[] args) {
		KeyListenerExample t = new KeyListenerExample();
		t.test("shuman");
		
		String exp = "gan"+"shuman";
		
		
		SubClass subClass = new SubClass();
		System.out.println(subClass);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -