Presentation is loading. Please wait.

Presentation is loading. Please wait.

SWTworkbench.com SWT, The Standard Widget Toolkit A simple, productive path to effective cross-platform interfaces.

Similar presentations


Presentation on theme: "SWTworkbench.com SWT, The Standard Widget Toolkit A simple, productive path to effective cross-platform interfaces."— Presentation transcript:

1 SWTworkbench.com SWT, The Standard Widget Toolkit A simple, productive path to effective cross-platform interfaces

2 SWTworkbench.com Objectives ● Cut through the hype and explain what SWT really is ● Describe SWT's advantages and disadvantages ● Explain SWT's technical relationship to Swing ● Provide a taste of coding with SWT ● List where to find additional SWT resources

3 SWTworkbench.com Assumptions ● You feel comfortable with Java ● You have prior experience programming using Swing, Visual Basic, Delphi, C++ Builder, or a similar visual programming environment

4 SWTworkbench.com What is SWT? ● Strict technical ● Common usage

5 SWTworkbench.com What is SWT? ● Technical description – org.eclipse.swt.* – A portable toolkit providing access to the native platform's graphical resources

6 SWTworkbench.com What is SWT? ● Implementation strategy – A thin layer of Java objects over the native operating system's “objects” – Minimum abstraction required to be portable

7 SWTworkbench.com What is SWT? ● Common Usage: – The GUI toolkit used to create: ● Eclipse plug-ins ● Standalone applications based on Eclipse technology ● New SWT controls – This definition includes Eclipse technologies in addition to SWT

8 SWTworkbench.com What is SWT (common usage)? ● Related technologies – JFace – Swing-like MVC layer built on top of SWT plus other helpful user interface classes

9 SWTworkbench.com What is SWT (common usage)? ● Related technologies – Java2d – An object-based drawing toolkit built on top of SWT – GEF – A toolkit built on top of Java2d for creating GUI builders, HTML editors, UML diagrammers, object-based drawing editors, etc.

10 SWTworkbench.com What is SWT (common usage)? ● Related technologies – Sweet – A component layer on top of SWT similar to Active-X or VCL for the Win32 API ● JavaBeans for SWT ● http://sweet-swt.sourceforge.net

11 SWTworkbench.com What is SWT (common usage)? ● Related technologies – All of the Eclipse framework, when used as an application framework for custom applications and not as an IDE

12 SWTworkbench.com SWT Advantages ● Native Look & Feel – almost for free ● Lightweight and simple ● “Familiarly” Fast ● Open source

13 SWTworkbench.com SWT Advantages – Win2k Used by permission from: http://gallery.livemedia.com.au/

14 SWTworkbench.com SWT Advantages – Win2k

15 SWTworkbench.com SWT Advantages – WinXP + theme Used by permission from: http://gallery.livemedia.com.au/

16 SWTworkbench.com SWT Advantages – GTK + theme Used by permission from: http://gallery.livemedia.com.au/

17 SWTworkbench.com SWT Advantages – GTK + theme Used by permission from: http://gallery.livemedia.com.au/

18 SWTworkbench.com SWT Advantages – GTK + theme Used by permission from: http://gallery.livemedia.com.au/

19 SWTworkbench.com SWT Advantages – MacOS X Used by permission from: http://gallery.livemedia.com.au/

20 SWTworkbench.com SWT Disadvantages ● Lightweight ● Immature compared to Swing ● A few fewer platforms supported

21 SWTworkbench.com How does SWT relate to Swing? ● Swing's main strengths – Consistent look & feel across all platforms; attractive themes are available. – Sun-supported – (What else would you add?)

22 SWTworkbench.com How does SWT relate to Swing? ● SWT's main strengths – Native look and feel, because it is native. – Open source support

23 SWTworkbench.com How does SWT relate to Swing? ● Swing's main strengths – Consistent look & feel across all platforms; attractive themes are available. – Sun-supported. ● SWT's main strengths – Native look and feel, because it is native. – Open source support. These are complementary, not competitive strengths

24 SWTworkbench.com Why SWT? ● Web Services shift the emphasis on the client away from the web browser, back toward traditional GUI applications ● SWT strengthens Java's position in this market ● SWT provides features that compliment, rather than replace, Swing

25 SWTworkbench.com A Taste of SWT ● Hello, SWT public class HelloSWT { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

26 SWTworkbench.com A Taste of SWT ● Hello, SWT

27 SWTworkbench.com A Taste of SWT ● A simple SWT control public class HelloSWTControl extends Canvas implements PaintListener { public HelloSWTControl(Composite parent, int style) { super(parent, style); addPaintListener(this); } public void paintControl(PaintEvent e) { e.gc.drawText("Hello, world", 5, 5); }

28 SWTworkbench.com A Taste of SWT ● A closer look at the constructor public class HelloSWTControl extends Canvas implements PaintListener { public HelloSWTControl(Composite parent, int style) { super(parent, style); addPaintListener(this); } public void paintControl(PaintEvent e) { e.gc.drawText("Hello, world", 5, 5); }

29 SWTworkbench.com A Taste of SWT ● SWT constructors have 2 arguments: – The parent control ● SWT controls are added to their parents during construction, not by using an add( ) method – Style bits ● Some things you're used to seeing as properties of an object show up as style bits on the constructor ● This is the way the underlying O/S toolkits actually work – (SWT just wraps the underlying O/S's objects)

30 SWTworkbench.com A Taste of SWT ● Displaying the SWT control public class HelloSWT { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

31 SWTworkbench.com A Taste of SWT ● Displaying the SWT control public class HelloSWT { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); new HelloSWTControl(shell, SWT.NULL); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

32 SWTworkbench.com A Taste of SWT ● Displaying the SWT control

33 SWTworkbench.com A Taste of SWT ● Managing graphical resources: a more complex example

34 SWTworkbench.com A Taste of SWT ● Managing graphical resources public class Blotter extends Canvas implements PaintListener { public Blotter(Composite parent, int style) { super(parent, style); addPaintListener(this); } public void paintControl(PaintEvent e) { // Put our drawing code here }

35 SWTworkbench.com A Taste of SWT ● Managing graphical resources public Blotter(Composite parent, int style) { super(parent, style); addPaintListener(this); }

36 SWTworkbench.com A Taste of SWT ● Managing graphical resources public Blotter(Composite parent, int style) { super(parent, style); addPaintListener(this); // Set a default background color display = Display.getCurrent(); Color background = display.getSystemColor( SWT.COLOR_DARK_GREEN); setBackground(background); } private Display display;

37 SWTworkbench.com A Taste of SWT ● Managing graphical resources public class Blotter extends Canvas implements PaintListener { public Blotter(Composite parent, int style) { super(parent, style); addPaintListener(this); } public void paintControl(PaintEvent e) { // Put our drawing code here }

38 SWTworkbench.com A Taste of SWT ● Managing graphical resources public void paintControl(PaintEvent e) { // Put our drawing code here }

39 SWTworkbench.com A Taste of SWT ● Managing graphical resources public void paintControl(PaintEvent e) { GC gc = e.gc; Color black = display.getSystemColor(SWT.COLOR_BLACK); Color gray = display.getSystemColor(SWT.COLOR_GRAY); Rectangle bounds = this.getBounds(); gc.setForeground(black); gc.drawLine(0, 0, 0, bounds.height); gc.setForeground(gray); gc.drawLine(1, 0, 1, bounds.height); //...and so on... }

40 SWTworkbench.com A Taste of SWT ● Managing graphical resources – This is all there is to creating this control! – Conclusion: ● If you don't construct a graphical resource, you do not have to dispose it ● You can get away with this an amazing amount of the time

41 SWTworkbench.com What is JFace? ● A bunch of convenience classes for building SWT applications – ApplicationWindow – Dialog – Wizard ● A framework for displaying and editing Java business model objects using SWT – TableViewer – TreeViewer

42 SWTworkbench.com What is JFace? ● A bunch of convenience classes for building SWT applications – ApplicationWindow – Dialog – Wizard ● A framework for displaying and editing Java business model objects using SWT – TableViewer – TreeViewer

43 SWTworkbench.com A Taste of SWT + JFace ● Hello, JFace public class HelloJFace extends ApplicationWindow { public HelloJFace(Shell parentShell) { super(parentShell); setBlockOnOpen(true); } public static void main(String[] args) { (new HelloJFace(null)).open(); }

44 SWTworkbench.com A Taste of SWT + JFace ● Hello, JFace

45 SWTworkbench.com A Taste of SWT + JFace ● Ways to add features to your JFace application: – Add code to constructor – Override protected methods – Add new methods or classes

46 SWTworkbench.com A Taste of SWT + JFace ● Add menu bar, tool bar, status line public class HelloJFace extends ApplicationWindow { public HelloJFace(Shell parentShell) { super(parentShell); setBlockOnOpen(true); } public static void main(String[] args) { (new HelloJFace(null)).open(); }

47 SWTworkbench.com A Taste of SWT + JFace ● Add menu bar, tool bar, status line public class HelloJFace extends ApplicationWindow { public HelloJFace(Shell parentShell) { super(parentShell); setBlockOnOpen(true); addMenuBar(); addToolBar(SWT.FLAT); addStatusLine(); } public static void main(String[] args) { (new HelloJFace(null)).open(); }

48 SWTworkbench.com A Taste of SWT + JFace ● Add application title and icon protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText("Hello, JFace"); shell.setImage( ImageDescriptor.createFromFile( HelloJFace.class, "icons/app.png").createImage()); }

49 SWTworkbench.com A Taste of SWT + JFace ● Add menu to menu bar protected MenuManager createMenuManager() { MenuManager menuManager = new MenuManager(); menuManager.add(createFileMenu()); return menuManager; } private MenuManager createFileMenu() { MenuManager menu = new MenuManager("&File"); menu.add(new Action() { public String getText() { return "E&xit"; } public void run() { getShell().close(); } }); return menu; }

50 SWTworkbench.com A Taste of SWT + JFace ● Add button to tool bar protected ToolBarManager createToolBarManager( int style) { ToolBarManager toolBar = new ToolBarManager(style); toolBar.add(new NewAction()); return toolBar; }

51 SWTworkbench.com A Taste of SWT + JFace ● Add private class NewAction for button private class NewAction extends Action { public String getText() { return "New"; } public String getToolTipText() { return "New"; } public ImageDescriptor getImageDescriptor() { ImageDescriptor imageDesc = ImageDescriptor.createFromFile( HelloJFace.class, "icons/new.png"); return imageDesc; } public ImageDescriptor getHoverImageDescriptor() { ImageDescriptor imageDesc = ImageDescriptor.createFromFile( HelloJFace.class, "icons/new-h.png"); return imageDesc; } public void run() { // add action code here }

52 SWTworkbench.com A Taste of SWT + JFace ● Add a blotter to the client area protected Control createContents(Composite parent) { Composite contents = new Blotter(parent, SWT.NULL); return contents; }

53 SWTworkbench.com A Taste of SWT + JFace ● Here's how it looks now...

54 SWTworkbench.com A Taste of JFace Viewers ● Suppose we really want to build a “To-do” list...

55 SWTworkbench.com What is JFace? ● A bunch of convenience classes for building SWT applications – ApplicationWindow – Dialog – Wizard ● A framework for displaying and editing Java business model objects using SWT – TableViewer – TreeViewer

56 SWTworkbench.com A Taste of JFace Viewers ● Steps to add to-do list editor to application – Create TodoList “model” objects – Add TableViewer object to layout – Initialize TableViewer – Set TodoList object as the TableViewer's input – Write (or reuse existing classes) to specify the following TableViewer event handler objects ● ContentProvider, LabelProvider ● CellEditor, CellModifier ● RowSorter

57 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input”

58 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier

59 SWTworkbench.com ● Steps to add to-do list editor to application – Create TodoList “model” objects – Add TableViewer object to layout – Initialize TableViewer – Set TodoList object as the TableViewer's input – Write (or reuse existing classes) to specify the following TableViewer event handler objects ● ContentProvider, LabelProvider ● CellEditor, CellModifier ● RowSorter A Taste of JFace Viewers

60 SWTworkbench.com A Taste of JFace Viewers ● Create TodoList “model” object public class TodoList implements Serializable { // The Model's entry-point is here... public static TodoList theList = null; public TodoList() { theList = this; } //...

61 SWTworkbench.com A Taste of JFace Viewers ● Create TodoList “model” object (continued) public Object[] toArray() { Object[] results = new Object[todoList.size()]; int i = 0; Iterator iter = todoList.keySet().iterator(); while (iter.hasNext()) { results[i] = todoList.get(iter.next()); ++i; } return results; }

62 SWTworkbench.com A Taste of JFace Viewers ● Steps to add to-do list editor to application – Create TodoList “model” object – Add TableViewer object to layout – Initialize TableViewer – Set TodoList object as the TableViewer's input – Write (or reuse existing classes) to specify the following TableViewer event handler objects ● ContentProvider, LabelProvider ● CellEditor, CellModifier ● RowSorter

63 SWTworkbench.com A Taste of JFace Viewers ● Add TableViewer object to layout protected Control createContents(Composite parent) { Composite contents = new Blotter(parent, SWT.NULL); return contents; }

64 SWTworkbench.com A Taste of JFace Viewers ● Add TableViewer object to layout protected Control createContents(Composite parent) { Composite contents = new Blotter(parent, SWT.NULL); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 20; layout.marginWidth = 20; contents.setLayout(layout); table = new TableViewer(contents, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setLayoutData( new GridData(GridData.FILL_BOTH)); return contents; }

65 SWTworkbench.com A Taste of JFace Viewers ● Steps to add to-do list editor to application – Create TodoList “model” object – Add TableViewer object to layout – Initialize TableViewer – Set TodoList object as the TableViewer's input – Write (or reuse existing classes) to specify the following TableViewer event handler objects ● ContentProvider, LabelProvider ● CellEditor, CellModifier ● RowSorter

66 SWTworkbench.com A Taste of JFace Viewers ● Initialize TableViewer... protected Control createContents(Composite parent) { Composite contents = new Blotter(parent, SWT.NULL); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 20; layout.marginWidth = 20; contents.setLayout(layout); table = new TableViewer(contents, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setLayoutData( new GridData(GridData.FILL_BOTH)); return contents; }

67 SWTworkbench.com A Taste of JFace Viewers ● Initialize TableViewer... protected Control createContents(Composite parent) { Composite contents = new Blotter(parent, SWT.NULL); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 20; layout.marginWidth = 20; contents.setLayout(layout); table = new TableViewer(contents, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setLayoutData( new GridData(GridData.FILL_BOTH)); initTable(); return contents; }

68 SWTworkbench.com A Taste of JFace Viewers ● Initialize TableViewer... private void initTable() { addColumns(); addProvidersAndEditors(); } private static final String[] colNames = { "Done", "Priority", "Description" }; private static final int[] colWeight = { 5, 5, 90 }; private static final int COL_DONE = 0; private static final int COL_PRIORITY = 1; private static final int COL_DESC = 2;

69 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier

70 SWTworkbench.com A Taste of JFace Viewers ● Implement addColumns() private void addColumns() { TableLayout tl = new TableLayout(); for (int i=0; i < colWeight.length; ++i) { TableColumn tc = new TableColumn(getTable(), SWT.NULL); tc.setResizable(true); tc.setText(colNames[i]); tc.setAlignment(SWT.CENTER); if (i == COL_DESC) tc.setAlignment(SWT.LEFT); tl.addColumnData(new ColumnWeightData(colWeight[i], true)); } getTable().setHeaderVisible(true); getTable().setLayout(tl); }

71 SWTworkbench.com A Taste of JFace Viewers ● Implement addProvidersAndEditors() private void addProvidersAndEditors() { table.setContentProvider( new ContentProvider()); table.setLabelProvider(new LabelProvider()); CellEditor[] editors = { new CheckboxCellEditor(table.getTable()), new TextCellEditor(table.getTable()), new TextCellEditor(table.getTable())}; table.setCellEditors(editors); table.setCellModifier(new CellModifier()); table.setSorter(new RowSorter()); table.setColumnProperties(colNames); }

72 SWTworkbench.com A Taste of JFace Viewers ● Steps to add to-do list editor to application – Create TodoList “model” object – Add TableViewer object to layout – Initialize TableViewer – Set TodoList object as the TableViewer's input – Write (or reuse existing classes) to specify the following TableViewer event handler objects ● ContentProvider, LabelProvider ● CellEditor, CellModifier ● RowSorter

73 SWTworkbench.com A Taste of JFace Viewers ● Set TodoList as the TableViewer's input private void initTable() { addColumns(); addProvidersAndEditors(); } private static final String[] colNames = { "Done", "Priority", "Description" }; private static final int[] colWeight = { 5, 5, 90 }; private static final int COL_DONE = 0; private static final int COL_PRIORITY = 1; private static final int COL_DESC = 2;

74 SWTworkbench.com A Taste of JFace Viewers ● Set TodoList as the TableViewer's input private void initTable() { addColumns(); addProvidersAndEditors(); table.setInput(TodoList.theList); } private static final String[] colNames = { "Done", "Priority", "Description" }; private static final int[] colWeight = { 5, 5, 90 }; private static final int COL_DONE = 0; private static final int COL_PRIORITY = 1; private static final int COL_DESC = 2;

75 SWTworkbench.com A Taste of JFace Viewers ● Steps to add to-do list editor to application – Create TodoList “model” object – Add TableViewer object to layout – Initialize TableViewer – Set TodoList object as the TableViewer's input – Write (or reuse existing classes) to specify the following TableViewer event handler objects ● ContentProvider, LabelProvider ● CellEditor, CellModifier ● RowSorter

76 SWTworkbench.com A Taste of JFace Viewers ● Implement addProvidersAndEditors() private void addProvidersAndEditors() { table.setContentProvider( new ContentProvider()); table.setLabelProvider(new LabelProvider()); CellEditor[] editors = { new CheckboxCellEditor(table.getTable()), new TextCellEditor(table.getTable()), new TextCellEditor(table.getTable())}; table.setCellEditors(editors); table.setCellModifier(new CellModifier()); table.setSorter(new RowSorter()); table.setColumnProperties(colNames); }

77 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier

78 SWTworkbench.com A Taste of JFace Viewers ● A closer look at JFace “event handler objects”

79 SWTworkbench.com A Taste of JFace Viewers ● A closer look at JFace “event handler objects”

80 SWTworkbench.com A Taste of JFace Viewers ● Implementing ContentProvider private class ContentProvider implements IStructuredContentProvider { public Object[] getElements( Object inputElement) { return ((TodoList)inputElement).toArray(); } public void dispose() {} public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} }

81 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier

82 SWTworkbench.com A Taste of JFace Viewers ● A closer look at JFace “event handler objects”

83 SWTworkbench.com A Taste of JFace Viewers ● Implementing LabelProvider private class LabelProvider implements ITableLabelProvider { private Image done; private Image notdone; public LabelProvider() { done = ImageDescriptor.createFromFile( TodoListWindow.class, "icons/task-done.png").createImage(); notdone = ImageDescriptor.createFromFile( TodoListWindow.class, "icons/task-open.png").createImage(); } //...

84 SWTworkbench.com A Taste of JFace Viewers ● Implementing LabelProvider public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == COL_DONE) { Todo todo = (Todo) element; if (todo.isDone()) { return done; } else { return notdone; } return null; } //...

85 SWTworkbench.com A Taste of JFace Viewers ● Implementing LabelProvider public String getColumnText(Object element, int columnIndex) { Todo todo = (Todo) element; switch (columnIndex) { case COL_PRIORITY: return Integer.toString( todo.getPriority()); case COL_DESC: return todo.getDesc(); default: return ""; } //...

86 SWTworkbench.com A Taste of JFace Viewers ● Implementing LabelProvider public boolean isLabelProperty( Object element, String property) { return true; } public void dispose() { done.dispose(); notdone.dispose(); } public void addListener( ILabelProviderListener listener) {} public void removeListener( ILabelProviderListener listener) {} }

87 SWTworkbench.com A Taste of JFace Viewers ● A closer look at JFace “event handler objects”

88 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier

89 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier The visible editor

90 SWTworkbench.com A Taste of JFace Viewers ● JFace TableViewer usage TableViewer TodoList TreeMap Todo “input” ContentProvider LabelProvider RowSorter CellEditor CellModifier Translates between visible editor's data type and the model's storage data type

91 SWTworkbench.com A Taste of JFace Viewers ● Implementing CellModifier private class CellModifier implements ICellModifier { public boolean canModify(Object element, String property) { return true; } //...

92 SWTworkbench.com A Taste of JFace Viewers ● Implementing CellModifier public Object getValue(Object element, String property) { Todo todo = (Todo) element; if (property.equals(colNames[COL_DONE])) { return new Boolean(todo.isDone()); } else if (property.equals(colNames[COL_PRIORITY])) { return Integer.toString(todo.getPriority()); } else if (property.equals(colNames[COL_DESC])) { return todo.getDesc(); } return null; } //...

93 SWTworkbench.com A Taste of JFace Viewers ● Implementing CellModifier public void modify(Object element, String property, Object value) { Item item = (Item) element; Todo todo = (Todo) item.getData(); if (property.equals(colNames[COL_DONE])) { boolean val = ((Boolean)value).booleanValue(); todo.setDone(val); } else if (property.equals(colNames[COL_PRIORITY])) { //...handle the other columns similarly } table.refresh(); }

94 SWTworkbench.com A Taste of JFace Viewers ● A closer look at JFace “event handler objects”

95 SWTworkbench.com A Taste of JFace Viewers ● Implementing RowSorter private class RowSorter extends ViewerSorter { public int compare(Viewer viewer, Object element1, Object element2) { Todo t1 = (Todo) element1; Todo t2 = (Todo) element2; return t1.getPriority() - t2.getPriority(); }

96 SWTworkbench.com A Taste of JFace Viewers ● A closer look at JFace “event handler objects”

97 SWTworkbench.com A Taste of JFace Viewers ● So here's what we just built...

98 SWTworkbench.com SWT GUI Builders ● Shortens the learning curve by handling layout tasks for you ● Easier to quickly prototype an interface ● Several commercial SWT GUI builders are under development

99 SWTworkbench.com SWT GUI Builders (under development) ● V4All – Ramen Assisi ● Scott Stanchfield's unnamed GUI builder ● SWTworkbench – Advanced Systems Concepts

100 SWTworkbench.com Summary ● SWT provides a fast, native user interface for rich client Java applications. ● SWT has taken two meanings depending on if a formal or informal context is being used: – Formal: SWT = Java-wrapped O/S widgets. – Informal: SWT+JFace all the way up to the entire Eclipse application framework. ● SWT and Swing have complementary (not competitive) strengths and weaknesses.

101 SWTworkbench.com Source Code Availability ● Complete source code is available at – http://www.swtworkbench.com/wsee_2003.zip

102 SWTworkbench.com SWT, the Standard Widget Toolkit Any questions?

103 SWTworkbench.com SWT Development Resources ● SWT Home Page – http://dev.eclipse.org/viewcvs/index.cgi/%7Echec kout%7E/platform-swt-home/main.html ● SWT articles at Eclipse.org – http://www.eclipse.org/articles/index.html ● SWT/JFace page on the Eclipse Wiki – http://eclipsewiki.swiki.net/2 ● See especially the “Hello, world” examples provided here.

104 SWTworkbench.com SWT Development Resources (cont.) ● SWT Development Resources / Examples – http://dev.eclipse.org/viewcvs/index.cgi/%7Echec kout%7E/platform-swt-home/dev.html ● Especially note the code snippets starting about halfway down the page. ● SWT FAQ – http://dev.eclipse.org/viewcvs/index.cgi/%7Echec kout%7E/platform-swt-home/faq.html

105 SWTworkbench.com SWT GUI Builder Resources ● GUI builder page on the Eclipse Wiki – http://eclipsewiki.swiki.net/145 ● Sweet Project Home Page – http://sweet-swt.sourceforge.net ● Sweet is an open source, cross-vendor effort to provide SWT metadata to all SWT GUI builders. Basically, it's BeanInfo for SWT.

106 SWTworkbench.com Relevant Eclipse Resources ● Eclipse.org newsgroups, archives, IRC – http://www.eclipse.org/newsgroups/index.html – http://www.eclipse.org/search/search.cgi – irc://irc.freenode.net/#eclipse ● Eclipse Wiki – http://eclipsewiki.swiki.net/1 ● Eclipse plug-in registry – http://eclipse-plugins.2y.net/

107 SWTworkbench.com

108

109


Download ppt "SWTworkbench.com SWT, The Standard Widget Toolkit A simple, productive path to effective cross-platform interfaces."

Similar presentations


Ads by Google