SlideShare a Scribd company logo
2006 JavaOneSM
Conference | Session TS-3853 |
Introduction to SWT (The
Standard Widget Toolkit)
Steve Northover
SWT Team Lead
IBM Canada
eclipse.org/swt
SWT Eye for the
Swing Guy!
TS-3853
2006 JavaOneSM
Conference | Session TS-3853 | 2
Write an SWT Application
Goal of This Talk
After this talk you will understand what
SWT is and how to write a simple SWT
application
2006 JavaOneSM
Conference | Session TS-3853 | 3
Agenda
Background: A Brief History of SWT
The Basics: Widgets and Graphics
Putting It All Together: An SWT Application
Sneak Peek: Advanced Topics
2006 JavaOneSM
Conference | Session TS-3853 | 4
What Is SWT?
• SWT = “Standard Widget Toolkit”
• A native GUI Toolkit for Java™ platform
• Standard UI component for Eclipse
• Roughly equivalent to AWT/Swing
2006 JavaOneSM
Conference | Session TS-3853 | 5
History of SWT
• Object Technology International (OTI)
• VM’s, Class Libraries, Compilers, IDE’s
• Configuration Management (ENVY/Manager)
• Smalltalk (in the early 90’s)
• Major Vendors: ParcPlace, Digitalk, IBM
IBM Acquired OTI in 1996
2006 JavaOneSM
Conference | Session TS-3853 | 6
Smalltalk Was… Java™!
• Object Oriented
• Byte Coded (VM, GC, JIT, Hot Replace…)
• Class Libraries (Collections, Streams…)
• Portable (Write Once, Run Anywhere™)
2006 JavaOneSM
Conference | Session TS-3853 | 7
WORA (Write Once, Run Away!)
• ParcPlace Smalltalk (emulated widgets)
• Digitalk Smalltalk/V (native + emulated)
• Windows, OS/2, Mac (emulated)
• IBM Smalltalk (native, written by OTI)
• Windows, X/Motif, OS/2, Mac, Open Look
Native vs. Emulated!
2006 JavaOneSM
Conference | Session TS-3853 | 8
The “Leap Frog” Experience
• VisualAge for Java™
• Written in IBM Smalltalk
• VisualAge Micro Edition
• Prototype in Java code using AWT/Swing
• Rewritten in Java code using SWT
• Eclipse
2006 JavaOneSM
Conference | Session TS-3853 | 9
What Is Eclipse?
2006 JavaOneSM
Conference | Session TS-3853 | 10
“The SWT component is designed to
provide efficient, portable access to the
user-interface facilities of the operating
system on which it is implemented”
eclipse.org/swt
2006 JavaOneSM
Conference | Session TS-3853 | 11
SWT Is
• Efficient
• Thin Java based layer over Java Native Interface
calls to the OS
• Portable
• Windows, GTK, Motif, Macintosh, Photon
• Java ME, Java SE
• Native
• Win32, GDI, GDI+, OLE, IE, Carbon, Cocoa, Core
Graphics, Quick Draw, Safari, ATSUI, X Windows,
X/t, Motif, GTK, GDK, Pango, cairo, ATK, Photon,
Mozilla, QNX Voyager, Uniscribe...
2006 JavaOneSM
Conference | Session TS-3853 | 12
2006 JavaOneSM
Conference | Session TS-3853 | 13
Myths
• SWT is better than Swing
• Swing is better than SWT
• SWT is “windows only”
• SWT is proprietary
• SWT applications are not portable
• …and more
TM
2006 JavaOneSM
Conference | Session TS-3853 | 14
Agenda
Background: A Brief History of SWT
The Basics: Widgets and Graphics
Putting It All Together: An SWT Application
Sneak Peek: Advanced Topics
2006 JavaOneSM
Conference | Session TS-3853 | 15
Hello World in SWT
import org.eclipse.swt.widgets.*;
public class HelloWorld {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello World");
shell.setSize(200, 100);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep ();
}
display.dispose ();
}
}
2006 JavaOneSM
Conference | Session TS-3853 | 16
Display
• Connection to the window system
• Represents the “screen”
• Contains a list of Shells
• Normally a singleton
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
2006 JavaOneSM
Conference | Session TS-3853 | 17
Shell
• Represents a “window” on the “screen”
• Root of a tree of Composites and Controls
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello World");
shell.setSize(200, 100);
shell.open();
2006 JavaOneSM
Conference | Session TS-3853 | 18
Composite and Control
• Composite
• Control that contains other Composites and Controls
• Control
• A heavyweight operating system object
• buttons, labels, entry fields, tables, toolbars,
and trees are controls (Shells and Composites too)
Shell, Composite, Control are subclasses of Widget
2006 JavaOneSM
Conference | Session TS-3853 | 19
The Event Loop
• Repeatedly reads and dispatches events
• Yields CPU when no events are available
• Applications choose when to exit
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
2006 JavaOneSM
Conference | Session TS-3853 | 20
Events
• JavaBeans™ event model (“typed” events)
• Events come from the event loop
(and from widget operations)
• Low level “untyped” events also available
2006 JavaOneSM
Conference | Session TS-3853 | 21
Freeing Resources
• Operating system resources are explicitly
released by the programmer
display.dispose();
Rule #1: “If you created it, you dispose it”
Rule #2: “Disposing a parent disposes the
children”
2006 JavaOneSM
Conference | Session TS-3853 | 22
Standard Constructors
• Widgets must be created with a parent
• Style bits used for create-only attributes
//Create a push button control
Button button = new Button(shell, SWT.PUSH);
//Create a single line entry field with a border
Text text = new Text(group, SWT.SINGLE|SWT.BORDER);
//Create a shell with dialog trimmings
Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
2006 JavaOneSM
Conference | Session TS-3853 | 23
Errors and Exceptions
• SWTError
• An unrecoverable error
• The operating system failed
• SWTException
• A recoverable error occurred
• Invalid thread access, etc.
• IllegalArgumentException
• A recoverable error (argument is invalid)
• Argument cannot be null, etc.
2006 JavaOneSM
Conference | Session TS-3853 | 24
Items
• A lightweight operating system object
• Always occur within a specific widget
• A Tree contains TreeItems
• A Table contains TableItems
• A Menu contains MenuItems
• …and more
2006 JavaOneSM
Conference | Session TS-3853 | 25
Threads
• Single UI-thread (“apartment threaded”)
• Widget operations must be called from the UI-thread
• Runnables can be queued to run in the UI-thread
• Background Threads
• Use Display.syncExec(), asyncExec(), wake()
• Graphics operations may be called from any thread
2006 JavaOneSM
Conference | Session TS-3853 | 26
Widget Packages
• org.eclipse.swt.widgets
• org.eclipse.swt.dnd
• Drag and Drop and Clipboard
• org.eclipse.swt.browser
• HTLM Browser control
• org.eclipse.swt.custom
• Custom Controls for Eclipse
• org.eclipse.swt.ole.win32
• OLE (ActiveX) Support
2006 JavaOneSM
Conference | Session TS-3853 | 27
Widget Classes—All of Them!
(Dialogs, D&D, OLE, Browser, Custom Controls)
2006 JavaOneSM
Conference | Session TS-3853 | 28
Graphics Classes—All of Them!
• Resource Based Objects
• GC (Graphics Context), Color, Image, Font, Path,
Region, Transform, Pattern, TextLayout
• Java Based Objects
• Point, Rectangle, RGB, ImageData, FontData,
PaletteData, PathData, TextStyle, FontMetrics,
GlyphMetrics, ImageLoader
2006 JavaOneSM
Conference | Session TS-3853 | 29
GC (Graphics Context)
• All line, shape, text, image drawing, clipping,
alpha, anti-alias and filling operations
• Created on Control, Image, Display or Printer
• new GC (Control)
• new GC (Image)
• new GC (Display)
• new GC (Printer)
• Call dispose() when done
2006 JavaOneSM
Conference | Session TS-3853 | 30
GC Line Draw Methods
• drawLine(int x1, int y1, int x2, int y2)
• drawPolyline(int[] xyArray)
• setLineWidth(int width)
• setLineStyle(int style)
• SWT.LINE_SOLID, SWT.LINE_DASH,
SWT.LINE_DOT, SWT.LINE_DASHDOT,
SWT.LINE_DASHDOTDOT, SWT.LINE_CUSTOM
2006 JavaOneSM
Conference | Session TS-3853 | 31
shell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
GC gc = event.gc;
gc.setLineWidth(5);
gc.setLineStyle(SWT.LINE_SOLID);
gc.drawLine(10, 10, 200, 10);
gc.setLineWidth(1);
gc.setLineStyle(SWT.LINE_DASH);
gc.drawLine(10, 30, 200, 30);
gc.setLineStyle(SWT.LINE_DOT);
gc.drawLine(10, 50, 200, 50);
gc.setLineStyle(SWT.LINE_DASHDOT);
gc.drawLine(10, 70, 200, 70);
gc.setLineStyle(SWT.LINE_DASHDOTDOT);
gc.drawLine(10, 90, 200, 90);
}});
Draw Lines on a Shell
2006 JavaOneSM
Conference | Session TS-3853 | 32
Draw and Fill a Polygon on a Shell
public void paintControl(PaintEvent event) {
Rectangle bounds = shell.getClientArea();
center.x = bounds.x + bounds.width/2;
center.y = bounds.y + bounds.height/2;
int pos = 0;
for (int i = 0; i < points; ++i) {
double r = Math.PI*2 * pos/points;
radial[i*2] = (int)((1+Math.cos(r))*center.x);
radial[i*2+1] = (int)((1+Math.sin(r))*center.y);
pos = (pos + points/2) % points;
}
event.gc.setBackground(
display.getSystemColor(SWT.COLOR_WHITE));
event.gc.fillPolygon(radial);
event.gc.drawPolygon(radial);
}});
2006 JavaOneSM
Conference | Session TS-3853 | 33
shell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
…
//do I need to dispose this crazy thing?
GC gc = event.gc;
…
}});
Should This GC Be Disposed?
No. It was not created with “new GC()”
2006 JavaOneSM
Conference | Session TS-3853 | 34
What Else Can SWT Graphics Do?
2006 JavaOneSM
Conference | Session TS-3853 | 35
Layout Overview
• Layout
• An algorithm to position and resize controls
• Use Composite.setLayout()
• Layout Data
• Algorithm specific data associated with each control
• Use Control.setLayoutData()
2006 JavaOneSM
Conference | Session TS-3853 | 36
Layout Classes
• FillLayout
• RowLayout
• GridLayout
• FormLayout
• StackLayout
2006 JavaOneSM
Conference | Session TS-3853 | 37
Agenda
Background: A Brief History of SWT
The Basics: Widgets and Graphics
Putting It All Together: An SWT Application
Sneak Peek: Advanced Topics
2006 JavaOneSM
Conference | Session TS-3853 | 38
Example: FileExplorer
2006 JavaOneSM
Conference | Session TS-3853 | 39
Create the Display
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Example");
shell.setLayout(new FillLayout());
Tree tree = createTree(shell);
Table table = createTable(shell);
createListeners(tree, table);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
1
2
3
2006 JavaOneSM
Conference | Session TS-3853 | 40
Create the Shell
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Example");
shell.setLayout(new FillLayout());
Tree tree = createTree(shell);
Table table = createTable(shell);
createListeners(tree, table);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
1
2
2006 JavaOneSM
Conference | Session TS-3853 | 41
Create the Tree
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Example");
shell.setLayout(new FillLayout());
Tree tree = createTree(shell);
Table table = createTable(shell);
createListeners(tree, table);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
2006 JavaOneSM
Conference | Session TS-3853 | 42
Create the Tree with TreeItems
static Tree createTree (Composite parent) {
Tree tree = new Tree(parent, SWT.BORDER);
createTreeItems(tree, null, File.listRoots());
return tree;
}
First Level
2006 JavaOneSM
Conference | Session TS-3853 | 43
Create the TreeItems
static void createTreeItems(Tree tree, TreeItem parent,
File [] files) {
if (files == null) return;
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
TreeItem item;
if (parent == null) {
item = new TreeItem(tree, SWT.NONE);
item.setText(files[i].toString());
} else {
item = new TreeItem(parent, SWT.NONE);
item.setText(files[i].getName());
}
item.setData(files[i]);
new TreeItem(item, SWT.NULL); // force a '+'
}
}
}
1
2006 JavaOneSM
Conference | Session TS-3853 | 44
Create the TreeItems
static void createTreeItems(Tree tree, TreeItem parent,
File [] files) {
if (files == null) return;
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
TreeItem item;
if (parent == null) {
item = new TreeItem(tree, SWT.NONE);
item.setText(files[i].toString());
} else {
item = new TreeItem(parent, SWT.NONE);
item.setText(files[i].getName());
}
item.setData(files[i]);
new TreeItem(item, SWT.NULL); // force a '+'
}
}
}
1
2
2006 JavaOneSM
Conference | Session TS-3853 | 45
Create the TreeItems
static void createTreeItems(Tree tree, TreeItem parent,
File [] files) {
if (files == null) return;
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
TreeItem item;
if (parent == null) {
item = new TreeItem(tree, SWT.NONE);
item.setText(files[i].toString());
} else {
item = new TreeItem(parent, SWT.NONE);
item.setText(files[i].getName());
}
item.setData(files[i]);
new TreeItem(item, SWT.NULL); // force a '+'
}
}
}
1
2
3
2006 JavaOneSM
Conference | Session TS-3853 | 46
Create the TreeItems
static void createTreeItems(Tree tree, TreeItem parent,
File [] files) {
if (files == null) return;
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
TreeItem item;
if (parent == null) {
item = new TreeItem(tree, SWT.NONE);
item.setText(files[i].toString());
} else {
item = new TreeItem(parent, SWT.NONE);
item.setText(files[i].getName());
}
item.setData(files[i]);
new TreeItem(item, SWT.NULL); // force a '+'
}
}
}
1
2
3
4
2006 JavaOneSM
Conference | Session TS-3853 | 47
Create the Table
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Example");
shell.setLayout(new FillLayout());
Tree tree = createTree(shell);
Table table = createTable(shell);
createListeners(tree, table);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
2006 JavaOneSM
Conference | Session TS-3853 | 48
Create the Table Without TableItems
static Table createTable(Composite parent) {
Table table = new Table(parent, SWT.BORDER);
table.setHeaderVisible(true);
String [] titles = {"Name", "Size"};
for (int i=0; i<titles.length; i++) {
TableColumn column =
new TableColumn(table, SWT.NONE);
column.setText(titles[i]);
}
return table;
}
2006 JavaOneSM
Conference | Session TS-3853 | 49
Create the Listeners
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Example");
shell.setLayout(new FillLayout());
Tree tree = createTree(shell);
Table table = createTable(shell);
createListeners(tree, table);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
2006 JavaOneSM
Conference | Session TS-3853 | 50
Create the Listeners
static void createListeners(final Tree tree,
final Table table) {
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TreeItem item = (TreeItem) event.item;
File file = (File) item.getData();
createTableItems(table, file.listFiles());
}});
tree.addTreeListener(new TreeAdapter() {
public void treeExpanded(TreeEvent event) {
TreeItem item = (TreeItem) event.item;
if (item.getItem(0).getData() != null) return;
item.removeAll();
File file = (File) item.getData();
createTreeItems(null, item, file.listFiles());
}});
}}
1
2006 JavaOneSM
Conference | Session TS-3853 | 51
Create the Listeners
static void createListeners(final Tree tree,
final Table table) {
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TreeItem item = (TreeItem) event.item;
File file = (File) item.getData();
createTableItems(table, file.listFiles());
}});
tree.addTreeListener(new TreeAdapter() {
public void treeExpanded(TreeEvent event) {
TreeItem item = (TreeItem) event.item;
if (item.getItem(0).getData() != null) return;
item.removeAll();
File file = (File) item.getData();
createTreeItems(null, item, file.listFiles());
}});
}}
1
2
2006 JavaOneSM
Conference | Session TS-3853 | 52
Create the Listeners
static void createListeners(final Tree tree,
final Table table) {
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TreeItem item = (TreeItem) event.item;
File file = (File) item.getData();
createTableItems(table, file.listFiles());
}});
tree.addTreeListener(new TreeAdapter() {
public void treeExpanded(TreeEvent event) {
TreeItem item = (TreeItem) event.item;
if (item.getItem(0).getData() != null) return;
item.removeAll();
File file = (File) item.getData();
createTreeItems(null, item, file.listFiles());
}});
}}
1
2
3
2006 JavaOneSM
Conference | Session TS-3853 | 53
Create the Listeners
static void createListeners(final Tree tree,
final Table table) {
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TreeItem item = (TreeItem) event.item;
File file = (File) item.getData();
createTableItems(table, file.listFiles());
}});
tree.addTreeListener(new TreeAdapter() {
public void treeExpanded(TreeEvent event) {
TreeItem item = (TreeItem) event.item;
if (item.getItem(0).getData() != null) return;
item.removeAll();
File file = (File) item.getData();
createTreeItems(null, item, file.listFiles());
}});
}}
1
2
3
4
2006 JavaOneSM
Conference | Session TS-3853 | 54
Create the Listeners
static void createListeners(final Tree tree,
final Table table) {
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TreeItem item = (TreeItem) event.item;
File file = (File) item.getData();
createTableItems(table, file.listFiles());
}});
tree.addTreeListener(new TreeAdapter() {
public void treeExpanded(TreeEvent event) {
TreeItem item = (TreeItem) event.item;
if (item.getItem(0).getData() != null) return;
item.removeAll();
File file = (File) item.getData();
createTreeItems(null, item, file.listFiles());
}});
}}
Other
Levels
1
2
3
4
2006 JavaOneSM
Conference | Session TS-3853 | 55
Create the TableItems
static void createTableItems(Table table, File [] files) {
table.removeAll();
if (files == null) return;
for (int i = 0; i < files.length; i++) {
TableItem item = new TableItem(table, SWT.NULL);
item.setText(new String [] {
files[i].getName(),
files[i].length() / 1000 + " KB"
});
}
for (int i=0; i<table.getColumnCount(); i++) {
table.getColumn (i).pack();
}
}
2006 JavaOneSM
Conference | Session TS-3853 | 56
More Features
2006 JavaOneSM
Conference | Session TS-3853 | 57
Yet More Features
2006 JavaOneSM
Conference | Session TS-3853 | 58
And Finally
“Crown Roast of Frankfurters”
2006 JavaOneSM
Conference | Session TS-3853 | 59
Agenda
Background: A Brief History of SWT
The Basics: Widgets and Graphics
Putting It All Together: An SWT Application
Sneak Peek: Advanced Topics
2006 JavaOneSM
Conference | Session TS-3853 | 60
Sneak Peek: Advanced Topics
• Browser
• Drag and Drop
• Printing
• Program
• Accessibility
• OLE (win32)
• AWT/Swing interop
2006 JavaOneSM
Conference | Session TS-3853 |
Introduction to SWT (The
Standard Widget Toolkit)
Steve Northover
SWT Team Lead
IBM Canada
eclipse.org/swt
SWT Eye for the
Swing Guy!
TS-3853

More Related Content

Viewers also liked

Integrating Sustainability-3
Integrating Sustainability-3Integrating Sustainability-3
Integrating Sustainability-3sondramilkie
 
Why Public Policy Education is Extension's Long-Standing Approach for Working...
Why Public Policy Education is Extension's Long-Standing Approach for Working...Why Public Policy Education is Extension's Long-Standing Approach for Working...
Why Public Policy Education is Extension's Long-Standing Approach for Working...sondramilkie
 
Changing Lives through Service Learning
Changing Lives through Service LearningChanging Lives through Service Learning
Changing Lives through Service Learningsondramilkie
 
Understanding the System: Creating Impacts in Criminal Justice
Understanding the System: Creating Impacts in Criminal JusticeUnderstanding the System: Creating Impacts in Criminal Justice
Understanding the System: Creating Impacts in Criminal Justicesondramilkie
 
2010 Department of Community Resource Development Symposium-4
2010 Department of Community Resource Development Symposium-42010 Department of Community Resource Development Symposium-4
2010 Department of Community Resource Development Symposium-4sondramilkie
 
Making Connections and Creating Solidarity with African American Youth
Making Connections and Creating Solidarity with African American YouthMaking Connections and Creating Solidarity with African American Youth
Making Connections and Creating Solidarity with African American Youthsondramilkie
 
"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension
"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension
"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extensionsondramilkie
 
Integrating Sustainability-4
Integrating Sustainability-4Integrating Sustainability-4
Integrating Sustainability-4sondramilkie
 
Teaching Financial Literacy: Engagement of Multigenerational Learners
Teaching Financial Literacy: Engagement of Multigenerational LearnersTeaching Financial Literacy: Engagement of Multigenerational Learners
Teaching Financial Literacy: Engagement of Multigenerational Learnerssondramilkie
 
11 2-10 ratios and proportions
11 2-10 ratios and proportions11 2-10 ratios and proportions
11 2-10 ratios and proportionschelbs
 
Rute media festival presentation
Rute media festival presentationRute media festival presentation
Rute media festival presentationrutelopes95
 
"Power of Wind" Enhancing Facilitation through Science-Based Exploration
"Power of Wind" Enhancing Facilitation through Science-Based Exploration"Power of Wind" Enhancing Facilitation through Science-Based Exploration
"Power of Wind" Enhancing Facilitation through Science-Based Explorationsondramilkie
 
Complex Systems & Focused Solutions-2
Complex Systems & Focused Solutions-2Complex Systems & Focused Solutions-2
Complex Systems & Focused Solutions-2sondramilkie
 
Innovative responses to working with diverse and emerging audiences wnep ap...
Innovative responses to working with diverse and emerging audiences   wnep ap...Innovative responses to working with diverse and emerging audiences   wnep ap...
Innovative responses to working with diverse and emerging audiences wnep ap...sondramilkie
 
Maximizing the Teen Court Experience for Youth Panel Members
Maximizing the Teen Court Experience for Youth Panel MembersMaximizing the Teen Court Experience for Youth Panel Members
Maximizing the Teen Court Experience for Youth Panel Memberssondramilkie
 
Microsoft® office outlookcalendarbasics
Microsoft® office outlookcalendarbasicsMicrosoft® office outlookcalendarbasics
Microsoft® office outlookcalendarbasicscaudillsu
 

Viewers also liked (18)

Integrating Sustainability-3
Integrating Sustainability-3Integrating Sustainability-3
Integrating Sustainability-3
 
Why Public Policy Education is Extension's Long-Standing Approach for Working...
Why Public Policy Education is Extension's Long-Standing Approach for Working...Why Public Policy Education is Extension's Long-Standing Approach for Working...
Why Public Policy Education is Extension's Long-Standing Approach for Working...
 
Changing Lives through Service Learning
Changing Lives through Service LearningChanging Lives through Service Learning
Changing Lives through Service Learning
 
Understanding the System: Creating Impacts in Criminal Justice
Understanding the System: Creating Impacts in Criminal JusticeUnderstanding the System: Creating Impacts in Criminal Justice
Understanding the System: Creating Impacts in Criminal Justice
 
2010 Department of Community Resource Development Symposium-4
2010 Department of Community Resource Development Symposium-42010 Department of Community Resource Development Symposium-4
2010 Department of Community Resource Development Symposium-4
 
Making Connections and Creating Solidarity with African American Youth
Making Connections and Creating Solidarity with African American YouthMaking Connections and Creating Solidarity with African American Youth
Making Connections and Creating Solidarity with African American Youth
 
"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension
"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension
"Everybody is a Somebody" A Dialogue on Classism in Cooperative Extension
 
Integrating Sustainability-4
Integrating Sustainability-4Integrating Sustainability-4
Integrating Sustainability-4
 
Teaching Financial Literacy: Engagement of Multigenerational Learners
Teaching Financial Literacy: Engagement of Multigenerational LearnersTeaching Financial Literacy: Engagement of Multigenerational Learners
Teaching Financial Literacy: Engagement of Multigenerational Learners
 
11 2-10 ratios and proportions
11 2-10 ratios and proportions11 2-10 ratios and proportions
11 2-10 ratios and proportions
 
Rute media festival presentation
Rute media festival presentationRute media festival presentation
Rute media festival presentation
 
"Power of Wind" Enhancing Facilitation through Science-Based Exploration
"Power of Wind" Enhancing Facilitation through Science-Based Exploration"Power of Wind" Enhancing Facilitation through Science-Based Exploration
"Power of Wind" Enhancing Facilitation through Science-Based Exploration
 
Complex Systems & Focused Solutions-2
Complex Systems & Focused Solutions-2Complex Systems & Focused Solutions-2
Complex Systems & Focused Solutions-2
 
Innovative responses to working with diverse and emerging audiences wnep ap...
Innovative responses to working with diverse and emerging audiences   wnep ap...Innovative responses to working with diverse and emerging audiences   wnep ap...
Innovative responses to working with diverse and emerging audiences wnep ap...
 
Maximizing the Teen Court Experience for Youth Panel Members
Maximizing the Teen Court Experience for Youth Panel MembersMaximizing the Teen Court Experience for Youth Panel Members
Maximizing the Teen Court Experience for Youth Panel Members
 
Conservation Tech
Conservation TechConservation Tech
Conservation Tech
 
"Power of Wind"
"Power of Wind""Power of Wind"
"Power of Wind"
 
Microsoft® office outlookcalendarbasics
Microsoft® office outlookcalendarbasicsMicrosoft® office outlookcalendarbasics
Microsoft® office outlookcalendarbasics
 

Similar to Swt eye for the swing guy

AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion MiddlewareAMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
Getting value from IoT, Integration and Data Analytics
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayLuka Zakrajšek
 
Introduction_To_SWT_Rahul_Shukla
Introduction_To_SWT_Rahul_ShuklaIntroduction_To_SWT_Rahul_Shukla
Introduction_To_SWT_Rahul_ShuklaRahul Shukla
 
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS MiddlewareOracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
Getting value from IoT, Integration and Data Analytics
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
Ciklum Ukraine
 
CDK Meetup: Rule the World through IaC
CDK Meetup: Rule the World through IaCCDK Meetup: Rule the World through IaC
CDK Meetup: Rule the World through IaC
smalltown
 
Performance Test Driven Development with Oracle Coherence
Performance Test Driven Development with Oracle CoherencePerformance Test Driven Development with Oracle Coherence
Performance Test Driven Development with Oracle Coherence
aragozin
 
Make your gui shine with ajax solr
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solrlucenerevolution
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
Sylvain Wallez
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
vibrantuser
 
Unleashing your Kafka Streams Application Metrics!
Unleashing your Kafka Streams Application Metrics!Unleashing your Kafka Streams Application Metrics!
Unleashing your Kafka Streams Application Metrics!
HostedbyConfluent
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
DataStax Academy
 
20160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab0120160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab01
Ivan Ma
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevilla
Trisha Gee
 
Building a cloud management megam.io
Building a cloud management megam.io Building a cloud management megam.io
Building a cloud management megam.io Yeshwanth Kumar
 
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPSVMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
VMworld
 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
Rosen Spasov
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
orkaplan
 
Serverless on OpenStack with Docker Swarm, Mistral, and StackStorm
Serverless on OpenStack with Docker Swarm, Mistral, and StackStormServerless on OpenStack with Docker Swarm, Mistral, and StackStorm
Serverless on OpenStack with Docker Swarm, Mistral, and StackStorm
Dmitri Zimine
 

Similar to Swt eye for the swing guy (20)

AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion MiddlewareAMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
Introduction_To_SWT_Rahul_Shukla
Introduction_To_SWT_Rahul_ShuklaIntroduction_To_SWT_Rahul_Shukla
Introduction_To_SWT_Rahul_Shukla
 
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS MiddlewareOracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
 
CDK Meetup: Rule the World through IaC
CDK Meetup: Rule the World through IaCCDK Meetup: Rule the World through IaC
CDK Meetup: Rule the World through IaC
 
Performance Test Driven Development with Oracle Coherence
Performance Test Driven Development with Oracle CoherencePerformance Test Driven Development with Oracle Coherence
Performance Test Driven Development with Oracle Coherence
 
Make your gui shine with ajax solr
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solr
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
 
Unleashing your Kafka Streams Application Metrics!
Unleashing your Kafka Streams Application Metrics!Unleashing your Kafka Streams Application Metrics!
Unleashing your Kafka Streams Application Metrics!
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
 
20160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab0120160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab01
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevilla
 
Building a cloud management megam.io
Building a cloud management megam.io Building a cloud management megam.io
Building a cloud management megam.io
 
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPSVMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
VMworld 2013: Virtualizing Mission Critical Oracle RAC with vSphere and vCOPS
 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Serverless on OpenStack with Docker Swarm, Mistral, and StackStorm
Serverless on OpenStack with Docker Swarm, Mistral, and StackStormServerless on OpenStack with Docker Swarm, Mistral, and StackStorm
Serverless on OpenStack with Docker Swarm, Mistral, and StackStorm
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 

Swt eye for the swing guy

  • 1. 2006 JavaOneSM Conference | Session TS-3853 | Introduction to SWT (The Standard Widget Toolkit) Steve Northover SWT Team Lead IBM Canada eclipse.org/swt SWT Eye for the Swing Guy! TS-3853
  • 2. 2006 JavaOneSM Conference | Session TS-3853 | 2 Write an SWT Application Goal of This Talk After this talk you will understand what SWT is and how to write a simple SWT application
  • 3. 2006 JavaOneSM Conference | Session TS-3853 | 3 Agenda Background: A Brief History of SWT The Basics: Widgets and Graphics Putting It All Together: An SWT Application Sneak Peek: Advanced Topics
  • 4. 2006 JavaOneSM Conference | Session TS-3853 | 4 What Is SWT? • SWT = “Standard Widget Toolkit” • A native GUI Toolkit for Java™ platform • Standard UI component for Eclipse • Roughly equivalent to AWT/Swing
  • 5. 2006 JavaOneSM Conference | Session TS-3853 | 5 History of SWT • Object Technology International (OTI) • VM’s, Class Libraries, Compilers, IDE’s • Configuration Management (ENVY/Manager) • Smalltalk (in the early 90’s) • Major Vendors: ParcPlace, Digitalk, IBM IBM Acquired OTI in 1996
  • 6. 2006 JavaOneSM Conference | Session TS-3853 | 6 Smalltalk Was… Java™! • Object Oriented • Byte Coded (VM, GC, JIT, Hot Replace…) • Class Libraries (Collections, Streams…) • Portable (Write Once, Run Anywhere™)
  • 7. 2006 JavaOneSM Conference | Session TS-3853 | 7 WORA (Write Once, Run Away!) • ParcPlace Smalltalk (emulated widgets) • Digitalk Smalltalk/V (native + emulated) • Windows, OS/2, Mac (emulated) • IBM Smalltalk (native, written by OTI) • Windows, X/Motif, OS/2, Mac, Open Look Native vs. Emulated!
  • 8. 2006 JavaOneSM Conference | Session TS-3853 | 8 The “Leap Frog” Experience • VisualAge for Java™ • Written in IBM Smalltalk • VisualAge Micro Edition • Prototype in Java code using AWT/Swing • Rewritten in Java code using SWT • Eclipse
  • 9. 2006 JavaOneSM Conference | Session TS-3853 | 9 What Is Eclipse?
  • 10. 2006 JavaOneSM Conference | Session TS-3853 | 10 “The SWT component is designed to provide efficient, portable access to the user-interface facilities of the operating system on which it is implemented” eclipse.org/swt
  • 11. 2006 JavaOneSM Conference | Session TS-3853 | 11 SWT Is • Efficient • Thin Java based layer over Java Native Interface calls to the OS • Portable • Windows, GTK, Motif, Macintosh, Photon • Java ME, Java SE • Native • Win32, GDI, GDI+, OLE, IE, Carbon, Cocoa, Core Graphics, Quick Draw, Safari, ATSUI, X Windows, X/t, Motif, GTK, GDK, Pango, cairo, ATK, Photon, Mozilla, QNX Voyager, Uniscribe...
  • 12. 2006 JavaOneSM Conference | Session TS-3853 | 12
  • 13. 2006 JavaOneSM Conference | Session TS-3853 | 13 Myths • SWT is better than Swing • Swing is better than SWT • SWT is “windows only” • SWT is proprietary • SWT applications are not portable • …and more TM
  • 14. 2006 JavaOneSM Conference | Session TS-3853 | 14 Agenda Background: A Brief History of SWT The Basics: Widgets and Graphics Putting It All Together: An SWT Application Sneak Peek: Advanced Topics
  • 15. 2006 JavaOneSM Conference | Session TS-3853 | 15 Hello World in SWT import org.eclipse.swt.widgets.*; public class HelloWorld { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Hello World"); shell.setSize(200, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep (); } display.dispose (); } }
  • 16. 2006 JavaOneSM Conference | Session TS-3853 | 16 Display • Connection to the window system • Represents the “screen” • Contains a list of Shells • Normally a singleton public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display);
  • 17. 2006 JavaOneSM Conference | Session TS-3853 | 17 Shell • Represents a “window” on the “screen” • Root of a tree of Composites and Controls public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Hello World"); shell.setSize(200, 100); shell.open();
  • 18. 2006 JavaOneSM Conference | Session TS-3853 | 18 Composite and Control • Composite • Control that contains other Composites and Controls • Control • A heavyweight operating system object • buttons, labels, entry fields, tables, toolbars, and trees are controls (Shells and Composites too) Shell, Composite, Control are subclasses of Widget
  • 19. 2006 JavaOneSM Conference | Session TS-3853 | 19 The Event Loop • Repeatedly reads and dispatches events • Yields CPU when no events are available • Applications choose when to exit shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose();
  • 20. 2006 JavaOneSM Conference | Session TS-3853 | 20 Events • JavaBeans™ event model (“typed” events) • Events come from the event loop (and from widget operations) • Low level “untyped” events also available
  • 21. 2006 JavaOneSM Conference | Session TS-3853 | 21 Freeing Resources • Operating system resources are explicitly released by the programmer display.dispose(); Rule #1: “If you created it, you dispose it” Rule #2: “Disposing a parent disposes the children”
  • 22. 2006 JavaOneSM Conference | Session TS-3853 | 22 Standard Constructors • Widgets must be created with a parent • Style bits used for create-only attributes //Create a push button control Button button = new Button(shell, SWT.PUSH); //Create a single line entry field with a border Text text = new Text(group, SWT.SINGLE|SWT.BORDER); //Create a shell with dialog trimmings Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
  • 23. 2006 JavaOneSM Conference | Session TS-3853 | 23 Errors and Exceptions • SWTError • An unrecoverable error • The operating system failed • SWTException • A recoverable error occurred • Invalid thread access, etc. • IllegalArgumentException • A recoverable error (argument is invalid) • Argument cannot be null, etc.
  • 24. 2006 JavaOneSM Conference | Session TS-3853 | 24 Items • A lightweight operating system object • Always occur within a specific widget • A Tree contains TreeItems • A Table contains TableItems • A Menu contains MenuItems • …and more
  • 25. 2006 JavaOneSM Conference | Session TS-3853 | 25 Threads • Single UI-thread (“apartment threaded”) • Widget operations must be called from the UI-thread • Runnables can be queued to run in the UI-thread • Background Threads • Use Display.syncExec(), asyncExec(), wake() • Graphics operations may be called from any thread
  • 26. 2006 JavaOneSM Conference | Session TS-3853 | 26 Widget Packages • org.eclipse.swt.widgets • org.eclipse.swt.dnd • Drag and Drop and Clipboard • org.eclipse.swt.browser • HTLM Browser control • org.eclipse.swt.custom • Custom Controls for Eclipse • org.eclipse.swt.ole.win32 • OLE (ActiveX) Support
  • 27. 2006 JavaOneSM Conference | Session TS-3853 | 27 Widget Classes—All of Them! (Dialogs, D&D, OLE, Browser, Custom Controls)
  • 28. 2006 JavaOneSM Conference | Session TS-3853 | 28 Graphics Classes—All of Them! • Resource Based Objects • GC (Graphics Context), Color, Image, Font, Path, Region, Transform, Pattern, TextLayout • Java Based Objects • Point, Rectangle, RGB, ImageData, FontData, PaletteData, PathData, TextStyle, FontMetrics, GlyphMetrics, ImageLoader
  • 29. 2006 JavaOneSM Conference | Session TS-3853 | 29 GC (Graphics Context) • All line, shape, text, image drawing, clipping, alpha, anti-alias and filling operations • Created on Control, Image, Display or Printer • new GC (Control) • new GC (Image) • new GC (Display) • new GC (Printer) • Call dispose() when done
  • 30. 2006 JavaOneSM Conference | Session TS-3853 | 30 GC Line Draw Methods • drawLine(int x1, int y1, int x2, int y2) • drawPolyline(int[] xyArray) • setLineWidth(int width) • setLineStyle(int style) • SWT.LINE_SOLID, SWT.LINE_DASH, SWT.LINE_DOT, SWT.LINE_DASHDOT, SWT.LINE_DASHDOTDOT, SWT.LINE_CUSTOM
  • 31. 2006 JavaOneSM Conference | Session TS-3853 | 31 shell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { GC gc = event.gc; gc.setLineWidth(5); gc.setLineStyle(SWT.LINE_SOLID); gc.drawLine(10, 10, 200, 10); gc.setLineWidth(1); gc.setLineStyle(SWT.LINE_DASH); gc.drawLine(10, 30, 200, 30); gc.setLineStyle(SWT.LINE_DOT); gc.drawLine(10, 50, 200, 50); gc.setLineStyle(SWT.LINE_DASHDOT); gc.drawLine(10, 70, 200, 70); gc.setLineStyle(SWT.LINE_DASHDOTDOT); gc.drawLine(10, 90, 200, 90); }}); Draw Lines on a Shell
  • 32. 2006 JavaOneSM Conference | Session TS-3853 | 32 Draw and Fill a Polygon on a Shell public void paintControl(PaintEvent event) { Rectangle bounds = shell.getClientArea(); center.x = bounds.x + bounds.width/2; center.y = bounds.y + bounds.height/2; int pos = 0; for (int i = 0; i < points; ++i) { double r = Math.PI*2 * pos/points; radial[i*2] = (int)((1+Math.cos(r))*center.x); radial[i*2+1] = (int)((1+Math.sin(r))*center.y); pos = (pos + points/2) % points; } event.gc.setBackground( display.getSystemColor(SWT.COLOR_WHITE)); event.gc.fillPolygon(radial); event.gc.drawPolygon(radial); }});
  • 33. 2006 JavaOneSM Conference | Session TS-3853 | 33 shell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { … //do I need to dispose this crazy thing? GC gc = event.gc; … }}); Should This GC Be Disposed? No. It was not created with “new GC()”
  • 34. 2006 JavaOneSM Conference | Session TS-3853 | 34 What Else Can SWT Graphics Do?
  • 35. 2006 JavaOneSM Conference | Session TS-3853 | 35 Layout Overview • Layout • An algorithm to position and resize controls • Use Composite.setLayout() • Layout Data • Algorithm specific data associated with each control • Use Control.setLayoutData()
  • 36. 2006 JavaOneSM Conference | Session TS-3853 | 36 Layout Classes • FillLayout • RowLayout • GridLayout • FormLayout • StackLayout
  • 37. 2006 JavaOneSM Conference | Session TS-3853 | 37 Agenda Background: A Brief History of SWT The Basics: Widgets and Graphics Putting It All Together: An SWT Application Sneak Peek: Advanced Topics
  • 38. 2006 JavaOneSM Conference | Session TS-3853 | 38 Example: FileExplorer
  • 39. 2006 JavaOneSM Conference | Session TS-3853 | 39 Create the Display public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Example"); shell.setLayout(new FillLayout()); Tree tree = createTree(shell); Table table = createTable(shell); createListeners(tree, table); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } 1 2 3
  • 40. 2006 JavaOneSM Conference | Session TS-3853 | 40 Create the Shell public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Example"); shell.setLayout(new FillLayout()); Tree tree = createTree(shell); Table table = createTable(shell); createListeners(tree, table); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } 1 2
  • 41. 2006 JavaOneSM Conference | Session TS-3853 | 41 Create the Tree public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Example"); shell.setLayout(new FillLayout()); Tree tree = createTree(shell); Table table = createTable(shell); createListeners(tree, table); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
  • 42. 2006 JavaOneSM Conference | Session TS-3853 | 42 Create the Tree with TreeItems static Tree createTree (Composite parent) { Tree tree = new Tree(parent, SWT.BORDER); createTreeItems(tree, null, File.listRoots()); return tree; } First Level
  • 43. 2006 JavaOneSM Conference | Session TS-3853 | 43 Create the TreeItems static void createTreeItems(Tree tree, TreeItem parent, File [] files) { if (files == null) return; for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { TreeItem item; if (parent == null) { item = new TreeItem(tree, SWT.NONE); item.setText(files[i].toString()); } else { item = new TreeItem(parent, SWT.NONE); item.setText(files[i].getName()); } item.setData(files[i]); new TreeItem(item, SWT.NULL); // force a '+' } } } 1
  • 44. 2006 JavaOneSM Conference | Session TS-3853 | 44 Create the TreeItems static void createTreeItems(Tree tree, TreeItem parent, File [] files) { if (files == null) return; for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { TreeItem item; if (parent == null) { item = new TreeItem(tree, SWT.NONE); item.setText(files[i].toString()); } else { item = new TreeItem(parent, SWT.NONE); item.setText(files[i].getName()); } item.setData(files[i]); new TreeItem(item, SWT.NULL); // force a '+' } } } 1 2
  • 45. 2006 JavaOneSM Conference | Session TS-3853 | 45 Create the TreeItems static void createTreeItems(Tree tree, TreeItem parent, File [] files) { if (files == null) return; for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { TreeItem item; if (parent == null) { item = new TreeItem(tree, SWT.NONE); item.setText(files[i].toString()); } else { item = new TreeItem(parent, SWT.NONE); item.setText(files[i].getName()); } item.setData(files[i]); new TreeItem(item, SWT.NULL); // force a '+' } } } 1 2 3
  • 46. 2006 JavaOneSM Conference | Session TS-3853 | 46 Create the TreeItems static void createTreeItems(Tree tree, TreeItem parent, File [] files) { if (files == null) return; for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { TreeItem item; if (parent == null) { item = new TreeItem(tree, SWT.NONE); item.setText(files[i].toString()); } else { item = new TreeItem(parent, SWT.NONE); item.setText(files[i].getName()); } item.setData(files[i]); new TreeItem(item, SWT.NULL); // force a '+' } } } 1 2 3 4
  • 47. 2006 JavaOneSM Conference | Session TS-3853 | 47 Create the Table public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Example"); shell.setLayout(new FillLayout()); Tree tree = createTree(shell); Table table = createTable(shell); createListeners(tree, table); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
  • 48. 2006 JavaOneSM Conference | Session TS-3853 | 48 Create the Table Without TableItems static Table createTable(Composite parent) { Table table = new Table(parent, SWT.BORDER); table.setHeaderVisible(true); String [] titles = {"Name", "Size"}; for (int i=0; i<titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles[i]); } return table; }
  • 49. 2006 JavaOneSM Conference | Session TS-3853 | 49 Create the Listeners public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Example"); shell.setLayout(new FillLayout()); Tree tree = createTree(shell); Table table = createTable(shell); createListeners(tree, table); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
  • 50. 2006 JavaOneSM Conference | Session TS-3853 | 50 Create the Listeners static void createListeners(final Tree tree, final Table table) { tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { TreeItem item = (TreeItem) event.item; File file = (File) item.getData(); createTableItems(table, file.listFiles()); }}); tree.addTreeListener(new TreeAdapter() { public void treeExpanded(TreeEvent event) { TreeItem item = (TreeItem) event.item; if (item.getItem(0).getData() != null) return; item.removeAll(); File file = (File) item.getData(); createTreeItems(null, item, file.listFiles()); }}); }} 1
  • 51. 2006 JavaOneSM Conference | Session TS-3853 | 51 Create the Listeners static void createListeners(final Tree tree, final Table table) { tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { TreeItem item = (TreeItem) event.item; File file = (File) item.getData(); createTableItems(table, file.listFiles()); }}); tree.addTreeListener(new TreeAdapter() { public void treeExpanded(TreeEvent event) { TreeItem item = (TreeItem) event.item; if (item.getItem(0).getData() != null) return; item.removeAll(); File file = (File) item.getData(); createTreeItems(null, item, file.listFiles()); }}); }} 1 2
  • 52. 2006 JavaOneSM Conference | Session TS-3853 | 52 Create the Listeners static void createListeners(final Tree tree, final Table table) { tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { TreeItem item = (TreeItem) event.item; File file = (File) item.getData(); createTableItems(table, file.listFiles()); }}); tree.addTreeListener(new TreeAdapter() { public void treeExpanded(TreeEvent event) { TreeItem item = (TreeItem) event.item; if (item.getItem(0).getData() != null) return; item.removeAll(); File file = (File) item.getData(); createTreeItems(null, item, file.listFiles()); }}); }} 1 2 3
  • 53. 2006 JavaOneSM Conference | Session TS-3853 | 53 Create the Listeners static void createListeners(final Tree tree, final Table table) { tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { TreeItem item = (TreeItem) event.item; File file = (File) item.getData(); createTableItems(table, file.listFiles()); }}); tree.addTreeListener(new TreeAdapter() { public void treeExpanded(TreeEvent event) { TreeItem item = (TreeItem) event.item; if (item.getItem(0).getData() != null) return; item.removeAll(); File file = (File) item.getData(); createTreeItems(null, item, file.listFiles()); }}); }} 1 2 3 4
  • 54. 2006 JavaOneSM Conference | Session TS-3853 | 54 Create the Listeners static void createListeners(final Tree tree, final Table table) { tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { TreeItem item = (TreeItem) event.item; File file = (File) item.getData(); createTableItems(table, file.listFiles()); }}); tree.addTreeListener(new TreeAdapter() { public void treeExpanded(TreeEvent event) { TreeItem item = (TreeItem) event.item; if (item.getItem(0).getData() != null) return; item.removeAll(); File file = (File) item.getData(); createTreeItems(null, item, file.listFiles()); }}); }} Other Levels 1 2 3 4
  • 55. 2006 JavaOneSM Conference | Session TS-3853 | 55 Create the TableItems static void createTableItems(Table table, File [] files) { table.removeAll(); if (files == null) return; for (int i = 0; i < files.length; i++) { TableItem item = new TableItem(table, SWT.NULL); item.setText(new String [] { files[i].getName(), files[i].length() / 1000 + " KB" }); } for (int i=0; i<table.getColumnCount(); i++) { table.getColumn (i).pack(); } }
  • 56. 2006 JavaOneSM Conference | Session TS-3853 | 56 More Features
  • 57. 2006 JavaOneSM Conference | Session TS-3853 | 57 Yet More Features
  • 58. 2006 JavaOneSM Conference | Session TS-3853 | 58 And Finally “Crown Roast of Frankfurters”
  • 59. 2006 JavaOneSM Conference | Session TS-3853 | 59 Agenda Background: A Brief History of SWT The Basics: Widgets and Graphics Putting It All Together: An SWT Application Sneak Peek: Advanced Topics
  • 60. 2006 JavaOneSM Conference | Session TS-3853 | 60 Sneak Peek: Advanced Topics • Browser • Drag and Drop • Printing • Program • Accessibility • OLE (win32) • AWT/Swing interop
  • 61. 2006 JavaOneSM Conference | Session TS-3853 | Introduction to SWT (The Standard Widget Toolkit) Steve Northover SWT Team Lead IBM Canada eclipse.org/swt SWT Eye for the Swing Guy! TS-3853