Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Monitor


   * @param shell Shell to center on screen
   * @see Shell
   */
  public static void centerDialogOnScreen(Shell shell) {
    // do it by monitor to support dual-head cards and still center things correctly onto the screen people are on. -- Emil
    Monitor m = Display.getDefault().getPrimaryMonitor();
    Rectangle bounds = m.getBounds();

    int screen_x = bounds.width;
    int screen_y = bounds.height;

    shell.setLocation(screen_x / 2 - (shell.getBounds().width / 2), screen_y / 2 - (shell.getBounds().height / 2));
View Full Code Here


    int bestArea= Integer.MIN_VALUE;
    Anchor bestAnchor= null;
    do {

      upperLeft= computeLocation(subjectArea, controlSize, testAnchor);
      Monitor monitor= getClosestMonitor(subjectAreaDisplayRelative, testAnchor);
      if (updateLocation(upperLeft, controlSize, monitor.getClientArea(), testAnchor))
        return upperLeft;
     
      // compute available area for this anchor and update if better than best
      Rectangle available= computeAvailableArea(subjectAreaDisplayRelative, monitor.getClientArea(), testAnchor);
      Rectangle proposed= new Rectangle(upperLeft.x, upperLeft.y, controlSize.x, controlSize.y);
      available.intersect(proposed);
      int area= available.width * available.height;
      if (area > bestArea) {
        bestArea= area;
View Full Code Here

  private Monitor getClosestMonitor(Display display, Rectangle rectangle) {
    int closest = Integer.MAX_VALUE;

    Point toFind= Geometry.centerPoint(rectangle);
    Monitor[] monitors = display.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 computeBoundsAboveBelow(Shell shell, Point preferred, int offset) {
      Control subjectControl= fContentAssistSubjectControlAdapter.getControl();
      Display display= subjectControl.getDisplay();
      Rectangle caret= getCaretRectangle(offset);
      Monitor monitor= getClosestMonitor(display, caret);
      Rectangle bounds= monitor.getClientArea();
      Geometry.moveInside(caret, bounds);
     
      int spaceAbove= caret.y - bounds.y;
      int caretLowerY= caret.y + caret.height;
      int spaceBelow= bounds.y + bounds.height - caretLowerY;
View Full Code Here

     */
    protected Rectangle computeBoundsBelowAbove(Shell shell, Point preferred, int offset, CompletionProposalPopup popup) {
      Control subjectControl= fContentAssistSubjectControlAdapter.getControl();
      Display display= subjectControl.getDisplay();
      Rectangle caret= getCaretRectangle(offset);
      Monitor monitor= getClosestMonitor(display, caret);
      Rectangle bounds= monitor.getClientArea();
      Geometry.moveInside(caret, bounds);

      int threshold= popup == null ? Integer.MAX_VALUE : popup.getMinimalHeight();
      int spaceAbove= caret.y - bounds.y;
      int spaceBelow= bounds.y + bounds.height - (caret.y + caret.height);
View Full Code Here

      p.y += size.y;

      p= parent.toDisplay(p);

      Point shellSize= shell.getSize();
      Monitor monitor= getClosestMonitor(parent.getDisplay(), new Rectangle(p.x, p.y, 0, 0));
      Rectangle displayBounds= monitor.getClientArea();
      constrainLocation(p, shellSize, displayBounds);

      return p;
    }
View Full Code Here

    private Monitor getClosestMonitor(Display toSearch, Rectangle rectangle) {
      int closest = Integer.MAX_VALUE;

      Point toFind= Geometry.centerPoint(rectangle);
      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

  final class TWindowParams {
    public int x, y, w, h;
    public TWindowParams() {
      w = 800;
      h = 600;
      Monitor primary = MainHolder.getDisplay().getPrimaryMonitor();
      x = (primary.getBounds().width-w)/2;
      y = (primary.getBounds().height-h)/2;
    }
View Full Code Here

        editorList.setInput(folder);
        Point size = editorList.computeSizeHint();
        int x = displayCoordinates.x;
        int y = displayCoordinates.y;

        Monitor mon = folder.getTabFolder().getControl().getMonitor();
        Rectangle bounds = mon.getClientArea();
        if (x + size.x > bounds.x + bounds.width) {
      x = bounds.x + bounds.width - size.x;
    }
        if (y + size.y > bounds.y + bounds.height) {
      y = bounds.y + bounds.height - size.y;
View Full Code Here

    public static boolean intersectsAnyMonitor(Display display,
            Rectangle someRectangle) {
        Monitor[] monitors = display.getMonitors();
   
        for (int idx = 0; idx < monitors.length; idx++) {
            Monitor mon = monitors[idx];
   
            if (mon.getClientArea().intersects(someRectangle)) {
                return true;
            }
        }
   
        return false;
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.