Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Monitor


            Rectangle displayBounds = null;
            try {
              boolean ok = false;
              Monitor[] monitors = shell.getDisplay().getMonitors();
              for (int i = 0; i < monitors.length; i++) {
                Monitor monitor = monitors[i];
                displayBounds = monitor.getBounds();
                if (displayBounds.contains(endBounds.x, endBounds.y)) {
                  ok = true;
                  break;
                }
              }
View Full Code Here


    int x = (int) (WIDTH_NO_PADDING * (value > maxValue ? 1 : (double) value
        / maxValue));
    location.x -= PADDING_X0 + x;

    Rectangle bounds = new Rectangle(location.x, location.y, WIDTH, HEIGHT);
    Monitor mouseMonitor = shell.getMonitor();
    Monitor[] monitors = display.getMonitors();
    for (int i = 0; i < monitors.length; i++) {
      Monitor monitor = monitors[i];
      if (monitor.getBounds().contains(location)) {
        mouseMonitor = monitor;
        break;
      }
    }
    Rectangle monitorBounds = mouseMonitor.getBounds();
View Full Code Here

   * Get the Client Area of the primary Monitor.
   *
   * @return Returns the Client Area of the primary Monitor.
   */
  private Rectangle getPrimaryClientArea() {
    Monitor primaryMonitor = getShell().getDisplay().getPrimaryMonitor();
    return (primaryMonitor != null) ? primaryMonitor.getClientArea() : getShell().getDisplay().getClientArea();
  }
View Full Code Here

   * Get the Client Area of the primary Monitor.
   *
   * @return Returns the Client Area of the primary Monitor.
   */
  private Rectangle getPrimaryClientArea() {
    Monitor primaryMonitor = fShell.getDisplay().getPrimaryMonitor();
    return (primaryMonitor != null) ? primaryMonitor.getClientArea() : fShell.getDisplay().getClientArea();
  }
View Full Code Here

   * Get the Client Area of the primary Monitor.
   *
   * @return Returns the Client Area of the primary Monitor.
   */
  private Rectangle getPrimaryClientArea() {
    Monitor primaryMonitor = fShell.getDisplay().getPrimaryMonitor();
    return (primaryMonitor != null) ? primaryMonitor.getClientArea() : fShell.getDisplay().getClientArea();
  }
View Full Code Here

   * @return the initial location of the shell
   */
  protected Point getInitialLocation(Point initialSize) {
    Composite parent = shell.getParent();

    Monitor monitor = shell.getDisplay().getPrimaryMonitor();
    if (parent != null) {
      monitor = parent.getMonitor();
    }

    Rectangle monitorBounds = monitor.getClientArea();
    Point centerPoint;
    if (parent != null) {
      centerPoint = Geometry.centerPoint(parent.getBounds());
    } else {
      centerPoint = Geometry.centerPoint(monitorBounds);
View Full Code Here

   */
  private static Monitor getClosestMonitor(Display toSearch, Point toFind) {
    int closest = Integer.MAX_VALUE;

    Monitor[] monitors = toSearch.getMonitors();
    Monitor result = monitors[0];

    for (int idx = 0; idx < monitors.length; idx++) {
      Monitor current = monitors[idx];

      Rectangle clientArea = current.getClientArea();

      if (clientArea.contains(toFind)) {
        return current;
      }

View Full Code Here

   */
  protected Rectangle getConstrainedShellBounds(Rectangle preferredSize) {
    Rectangle result = new Rectangle(preferredSize.x, preferredSize.y,
        preferredSize.width, preferredSize.height);

    Monitor mon = getClosestMonitor(getShell().getDisplay(), Geometry
        .centerPoint(result));

    Rectangle bounds = mon.getClientArea();

    if (result.height > bounds.height) {
      result.height = bounds.height;
    }

View Full Code Here

            protected void configureShell( Shell shell ) {
                super.configureShell(shell);
                shell.setText(title);
                shell.setSize(DIALOG_WIDTH, 700);

                Monitor primary = Display.getDefault().getPrimaryMonitor();
                Rectangle bounds = primary.getBounds();
                Rectangle rect = shell.getBounds();
                int x = bounds.x + (bounds.width - rect.width) / 2;
                int y = bounds.y + (bounds.height - rect.height) / 2;
                shell.setLocation(x, y);
            }
View Full Code Here

  private static int iWidth;
  private static int iHeight;

  public static void centerFrame(Shell shell) {

    Monitor primary = shell.getDisplay().getPrimaryMonitor();

    iHeight = primary.getClientArea().height;
    iWidth = primary.getClientArea().width;
    iX = (iWidth / 2) - (shell.getBounds().width / 2);
    iY = (iHeight / 2) - (shell.getBounds().height / 2);

    shell.setLocation(iX, iY);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Monitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.