Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Monitor


  public static void centerShellandOpen(Shell shell){
    //open shell
    shell.pack();

    //Center Shell
    Monitor primary = Plugin.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


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

   * @param sudoku
   *            The sudoku which will be solved.
   */
  public GUI(Sudoku sudoku) {
    // Get the main monitor
    Monitor monitor = display.getPrimaryMonitor();

    ImageLoader loader = new ImageLoader();
    ImageData data = loader.load("images/Logo.png")[0];
    Image image = new Image(display, data);
    shell.setImage(image);

    // Customize the shell
    GridLayout layout = noMarginGridLayout(1, true, 16);
    shell.setLayout(layout);

    // Add the sudoku composite.
    getMenu(shell);
    getSudokuComposite(shell);
    getControlComposite(shell);

    // Set the sudoku
    setSudoku(sudoku);

    // Make the shell as small as possible.
    shell.pack();
    shell.setMinimumSize(shell.getSize());

    // Monitor dimension
    Rectangle mSize = monitor.getBounds();
    Rectangle sSize = shell.getBounds();

    // Set the location
    shell.setLocation(mSize.x + (mSize.width - sSize.width) / 2, mSize.y
        + (mSize.height - sSize.height) / 2);
View Full Code Here

    shell.setLayout(gridLayout);
    Label label = new Label(shell, SWT.WRAP | SWT.BOLD);
    label.setText(text);
    label.setFont(JFaceResources.getBannerFont());
    GridData data = new GridData();
    Monitor monitor = parent.getMonitor();
    int maxWidth = monitor.getBounds().width * 2 / 3;
    int width = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    data.widthHint = Math.min(width, maxWidth);
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    data.horizontalIndent = 15;
View Full Code Here

    Point location = getDefaultLocation(size);
    return new Rectangle(location.x, location.y, size.x, size.y);
  }

  private Point getDefaultLocation(Point initialSize) {
    Monitor monitor = dialogShell.getDisplay().getPrimaryMonitor();
    if (parentShell != null) {
      monitor = parentShell.getMonitor();
    }

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

  }

  // ---------- shuts down the dialog ---------------

  private Point getDefaultLocation(Point initialSize) {
    Monitor monitor = dialogShell.getDisplay().getPrimaryMonitor();
    if (parentShell != null) {
      monitor = parentShell.getMonitor();
    }

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

    Point location = getDefaultLocation(size);
    return new Rectangle(location.x, location.y, size.x, size.y);
  }

  private Point getDefaultLocation(Point initialSize) {
    Monitor monitor = dialogShell.getDisplay().getPrimaryMonitor();
    if (parentShell != null) {
      monitor = parentShell.getMonitor();
    }

    Rectangle monitorBounds = monitor.getClientArea();
    Point centerPoint;
    if (parentShell != null) {
      centerPoint = Geometry.centerPoint(parentShell.getBounds());
    }
    else {
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.