Java Code Examples for org.eclipse.swt.widgets.Control#setLocation()

The following examples show how to use org.eclipse.swt.widgets.Control#setLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GanttHeaderSpacedLayout.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected void layout(final Composite composite, final boolean flushCache) {
    if (flushCache || !_calculated) {
        recalculate(composite);
    }

    final Control[] children = composite.getChildren();

    final Rectangle bounds = composite.getClientArea();

    int y = _ganttHeaderSize;
    for (int i = 0; i < children.length; i++) {
        final Control child = children[i];
        final Point wantedSize = child.computeSize(SWT.DEFAULT, SWT.DEFAULT);

        child.setLocation(0, y);
        child.setSize(bounds.width, bounds.height - y);
        y += wantedSize.y;
    }

}
 
Example 2
Source File: CTreeCell.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
protected void locate(Control control) {
		Rectangle area = getClientArea();
		Point loc = new Point(area.x, item.getTop());
		Point size = control.getSize();
		if(hAlign == SWT.RIGHT) loc.x += (area.width-size.x);
		else if(hAlign == SWT.CENTER) loc.x += ((area.width-size.x)/2);
//		if(vAlign == SWT.BOTTOM) loc.y += (area.height-size.y);
//		else if(vAlign == SWT.CENTER) loc.y += ((area.height-size.y)/2);
		control.setLocation(loc);
	}
 
Example 3
Source File: CellEditorControlAdapter.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void controlMoved(final ControlEvent event) {
    if (control.equals(event.widget)) {
        final Control movedControl = (Control) event.widget;
        final Point location = movedControl.getLocation();
        if (location.x != OFFSET) {
            final int offset = OFFSET - location.x;
            movedControl.setLocation(OFFSET, location.y);
            movedControl.setSize(movedControl.getSize().x - offset, movedControl.getSize().y);
        }
    }

}
 
Example 4
Source File: TSWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the location of the page so that its origin is in the upper left
 * corner.
 * 
 * @param w
 *            the control
 */
public void setPageLocation(Control w) {
	w.setLocation(marginWidth, marginHeight);
}
 
Example 5
Source File: TSWizardDialog.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the location of the page so that its origin is in the upper left
 * corner.
 * 
 * @param w
 *            the control
 */
public void setPageLocation(Control w) {
	w.setLocation(marginWidth, marginHeight);
}