Composite myComposite = new Composite(parent, SWT.NONE); Point size = myComposite.getSize(); System.out.println("Width: " + size.x + ", Height: " + size.y);
Button resizeButton = new Button(parent, SWT.PUSH); resizeButton.setText("Resize Composite"); resizeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { Point currentSize = myComposite.getSize(); myComposite.setSize(currentSize.x + 50, currentSize.y + 50); } });This code creates a button widget that, when clicked, resizes a composite widget by adding 50 pixels to its width and height. It uses the getSize() method to get the current size of the composite widget and the setSize() method to set its new size. Package library: org.eclipse.swt.widgets, which is part of the eclipse platform.