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


Java SwingUtilities.getRootPane方法代码示例

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


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

示例1: keyPressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent ev) {
	if (ev.getKeyCode() != KeyEvent.VK_ENTER || "".equals(getText()))
		return;
	JRootPane root = SwingUtilities.getRootPane(getParent());
	if (root != null)
		root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

	try {
		// Create regex pattern
		pat = Pattern.compile(getText(), Pattern.CASE_INSENSITIVE);
		search(pat);
	} catch (PatternSyntaxException ex) {
		System.err.println(ex.getMessage());
	}

	if (root != null)
		root.setCursor(null); // turn off wait cursor
	// // Check if there was a recent update to reduce event load!
	// if (!isRunning) {
	// isRunning = true;
	// javax.swing.SwingUtilities.invokeLater(new Runnable() {
	// public void run() {
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:AbstractSearchField.java

示例2: resetState

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void resetState() {
    state = STATE_NOOP;
    JRootPane pane = SwingUtilities.getRootPane(comp);
    glass.setVisible(false);
    if (pane != null && oldGlass != null) {
        // when clicking results in hidden slide window, pne can be null?
        // how to avoid?
        JComponent current = (JComponent) pane.getGlassPane();
        if (current instanceof GlassPane) {
            pane.setGlassPane(oldGlass);
        }
    }
    if( null != comp )
        comp.setCursor(null);
    oldGlass = null;
    startPoint = null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ResizeGestureRecognizer.java

示例3: postProcessKeyEvent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public boolean postProcessKeyEvent(KeyEvent ev) {
    if(ev.isConsumed() && ev.getKeyCode() != KeyEvent.VK_ALT) {
        // mnemonic combination, it's consumed, but we need
        // set altKeyPressed to false, otherwise after selection
        // component by mnemonic combination a menu will be open
        altKeyPressed = false;
        return false;
    }
    if (ev.getKeyCode() == KeyEvent.VK_ALT) {
        root = SwingUtilities.getRootPane(ev.getComponent());
        winAncestor = (root == null ? null :
                SwingUtilities.getWindowAncestor(root));

        if (ev.getID() == KeyEvent.KEY_PRESSED) {
            if (!altKeyPressed) {
                altPressed(ev);
            }
            altKeyPressed = true;
            return true;
        } else if (ev.getID() == KeyEvent.KEY_RELEASED) {
            if (altKeyPressed) {
                altReleased(ev);
            } else {
                MenuSelectionManager msm =
                    MenuSelectionManager.defaultManager();
                MenuElement[] path = msm.getSelectedPath();
                if (path.length <= 0) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            }
            altKeyPressed = false;
        }
        root = null;
        winAncestor = null;
    } else {
        altKeyPressed = false;
    }
    return false;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:WindowsRootPaneUI.java

示例4: dispatchKeyEvent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public boolean dispatchKeyEvent(KeyEvent e) {
    if (skippingEvents || e.isConsumed()) return false;
    
    if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ESCAPE)
        if (SwingUtilities.getRootPane(this) != e.getSource()) { // Closing JPopupMenu using the ESC key
            e.consume();
            if (DEBUG) System.err.println(">>> Closed by ESC"); // NOI18N
            ProfilerPopup.this.hide();
            return true;
        }
    
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ProfilerPopup.java

示例5: setDragCursor

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
protected void setDragCursor() {
  JRootPane rootWin = SwingUtilities.getRootPane(this);
  if (rootWin != null) {
    // remove cursor from old window
    if (dragCursor.getParent() != null) {
      dragCursor.getParent().remove(dragCursor);
    }
    drawWin = rootWin.getLayeredPane();

    calcDrawOffset();
    dragCursor.setVisible(true);
    drawWin.add(dragCursor, JLayeredPane.DRAG_LAYER);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:SetupStack.java

示例6: setDragCursor

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
protected void setDragCursor() {
  final JRootPane rootWin = SwingUtilities.getRootPane(this);
  if (rootWin != null) {
    // remove cursor from old window
    if (dragCursor.getParent() != null) {
      dragCursor.getParent().remove(dragCursor);
    }
    drawWin = rootWin.getLayeredPane();

    dragCursor.setVisible(true);
    drawWin.add(dragCursor, JLayeredPane.DRAG_LAYER);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:RegionGrid.java

示例7: setDrawWinToOwnerOf

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 * creates or moves cursor object to given window. Called when drag operation begins in a window or the cursor is
 * dragged over a new drop-target window
 */
public void setDrawWinToOwnerOf(Component newDropWin) {
  if (newDropWin != null) {
    final JRootPane rootWin = SwingUtilities.getRootPane(newDropWin);
    if (rootWin != null) {
      setDrawWin(rootWin.getLayeredPane());
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:13,代码来源:PieceMover.java

示例8: selectInitialValue

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void selectInitialValue(JOptionPane op) {
    if (initialFocusComponent != null) {
        initialFocusComponent.requestFocus();
 
        if (initialFocusComponent instanceof JButton) {
            JRootPane root = SwingUtilities.getRootPane(initialFocusComponent);
            if (root != null) {
                root.setDefaultButton((JButton)initialFocusComponent);
            }
        }
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:FreeColOptionPaneUI.java

示例9: postProcessKeyEvent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public boolean postProcessKeyEvent(KeyEvent ev) {
    if(ev.isConsumed()) {
        // do not manage consumed event
        return false;
    }
    if (ev.getKeyCode() == KeyEvent.VK_ALT) {
        root = SwingUtilities.getRootPane(ev.getComponent());
        winAncestor = (root == null ? null :
                SwingUtilities.getWindowAncestor(root));

        if (ev.getID() == KeyEvent.KEY_PRESSED) {
            if (!altKeyPressed) {
                altPressed(ev);
            }
            altKeyPressed = true;
            return true;
        } else if (ev.getID() == KeyEvent.KEY_RELEASED) {
            if (altKeyPressed) {
                altReleased(ev);
            } else {
                MenuSelectionManager msm =
                    MenuSelectionManager.defaultManager();
                MenuElement[] path = msm.getSelectedPath();
                if (path.length <= 0) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            }
            altKeyPressed = false;
        }
        root = null;
        winAncestor = null;
    } else {
        altKeyPressed = false;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:WindowsRootPaneUI.java

示例10: postProcessKeyEvent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public boolean postProcessKeyEvent(KeyEvent ev) {
    if(ev.isConsumed() && ev.getKeyCode() != KeyEvent.VK_ALT) {
        // mnemonic combination, it's consumed, but we need
        // set altKeyPressed to false, otherwise after selection
        // component by mnemonic combination a menu will be open
        altKeyPressed = false;
        return false;
    }
    if (ev.getKeyCode() == KeyEvent.VK_ALT) {
        root = SwingUtilities.getRootPane(ev.getComponent());
        winAncestor = (root == null ? null :
                SwingUtilities.getWindowAncestor(root));

        if (ev.getID() == KeyEvent.KEY_PRESSED) {
            if (!altKeyPressed) {
                altPressed(ev);
            }
            altKeyPressed = true;
            return true;
        } else if (ev.getID() == KeyEvent.KEY_RELEASED) {
            if (altKeyPressed) {
                altReleased(ev);
            } else {
                MenuSelectionManager msm =
                    MenuSelectionManager.defaultManager();
                MenuElement[] path = msm.getSelectedPath();
                if (path.length <= 0) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            }
            altKeyPressed = false;
        }
        root = null;
        winAncestor = null;
    } else {
        if (WindowsLookAndFeel.isMnemonicHidden() && ev.isAltDown()) {
            WindowsLookAndFeel.setMnemonicHidden(false);
            WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        }
        altKeyPressed = false;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:WindowsRootPaneUI.java


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