当前位置: 首页>>代码示例>>Java>>正文


Java FocusEvent.getCause方法代码示例

本文整理汇总了Java中java.awt.event.FocusEvent.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java FocusEvent.getCause方法的具体用法?Java FocusEvent.getCause怎么用?Java FocusEvent.getCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.FocusEvent的用法示例。


在下文中一共展示了FocusEvent.getCause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCausedFocusEventDeserialization

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
private static void  testCausedFocusEventDeserialization() throws
        Exception {
    for (int i = 0; i < causesIn.length; i++) {
        final String causeIn = causesIn[i];
        ObjectInputStream oi = new ObjectInputStream(new InputStream() {
            int cnt = 0;
            @Override
            public int read() throws IOException {
                if(cnt < data.length) {
                    return data[cnt++];
                } else if(cnt == data.length){
                    cnt++;
                    return causeIn.length();
                } else if(cnt - data.length - 1 < causeIn.length()) {
                    return causeIn.getBytes()[cnt++ - data.length - 1];
                }
                return -1;
            }
        });
        FocusEvent ev = (FocusEvent) oi.readObject();
        System.out.println(ev);
        if(ev.getCause() != causesOut[i]) {
            throw new RuntimeException("Wrong cause read :" +ev.getCause());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:FocusCauseTest.java

示例2: forwardFocusLost

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
void forwardFocusLost( FocusEvent e) {
    isFocused = false;
    FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
            e.getOppositeComponent(), e.getCause());
    super.processFocusEvent(fe);

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:XTextFieldPeer.java

示例3: testFocusEventDeserialization

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
private static void testFocusEventDeserialization() throws
        Exception {
    ObjectInputStream oi = new ObjectInputStream(
            new ByteArrayInputStream(dataOld));
    FocusEvent ev = (FocusEvent)oi.readObject();
    if(ev.getCause() != FocusEvent.Cause.UNKNOWN) {
        throw new RuntimeException("Wrong cause in deserialized FocusEvent "
                + ev.getCause());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:FocusCauseTest.java

示例4: forwardFocusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
void forwardFocusGained( FocusEvent e) {
    isFocused = true;
    FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
            e.getOppositeComponent(), e.getCause());
    super.processFocusEvent(fe);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:XTextFieldPeer.java


注:本文中的java.awt.event.FocusEvent.getCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。