mainPanel.setSize( mainPanel.computeSize( SWT.DEFAULT, SWT.DEFAULT ) ); scrollpane.setMinSize( mainPanel.computeSize( SWT.DEFAULT, SWT.DEFAULT ) ); BaseStepDialog.setSize( shell, 250, 400, false );
ScrolledComposite sc = new ScrolledComposite(content, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Composite composite = new Composite(sc, SWT.NONE); composite.setLayout(new FillLayout(SWT.VERTICAL)); new Label(composite, SWT.NONE).setText("1111"); new Label(composite, SWT.NONE).setText("2222"); new Label(composite, SWT.NONE).setText("3333"); new Label(composite, SWT.NONE).setText("4444"); new Label(composite, SWT.NONE).setText("5555"); new Label(composite, SWT.NONE).setText("6666"); new Label(composite, SWT.NONE).setText("7777"); sc.setContent(composite); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
public int getHeight() { int height = fComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; return height; }
@Override public Point computeSize(int wHint, int hHint, boolean changed) { Point size = super.computeSize(wHint, hHint, changed); if (isHorizontal()) size.y = TrimUtil.TRIM_DEFAULT_HEIGHT; else { size.x = TrimUtil.TRIM_DEFAULT_HEIGHT; } return size; } };
@Override public Point computeSize(Composite parent, int wHint, int hHint, boolean changed) { Point size; size = container.computeSize(wHint, hHint, changed); // size set to account for the BORDER_MARGIN on // all sides of the decorated field size.x += 4; size.y += 4; return size; } });
@Override public Point computeSize(int wHint, int hHint, boolean changed) { return super.computeSize(wHint, Math.max(24, hHint), changed); } };
private Point calculateVerticalSize( boolean changed ) { Point resultSize = super.computeSize( SWT.DEFAULT, SWT.DEFAULT, changed ); int clientAreaWidth = scrolledComposite.getClientArea().width; Point widthSize = super.computeSize( clientAreaWidth, SWT.DEFAULT, changed ); if( widthSize.y > resultSize.y ) { resultSize = widthSize; } return resultSize; }
@Override public void controlResized(ControlEvent e) { settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } });
/** * Update the minimum size for scrolled composite. */ private void updateSize() { Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); size.x += IDialogConstants.HORIZONTAL_SPACING; size.y += IDialogConstants.VERTICAL_SPACING; scrolled.setMinSize(size); }
@Override public void controlResized(ControlEvent e) { Rectangle r = sc.getClientArea(); Point size = cMainComposite.computeSize(r.width, SWT.DEFAULT); sc.setMinSize(size); } });
@Override public void handleEvent(Event event) { int width = sc.getClientArea().width; Point size = parent.computeSize( width, SWT.DEFAULT ); sc.setMinSize( size ); } } );
@Override public void handleEvent(Event event) { expandItemFilters.setHeight(cFilterArea.computeSize( expandFilters.getSize().x, SWT.DEFAULT).y + 3); } });
@Override public void controlResized(ControlEvent e) { Rectangle r = scrollable.getClientArea(); scrollable.setMinSize(main.computeSize(r.width, SWT.DEFAULT )); } });
@Override public void controlResized(ControlEvent e) { Rectangle r = scrollable.getClientArea(); scrollable.setMinSize(scrollChild.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } });
/** * Fits the width of the main composite to the same width scrolled composite was given. */ private void fitSizeOfScrolledContent() { Point p = scrollComposite.getSize(); main.setSize(main.computeSize(p.x, SWT.DEFAULT)); }
@Override public void controlResized(ControlEvent e) { Rectangle r = sc.getClientArea(); Point size = cMainComposite.computeSize(r.width, SWT.DEFAULT); sc.setMinSize(size); } });
ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Composite composite = new Composite(sc, SWT.NONE); sc.setContent(composite); Label lblRelation = new Label(composite, SWT.NONE); lblRelation.setBounds(10, 13, 74, 15); lblRelation.setText("Label name:"); composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
public static ScrolledComposite createScrollable(Composite parent, Consumer<Composite> scrollableContentCreator) { ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Composite composite = new Composite(sc, SWT.NONE); sc.setContent(composite); scrollableContentCreator.accept(composite); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); return sc; }
ScrolledComposite scroller = new ScrolledComposite(tabs, SWT.BORDER | SWT.V_SCROLL); Composite tabArea = new Composite(scroller, SWT.NONE); scroller.setContent(tabArea); // create some controls in TabArea and assign a layout to TabArea scroller.setExpandVertical(true); scroller.setExpandHorizontal(true); scroller.setMinSize(tabArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); tab.setControl(scroller);
private void insureSize() { //panel.pack(); Point p = panel.computeSize(wizardWindow.getSize().x,SWT.DEFAULT); int height = p.y + wizardHeight; if(height > wizardWindow.getSize().y) wizardWindow.setSize(p.x,height); }