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

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

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

JDialog.getLocation介绍

暂无

代码示例

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

@Override
public Point getLocation() {
  return dialog.getLocation();
}

代码示例来源:origin: antlr/antlrworks

public Point getPosition() {
  return jDialog.getLocation();
}

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

@Override
public void componentMoved(ComponentEvent e) {
  prefs.putInt(PREF_MACHINECONTROLS_WINDOW_X, frameMachineControls.getLocation().x);
  prefs.putInt(PREF_MACHINECONTROLS_WINDOW_Y, frameMachineControls.getLocation().y);
}

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

@Override
public void componentMoved(ComponentEvent e) {
  prefs.putInt(PREF_CAMERA_WINDOW_X, frameCamera.getLocation().x);
  prefs.putInt(PREF_CAMERA_WINDOW_Y, frameCamera.getLocation().y);
}

代码示例来源:origin: net.sf.sf3jswing/kernel-core

@Override
    public void mouseDragged(MouseEvent e) {
        if (dragEvent != null) {
            d.setLocation(d.getLocation().x + (e.getX() - dragEvent.getX()), d.getLocation().y + (e.getY() - dragEvent.getY()));
        }
        dragEvent = e;
    }
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public void mouseDragged(MouseEvent me) {
    dialog.setLocation(dialog.getLocation().x + me.getX() - pX,dialog.getLocation().y + me.getY() - pY);
  }
});

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public void mouseDragged(MouseEvent me) {
    dialog.setLocation(dialog.getLocation().x + me.getX() - pX,dialog.getLocation().y + me.getY() - pY);
  }
});

代码示例来源:origin: antlr/antlrworks

public void offsetPosition(int dx, int dy) {
  Point p = jDialog.getLocation();
  jDialog.setLocation(p.x+dx, p.y+dy);
}

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

JDialog dialog = new JOptionPane("Message").createDialog(parent, "Title");
Point dialogLoc = dialog.getLocation();
Point parentLoc = parent.getLocation();
dialog.setLocation(parentLoc.x + parent.getWidth(), dialogLoc.y);
dialog.setVisible(true);

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

public void rememberFrom(JDialog dialog) {
location = dialog.getLocation();
width = dialog.getWidth();
height = dialog.getHeight();
}

代码示例来源:origin: notzippy/JALOPY2-MAIN

/**
 * {@inheritDoc} Overriden to dispatch the call to the top-level container if invoked
 * from the command line.
 */
public Point getLocation()
{
  Container c = getParent();
  if (c instanceof SettingsFrame)
  {
    return c.getLocation();
  }
  return super.getLocation();
}

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

private void startDialog() {
 final JDialog d = new JDialog(this, "Test", true);
 d.getContentPane().add(new JLabel("Something"));
 d.setBounds(100, 100, 400, 300);
 Thread t = new Thread(new Runnable() {
  public void run() {
   for (int i = 0; i < 50; i++) {
    SwingUtilities.invokeLater(new Runnable() {
     public void run() {
      Point p = d.getLocation();
      d.setLocation(p.x + 10, p.y + 10);
     }
    });
    try {
     Thread.sleep(100);
    } catch (InterruptedException e) {
     // ignore
    }
   }
  }
 });
 t.start();
 d.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 + ")");
      }
    }
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-ext-toolbar

private void validateBounds(){
  Rectangle bounds = dialog.getBounds();
  Point location = dialog.getLocation();

代码示例来源:origin: xyz.cofe/docking-frames-common

private void validateBounds(){
  Rectangle bounds = dialog.getBounds();
  Point location = dialog.getLocation();

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common

private void validateBounds(){
  Rectangle bounds = dialog.getBounds();
  Point location = dialog.getLocation();

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

popup.setSize(0, 0);
popup.setLocationRelativeTo(input);
Point point = popup.getLocation();
Dimension dim = input.getSize();
popup.setLocation(point.x - (int) dim.getWidth() / 2, point.y + (int) dim.getHeight() / 2);

代码示例来源:origin: javax.help/javahelp

Point dlocation = dialog.getLocation();
if (isXinerama()) {
GraphicsConfiguration gc = dialog.getGraphicsConfiguration();

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

private void testNotification() {
  NotificationWindow w = new NotificationWindow("[Test] "+type.getSettingValue().label+" Colors",
      "Nice color you got there, would be a shame if it was to be used for a notification.",
      foregroundColor.getSettingValueAsColor(),
      backgroundColor.getSettingValueAsColor(),
      null);
  w.setLocation(dialog.getLocation());
  w.setTimeout(30*1000);
  w.show();
  if (testNotification != null) {
    final NotificationWindow toClose = testNotification;
    SwingUtilities.invokeLater(() -> {
      toClose.close();
    });
  }
  testNotification = w;
}

代码示例来源:origin: MegaMek/megamek

/**
 * Saves the current settings to the cfg file.
 */
void saveSettings() {
  // save frame location
  GUIPreferences.getInstance().setWindowPosX(frame.getLocation().x);
  GUIPreferences.getInstance().setWindowPosY(frame.getLocation().y);
  GUIPreferences.getInstance().setWindowSizeWidth(frame.getSize().width);
  GUIPreferences.getInstance().setWindowSizeHeight(frame.getSize().height);
  // also minimap
  if ((minimapW != null) && ((minimapW.getSize().width * minimapW.getSize().height) > 0)) {
    GUIPreferences.getInstance().setMinimapPosX(minimapW.getLocation().x);
    GUIPreferences.getInstance().setMinimapPosY(minimapW.getLocation().y);
    GUIPreferences.getInstance().setMinimapZoom(minimap.getZoom());
  }
  // also mech display
  if ((mechW != null) && ((mechW.getSize().width * mechW.getSize().height) > 0)) {
    GUIPreferences.getInstance().setDisplayPosX(mechW.getLocation().x);
    GUIPreferences.getInstance().setDisplayPosY(mechW.getLocation().y);
    GUIPreferences.getInstance().setDisplaySizeWidth(mechW.getSize().width);
    GUIPreferences.getInstance().setDisplaySizeHeight(mechW.getSize().height);
  }
  // also ruler display
  if ((ruler != null) && (ruler.getSize().width != 0) && (ruler.getSize().height != 0)) {
    GUIPreferences.getInstance().setRulerPosX(ruler.getLocation().x);
    GUIPreferences.getInstance().setRulerPosY(ruler.getLocation().y);
    GUIPreferences.getInstance().setRulerSizeWidth(ruler.getSize().width);
    GUIPreferences.getInstance().setRulerSizeHeight(ruler.getSize().height);
  }
}

相关文章

JDialog类方法