本文整理汇总了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);
}