Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Monitor


   * It uses the anchor control as a reference point to display the popup.
   */
  private void open() {   
    calendar.setFocus();
   
    Monitor monitor = shell.getMonitor();
   
    Rectangle size = popupShell.getBounds();
    Rectangle monitorBounds = monitor.getBounds();
    Point location = new Point(bounds.x, bounds.y + bounds.height);
       
    if (location.x + size.width > monitorBounds.x + monitorBounds.width) {
      location.x = monitorBounds.x + monitorBounds.width - size.width;
    } else if (location.x < monitorBounds.x) {
View Full Code Here


      ref = screen[0];
    } else {
      Display d = Display.getDefault();
      Point cur = d.getCursorLocation();
      Monitor[] mons = d.getMonitors();
      Monitor mon = null;
     
      for (int i = 0; i < mons.length; i++) {
        Rectangle rt = mons[i].getBounds();
       
        if (rt.contains(cur)) {
View Full Code Here

    if (hasValue) {
      client = screenPtr[0];
    } else {
      Display display = Display.getDefault();
      Point mouse = display.getCursorLocation();
      Monitor active = null;
     
      for (Monitor monitor : display.getMonitors()) {
        if (monitor.getBounds().contains(mouse)) {
          active = monitor;
          break;
        }
      }
     
      if (active == null) {
        client = display.getClientArea();
      } else {
        client = active.getClientArea();
      }
     
      if (hasPtr) {
        screenPtr[0] = client;
      }
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

      buildMenuBar();
     
      shell.setSize(900, 650);
     
      // Center shell on Screen
      Monitor primary = display.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);
      shell.open();
View Full Code Here

      shell.pack();
      //Center Shell
      if(View.getDisplay() == null && View.getDisplay().isDisposed())
          return;
     
      Monitor primary = View.getDisplay().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

        dirShell.pack();
       
        //Center Shell
        if(View.getDisplay()==null && View.getDisplay().isDisposed())
            return;
        Monitor primary = View.getDisplay().getPrimaryMonitor ();
        Rectangle bounds = primary.getBounds ();
        Rectangle rect = dirShell.getBounds ();
        int x = bounds.x + (bounds.width - rect.width) / 2;
        int y = bounds.y +(bounds.height - rect.height) / 2;
        dirShell.setLocation (x, y);
       
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.