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


Java FocusEvent.isTemporary方法代码示例

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


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

示例1: focusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
    if (e.isTemporary()) {
        return;
    }
    Component cmp = e.getComponent();
    if(cmp instanceof JComponent) {
        JViewport vp = getViewport(container);
        if(vp == null) {
            return;
        }
        Rectangle vr = vp.getViewRect();
        Point p = SwingUtilities.convertPoint(cmp.getParent(), cmp.getLocation(), container);
        final Rectangle r = new Rectangle(p, cmp.getSize());
        if(vr.intersects(r)) {
            return; 
        }
        container.scrollRectToVisible(r);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:UIUtils.java

示例2: EditorUI

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Construct extended UI for the use with a text component */
public EditorUI() {
    focusL = new FocusAdapter() {
                 public @Override void focusGained(FocusEvent evt) {
                     /* Fix of #25475 - copyAction's enabled flag
                      * must be updated on focus change
                      */
                     stateChanged(null);
                     if (component!=null){
                        BaseTextUI ui = (BaseTextUI)component.getUI();
                        if (ui!=null) ui.refresh();
                     }
                 }

                 @Override
                 public void focusLost(FocusEvent e) {
                     // see #222935, update actions before menu activates
                     if (e.isTemporary()) {
                         doStateChange(true);
                     }
                 }
             };

    getToolTipSupport();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:EditorUI.java

示例3: 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:TreeTable.java

示例4: focusLost

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusLost(FocusEvent fe) {
    if ((dragListener != null) && dragListener.isDragging()) {
        dragListener.abortDrag();
    }

    PropUtils.log(BaseTable.class, fe);

    //Ignore temporary focus changes, so sloppy focus middle mouse button
    //cut/paste can work
    if (fe.isTemporary()) {
        return;
    }

    Component opposite = fe.getOppositeComponent();

    if (!isKnownComponent(opposite)) {
        doFocusLost(opposite);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:BaseTable.java

示例5: focusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
    if (!e.isTemporary()) {
        JTextComponent textComp = (JTextComponent) e.getSource();
        if (textComp.getText().length() != 0) {
            textComp.selectAll();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TextFieldFocusListener.java

示例6: focusLost

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusLost(FocusEvent evt) {
    if (evt.isTemporary()) {
        return;
    }

    int selectedRow = list.getSelectedIndex();
    table.getSelectionModel().setAnchorSelectionIndex(selectedRow);
    table.getColumnModel().getSelectionModel().setAnchorSelectionIndex(0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ListTableView.java

示例7: focusLost

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
    if (!e.isTemporary()) {
        setVisible(false);
        textField.requestFocus();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:FileCompletionPopup.java

示例8: focusLost

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
    if (!e.isTemporary()) {
        setVisible(false);
        completable.requestFocus();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CompletionPopup.java

示例9: focusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
    if (!e.isTemporary()) {
        // add a runnable to be executed later
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                field.selectAll();
            }
        });
    }
    super.focusGained(e);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:14,代码来源:SelectTextFocusListener.java

示例10: 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

示例11: 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

示例12: 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:CausedFocusEvent.java


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