public void handleEvent( Event e ) { Rectangle rect = composite.getClientArea(); text.setBounds( rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2 ); } } );
public void handleEvent( Event e ) { Rectangle rect = composite.getClientArea(); text.setBounds( rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2 ); } } );
public void handleEvent( Event e ) { Rectangle rect = composite.getClientArea(); text.setBounds( rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2 ); } } );
channel.setBounds(0, 0, 88, 23); channel.addControlListener(new ControlAdapter() { @Override
void layout() { Composite parent = canvas.getParent(); Rectangle rect = parent.getClientArea(); int width = 0; String[] items = list.getItems(); GC gc = new GC( list ); for ( int i = 0; i < objects.length; i++ ) { width = Math.max( width, gc.stringExtent( items[i] ).x ); } gc.dispose(); Point size1 = start.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Point size2 = stop.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Point size3 = check.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Point size4 = label.computeSize( SWT.DEFAULT, SWT.DEFAULT ); width = Math.max( size1.x, Math.max( size2.x, Math.max( size3.x, width ) ) ); width = Math.max( 64, Math.max( size4.x, list.computeSize( width, SWT.DEFAULT ).x ) ); start.setBounds( 0, 0, width, size1.y ); stop.setBounds( 0, size1.y, width, size2.y ); check.setBounds( 0, size1.y + size2.y, width, size3.y ); label.setBounds( 0, rect.height - size4.y, width, size4.y ); int height = size1.y + size2.y + size3.y; list.setBounds( 0, height, width, rect.height - height - size4.y ); text.setBounds( width, 0, rect.width - width, rect.height ); canvas.setBounds( width, 0, rect.width - width, rect.height ); }
public void handleEvent(Event e) { Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT); textSize.x += textSize.y; // Add extra space for new // characters. Point parentSize = textEditorParent.getSize(); textEditor.setBounds(2, inset, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2 * inset); textEditorParent.redraw(); } });
public void handleEvent(Event e) { Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT); textSize.x += textSize.y; // Add extra space for new characters. Point parentSize = textEditorParent.getSize(); textEditor.setBounds(2, 1, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2); textEditorParent.redraw(); } });
public static Text newShortTextInput(Composite parent, String title, int textLimit, int width) { Text t = newInput(parent, title, SWT.BORDER); t.setTextLimit(textLimit); Rectangle r = t.getBounds(); r.width = width; t.setBounds(r); t.setSize(width, r.height); t.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); return t; }
public Text newShortTextInput(int textLimit, int width) { Text t = newInput(this, null, SWT.BORDER); t.setTextLimit(textLimit); Rectangle r = t.getBounds(); r.width = width; t.setBounds(r); t.setSize(width, r.height); t.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); return t; }
void resize() { Point pt = computeSize(SWT.DEFAULT, SWT.DEFAULT); int textWidth = pt.x - BUTTON_WIDTH; int buttonHeight = pt.y / 2; text.setBounds(0, 0, textWidth, pt.y); up.setBounds(textWidth, -3, BUTTON_WIDTH, buttonHeight); down.setBounds(textWidth, pt.y - buttonHeight - 3, BUTTON_WIDTH, buttonHeight); }
void internalLayout (boolean changed) { if (isDropped ()) dropDown (false); Rectangle rect = getClientArea (); int width = rect.width; int height = rect.height; // Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); // text.setBounds (0, 0, width - arrowSize.x, height); text.setBounds (0, 0, width - 16, height); // arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); arrow.setBounds (width - 16, 0, 16, 16); } void listEvent (Event event) {
void internalLayout (boolean changed) { if (isDropped ()) dropDown (false); Rectangle rect = getClientArea (); int width = rect.width; int height = rect.height; Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); text.setBounds (0, 0, width - arrowSize.x, height); arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); } void listEvent (Event event) {
void internalLayout (boolean changed) { if (isDropped ()) dropDown (false); Rectangle rect = getClientArea (); int width = rect.width; int height = rect.height; Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); text.setBounds (0, 0, width - arrowSize.x, height); arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); } void listEvent (Event event) {
void internalLayout (boolean changed) { if (isDropped ()) dropDown (false); Rectangle rect = getClientArea (); int width = rect.width; int height = rect.height; Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); text.setBounds (0, 0, width - arrowSize.x, height); arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); } void listEvent (Event event) {
void internalLayout (boolean changed) { if (isDropped ()) dropDown (false); Rectangle rect = getClientArea (); int width = rect.width; int height = rect.height; Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); text.setBounds (0, 0, width - arrowSize.x, height); arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); } void listEvent (Event event) {
void internalLayout (boolean changed) { if (isDropped ()) dropDown (false); Rectangle rect = getClientArea (); int width = rect.width; int height = rect.height; Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); text.setBounds (0, 0, width - arrowSize.x, height); arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); } void listEvent (Event event) {
@Override public void relocate(CellEditor celleditor) { // Obtain the location IFigure figure = OfficeFloorDirectEditPolicy.this.initialiser .getLocationFigure(); Rectangle rect = figure.getBounds().getCopy(); figure.translateToAbsolute(rect); // Obtain the preferred size Text text = (Text) celleditor.getControl(); Point pref = text.computeSize(SWT.DEFAULT, SWT.DEFAULT); // Position the cell editor text box text.setBounds(rect.x, rect.y, pref.x, pref.y); } };
/** * Layout the list and text widgets according to the new * positions of the sashes..events.SelectionEvent */ void layout () { Rectangle clientArea = sashComp.getClientArea (); Rectangle hSashBounds = hSash.getBounds (); Rectangle vSashBounds = vSash.getBounds (); list1.setBounds (0, 0, vSashBounds.x, hSashBounds.y); list2.setBounds (vSashBounds.x + vSashBounds.width, 0, clientArea.width - (vSashBounds.x + vSashBounds.width), hSashBounds.y); text.setBounds (0, hSashBounds.y + hSashBounds.height, clientArea.width, clientArea.height - (hSashBounds.y + hSashBounds.height)); /** * If the horizontal sash has been moved then the vertical * sash is either too long or too short and its size must * be adjusted. */ vSashBounds.height = hSashBounds.y; vSash.setBounds (vSashBounds); } /**
public void relocate(CellEditor celleditor) { Text text = (Text) celleditor.getControl(); Label label = namedEditPart.getNameLabelFigure(); if (text.getBounds().x <= 0) { super.relocate(celleditor); } else { org.eclipse.swt.graphics.Point sel = text.getSelection(); org.eclipse.swt.graphics.Point pref = text.computeSize(-1, -1); Rectangle rect = label.getTextBounds().getCopy(); label.translateToAbsolute(rect); text.setBounds(rect.x, rect.y-1, rect.width, pref.y+1); text.setSelection(0); text.setSelection(sel); } } }