Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Button.computeSize()


      button.setText(key);
      button.setFont(parent.getFont());
      GridData data = new GridData(GridData.FILL_HORIZONTAL);
      int widthHint = convertHorizontalDLUsToPixels(button,
              IDialogConstants.BUTTON_WIDTH);
      data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT,
              SWT.DEFAULT, true).x);
      button.setLayoutData(data);
      return button;
  }
View Full Code Here


    // This little code fragment is an attempt to get the right sizing for the buttons
    // Was wrong on Mac platforms
    //   Word below is the longer of the two words in the button container
    Button tempForSize = toolkit.createButton(tableContainer, "Remove", SWT.PUSH);
    Point p = tempForSize.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    tempForSize.dispose();
   
    Composite bottomButtonContainer = newButtonContainer(tableContainer, HORIZONTAL_BUTTONS, 3* p.x);

    addButton = newPushButton(bottomButtonContainer, S_ADD,
View Full Code Here

    Button button = new Button(parent, SWT.PUSH);
    button.setText(JFaceResources.getString(key));
    button.setFont(parent.getFont());
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(data);
    button.addSelectionListener(getSelectionListener());
    return button;
  }
View Full Code Here

    button.setText(JFaceResources.getString(key));
    button.setFont(parent.getFont());
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    int widthHint = convertHorizontalDLUsToPixels(button,
        IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT,
        SWT.DEFAULT, true).x);
    button.setLayoutData(data);
    button.addSelectionListener(getSelectionListener());
    return button;
  }
View Full Code Here

    button.setEnabled(enabled);

    FontMetrics fontMetrics = getFontMetrics(button);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
    gd.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    gd.horizontalIndent = indentation;
    button.setLayoutData(gd);
    return button;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.