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

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

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

JDialog.getOwner介绍

暂无

代码示例

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

/** Finds main window.
 * @return main window or null
 */
static java.awt.Frame mainWindow() {
  try {
    if (exec("Win")) { // NOI18N
      return (java.awt.Frame) TALK.get();
    } else {
      // default owner for JDialog
      if (owner == null) {
        owner = (java.awt.Frame) new javax.swing.JDialog().getOwner();
      }
      return owner;
    }
  } finally {
    TALK.set(null);
  }
}

代码示例来源:origin: protegeproject/protege

/**
 * Returns the owner of the generated javax.swing.JDialog.
 * @return The owner (java.awt.Frame or java.awt.Dialog) of the javax.swing.JDialog generated
 *         by this class.
 */
public Component getOwner() {
  return wizardDialog.getOwner();
}

代码示例来源:origin: org.protege/protege-editor-core-application

/**
 * Returns the owner of the generated javax.swing.JDialog.
 * @return The owner (java.awt.Frame or java.awt.Dialog) of the javax.swing.JDialog generated
 *         by this class.
 */
public Component getOwner() {
  return wizardDialog.getOwner();
}

代码示例来源:origin: org.n52.wps/52n-wps-install-wizard

/**
 * Returns the owner of the generated javax.swing.JDialog.
 * @return The owner (java.awt.Frame or java.awt.Dialog) of the javax.swing.JDialog generated
 * by this class.
 */    
public Component getOwner() {
  return wizardDialog.getOwner();
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

/**
 * Returns the owner of the generated javax.swing.JDialog.
 * @return The owner (java.awt.Frame or java.awt.Dialog) of the javax.swing.JDialog generated
 *         by this class.
 */
public Component getOwner() {
  return wizardDialog.getOwner();
}

代码示例来源:origin: org.ihtsdo/wb-api

public Component getOwner() {
  return wizardDialog.getOwner();
}

代码示例来源:origin: omegat-org/omegat

public void show() {
  dialog.pack();
  dialog.setLocationRelativeTo(dialog.getOwner());
  dialog.setVisible(true);
}

代码示例来源:origin: protegeproject/protege

private void showWindow(final String message) {    	
  SwingUtilities.invokeLater(() -> {
    if (!taskIsRunning)
      return;
    initWindow();
    taskLabel.setText(message);
    if (window.isVisible())
      return;
    cancelledAction.setEnabled(true);
    window.setLocationRelativeTo(window.getOwner());
    window.setVisible(true);
  });
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

private void showWindow(final String message) {    	
  SwingUtilities.invokeLater(() -> {
    if (!taskIsRunning)
      return;
    initWindow();
    taskLabel.setText(message);
    if (window.isVisible())
      return;
    cancelledAction.setEnabled(true);
    window.setLocationRelativeTo(window.getOwner());
    window.setVisible(true);
  });
}

代码示例来源:origin: christian-schlichtherle/truelicense

/** Packs and displays the modal wizard dialog. */
public ReturnCode showModalDialog() {
  fireAfterStateSwitch();
  dialog.pack();
  dialog.setLocationRelativeTo(dialog.getOwner());
  dialog.setModal(true);
  dialog.setVisible(true);
  return lastReturnCode;
}

代码示例来源:origin: senbox-org/snap-desktop

private AbstractAdapterEditor(AppContext appContext, JDialog parent, String title) {
  super(parent.getOwner(), title, ID_OK_CANCEL_HELP, new Object[] { new JButton(Bundle.CTL_Button_Export_Text()) }, helpID);
  this.context = appContext;
  this.logger = Logger.getLogger(ToolAdapterEditorDialog.class.getName());
  this.registerButton(ID_OTHER, new JButton(Bundle.CTL_Button_Export_Text()));
  controlHeight = (getJDialog().getFont().getSize() + 1) * 2;
  errorPanel = new JPanel();
  errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.Y_AXIS));
  getButtonPanel().add(errorPanel, 0);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-performance

/**
 * Find Bottom dialogs.
 *
 * @param dialog find all dialogs of owner for this dialog
 * @param chooser chooser used for looking for dialogs
 * @return return bottm dialog
 */
private static javax.swing.JDialog findBottomDialog(javax.swing.JDialog dialog, org.netbeans.jemmy.ComponentChooser chooser) {
  java.awt.Window owner = dialog.getOwner();
  if (chooser.checkComponent(owner)) {
    return (findBottomDialog((javax.swing.JDialog) owner, chooser));
  }
  return (dialog);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-performance

/**
 * Find Bottom dialogs.
 *
 * @param dialog find all dialogs of owner for this dialog
 * @param chooser chooser used for looking for dialogs
 * @return return bottm dialog
 */
private static javax.swing.JDialog findBottomDialog(javax.swing.JDialog dialog, org.netbeans.jemmy.ComponentChooser chooser) {
  java.awt.Window owner = dialog.getOwner();
  if (chooser.checkComponent(owner)) {
    return (findBottomDialog((javax.swing.JDialog) owner, chooser));
  }
  return (dialog);
}

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

private void init(String description, int totalItems, boolean intermediate,
    IAbortEventHandler abortHandler) {
  itemCount = totalItems;
  this.indeterminate = intermediate;
  this.abortHandler = abortHandler;
  this.simpleTaskDescription = description;
  final Window owner = super.getOwner();
  final ProgressAbortDialog dialog = this;
  createGUI();
  setLocationRelativeTo(owner);
  dialog.setVisible(true);
}

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

private void init(int totalItems)
{
  itemCount = totalItems;
  final Window owner = super.getOwner();
  final ProgressCallBackDialog dialog = this;
  createGUI();
  setLocationRelativeTo(owner);
  dialog.setVisible(true);
}

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

private void init(int totalItems)
{
  itemCount = totalItems;
  final Window owner = super.getOwner();
  final ProgressCallBackDialog dialog = this;
  createGUI();
  setLocationRelativeTo(owner);
  dialog.setVisible(true);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-core

private static boolean isModalDialogPresent() {
  return hasModalDialog(WindowManager.getDefault().getMainWindow())
    // XXX Trick to get the shared frame instance.
    || hasModalDialog(new JDialog().getOwner());
}

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

private void init(String description, int totalItems, boolean intermediate,
    IAbortEventHandler abortHandler) {
  itemCount = totalItems;
  this.indeterminate = intermediate;
  this.abortHandler = abortHandler;
  this.simpleTaskDescription = description;
  final Window owner = super.getOwner();
  final ProgressAbortDialog dialog = this;
  createGUI();
  setLocationRelativeTo(owner);
  dialog.setVisible(true);
}

代码示例来源:origin: org.verapdf.apps/gui

void showDialog(Component parent, String title) {
  Frame owner;
  if (parent instanceof Frame) {
    owner = (Frame) parent;
  } else {
    owner = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
  }
  if (this.dialog == null || this.dialog.getOwner() != owner) {
    this.dialog = new JDialog(owner, true);
    this.dialog.setResizable(false);
    this.dialog.add(this);
    this.dialog.getRootPane().setDefaultButton(this.okButton);
    this.dialog.pack();
    this.dialog.setTitle(title);
  }
  this.dialog.setLocation(GUIConstants.ABOUT_DIALOG_COORD_X, GUIConstants.ABOUT_DIALOG_COORD_Y);
  this.dialog.setVisible(true);
}

代码示例来源:origin: groboclown/p4ic4idea

public static void centerDialog(@NotNull JDialog dialog) {
    dialog.pack();
    final Dimension bounds = dialog.getSize();
    final Rectangle parentBounds = dialog.getOwner().getBounds();
    if (parentBounds.width > 0 && parentBounds.height > 0) {
      dialog.setLocation(
          Math.max(0, parentBounds.x + (parentBounds.width - bounds.width) / 2),
          Math.max(0, parentBounds.y + (parentBounds.height - bounds.height) / 2));
      if (LOG.isDebugEnabled()) {
        LOG.debug("Set dialog centered on (" + parentBounds.x + ", " + parentBounds.y + " " +
            parentBounds.width + "x" + parentBounds.height + ") -> (" +
            dialog.getLocation().x + ", " + dialog.getLocation().y + " " +
            bounds.width + "x" + bounds.height + ")");
      }
    }
  }
}

相关文章

JDialog类方法