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


Java Component.requestFocusInWindow方法代码示例

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


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

示例1: componentActivated

import java.awt.Component; //导入方法依赖的package包/类
@Override
protected void componentActivated () {
    if( null != browserComponent ) {
        HtmlBrowser.Impl impl = browserComponent.getBrowserImpl();
        if( null != impl ) {
            Component c = impl.getComponent();
            if( null != c )
                c.requestFocusInWindow();
        }
    }
    super.componentActivated ();
    SwingUtilities.invokeLater( new Runnable() {

        @Override
        public void run() {
            setEnableHome(enableHome);
            setEnableLocation(enableLocation);
            setToolbarVisible(toolbarVisible);
            setStatusLineVisible(statusVisible);
            if( null != urlToLoad ) {
                setURL(urlToLoad);
            }
            urlToLoad = null;
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:HtmlBrowserComponent.java

示例2: requestFocusInWindow

import java.awt.Component; //导入方法依赖的package包/类
@Override
public boolean requestFocusInWindow() {
    boolean value = super.requestFocusInWindow();
    Component comp = getRefactoringPanelComp();
    if(comp != null) {
        return comp.requestFocusInWindow();
    } else {
        return value;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:RefactoringPanelContainer.java

示例3: processComponentKeyEvent

import java.awt.Component; //导入方法依赖的package包/类
@Override
protected void processComponentKeyEvent(KeyEvent e) {
    Component editorComponent = getEditorComponent();
    if (editorComponent != null && editorComponent.isFocusable()) {
        // The event should go to the editor component
        editorComponent.requestFocusInWindow();
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } else {
        super.processComponentKeyEvent(e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:OutlineView.java

示例4: requestFocusInWindow

import java.awt.Component; //导入方法依赖的package包/类
public @Override boolean requestFocusInWindow() {
    JSplitPane view = getCurrentResultView();
    if (view == null) {
        return super.requestFocusInWindow();
    }
    Component left = view.getLeftComponent();
    if (left == null) {
        return super.requestFocusInWindow();
    }
    return left.requestFocusInWindow();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ResultWindow.java

示例5: requestFocusForMessage

import java.awt.Component; //导入方法依赖的package包/类
/** Requests focus for <code>currentMessage</code> component.
 * If it is of <code>JComponent</code> type it tries default focus
 * request first. */
private void requestFocusForMessage() {
    Component comp = currentMessage;
    
    if(comp == null) {
        return;
    }

    if (/*!Constants.AUTO_FOCUS &&*/ FocusManager.getCurrentManager().getActiveWindow() == null) {
        // Do not steal focus if no Java window have it
        Component defComp = null;
        Container nearestRoot =
            (comp instanceof Container && ((Container) comp).isFocusCycleRoot()) ? (Container) comp : comp.getFocusCycleRootAncestor();
        if (nearestRoot != null) {
            defComp = nearestRoot.getFocusTraversalPolicy().getDefaultComponent(nearestRoot);
        }
        if (defComp != null) {
            defComp.requestFocusInWindow();
        } else {
            comp.requestFocusInWindow();
        }
    } else {
        if (!(comp instanceof JComponent)
            || !((JComponent)comp).requestDefaultFocus()) {

            comp.requestFocus();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:NbPresenter.java

示例6: show

import java.awt.Component; //导入方法依赖的package包/类
public void show() {
//        Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
//        if (focusOwner != null) focusRef = new WeakReference(focusOwner);
            
        owner = ownerRef == null ? null : ownerRef.get();
        ownerLocation = owner == null ? null : owner.getLocationOnScreen();
        
        window = new JWindow(owner);
        window.setType(Window.Type.POPUP);
        window.setAlwaysOnTop(false);
        window.setFocusable(true);
        window.setFocusableWindowState(true);
        window.setAutoRequestFocus(true);
        
        window.getContentPane().add(content);
        window.pack();
        
        if (popupAlign == -1) {
            window.setLocation(location.getLocation());
        } else {
            Dimension size = content.getSize();
            
            int x;
            switch (popupAlign) {
                case SwingConstants.EAST:
                case SwingConstants.NORTH_EAST:
                case SwingConstants.SOUTH_EAST:
                    x = location.x + location.width - size.width + 1;
                    break;
                default:
                    x = location.x + 1;
                    break;
            }
            
            int y;
            switch (popupAlign) {
                case SwingConstants.NORTH:
                case SwingConstants.NORTH_EAST:
                case SwingConstants.NORTH_WEST:
                    y = location.y - size.height + 1;
                    break;
                default:
                    y = location.y + location.height + 1;
                    break;
            }
            
            window.setLocation(x, y);
        }
        
        window.setVisible(true);
        
        Component defaultFocus = content.getFocusTraversalPolicy().getDefaultComponent(content);
        if (defaultFocus != null) defaultFocus.requestFocusInWindow();
        
        content.installListeners();
        
        if (listener != null) listener.popupShown();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:59,代码来源:ProfilerPopup.java


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