易截截图软件、单文件、免安装、纯绿色、仅160KB

JAVA程序全局键盘监听事件


// 注册应用程序全局键盘事件, 所有的键盘事件都会被此事件监听器处理.
Toolkit tk = Toolkit.getDefaultToolkit();
tk.addAWTEventListener(new MyAWTEventListener(), AWTEvent.KEY_EVENT_MASK);
class MyAWTEventListener implements AWTEventListener {
    private boolean controlPressed = false;
    private boolean cPressed       = false;
    @Override
    public void eventDispatched(AWTEvent event) {
        if (event.getClass() == KeyEvent.class) {
            // 被处理的事件是键盘事件.
            KeyEvent keyEvent = (KeyEvent) event;
            if (keyEvent.getID() == KeyEvent.KEY_PRESSED) {
                keyPressed(keyEvent);
            } else if (keyEvent.getID() == KeyEvent.KEY_RELEASED) {
                keyReleased(keyEvent);
            }
        }
    }
    private void keyPressed(KeyEvent event) {
        if (event.getKeyCode() == KeyEvent.VK_CONTROL) {
            controlPressed = true;
        } else if (event.getKeyCode() == KeyEvent.VK_C) {
            cPressed = true;
        }
        if (controlPressed && cPressed) {
         &nbs


相关文档:

java数据结构之队列

在使用队列中,我们一般都会使用循环队列以保证性能
package com.yz.myqueue;
public class Queue {
private Integer size;
private Integer front;
private Integer rear;
private Object[] datas;
public Queue(int size){
this.size=size;
this.front=-1;
this.rear=-1;
datas=new Object[size] ......

Java中的IO流知识总结(转)

总结一:
Java IO的一般使用原则:
一、按数据来源(去向)分类:
1、是文件: FileInputStream, FileOutputStream, FileReader, FileWriter
2、是byte[]:ByteArrayInputStream, ByteArrayOutputStream
3、是Char[]: CharArrayReader, CharArrayWriter
4、是String: StringBufferInputStream, StringReader, StringW ......

Java实现XMPP发送接收消息和文件功能

package test;
import java.io.File;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack ......

Java equals

boolean java.lang.Object.equals(Object obj)
Indicates whether some other
object is "equal to" this one.
The equals method implements an
equivalence relation on non-null object references:
It is reflexive: for
any non-null reference value x, x.equals(x) should return true.
It ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号