當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。