本文整理汇总了Java中java.awt.event.FocusEvent.getID方法的典型用法代码示例。如果您正苦于以下问题:Java FocusEvent.getID方法的具体用法?Java FocusEvent.getID怎么用?Java FocusEvent.getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.FocusEvent
的用法示例。
在下文中一共展示了FocusEvent.getID方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
//Remove the editor here if the new focus owner is not
//known to the table & the focus event is not temporary
if ((fe.getID() == FocusEvent.FOCUS_LOST) && !fe.isTemporary() && !inRemoveRequest && !inEditRequest) {
boolean stopEditing = ((fe.getOppositeComponent() != getParent()) &&
!isKnownComponent(fe.getOppositeComponent()) && (fe.getOppositeComponent() != null));
if (stopEditing) {
removeEditor();
}
}
//The UI will only repaint the lead selection, but we need to
//paint all selected rows for the color to change when focus
//is lost/gained
if (!inRemoveRequest && !inEditRequest) {
repaintSelection(fe.getID() == FocusEvent.FOCUS_GAINED);
}
}
示例2: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Overridden to check the focus event countdown and initiate editing on
* the second focus event following a failed edit (dialog was shown) */
@Override
public void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
if (fe.getID() == fe.FOCUS_GAINED) {
countDown--;
if (countDown == 0) {
autoEdit();
}
}
if (
(fe.getID() == fe.FOCUS_GAINED) ||
((fe.getOppositeComponent() != null) && (fe.getID() == fe.FOCUS_LOST) &&
!isAncestorOf(fe.getOppositeComponent()))
) {
//Ensure the description goes back to the node description if
//we lose focus
fireChange();
}
}
示例3: retargetUnexpectedFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
static FocusEvent retargetUnexpectedFocusEvent(FocusEvent fe) {
synchronized (heavyweightRequests) {
// Any other case represents a failure condition which we did
// not expect. We need to clearFocusRequestList() and patch up
// the event as best as possible.
if (removeFirstRequest()) {
return (FocusEvent)retargetFocusEvent(fe);
}
Component source = fe.getComponent();
Component opposite = fe.getOppositeComponent();
boolean temporary = false;
if (fe.getID() == FocusEvent.FOCUS_LOST &&
(opposite == null || isTemporary(opposite, source)))
{
temporary = true;
}
return new CausedFocusEvent(source, fe.getID(), temporary, opposite,
CausedFocusEvent.Cause.NATIVE_SYSTEM);
}
}
示例4: retargetUnexpectedFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
static FocusEvent retargetUnexpectedFocusEvent(FocusEvent fe) {
synchronized (heavyweightRequests) {
// Any other case represents a failure condition which we did
// not expect. We need to clearFocusRequestList() and patch up
// the event as best as possible.
if (removeFirstRequest()) {
return (FocusEvent)retargetFocusEvent(fe);
}
Component source = fe.getComponent();
Component opposite = fe.getOppositeComponent();
boolean temporary = false;
if (fe.getID() == FocusEvent.FOCUS_LOST &&
(opposite == null || isTemporary(opposite, source)))
{
temporary = true;
}
return new FocusEvent(source, fe.getID(), temporary, opposite,
FocusEvent.Cause.UNEXPECTED);
}
}
示例5: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
protected void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
if ((fe.getID() == FocusEvent.FOCUS_GAINED) && (inner != null)) {
inner.requestFocus();
}
}
示例6: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Overridden to remove the editor on focus lost */
public void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
if (PropUtils.isLoggable(BaseTable.class)) {
PropUtils.log(BaseTable.class, "processFocusEvent - "); //NOI18N
PropUtils.log(BaseTable.class, fe);
}
if (!isAncestorOf(fe.getOppositeComponent()) || (fe.getOppositeComponent() == null)) {
if (isEditing() && (fe.getID() == fe.FOCUS_LOST)) {
if (PropUtils.isLoggable(BaseTable.class)) {
PropUtils.log(
BaseTable.class, "ProcessFocusEvent got focus lost to unknown component, removing editor"
); //NOI18N
}
focusLostCancel();
}
}
if (!inEditorRemoveRequest() && !inEditRequest()) { //XXX inEditRequest probably shouldn't be here
if ((fe.getOppositeComponent() == null) && (fe.getID() == fe.FOCUS_LOST)) {
//ignore the strange focus to null stuff NetBeans does
return;
}
paintSelectionRow();
} else {
paintSelectionRow();
}
}
示例7: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
protected void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
if (fe.getID() == fe.FOCUS_GAINED) {
if ((inner != null) && inner.isEnabled() && inner.isFocusTraversable()) {
inner.requestFocus();
}
}
}
示例8: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
if (fe.getID() == fe.FOCUS_LOST) {
stopTimer();
}
}
示例9: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
if (fe.getID() == FocusEvent.FOCUS_LOST) {
stopTimer();
}
}
示例10: handleJavaFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
* Restoring native behavior. We should sets the selection range to zero,
* when component lost its focus.
*
* @param e the focus event
*/
@Override
void handleJavaFocusEvent(final FocusEvent e) {
if (e.getID() == FocusEvent.FOCUS_LOST) {
// In order to de-select the selection
setCaretPosition(0);
}
super.handleJavaFocusEvent(e);
}
示例11: 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);
}
示例12: 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);
}
示例13: retarget
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
* Retargets the original focus event to the new target. If the
* original focus event is CausedFocusEvent, it remains such and
* cause is copied. Otherwise, new CausedFocusEvent is created,
* with cause as RETARGETED.
* @return retargeted event, or null if e is null
*/
public static FocusEvent retarget(FocusEvent e, Component newSource) {
if (e == null) return null;
return new CausedFocusEvent(newSource, e.getID(), e.isTemporary(), e.getOppositeComponent(),
(e instanceof CausedFocusEvent) ? ((CausedFocusEvent)e).getCause() : Cause.RETARGETED);
}