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

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

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

JDialog.setLocationByPlatform介绍

暂无

代码示例

代码示例来源:origin: org.languagetool/languagetool-gui-commons

/**
 * Set dialog location to the center of the screen
 *
 * @param dialog the dialog which will be centered
 * @since 2.6
 */
public static void centerDialog(JDialog dialog) {
 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
 Dimension frameSize = dialog.getSize();
 dialog.setLocation(screenSize.width / 2 - frameSize.width / 2,
     screenSize.height / 2 - frameSize.height / 2);
 dialog.setLocationByPlatform(true);
}

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

for (File file : files) {
  try {
    ...
    HistogramPanel panel = new HistogramPanel(width, counts, height, horizon);
    JDialog dialog = new JDialog();
    dialog.setModal(false);        <---- very important
    dialog.setLayout(new BorderLayout());
    dialog.add(panel);
    dialog.pack();
    dialog.setLocationByPlatform(true);
    dialog.setVisible(true);
  } catch (...)
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
public void setLocationByPlatform(boolean aValue) {
  locationByPlatform = aValue;
  if (surface instanceof JDialog) {
    ((JDialog) surface).setLocationByPlatform(locationByPlatform);
  }
  if (surface instanceof JInternalFrame) {
    //((JInternalFrame) surface).setLocationByPlatform(locationByPlatform)
  }
  if (surface instanceof JFrame) {
    ((JFrame) surface).setLocationByPlatform(locationByPlatform);
  }
}

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

JDialog dialog = super.createDialog(parent);
dialog.setLocationByPlatform(true);

代码示例来源:origin: net.sf.ingenias/editor

public static int showConfirmDialog(Component parentComponent,
    Object message, String title,
    int optionType)
{
  JOptionPane pane = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, optionType);
  JDialog dialog = pane.createDialog(parentComponent, title);
  dialog.setLocationByPlatform(true);
  dialog.setVisible(true);
  if (pane.getValue() instanceof Integer)
    return ((Integer) pane.getValue()).intValue();
  return -1;
}

代码示例来源:origin: RPTools/maptool

public static void createAndShowGUI(String title) {
    if (frame != null) {
      frame.dispose(); // This is so that the memory characteristics are queried each time this frame is displayed.
      frame = null;
    }
    frame = new JDialog(MapTool.getFrame(), title);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    SysInfo demo = new SysInfo();
    // frame.setJMenuBar(demo.createMenuBar());
    frame.setContentPane(demo.createContentPane());
    try {
      Image img = ImageUtil.getImage("net/rptools/maptool/client/image/maptool_icon.png");
      frame.setIconImage(img);
      //			URL url = MapTool.class.getClassLoader().getResource("net/rptools/maptool/client/image/maptool_icon.png");
      //			Toolkit tk = Toolkit.getDefaultToolkit();
      //			if (url != null) {
      //				Image img = tk.createImage(url);
      //				frame.setIconImage(img);
      //			}
    } catch (Exception ex) {
      MapTool.showError("While retrieving MapTool logo image?!", ex);
    }
    frame.setSize(550, 640);
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
  }
}

代码示例来源:origin: org.languagetool/languagetool-gui-commons

dialog.setLocation(screenSize.width / 2 - frameSize.width / 2,
  screenSize.height / 2 - frameSize.height / 2);
dialog.setLocationByPlatform(true);

代码示例来源:origin: com.eas.platypus/platypus-js-forms

dialog.setLocationByPlatform(locationByPlatform);
dialog.getContentPane().add(view, BorderLayout.CENTER);
dialog.setModalityType(ModalityType.APPLICATION_MODAL);

代码示例来源:origin: de.richtercloud/reflection-form-builder

dialog.add(new mxGraphComponent(graphAdapter));
dialog.pack();
dialog.setLocationByPlatform(true);
LOGGER.info("displayed field order dependency graph "
    + "visualization dialog and waiting for it to be "

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

dialog.setLocationByPlatform(true);
updateSource(drawing, ta);

相关文章

JDialog类方法