Problemas com ScrolledComposite

0 respostas
marceloamigo

Boa Tarde,

Estou tentando montar uma interface semelhante a da figura abaixo, porém estou tendo dificuldades em fazer o scrollbar funcionar, alguem pode dar uma dica

segue o código

private void createCompositeLabel(Composite parent) {
		if (compositeOuter != null) {
			compositeOuter.dispose();
		}
		if (scrolledComposite != null) {
			scrolledComposite.dispose();
		}
		if (compositeLabel != null) {
			compositeLabel.dispose();
		}
		
		compositeOuter= new Composite(parent,SWT.BORDER);
		GridLayout layoutOuter = new GridLayout(1,false);		
		GridData dataOuter = new GridData();			
		dataOuter.horizontalAlignment =  org.eclipse.swt.layout.GridData.BEGINNING;
		dataOuter.heightHint = Layout.MAX_HEIGHT + 30;
		dataOuter.widthHint = Layout.MAX_WIDTH + 30;
		dataOuter.verticalAlignment =  org.eclipse.swt.layout.GridData.BEGINNING;
		compositeOuter.setLayout(layoutOuter);
		compositeOuter.setLayoutData(dataOuter);
		compositeOuter.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
						
		
		scrolledComposite = new ScrolledComposite(compositeOuter, SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL);		
		GridLayout layoutScrolled = new GridLayout(1, false);
		GridData dataScrolled = new GridData();
		dataScrolled.horizontalAlignment =  org.eclipse.swt.layout.GridData.BEGINNING;
		dataScrolled.verticalAlignment =  org.eclipse.swt.layout.GridData.BEGINNING;
		scrolledComposite.setLayout(layoutScrolled);
		scrolledComposite.setLayoutData(dataScrolled);
		scrolledComposite.setBackground(Display.getCurrent().getSystemColor(
				SWT.COLOR_WHITE));		   		
		scrolledComposite.setExpandVertical(true);
		scrolledComposite.setExpandHorizontal(true);		

		
		compositeLabel = new Composite(scrolledComposite,SWT.BORDER);
		GridLayout layoutLabel = new GridLayout(1,false);		
		GridData dataLabel = new GridData();
		dataLabel.heightHint = 400;
		dataLabel.widthHint = 400;
		dataLabel.horizontalAlignment =  org.eclipse.swt.layout.GridData.BEGINNING;
		dataLabel.verticalAlignment =  org.eclipse.swt.layout.GridData.BEGINNING;
		compositeLabel.setLayout(layoutLabel);
		compositeLabel.setLayoutData(dataLabel);
		compositeLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		
		scrolledComposite.setMinSize(100, 100);
		scrolledComposite.setContent(compositeLabel);
}

obrigado

Criado 3 de maio de 2010
Respostas 0
Participantes 1