javax.swing.JComponent.getRootPane()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中javax.swing.JComponent.getRootPane()方法的一些代码示例,展示了JComponent.getRootPane()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.getRootPane()方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:getRootPane

JComponent.getRootPane介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

@Override 
public int getSourceActions(JComponent c) {
  if (c instanceof DnDTabbedPane) {
    DnDTabbedPane src = (DnDTabbedPane) c;
    c.getRootPane().setGlassPane(new GhostGlassPane(src));
    if (src.dragTabIndex < 0) {
      return TransferHandler.NONE;
    }
    this.setDragImage(this.makeDragTabImage(src));
    c.getRootPane().getGlassPane().setVisible(true);
    return TransferHandler.MOVE;
  }
  return TransferHandler.NONE;
}

代码示例来源:origin: JetBrains/jediterm

private static boolean isToDeferRemoveForLater(JComponent c) {
  return c.getRootPane() != null;
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

private static Window getWindow(final JComponent comp) {
  if (comp.getRootPane() != null) {
    final Container cont = comp.getRootPane().getParent();
    if (cont != null) {
      if (cont instanceof Window) {
        return (Window) cont;
      }
    }
  }
  return null;
}

代码示例来源:origin: triplea-game/triplea

/**
 * To a given component, adds a key listener that is fired if a key is pressed.
 */
public static void addEscapeKeyListener(
  final JComponent component,
  final Runnable keyDownAction) {
 // TODO: null checks are bit questionable, have them here because they were here before...
 if (component.getRootPane() != null) {
  addKeyListener(component.getRootPane(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), keyDownAction);
 }
}

代码示例来源:origin: khuxtable/seaglass

/**
   * {@inheritDoc}
   */
  public boolean isInState(JComponent c) {
    return c.getRootPane() != null &&
          c.getRootPane().getClientProperty(
            SeaGlassRootPaneUI.UNIFIED_TOOLBAR_LOOK) != Boolean.TRUE && 
            c.getRootPane().getClientProperty("JRootPane.MenuInTitle") != Boolean.TRUE;
  }
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

/**
 * Close panel dialog.
 *
 * @param comp
 *            the comp
 */
public static void closePanelDialog(final JComponent comp) {
  if (comp.getRootPane() != null) {
    final Container cont = comp.getRootPane().getParent();
    if (cont != null) {
      if (cont instanceof JDialog) {
        ((JDialog) cont).dispose();
      }
    }
  }
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

/**
 * i seperated it in different method to avoid affecting other components.
 *
 * @param comp
 *            the comp
 */
public static void packJFrameWindow(final JComponent comp) {
  if (comp.getRootPane() != null) {
    final Container cont = comp.getRootPane().getParent();
    if (cont instanceof JFrame) {
      ((JFrame) cont).pack();
      ((JFrame) cont).setLocationRelativeTo(null);
    }
  }
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

/**
 * Pack window.
 *
 * @param comp
 *            the comp
 */
public static void packWindow(final JComponent comp) {
  if (comp.getRootPane() != null) {
    final Container cont = comp.getRootPane().getParent();
    if (cont != null) {
      if (cont instanceof JDialog) {
        ((JDialog) cont).pack();
        ((JDialog) cont).setLocationRelativeTo(null);
      }
    }
  }
}

代码示例来源:origin: net.java.abeille/abeille

private void checkRemoveFromPane(JComponent component) {
  if (toolTip != null) {
    JRootPane rp = component.getRootPane();
    if (rp != null) {
      rp.remove(toolTip);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf

@SuppressWarnings({"ObjectEquality"})
private static boolean isGlassPane(JComponent c) {
  JRootPane rootPane = c.getRootPane();
  return (rootPane != null && rootPane.getGlassPane() == c);
}

代码示例来源:origin: freeplane/freeplane

@Override
public void init(Controller controller) {
  final JComponent mainContentPane = getMainContentPane();
  mainContentPane.add(toolbarPanel[TOP], BorderLayout.NORTH);
  mainContentPane.add(toolbarPanel[LEFT], BorderLayout.WEST);
  mainContentPane.add(toolbarPanel[RIGHT], BorderLayout.EAST);
  mainContentPane.add(toolbarPanel[BOTTOM], BorderLayout.SOUTH);
  status.setText("");
  status.setVisible(false);
  mainContentPane.getRootPane().putClientProperty(Controller.class, controller);
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void checkThread(JComponent comp) throws Exception
{
  if (comp.isVisible())
  {
    final Component root = comp.getRootPane();
    if (root != null && root.isVisible())
    {
      if (!SwingUtilities.isEventDispatchThread())
      {
        // i18n[ThreadCheckingRepaintManager.workinwrongthread=GUI work done in wrong thread]
        //throw new Exception(s_stringMgr.getString("ThreadCheckingRepaintManager.workinwrongthread"));
      }
    }
  }
}

代码示例来源:origin: realXuJiang/bigtable-sql

private void checkThread(JComponent comp) throws Exception
{
  if (comp.isVisible())
  {
    final Component root = comp.getRootPane();
    if (root != null && root.isVisible())
    {
      if (!SwingUtilities.isEventDispatchThread())
      {
        // i18n[ThreadCheckingRepaintManager.workinwrongthread=GUI work done in wrong thread]
        //throw new Exception(s_stringMgr.getString("ThreadCheckingRepaintManager.workinwrongthread"));
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Sets the original glass pane to the root pane of stored container.
 */
static void putBackOriginal() {
  if (oldPane == null) {
    throw new IllegalStateException("No original pane present");
  }
  final JRootPane rp = originalSource.getRootPane();
  if (rp == null) {
    if( originalSource.isDisplayable() ) //#216921
      throw new IllegalStateException("originalSource " + originalSource + " has no root pane: " + rp); // NOI18N
  } else {
    rp.setGlassPane(oldPane);
    oldPane.setVisible(wasVisible);
  }
  oldPane = null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Remove popup panel from previous textComponent root pane */
private void removeFromRootPane(JComponent c) {
  JRootPane rp = c.getRootPane();
  if (rp != null) {
    rp.getLayeredPane().remove(c);
  }
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

/**
 * Close panel window.
 *
 * @param comp
 *            the comp
 */
public static void closePanelWindow(final JComponent comp) {
  if (comp.getRootPane() != null) {
    final Window window = getWindow(comp);
    if (window != null) {
      window.dispose();
    }
  }
}

代码示例来源:origin: freeplane/freeplane

@Override
  public void hierarchyChanged(HierarchyEvent e) {
    if(arrowLinkPopup.isDisplayable()) {
      arrowLinkPopup.removeHierarchyListener(this);
      final JRootPane rootPane = arrowLinkPopup.getRootPane();
      final InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
      final ActionMap actionMap = rootPane.getActionMap();
      final ClosePopupAction closeAction = new ClosePopupAction(CLOSE);
      final ClosePopupAction cancelAction = new ClosePopupAction(CANCEL);
      inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), cancelAction);
      actionMap.put(cancelAction, cancelAction);
      inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.ALT_DOWN_MASK), closeAction);
      final boolean enterConfirms = ResourceController.getResourceController().getBooleanProperty("el__enter_confirms_by_default");
      if(enterConfirms)
        inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), closeAction);
      actionMap.put(closeAction, closeAction);
    }
  }
});

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

@Override
public void doAction(ActionEvent e) throws IllegalUserActionException {
  if (!commands.contains(e.getActionCommand())) {
    throw new IllegalUserActionException("Invalid user command:" + e.getActionCommand());
  }
  if (e.getActionCommand().equals(ActionNames.SAVE_GRAPHICS)) {
    JMeterGUIComponent component = GuiPackage.getInstance().getCurrentGui();
    // get the JComponent from the visualizer
    if (component instanceof Printable) {
      JComponent comp = ((Printable) component).getPrintableComponent();
      saveImage(comp);
    }
  }
  if (e.getActionCommand().equals(ActionNames.SAVE_GRAPHICS_ALL)) {
    JMeterGUIComponent component = GuiPackage.getInstance().getCurrentGui();
    JComponent comp = ((JComponent) component).getRootPane();
    saveImage(comp);
  }
}

代码示例来源:origin: JetBrains/jediterm

private void invalidateIfNeeded() {
  if (getLabelComponent().getRootPane() == null) return;
  Dimension d = getLabelComponent().getSize();
  Dimension pref = getLabelComponent().getPreferredSize();
  if (d != null && d.equals(pref)) {
    return;
  }
  setInactiveStateImage(null);
  getLabelComponent().invalidate();
  myTabs.revalidateAndRepaint(false);
}

代码示例来源:origin: net.java.abeille/abeille

private void checkAddToPane() {
  if (toolTip != null) {
    JTextComponent component = extEditorUI.getComponent();
    if (component != null) {
      JRootPane rp = component.getRootPane();
      // Possibly deinstall the old component from layered pane
      JRootPane ttrp = toolTip.getRootPane();
      if (ttrp != rp) {
        if (ttrp != null) {
          ttrp.getLayeredPane().remove(toolTip);
        }
        rp.getLayeredPane().add(toolTip, JLayeredPane.POPUP_LAYER, 0);
      }
    }
  }
}

相关文章

JComponent类方法