Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Monitor


   * 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


     *
     */
    public void preWindowOpen()
    {
        final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
        final Monitor primary = Display.getDefault().getPrimaryMonitor();

        /*
         * Get the bounds of the primary monitor, not its client area.
         *
         * Client area on multi-monitor desktops in Linux (Xinerama) spans across all monitors,
         * but the window manager won't allow the window to take all that space immediately
         * (at least that's the effect I'm observing on my desktop).
         *
         * What's funny is that the window still opens on monitor[0], but is shifted
         * outside of its bounds (and thus spills to monitor[1]). Seems like getPrimaryMonitor()
         * is not used when creating the Workbench shell.
         */
        final Rectangle fullScreenSize = primary.getBounds();
        int width = calculateInitialSize(fullScreenSize.width, 800);
        int height = calculateInitialSize(fullScreenSize.height, 600);
        configurer.setInitialSize(new Point(width, height));

        configurer.setShowStatusLine(true);
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

   
   
   
    shell.pack();
   
  Monitor primary = display.getPrimaryMonitor ();
  //Rectangle bounds = primary.getBounds ();
  Rectangle bounds = display.getBounds ();
  Rectangle rect = shell.getBounds ();
  int x = bounds.x + (bounds.width - rect.width) / 2;
  int y = bounds.y + (bounds.height - rect.height) / 2;
View Full Code Here

    public static void centerShellandOpen(Shell shell){
        //open shell
        shell.pack();
       
        //Center Shell
        Monitor primary = 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

  //shell.setSize(900,300);
 
 
 
 
  Monitor primary = display.getPrimaryMonitor ();
  //Rectangle bounds = primary.getBounds ();
  Rectangle bounds = display.getBounds ();
  Rectangle rect = shell.getBounds ();
  int x = bounds.x + (bounds.width - rect.width) / 2;
  int y = bounds.y + (bounds.height - rect.height) / 2;
View Full Code Here

   
    //Pack Shell
    shell.pack();
   
    //Center Shell
    Monitor primary = display.getPrimaryMonitor ();
    Rectangle bounds = display.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

       
        //Pack Shell
        shell.pack();
       
        //Center Shell
        Monitor primary = display.getPrimaryMonitor ();
        Rectangle bounds = display.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

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.