當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。