本文整理匯總了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());
}
}
}
示例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);
}
示例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());
}
}
示例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);
}