<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FSWT%2FScrolledComposite</id>
		<title>Java Tutorial/SWT/ScrolledComposite - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FSWT%2FScrolledComposite"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/ScrolledComposite&amp;action=history"/>
		<updated>2026-04-21T15:33:39Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/ScrolledComposite&amp;diff=3037&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/ScrolledComposite&amp;diff=3037&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:26Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:44, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/ScrolledComposite&amp;diff=3038&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/ScrolledComposite&amp;diff=3038&amp;oldid=prev"/>
				<updated>2010-05-31T15:20:03Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  Create a ScrolledComposite with wrapping content ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
 * Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br /&gt;
 * All rights reserved. This program and the accompanying materials&lt;br /&gt;
 * are made available under the terms of the Eclipse Public License v1.0&lt;br /&gt;
 * which accompanies this distribution, and is available at&lt;br /&gt;
 * http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 *&lt;br /&gt;
 * Contributors:&lt;br /&gt;
 *     IBM Corporation - initial API and implementation&lt;br /&gt;
 *******************************************************************************/&lt;br /&gt;
//package org.eclipse.swt.snippets;&lt;br /&gt;
/*&lt;br /&gt;
 * Create a ScrolledComposite with wrapping content.&lt;br /&gt;
 *&lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://www.eclipse.org/swt/snippets/&lt;br /&gt;
 * &lt;br /&gt;
 * @since 3.0&lt;br /&gt;
 */&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.events.ControlAdapter;&lt;br /&gt;
import org.eclipse.swt.events.ControlEvent;&lt;br /&gt;
import org.eclipse.swt.graphics.Image;&lt;br /&gt;
import org.eclipse.swt.graphics.Rectangle;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.layout.RowLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.ruposite;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Label;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScrolledCompositeCreate {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Image image1 = display.getSystemImage(SWT.ICON_WORKING);&lt;br /&gt;
    Image image2 = display.getSystemImage(SWT.ICON_QUESTION);&lt;br /&gt;
    Image image3 = display.getSystemImage(SWT.ICON_ERROR);&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    final ScrolledComposite scrollComposite = new ScrolledComposite(shell, SWT.V_SCROLL&lt;br /&gt;
        | SWT.BORDER);&lt;br /&gt;
    final Composite parent = new Composite(scrollComposite, SWT.NONE);&lt;br /&gt;
    for (int i = 0; i &amp;lt;= 50; i++) {&lt;br /&gt;
      Label label = new Label(parent, SWT.NONE);&lt;br /&gt;
      if (i % 3 == 0)&lt;br /&gt;
        label.setImage(image1);&lt;br /&gt;
      if (i % 3 == 1)&lt;br /&gt;
        label.setImage(image2);&lt;br /&gt;
      if (i % 3 == 2)&lt;br /&gt;
        label.setImage(image3);&lt;br /&gt;
    }&lt;br /&gt;
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);&lt;br /&gt;
    layout.wrap = true;&lt;br /&gt;
    parent.setLayout(layout);&lt;br /&gt;
    scrollComposite.setContent(parent);&lt;br /&gt;
    scrollComposite.setExpandVertical(true);&lt;br /&gt;
    scrollComposite.setExpandHorizontal(true);&lt;br /&gt;
    scrollComposite.addControlListener(new ControlAdapter() {&lt;br /&gt;
      public void controlResized(ControlEvent e) {&lt;br /&gt;
        Rectangle r = scrollComposite.getClientArea();&lt;br /&gt;
        scrollComposite.setMinSize(parent.ruputeSize(r.width, SWT.DEFAULT));&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch()) {&lt;br /&gt;
        display.sleep();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Create the ScrolledComposite to scroll horizontally and vertically ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;SWT.H_SCROLL: horizontal scrolling.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;SWT.V_SCROLL: vertical scrolling.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;SWT.H_SCROLL | SWT.V_SCROLL: enable both.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.ruposite;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScrollCompisiteHoriVertical {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;SashForm Test&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
//  Create the ScrolledComposite to scroll horizontally and vertically&lt;br /&gt;
    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);&lt;br /&gt;
    Composite child = new Composite(sc, SWT.NONE);&lt;br /&gt;
    child.setLayout(new FillLayout());&lt;br /&gt;
    new Button(child, SWT.PUSH).setText(&amp;quot;One&amp;quot;);&lt;br /&gt;
    new Button(child, SWT.PUSH).setText(&amp;quot;Two&amp;quot;);&lt;br /&gt;
    child.setSize(400, 400);&lt;br /&gt;
    sc.setContent(child);&lt;br /&gt;
    &lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch()) {&lt;br /&gt;
        display.sleep();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Create two ScrolledComposites that scroll in tandem ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
 * Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br /&gt;
 * All rights reserved. This program and the accompanying materials&lt;br /&gt;
 * are made available under the terms of the Eclipse Public License v1.0&lt;br /&gt;
 * which accompanies this distribution, and is available at&lt;br /&gt;
 * http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 *&lt;br /&gt;
 * Contributors:&lt;br /&gt;
 *     IBM Corporation - initial API and implementation&lt;br /&gt;
 *******************************************************************************/&lt;br /&gt;
//package org.eclipse.swt.snippets;&lt;br /&gt;
/*&lt;br /&gt;
 * Create two ScrolledComposites that scroll in tandem.&lt;br /&gt;
 *&lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://www.eclipse.org/swt/snippets/&lt;br /&gt;
 */&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.events.SelectionAdapter;&lt;br /&gt;
import org.eclipse.swt.events.SelectionEvent;&lt;br /&gt;
import org.eclipse.swt.events.SelectionListener;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.ScrollBar;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScrolledCompositeInTandem {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    final ScrolledComposite sc1 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL&lt;br /&gt;
        | SWT.V_SCROLL);&lt;br /&gt;
    Button button1 = new Button(sc1, SWT.PUSH);&lt;br /&gt;
    button1.setText(&amp;quot;Button 1&amp;quot;);&lt;br /&gt;
    button1.setSize(400, 300);&lt;br /&gt;
    sc1.setContent(button1);&lt;br /&gt;
    final ScrolledComposite sc2 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL&lt;br /&gt;
        | SWT.V_SCROLL);&lt;br /&gt;
    Button button2 = new Button(sc2, SWT.PUSH);&lt;br /&gt;
    button2.setText(&amp;quot;Button 2&amp;quot;);&lt;br /&gt;
    button2.setSize(300, 400);&lt;br /&gt;
    sc2.setContent(button2);&lt;br /&gt;
    final ScrollBar vBar1 = sc1.getVerticalBar();&lt;br /&gt;
    final ScrollBar vBar2 = sc2.getVerticalBar();&lt;br /&gt;
    final ScrollBar hBar1 = sc1.getHorizontalBar();&lt;br /&gt;
    final ScrollBar hBar2 = sc2.getHorizontalBar();&lt;br /&gt;
    SelectionListener listener1 = new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent e) {&lt;br /&gt;
        int x = hBar1.getSelection() * (hBar2.getMaximum() - hBar2.getThumb())&lt;br /&gt;
            / Math.max(1, hBar1.getMaximum() - hBar1.getThumb());&lt;br /&gt;
        int y = vBar1.getSelection() * (vBar2.getMaximum() - vBar2.getThumb())&lt;br /&gt;
            / Math.max(1, vBar1.getMaximum() - vBar1.getThumb());&lt;br /&gt;
        sc2.setOrigin(x, y);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
    SelectionListener listener2 = new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent e) {&lt;br /&gt;
        int x = hBar2.getSelection() * (hBar1.getMaximum() - hBar1.getThumb())&lt;br /&gt;
            / Math.max(1, hBar2.getMaximum() - hBar2.getThumb());&lt;br /&gt;
        int y = vBar2.getSelection() * (vBar1.getMaximum() - vBar1.getThumb())&lt;br /&gt;
            / Math.max(1, vBar2.getMaximum() - vBar2.getThumb());&lt;br /&gt;
        sc1.setOrigin(x, y);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
    vBar1.addSelectionListener(listener1);&lt;br /&gt;
    hBar1.addSelectionListener(listener1);&lt;br /&gt;
    vBar2.addSelectionListener(listener2);&lt;br /&gt;
    hBar2.addSelectionListener(listener2);&lt;br /&gt;
    shell.setSize(400, 300);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch())&lt;br /&gt;
        display.sleep();&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  If the window is too small, scrollbars will appear. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
 * Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br /&gt;
 * All rights reserved. This program and the accompanying materials&lt;br /&gt;
 * are made available under the terms of the Eclipse Public License v1.0&lt;br /&gt;
 * which accompanies this distribution, and is available at&lt;br /&gt;
 * http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 *&lt;br /&gt;
 * Contributors:&lt;br /&gt;
 *     IBM Corporation - initial API and implementation&lt;br /&gt;
 *******************************************************************************/&lt;br /&gt;
//package org.eclipse.swt.snippets;&lt;br /&gt;
/*&lt;br /&gt;
 * ScrolledComposite example snippet: scroll a control in a scrolled composite&lt;br /&gt;
 *&lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://www.eclipse.org/swt/snippets/&lt;br /&gt;
 */&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScrollBarAuto {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    // this button has a minimum size of 400 x 400. If the window is resized to be big&lt;br /&gt;
    // enough to show more than 400 x 400, the button will grow in size. If the window&lt;br /&gt;
    // is made too small to show 400 x 400, scrollbars will appear.&lt;br /&gt;
    ScrolledComposite c2 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);&lt;br /&gt;
    Button b2 = new Button(c2, SWT.PUSH);&lt;br /&gt;
    b2.setText(&amp;quot;expanding button&amp;quot;);&lt;br /&gt;
    c2.setContent(b2);&lt;br /&gt;
    c2.setExpandHorizontal(true);&lt;br /&gt;
    c2.setExpandVertical(true);&lt;br /&gt;
    c2.setMinWidth(400);&lt;br /&gt;
    c2.setMinHeight(400);&lt;br /&gt;
    shell.setSize(600, 300);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch())&lt;br /&gt;
        display.sleep();&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Scroll a widget into view on focus in ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
 * Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved.&lt;br /&gt;
 * This program and the accompanying materials are made available under the&lt;br /&gt;
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,&lt;br /&gt;
 * and is available at http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 * &lt;br /&gt;
 * Contributors: IBM Corporation - initial API and implementation&lt;br /&gt;
 ******************************************************************************/&lt;br /&gt;
// package org.eclipse.swt.snippets;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.graphics.Point;&lt;br /&gt;
import org.eclipse.swt.graphics.Rectangle;&lt;br /&gt;
import org.eclipse.swt.layout.GridData;&lt;br /&gt;
import org.eclipse.swt.layout.GridLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.ruposite;&lt;br /&gt;
import org.eclipse.swt.widgets.Control;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Event;&lt;br /&gt;
import org.eclipse.swt.widgets.Listener;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
/*&lt;br /&gt;
 * Scroll a widget into view on focus in&lt;br /&gt;
 * &lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://www.eclipse.org/swt/snippets/&lt;br /&gt;
 * &lt;br /&gt;
 * @since 3.0&lt;br /&gt;
 */&lt;br /&gt;
public class ScrollWidgetViewFocusIn {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new GridLayout());&lt;br /&gt;
    Button b1 = new Button(shell, SWT.PUSH);&lt;br /&gt;
    b1.setText(&amp;quot;top&amp;quot;);&lt;br /&gt;
    b1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));&lt;br /&gt;
    final ScrolledComposite sc = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL&lt;br /&gt;
        | SWT.V_SCROLL);&lt;br /&gt;
    sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));&lt;br /&gt;
    Composite c = new Composite(sc, SWT.NONE);&lt;br /&gt;
    c.setLayout(new GridLayout(10, true));&lt;br /&gt;
    for (int i = 0; i &amp;lt; 300; i++) {&lt;br /&gt;
      Button b = new Button(c, SWT.PUSH);&lt;br /&gt;
      b.setText(&amp;quot;Button &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    Button b2 = new Button(shell, SWT.PUSH);&lt;br /&gt;
    b2.setText(&amp;quot;bottom&amp;quot;);&lt;br /&gt;
    b2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));&lt;br /&gt;
    sc.setContent(c);&lt;br /&gt;
    sc.setExpandHorizontal(true);&lt;br /&gt;
    sc.setExpandVertical(true);&lt;br /&gt;
    sc.setMinSize(c.ruputeSize(SWT.DEFAULT, SWT.DEFAULT));&lt;br /&gt;
    Listener listener = new Listener() {&lt;br /&gt;
      public void handleEvent(Event e) {&lt;br /&gt;
        Control child = (Control) e.widget;&lt;br /&gt;
        Rectangle bounds = child.getBounds();&lt;br /&gt;
        Rectangle area = sc.getClientArea();&lt;br /&gt;
        Point origin = sc.getOrigin();&lt;br /&gt;
        if (origin.x &amp;gt; bounds.x)&lt;br /&gt;
          origin.x = Math.max(0, bounds.x);&lt;br /&gt;
        if (origin.y &amp;gt; bounds.y)&lt;br /&gt;
          origin.y = Math.max(0, bounds.y);&lt;br /&gt;
        if (origin.x + area.width &amp;lt; bounds.x + bounds.width)&lt;br /&gt;
          origin.x = Math.max(0, bounds.x + bounds.width - area.width);&lt;br /&gt;
        if (origin.y + area.height &amp;lt; bounds.y + bounds.height)&lt;br /&gt;
          origin.y = Math.max(0, bounds.y + bounds.height - area.height);&lt;br /&gt;
        sc.setOrigin(origin);&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
    Control[] controls = c.getChildren();&lt;br /&gt;
    for (int i = 0; i &amp;lt; controls.length; i++) {&lt;br /&gt;
      controls[i].addListener(SWT.Activate, listener);&lt;br /&gt;
    }&lt;br /&gt;
    shell.setSize(300, 500);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch())&lt;br /&gt;
        display.sleep();&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Scrollbars appear if the window is resized to be too small to show part of the button ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*******************************************************************************&lt;br /&gt;
 * Copyright (c) 2000, 2004 IBM Corporation and others.&lt;br /&gt;
 * All rights reserved. This program and the accompanying materials&lt;br /&gt;
 * are made available under the terms of the Eclipse Public License v1.0&lt;br /&gt;
 * which accompanies this distribution, and is available at&lt;br /&gt;
 * http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 *&lt;br /&gt;
 * Contributors:&lt;br /&gt;
 *     IBM Corporation - initial API and implementation&lt;br /&gt;
 *******************************************************************************/&lt;br /&gt;
//package org.eclipse.swt.snippets;&lt;br /&gt;
/*&lt;br /&gt;
 * ScrolledComposite example snippet: scroll a control in a scrolled composite&lt;br /&gt;
 *&lt;br /&gt;
 * For a list of all SWT example snippets see&lt;br /&gt;
 * http://www.eclipse.org/swt/snippets/&lt;br /&gt;
 */&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScollCompositeControl {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    // this button is always 400 x 400. Scrollbars appear if the window is&lt;br /&gt;
    // resized to be&lt;br /&gt;
    // too small to show part of the button&lt;br /&gt;
    ScrolledComposite c1 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);&lt;br /&gt;
    Button b1 = new Button(c1, SWT.PUSH);&lt;br /&gt;
    b1.setText(&amp;quot;fixed size button&amp;quot;);&lt;br /&gt;
    b1.setSize(400, 400);&lt;br /&gt;
    c1.setContent(b1);&lt;br /&gt;
    shell.setSize(600, 300);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch())&lt;br /&gt;
        display.sleep();&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Setting Minimum Size for a Child Control ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.ruposite;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScrolledCompositeMiniSize {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;SashForm Test&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    // Create the ScrolledComposite to scroll horizontally and vertically&lt;br /&gt;
    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);&lt;br /&gt;
    Composite child = new Composite(sc, SWT.NONE);&lt;br /&gt;
    child.setLayout(new FillLayout());&lt;br /&gt;
    new Button(child, SWT.PUSH).setText(&amp;quot;One&amp;quot;);&lt;br /&gt;
    new Button(child, SWT.PUSH).setText(&amp;quot;Two&amp;quot;);&lt;br /&gt;
    sc.setMinSize(400, 400);&lt;br /&gt;
    // Expand both horizontally and vertically&lt;br /&gt;
    sc.setExpandHorizontal(true);&lt;br /&gt;
    sc.setExpandVertical(true);&lt;br /&gt;
    sc.setContent(child);&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch()) {&lt;br /&gt;
        display.sleep();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Setting the Child Control&amp;quot;s Size ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.custom.ScrolledComposite;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Button;&lt;br /&gt;
import org.eclipse.swt.widgets.ruposite;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
public class ScrolledCompositeChildSize {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;SashForm Test&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
//  Create the ScrolledComposite to scroll horizontally and vertically&lt;br /&gt;
    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);&lt;br /&gt;
    Composite child = new Composite(sc, SWT.NONE);&lt;br /&gt;
    child.setLayout(new FillLayout());&lt;br /&gt;
    new Button(child, SWT.PUSH).setText(&amp;quot;One&amp;quot;);&lt;br /&gt;
    new Button(child, SWT.PUSH).setText(&amp;quot;Two&amp;quot;);&lt;br /&gt;
    child.setSize(400, 400);&lt;br /&gt;
    sc.setContent(child);&lt;br /&gt;
    &lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed()) {&lt;br /&gt;
      if (!display.readAndDispatch()) {&lt;br /&gt;
        display.sleep();&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    display.dispose();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>