<?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%2FTable</id>
		<title>Java Tutorial/SWT/Table - История изменений</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%2FTable"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Table&amp;action=history"/>
		<updated>2026-04-21T11:26:38Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/SWT/Table&amp;diff=3103&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/Table&amp;diff=3103&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/Table&amp;diff=3104&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/Table&amp;diff=3104&amp;oldid=prev"/>
				<updated>2010-05-31T15:20:44Z</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 table (lazy) ==&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;
/*&lt;br /&gt;
 * example snippet: create a table (lazy)&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.graphics.GC;&lt;br /&gt;
import org.eclipse.swt.graphics.Image;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableCreateLazy {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    final Display display = new Display();&lt;br /&gt;
    final Image image = new Image(display, 16, 16);&lt;br /&gt;
    GC gc = new GC(image);&lt;br /&gt;
    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));&lt;br /&gt;
    gc.fillRectangle(image.getBounds());&lt;br /&gt;
    gc.dispose();&lt;br /&gt;
    final Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;Lazy Table&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    final Table table = new Table(shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
    table.setSize(200, 200);&lt;br /&gt;
    Thread thread = new Thread() {&lt;br /&gt;
      public void run() {&lt;br /&gt;
        for (int i = 0; i &amp;lt; 20000; i++) {&lt;br /&gt;
          if (table.isDisposed())&lt;br /&gt;
            return;&lt;br /&gt;
          final int[] index = new int[] { i };&lt;br /&gt;
          display.syncExec(new Runnable() {&lt;br /&gt;
            public void run() {&lt;br /&gt;
              if (table.isDisposed())&lt;br /&gt;
                return;&lt;br /&gt;
              TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
              item.setText(&amp;quot;Table Item &amp;quot; + index[0]);&lt;br /&gt;
              item.setImage(image);&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
    thread.start();&lt;br /&gt;
    shell.setSize(200, 200);&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;
    image.dispose();&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 a table with 000 items (lazy) ==&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;
 * Virtual Table example snippet: create a table with 1,000,000 items (lazy)&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.layout.RowData;&lt;br /&gt;
import org.eclipse.swt.layout.RowLayout;&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;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableCreateLazy {&lt;br /&gt;
  static final int COUNT = 1000000;&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    final Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new RowLayout(SWT.VERTICAL));&lt;br /&gt;
    final Table table = new Table(shell, SWT.VIRTUAL | SWT.BORDER);&lt;br /&gt;
    table.addListener(SWT.SetData, new Listener() {&lt;br /&gt;
      public void handleEvent(Event event) {&lt;br /&gt;
        TableItem item = (TableItem) event.item;&lt;br /&gt;
        int index = table.indexOf(item);&lt;br /&gt;
        item.setText(&amp;quot;Item &amp;quot; + index);&lt;br /&gt;
        System.out.println(item.getText());&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    &lt;br /&gt;
    table.setLayoutData(new RowData(200, 200));&lt;br /&gt;
    long t1 = System.currentTimeMillis();&lt;br /&gt;
    table.setItemCount(COUNT);&lt;br /&gt;
    long t2 = System.currentTimeMillis();&lt;br /&gt;
    System.out.println(&amp;quot;Items: &amp;quot; + COUNT + &amp;quot;, Time: &amp;quot; + (t2 - t1) + &amp;quot; (ms)&amp;quot;);&lt;br /&gt;
    shell.layout();&lt;br /&gt;
    shell.pack();&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;
==  Create a table with 000 items (lazy, page size 64) ==&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.&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;
 * Virtual Table example snippet: create a table with 1,000,000 items (lazy, page size 64)&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.layout.RowData;&lt;br /&gt;
import org.eclipse.swt.layout.RowLayout;&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;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableWithPageSize {&lt;br /&gt;
  static final int PAGE_SIZE = 64;&lt;br /&gt;
  static final int COUNT = 100000;&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    Display display = new Display();&lt;br /&gt;
    final Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new RowLayout(SWT.VERTICAL));&lt;br /&gt;
    final Table table = new Table(shell, SWT.VIRTUAL | SWT.BORDER);&lt;br /&gt;
    table.addListener(SWT.SetData, new Listener() {&lt;br /&gt;
      public void handleEvent(Event event) {&lt;br /&gt;
        TableItem item = (TableItem) event.item;&lt;br /&gt;
        int index = table.indexOf(item);&lt;br /&gt;
        int start = index / PAGE_SIZE * PAGE_SIZE;&lt;br /&gt;
        int end = Math.min(start + PAGE_SIZE, table.getItemCount());&lt;br /&gt;
        for (int i = start; i &amp;lt; end; i++) {&lt;br /&gt;
          item = table.getItem(i);&lt;br /&gt;
          item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    table.setLayoutData(new RowData(200, 200));&lt;br /&gt;
    long t1 = System.currentTimeMillis();&lt;br /&gt;
    table.setItemCount(COUNT);&lt;br /&gt;
    long t2 = System.currentTimeMillis();&lt;br /&gt;
    System.out.println(&amp;quot;Items: &amp;quot; + COUNT + &amp;quot;, Time: &amp;quot; + (t2 - t1) + &amp;quot; (ms) [page=&amp;quot; + PAGE_SIZE&lt;br /&gt;
        + &amp;quot;]&amp;quot;);&lt;br /&gt;
    shell.layout();&lt;br /&gt;
    shell.pack();&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;
==  Create a table with columns, headers, lines ==&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;
 * Table example snippet: create a table (columns, headers, lines)&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableColumn;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableWithColumnHeader {&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;
    Table table = new Table(shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);&lt;br /&gt;
    table.setLinesVisible(true);&lt;br /&gt;
    table.setHeaderVisible(true);&lt;br /&gt;
    String[] titles = { &amp;quot; &amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;!&amp;quot;, &amp;quot;Description&amp;quot;, &amp;quot;Resource&amp;quot;, &amp;quot;In Folder&amp;quot;, &amp;quot;Location&amp;quot; };&lt;br /&gt;
    for (int i = 0; i &amp;lt; titles.length; i++) {&lt;br /&gt;
      TableColumn column = new TableColumn(table, SWT.NONE);&lt;br /&gt;
      column.setText(titles[i]);&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; 100; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(0, &amp;quot;x&amp;quot;);&lt;br /&gt;
      item.setText(1, &amp;quot;y&amp;quot;);&lt;br /&gt;
      item.setText(2, &amp;quot;!&amp;quot;);&lt;br /&gt;
      item.setText(3, &amp;quot;this stuff behaves the way I expect&amp;quot;);&lt;br /&gt;
      item.setText(4, &amp;quot;almost everywhere&amp;quot;);&lt;br /&gt;
      item.setText(5, &amp;quot;some.folder&amp;quot;);&lt;br /&gt;
      item.setText(6, &amp;quot;line &amp;quot; + i + &amp;quot; in nowhere&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    for (int i=0; i&amp;lt;titles.length; i++) {&lt;br /&gt;
      table.getColumn (i).pack ();&lt;br /&gt;
    }     &lt;br /&gt;
    &lt;br /&gt;
    table.setSize(table.ruputeSize(SWT.DEFAULT, 200));&lt;br /&gt;
    shell.pack();&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;
==  Create a table without columns and headers ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableWithoutColumnHeader {&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;
    Table table = new Table(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 12; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, 0);&lt;br /&gt;
      item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    table.setSize(180, 200);&lt;br /&gt;
    &lt;br /&gt;
    shell.setSize(200, 200);&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;
==  Create a virtual table and add ntries to it every 500 ms ==&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.&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 virtual table and add 1000 entries to it every 500 ms.&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 java.util.Arrays;&lt;br /&gt;
import java.util.Random;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.layout.FillLayout;&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;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableCreate1000Entries {&lt;br /&gt;
  static int[] data = new int[0];&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    final Display display = new Display();&lt;br /&gt;
    Shell shell = new Shell(display);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    final Table table = new Table(shell, SWT.BORDER | SWT.VIRTUAL);&lt;br /&gt;
    table.addListener(SWT.SetData, new Listener() {&lt;br /&gt;
      public void handleEvent(Event e) {&lt;br /&gt;
        TableItem item = (TableItem) e.item;&lt;br /&gt;
        int index = table.indexOf(item);&lt;br /&gt;
        item.setText(&amp;quot;Item &amp;quot; + data[index]);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    Thread thread = new Thread() {&lt;br /&gt;
      public void run() {&lt;br /&gt;
        int count = 0;&lt;br /&gt;
        Random random = new Random();&lt;br /&gt;
        while (count++ &amp;lt; 500) {&lt;br /&gt;
          if (table.isDisposed())&lt;br /&gt;
            return;&lt;br /&gt;
          // add 10 random numbers to array and sort&lt;br /&gt;
          int grow = 10;&lt;br /&gt;
          int[] newData = new int[data.length + grow];&lt;br /&gt;
          System.arraycopy(data, 0, newData, 0, data.length);&lt;br /&gt;
          int index = data.length;&lt;br /&gt;
          data = newData;&lt;br /&gt;
          for (int j = 0; j &amp;lt; grow; j++) {&lt;br /&gt;
            data[index++] = random.nextInt();&lt;br /&gt;
          }&lt;br /&gt;
          Arrays.sort(data);&lt;br /&gt;
          display.syncExec(new Runnable() {&lt;br /&gt;
            public void run() {&lt;br /&gt;
              if (table.isDisposed())&lt;br /&gt;
                return;&lt;br /&gt;
              table.setItemCount(data.length);&lt;br /&gt;
              table.clearAll();&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
          try {&lt;br /&gt;
            Thread.sleep(500);&lt;br /&gt;
          } catch (Throwable t) {&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
    thread.start();&lt;br /&gt;
    shell.open();&lt;br /&gt;
    while (!shell.isDisposed() || thread.isAlive()) {&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;
==  Fill a table in the Thread ==&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;
 * example snippet: create a table (lazy)&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.layout.FillLayout;&lt;br /&gt;
import org.eclipse.swt.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableFillThread {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    final Display display = new Display();&lt;br /&gt;
    final Shell shell = new Shell(display);&lt;br /&gt;
    shell.setText(&amp;quot;Lazy Table&amp;quot;);&lt;br /&gt;
    shell.setLayout(new FillLayout());&lt;br /&gt;
    final Table table = new Table(shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
    table.setSize(200, 200);&lt;br /&gt;
    &lt;br /&gt;
    Thread thread = new Thread() {&lt;br /&gt;
      public void run() {&lt;br /&gt;
        for (int i = 0; i &amp;lt; 20000; i++) {&lt;br /&gt;
          final int[] index = new int[] { i };&lt;br /&gt;
          display.syncExec(new Runnable() {&lt;br /&gt;
            public void run() {&lt;br /&gt;
              if (table.isDisposed())&lt;br /&gt;
                return;&lt;br /&gt;
              TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
              item.setText(&amp;quot;Table Item &amp;quot; + index[0]);&lt;br /&gt;
            }&lt;br /&gt;
          });&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    };&lt;br /&gt;
    thread.start();&lt;br /&gt;
    shell.setSize(200, 200);&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;
==  Get TableItem Index in a Table ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableItemGetIndex {&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;
    Table table = new Table(shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
    table.setSize(200, 200);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 12; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    TableItem item = new TableItem(table, SWT.NONE, 5);&lt;br /&gt;
    item.setText(&amp;quot; New Item &amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    System.out.println(table.indexOf(item)); &lt;br /&gt;
    &lt;br /&gt;
    shell.pack();&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;
==  Insert TableItem by Index ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableItemInsertByIndex {&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;
    Table table = new Table(shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
    table.setSize(200, 200);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 12; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    TableItem item = new TableItem(table, SWT.NONE, 5);&lt;br /&gt;
    item.setText(&amp;quot; New Item &amp;quot;);&lt;br /&gt;
    shell.pack();&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;
==  new Table(shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION| SWT.CHECK) ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableColumn;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableMultiCheckSelectionBorder {&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;
    Table table = new Table(shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION| SWT.CHECK);&lt;br /&gt;
    table.setLinesVisible(true);&lt;br /&gt;
    table.setHeaderVisible(true);&lt;br /&gt;
    String[] titles = { &amp;quot; &amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;!&amp;quot;, &amp;quot;Description&amp;quot;, &amp;quot;Resource&amp;quot;, &amp;quot;In Folder&amp;quot;, &amp;quot;Location&amp;quot; };&lt;br /&gt;
    for (int i = 0; i &amp;lt; titles.length; i++) {&lt;br /&gt;
      TableColumn column = new TableColumn(table, SWT.NONE);&lt;br /&gt;
      column.setText(titles[i]);&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(0, &amp;quot;x&amp;quot;);&lt;br /&gt;
      item.setText(1, &amp;quot;y&amp;quot;);&lt;br /&gt;
      item.setText(2, &amp;quot;!&amp;quot;);&lt;br /&gt;
      item.setText(3, &amp;quot;dddddddddddddddddddd&amp;quot;);&lt;br /&gt;
      item.setText(4, &amp;quot;rrrrrrrrrrrrrrrrrrr&amp;quot;);&lt;br /&gt;
      item.setText(5, &amp;quot;some.folder&amp;quot;);&lt;br /&gt;
      item.setText(6, &amp;quot;line &amp;quot; + i + &amp;quot; in nowhere&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    for (int i=0; i&amp;lt;titles.length; i++) {&lt;br /&gt;
      table.getColumn (i).pack ();&lt;br /&gt;
    }     &lt;br /&gt;
    &lt;br /&gt;
    table.setSize(table.ruputeSize(SWT.DEFAULT, 200));&lt;br /&gt;
    shell.pack();&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;
==  Resize columns as table resizes ==&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;
 * Table example snippet: resize columns as table resizes&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.events.ControlAdapter;&lt;br /&gt;
import org.eclipse.swt.events.ControlEvent;&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.FillLayout;&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;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableColumn;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableColumnResizeTableResize {&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 Composite comp = new Composite(shell, SWT.NONE);&lt;br /&gt;
    final Table table = new Table(comp, SWT.BORDER | SWT.V_SCROLL);&lt;br /&gt;
    table.setHeaderVisible(true);&lt;br /&gt;
    table.setLinesVisible(true);&lt;br /&gt;
    final TableColumn column1 = new TableColumn(table, SWT.NONE);&lt;br /&gt;
    column1.setText(&amp;quot;Column 1&amp;quot;);&lt;br /&gt;
    final TableColumn column2 = new TableColumn(table, SWT.NONE);&lt;br /&gt;
    column2.setText(&amp;quot;Column 2&amp;quot;);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(new String[] { &amp;quot;item 0&amp;quot; + i, &amp;quot;item 1&amp;quot; + i });&lt;br /&gt;
    }&lt;br /&gt;
    comp.addControlListener(new ControlAdapter() {&lt;br /&gt;
      public void controlResized(ControlEvent e) {&lt;br /&gt;
        Rectangle area = comp.getClientArea();&lt;br /&gt;
        Point preferredSize = table.ruputeSize(SWT.DEFAULT, SWT.DEFAULT);&lt;br /&gt;
        int width = area.width - 2 * table.getBorderWidth();&lt;br /&gt;
        if (preferredSize.y &amp;gt; area.height + table.getHeaderHeight()) {&lt;br /&gt;
          // Subtract the scrollbar width from the total column width&lt;br /&gt;
          // if a vertical scrollbar will be required&lt;br /&gt;
          Point vBarSize = table.getVerticalBar().getSize();&lt;br /&gt;
          width -= vBarSize.x;&lt;br /&gt;
        }&lt;br /&gt;
        Point oldSize = table.getSize();&lt;br /&gt;
        if (oldSize.x &amp;gt; area.width) {&lt;br /&gt;
          // table is getting smaller so make the columns&lt;br /&gt;
          // smaller first and then resize the table to&lt;br /&gt;
          // match the client area width&lt;br /&gt;
          column1.setWidth(width / 3);&lt;br /&gt;
          column2.setWidth(width - column1.getWidth());&lt;br /&gt;
          table.setSize(area.width, area.height);&lt;br /&gt;
        } else {&lt;br /&gt;
          // table is getting bigger so make the table&lt;br /&gt;
          // bigger first and then make the columns wider&lt;br /&gt;
          // to match the client area width&lt;br /&gt;
          table.setSize(area.width, area.height);&lt;br /&gt;
          column1.setWidth(width / 3);&lt;br /&gt;
          column2.setWidth(width - column1.getWidth());&lt;br /&gt;
        }&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;
    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;
==  Set table selected item and remove it from table ==&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.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
public class TableRowSelectionRemove{&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;
  final Table table = new Table (shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
  table.setSize (200, 200);&lt;br /&gt;
  for (int i=0; i&amp;lt;128; i++) {&lt;br /&gt;
    TableItem item = new TableItem (table, SWT.NONE);&lt;br /&gt;
    item.setText (&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
  }&lt;br /&gt;
  table.setSelection(2);&lt;br /&gt;
  &lt;br /&gt;
  table.remove (table.getSelectionIndices ());&lt;br /&gt;
  &lt;br /&gt;
  shell.pack ();&lt;br /&gt;
  shell.open ();&lt;br /&gt;
  while (!shell.isDisposed ()) {&lt;br /&gt;
    if (!display.readAndDispatch ()) 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;
==  Set table selection to scroll a table ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableScrollSelection {&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;
    Table table = new Table(shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
    table.setSize(200, 200);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 128; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    table.setSelection(95);&lt;br /&gt;
    shell.pack();&lt;br /&gt;
    shell.open();&lt;br /&gt;
 &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;
==  Set top index to scroll a table ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableScrollIndex {&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;
    Table table = new Table(shell, SWT.BORDER | SWT.MULTI);&lt;br /&gt;
    table.setSize(200, 200);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 128; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    table.setTopIndex(95);&lt;br /&gt;
    shell.pack();&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;
==  Tables ==&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;Tables are useful for handling tabular data.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The org.eclipse.swt.widgets.Table class represents a table.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The TableColumn class represents a column in a table&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The TableItem class represents a row in a table.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;To create a table, you follow these basic steps:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;Construct a Table instance and set its property.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Define columns by using TableColumn objects.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Add rows by creating TableItem objects.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Table Styles ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
StyleDescriptionSWT.SINGLEOnly one table row may be selected at a time. This is the default.SWT.MULTIMultiple table rows may be selected, usually by holding down a key on the keyboard (typically the Ctrl key) while clicking the table row.SWT.CHECKPlaces a checkbox at the beginning of each table row. Note that the checked state of the checkbox is independent from the selected state of the table row.SWT.FULL_SELECTIONHighlights the entire row, rather than just the first column of the row, when the row is selected. The default is to highlight only the first column.SWT.HIDE_SELECTIONRemoves the highlight from the selected row (if any) when the window containing the table isn&amp;quot;t the foreground window. The default is to keep the row highlighted whether or not the parent window is the foreground window.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Table With CheckBox Cell ==&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.widgets.Display;&lt;br /&gt;
import org.eclipse.swt.widgets.Shell;&lt;br /&gt;
import org.eclipse.swt.widgets.Table;&lt;br /&gt;
import org.eclipse.swt.widgets.TableItem;&lt;br /&gt;
public class TableCheckBoxCell {&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;
    Table table = new Table(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 12; i++) {&lt;br /&gt;
      TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
      item.setText(&amp;quot;Item &amp;quot; + i);&lt;br /&gt;
    }&lt;br /&gt;
    table.setSize(100, 100);&lt;br /&gt;
    shell.setSize(200, 200);&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;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>