Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: lionelv@gmail.com.remove-dii-this Subject: Getting ScrolledComposite Message-ID: <1171436554.686283.86420@s48g2000cws.googlegroups.com> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 58 Date: Wed, 27 Apr 2011 15:30:21 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918221 96.60.20.240 (Wed, 27 Apr 2011 10:30:21 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:30:21 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:922 To: comp.lang.java.gui I'm new to SWT, I have come from using Swing. I think I'm having problems with the size stuff but I'm not sure. Basically I've forced the scroll bar to show, but it's not enabled. Here's my code as a subclass of org.eclipse.jface.window.Window: protected Control createContents(Composite parent) { //layout the parent composite GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 2; parent.setLayout(layout); ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setAlwaysShowScrollBars(true); //layout the composite holding the content content = new Composite(scrolledComposite, SWT.BORDER); scrolledComposite.setContent(content); content.setLayout(new GridLayout(2, false)); content.setLayoutData(new GridData(GridData.FILL_BOTH)); //heading font FontData fontData = new FontData(); fontData.setStyle(SWT.BOLD); Font font = new Font(Display.getCurrent(), fontData); //create the heading labels Label label = new Label(content, SWT.CENTER); label.setText("Variable Name"); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setFont(font); label = new Label(content, SWT.NULL); label.setText("Hide Variable?"); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setFont(font); //adds 0-many labels to content addVariablePairs(); content.setSize(content.computeSize(SWT.DEFAULT, SWT.DEFAULT)); content.layout(true); return parent; } Thanks Lionel. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24