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

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

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

JDialog.getRootPane介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public static void addEscapeListener(final JDialog dialog) {
  ActionListener escListener = new ActionListener() {

    @Override
    public void actionPerformed(ActionEvent e) {
      dialog.setVisible(false);
    }
  };

  dialog.getRootPane().registerKeyboardAction(escListener,
      KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
      JComponent.WHEN_IN_FOCUSED_WINDOW);

}

代码示例来源:origin: stanfordnlp/CoreNLP

alternateEncodingPrompt(encoding);
});
dialog.getRootPane().setDefaultButton(useNewEncoding);
dialog.pack();
dialog.setLocationRelativeTo(this);

代码示例来源:origin: stanfordnlp/CoreNLP

});
cancel.addActionListener(e -> dialog.setVisible(false));
dialog.getRootPane().setDefaultButton(okay);
dialog.pack();
dialog.setLocationRelativeTo(this);

代码示例来源:origin: stackoverflow.com

private static final KeyStroke escapeStroke = 
  KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); 
public static final String dispatchWindowClosingActionMapKey = 
  "com.spodding.tackline.dispatch:WINDOW_CLOSING"; 
public static void installEscapeCloseOperation(final JDialog dialog) { 
  Action dispatchClosing = new AbstractAction() { 
    public void actionPerformed(ActionEvent event) { 
      dialog.dispatchEvent(new WindowEvent( 
        dialog, WindowEvent.WINDOW_CLOSING 
      )); 
    } 
  }; 
  JRootPane root = dialog.getRootPane(); 
  root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 
    escapeStroke, dispatchWindowClosingActionMapKey 
  ); 
  root.getActionMap().put( dispatchWindowClosingActionMapKey, dispatchClosing 
  ); 
}

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

public int show(JFrame frame) {
  dialog = new JDialog(frame, "Save Changes", true);
  Container contentPane = dialog.getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(this, BorderLayout.CENTER);
  dialog.setResizable(false);
  dialog.pack();
  dialog.setLocationRelativeTo(frame);
  dialog.getRootPane().setDefaultButton(saveButton);
  dialog.setVisible(true);
  dialog.dispose();
  return selectedValue;
}

代码示例来源:origin: stackoverflow.com

pack();
getRootPane().setDefaultButton( ok );

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
@Override
public JXRootPane getRootPane() {
  return (JXRootPane) super.getRootPane();
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
public JXRootPane getRootPane() {
  return (JXRootPane) super.getRootPane();
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * {@inheritDoc}
 */
@Override
public JXRootPane getRootPane() {
  return (JXRootPane) super.getRootPane();
}

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

/**
 * Register a popout window, so regular hotkeys can be added to it if
 * necessary. References are saved in a WeakHashMap.
 *
 * @param popout 
 */
public void registerPopout(JDialog popout) {
  popouts.put(popout, null);
  addHotkeys(popout.getRootPane());
}

代码示例来源:origin: net.imagej/imagej-ui-swing

public static void escapeCancels(final JDialog dialog) {
  dialog.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
  dialog.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
    @Override
    public void actionPerformed(final ActionEvent e) {
      dialog.dispose();
    }
  });
}

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

/** returns the root pane used by this detached dockable container, regardless of its type (frame or dialog)*/
public static JRootPane getRootPane(FloatingDockableContainer fdc) {
  if(fdc instanceof JFrame) {
    return ((JFrame) fdc).getRootPane();
  } else if(fdc instanceof JDialog) {
    return ((JDialog) fdc).getRootPane();
  } else {
    return null; // not reachable
  }
}

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

public static void addKeyActionToDialog(final JDialog dialog, final Action action, final String keyStroke,
                    final String actionId) {
  action.putValue(Action.NAME, actionId);
  dialog.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(keyStroke),
    action.getValue(Action.NAME));
  dialog.getRootPane().getActionMap().put(action.getValue(Action.NAME), action);
}

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

@Override
public void setWaitingCursor(final boolean waiting) {
  if (waiting) {
    dialog.getRootPane().getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    dialog.getRootPane().getGlassPane().setVisible(true);
  }
  else {
    dialog.getRootPane().getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    dialog.getRootPane().getGlassPane().setVisible(false);
  }
}

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-dialog

private void setupKeyboardActions() {
  JRootPane rootPane = dialog.getRootPane();
  rootPane.setDefaultButton(getApproveButton());
  rootPane.registerKeyboardAction(cancelAction,
      getKeyStroke(VK_ESCAPE, 0), WHEN_IN_FOCUSED_WINDOW);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

private void paintImmediately() {
if (dialog instanceof JDialog) {
  JDialog jdialog = (JDialog) dialog;
  JComponent rootPane = jdialog.getRootPane();
  final Rectangle rect = new Rectangle();
  rootPane.getBounds(rect);
  rect.x = 0;
  rect.y = 0;
  rootPane.paintImmediately(rect);
}
}

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Set cursor to busy and disable application input. This can be reversed by
 * a subsequent call to setCursorFree.
 *
 * @param dialog
 *            Dialog to apply to
 */
public static void setCursorBusy(JDialog dialog) {
  setCursorBusy(dialog.getRootPane().getGlassPane());
}

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Set cursor to free and enable application input. Called after a call to
 * setCursorBusy.
 *
 * @param dialog
 *            Dialog to apply to
 */
public static void setCursorFree(JDialog dialog) {
  setCursorFree(dialog.getRootPane().getGlassPane());
}

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

/**
 * Removes all hotkeys that have to be registered (regular and global).
 */
private void removeAllHotkeys() {
  removeHotkeys(main.getRootPane());
  for (JDialog popout : popouts.keySet()) {
    removeHotkeys(popout.getRootPane());
  }
  removeGlobalHotkeys();
  removeHotkeysFromActions();
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

void stopComputing() {
 if (stop_ != null) {
  stop_.setVisible(false);
  if (owner_ != null) {
   owner_.getRootPane().remove(stop_);
  }
 }
 owner_.setCursor(Cursor.getDefaultCursor());
}

相关文章

JDialog类方法