From 183264fc8c45e7b48b5b87ae4cb083147c586499 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Fri, 22 Feb 2008 20:03:24 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v3430'. Sprout from master 2008-02-22 19:27:20 UTC Bogdan Gheorghe 'v3430 for I20080222' Cherrypick from master 2008-02-22 20:03:23 UTC Bogdan Gheorghe 'v3430 for I20080222': bundles/org.eclipse.swt/buildnotes_swt.html Delete: bundles/org.eclipse.swt.opengl/.classpath_carbon bundles/org.eclipse.swt.opengl/.classpath_gtk bundles/org.eclipse.swt.opengl/.classpath_motif bundles/org.eclipse.swt.opengl/.classpath_win32 bundles/org.eclipse.swt.opengl/.cvsignore bundles/org.eclipse.swt.opengl/.project bundles/org.eclipse.swt.opengl/META-INF/MANIFEST.MF bundles/org.eclipse.swt.opengl/about.html bundles/org.eclipse.swt.opengl/carbon/library/agl.c bundles/org.eclipse.swt.opengl/carbon/library/agl.h bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.c bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.h bundles/org.eclipse.swt.opengl/carbon/library/agl_structs.h bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/opengl/GLCanvas.java bundles/org.eclipse.swt.opengl/common/library/gl.c bundles/org.eclipse.swt.opengl/common/library/gl.h bundles/org.eclipse.swt.opengl/common/library/gl_stats.c bundles/org.eclipse.swt.opengl/common/library/gl_stats.h bundles/org.eclipse.swt.opengl/common/library/gl_structs.c bundles/org.eclipse.swt.opengl/common/library/gl_structs.h bundles/org.eclipse.swt.opengl/common/library/glu.c bundles/org.eclipse.swt.opengl/common/library/glu.h bundles/org.eclipse.swt.opengl/common/library/glu_stats.c bundles/org.eclipse.swt.opengl/common/library/glu_stats.h bundles/org.eclipse.swt.opengl/common/library/glu_structs.c bundles/org.eclipse.swt.opengl/common/library/glu_structs.h bundles/org.eclipse.swt.opengl/common/library/swt.c bundles/org.eclipse.swt.opengl/common/library/swt.h bundles/org.eclipse.swt.opengl/common/org/eclipse/opengl/GL.java bundles/org.eclipse.swt.opengl/common/org/eclipse/opengl/GLU.java bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/GLData.java bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/ImageDataUtil.java bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/Library.java bundles/org.eclipse.swt.opengl/gtk/library/build.sh bundles/org.eclipse.swt.opengl/gtk/library/glx.c bundles/org.eclipse.swt.opengl/gtk/library/glx.h bundles/org.eclipse.swt.opengl/gtk/library/glx_stats.c bundles/org.eclipse.swt.opengl/gtk/library/glx_stats.h bundles/org.eclipse.swt.opengl/gtk/library/glx_structs.c bundles/org.eclipse.swt.opengl/gtk/library/glx_structs.h bundles/org.eclipse.swt.opengl/gtk/library/make_linux.mak bundles/org.eclipse.swt.opengl/gtk/library/structs.c bundles/org.eclipse.swt.opengl/gtk/library/structs.h bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/internal/opengl/gtk/GLX.java bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/internal/opengl/gtk/XVisualInfo.java bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/opengl/GLCanvas.java bundles/org.eclipse.swt.opengl/motif/library/build.sh bundles/org.eclipse.swt.opengl/motif/library/glx.c bundles/org.eclipse.swt.opengl/motif/library/make_aix.mak bundles/org.eclipse.swt.opengl/motif/library/make_hpux.mak bundles/org.eclipse.swt.opengl/motif/library/make_linux.mak bundles/org.eclipse.swt.opengl/motif/library/make_solaris.mak bundles/org.eclipse.swt.opengl/motif/library/structs.c bundles/org.eclipse.swt.opengl/motif/library/structs.h bundles/org.eclipse.swt.opengl/motif/org/eclipse/swt/opengl/GLContext.java bundles/org.eclipse.swt.opengl/motif/org/eclipse/swt/opengl/internal/motif/XGL.java bundles/org.eclipse.swt.opengl/motif/org/eclipse/swt/opengl/internal/motif/XVisualInfo.java bundles/org.eclipse.swt.opengl/plugin.properties bundles/org.eclipse.swt.opengl/plugin.xml bundles/org.eclipse.swt.opengl/win32/library/build.bat bundles/org.eclipse.swt.opengl/win32/library/glw.c bundles/org.eclipse.swt.opengl/win32/library/make_win32.mak bundles/org.eclipse.swt.opengl/win32/library/structs.c bundles/org.eclipse.swt.opengl/win32/library/structs.h bundles/org.eclipse.swt.opengl/win32/library/swt.rc bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/GLCanvas.java bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/LAYERPLANEDESCRIPTOR.java bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/PIXELFORMATDESCRIPTOR.java bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/WGL.java examples/org.eclipse.swt.examples.browser.demos/.classpath examples/org.eclipse.swt.examples.browser.demos/.project examples/org.eclipse.swt.examples.browser.demos/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.browser.demos/about.html examples/org.eclipse.swt.examples.browser.demos/build.properties examples/org.eclipse.swt.examples.browser.demos/css1/back1.jpg examples/org.eclipse.swt.examples.browser.demos/css1/back2.jpg examples/org.eclipse.swt.examples.browser.demos/css1/black.gif examples/org.eclipse.swt.examples.browser.demos/css1/board1.jpg examples/org.eclipse.swt.examples.browser.demos/css1/empty.gif examples/org.eclipse.swt.examples.browser.demos/css1/line1.gif examples/org.eclipse.swt.examples.browser.demos/css1/style.css examples/org.eclipse.swt.examples.browser.demos/css1/wall.gif examples/org.eclipse.swt.examples.browser.demos/css1/welcome.html examples/org.eclipse.swt.examples.browser.demos/css1/white.gif examples/org.eclipse.swt.examples.browser.demos/css2/Back640x440.gif examples/org.eclipse.swt.examples.browser.demos/css2/black_chip.gif examples/org.eclipse.swt.examples.browser.demos/css2/line1.gif examples/org.eclipse.swt.examples.browser.demos/css2/style.css examples/org.eclipse.swt.examples.browser.demos/css2/texture_cells.gif examples/org.eclipse.swt.examples.browser.demos/css2/wall_chip.gif examples/org.eclipse.swt.examples.browser.demos/css2/welcome.html examples/org.eclipse.swt.examples.browser.demos/css2/white_chip.gif examples/org.eclipse.swt.examples.browser.demos/css3/Back640x440.gif examples/org.eclipse.swt.examples.browser.demos/css3/black_pawn.gif examples/org.eclipse.swt.examples.browser.demos/css3/line1.gif examples/org.eclipse.swt.examples.browser.demos/css3/style.css examples/org.eclipse.swt.examples.browser.demos/css3/texture_cells.gif examples/org.eclipse.swt.examples.browser.demos/css3/wall_pawn.gif examples/org.eclipse.swt.examples.browser.demos/css3/welcome.html examples/org.eclipse.swt.examples.browser.demos/css3/white_pawn.gif examples/org.eclipse.swt.examples.browser.demos/css4/Back640x440.gif examples/org.eclipse.swt.examples.browser.demos/css4/blue_people.gif examples/org.eclipse.swt.examples.browser.demos/css4/gold_people.gif examples/org.eclipse.swt.examples.browser.demos/css4/line1.gif examples/org.eclipse.swt.examples.browser.demos/css4/style.css examples/org.eclipse.swt.examples.browser.demos/css4/texture_cells.gif examples/org.eclipse.swt.examples.browser.demos/css4/wall_people.gif examples/org.eclipse.swt.examples.browser.demos/css4/welcome.html examples/org.eclipse.swt.examples.browser.demos/doc-html/swt_browser_demos_ex.html examples/org.eclipse.swt.examples.browser.demos/icons/pawn.gif examples/org.eclipse.swt.examples.browser.demos/plugin.properties examples/org.eclipse.swt.examples.browser.demos/plugin.xml examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/BrowserDemoPlugin.java examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/Pawns.java examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/BrowserDemoView.java examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/EditorTab.java examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/PawnTab.java examples/org.eclipse.swt.examples.browser/.classpath examples/org.eclipse.swt.examples.browser/.cvsignore examples/org.eclipse.swt.examples.browser/.project examples/org.eclipse.swt.examples.browser/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.browser/about.html examples/org.eclipse.swt.examples.browser/build.properties examples/org.eclipse.swt.examples.browser/doc-html/swt_browser_ex.html examples/org.eclipse.swt.examples.browser/icons/browser_example.gif examples/org.eclipse.swt.examples.browser/plugin.properties examples/org.eclipse.swt.examples.browser/plugin.xml examples/org.eclipse.swt.examples.browser/src/import.properties examples/org.eclipse.swt.examples.browser/src/org/eclipse/swt/examples/browserexample/BrowserPlugin.java examples/org.eclipse.swt.examples.browser/src/org/eclipse/swt/examples/browserexample/BrowserView.java examples/org.eclipse.swt.examples.controls/.classpath examples/org.eclipse.swt.examples.controls/.cvsignore examples/org.eclipse.swt.examples.controls/.project examples/org.eclipse.swt.examples.controls/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.controls/about.html examples/org.eclipse.swt.examples.controls/build.properties examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html examples/org.eclipse.swt.examples.controls/doc-html/swt_customcontrols_ex.html examples/org.eclipse.swt.examples.controls/icons/controls_example.gif examples/org.eclipse.swt.examples.controls/plugin.properties examples/org.eclipse.swt.examples.controls/plugin.xml examples/org.eclipse.swt.examples.controls/src/import.properties examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/CustomControlView.java examples/org.eclipse.swt.examples.launcher/.classpath examples/org.eclipse.swt.examples.launcher/.cvsignore examples/org.eclipse.swt.examples.launcher/.project examples/org.eclipse.swt.examples.launcher/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.launcher/about.html examples/org.eclipse.swt.examples.launcher/build.properties examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif examples/org.eclipse.swt.examples.launcher/plugin.properties examples/org.eclipse.swt.examples.launcher/plugin.xml examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.exsd examples/org.eclipse.swt.examples.launcher/src/import.properties examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java examples/org.eclipse.swt.examples.layouts/.classpath examples/org.eclipse.swt.examples.layouts/.cvsignore examples/org.eclipse.swt.examples.layouts/.project examples/org.eclipse.swt.examples.layouts/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.layouts/about.html examples/org.eclipse.swt.examples.layouts/build.properties examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html examples/org.eclipse.swt.examples.layouts/icons/layouts_example.gif examples/org.eclipse.swt.examples.layouts/plugin.properties examples/org.eclipse.swt.examples.layouts/plugin.xml examples/org.eclipse.swt.examples.layouts/src/import.properties examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutPlugin.java examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutView.java examples/org.eclipse.swt.examples.ole.win32/.classpath examples/org.eclipse.swt.examples.ole.win32/.cvsignore examples/org.eclipse.swt.examples.ole.win32/.project examples/org.eclipse.swt.examples.ole.win32/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.ole.win32/about.html examples/org.eclipse.swt.examples.ole.win32/build.properties examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif examples/org.eclipse.swt.examples.ole.win32/plugin.properties examples/org.eclipse.swt.examples.ole.win32/plugin.xml examples/org.eclipse.swt.examples.ole.win32/src/import.properties examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OLEExample.java examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java examples/org.eclipse.swt.examples.paint/.classpath examples/org.eclipse.swt.examples.paint/.cvsignore examples/org.eclipse.swt.examples.paint/.project examples/org.eclipse.swt.examples.paint/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples.paint/about.html examples/org.eclipse.swt.examples.paint/build.properties examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html examples/org.eclipse.swt.examples.paint/icons/paint_example.gif examples/org.eclipse.swt.examples.paint/plugin.properties examples/org.eclipse.swt.examples.paint/plugin.xml examples/org.eclipse.swt.examples.paint/src/import.properties examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java examples/org.eclipse.swt.examples/.classpath examples/org.eclipse.swt.examples/.cvsignore examples/org.eclipse.swt.examples/.project examples/org.eclipse.swt.examples/.settings/org.eclipse.jdt.core.prefs examples/org.eclipse.swt.examples/.settings/org.eclipse.pde.prefs examples/org.eclipse.swt.examples/about.html examples/org.eclipse.swt.examples/build.properties examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html examples/org.eclipse.swt.examples/doc-html/swt_browser_ex.html examples/org.eclipse.swt.examples/doc-html/swt_clipboard_ex.html examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html examples/org.eclipse.swt.examples/doc-html/swt_customcontrols_ex.html examples/org.eclipse.swt.examples/doc-html/swt_dnd_ex.html examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html examples/org.eclipse.swt.examples/doc-html/swt_layout_ex.html examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html examples/org.eclipse.swt.examples/doc-html/swt_paint_ex.html examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html examples/org.eclipse.swt.examples/plugin.properties examples/org.eclipse.swt.examples/plugin.xml examples/org.eclipse.swt.examples/src/examples_addressbook.properties examples/org.eclipse.swt.examples/src/examples_browser.properties examples/org.eclipse.swt.examples/src/examples_control.properties examples/org.eclipse.swt.examples/src/examples_fileviewer.properties examples/org.eclipse.swt.examples/src/examples_graphics.properties examples/org.eclipse.swt.examples/src/examples_helloworld.properties examples/org.eclipse.swt.examples/src/examples_hoverhelp.properties examples/org.eclipse.swt.examples/src/examples_images.properties examples/org.eclipse.swt.examples/src/examples_javaviewer.properties examples/org.eclipse.swt.examples/src/examples_layout.properties examples/org.eclipse.swt.examples/src/examples_paint.properties examples/org.eclipse.swt.examples/src/examples_texteditor.properties examples/org.eclipse.swt.examples/src/import.properties examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/BrowserExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/document.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse01.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse02.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse03.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse04.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse05.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse06.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse07.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse08.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse09.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse10.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse11.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/eclipse12.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/MyType.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/MyTypeTransfer.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/BrowserTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CComboTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CLabelTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CanvasTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CustomControlExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DateTimeTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ExpandBarTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/GroupTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LinkTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/MenuTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashFormTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScaleTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SpinnerTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/StyledTextTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TabFolderTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolTipTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/backgroundImage.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/browser-content.html examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/italic.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/italic_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/parentBackgroundImage.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/strikeout.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/strikeout_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/underline.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/underline_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/ImageTransfer.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/AdvancedGraphics.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/AlphaTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/AnimatedGraphicsTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/BallTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/BlackHoleTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CardsTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorListener.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CountDownTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CurvesSWTTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CurvesTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomAlphaTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CustomFontTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/FontBounceTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicAntialiasTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsBackground.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ImageFlipTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ImageScaleTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ImageTransformTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/InterpolationTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/IntroTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/LineCapTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/LineJoinTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/LineStyleTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/LineTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/MazeTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingAnimTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathClippingTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/PathTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RGBTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/RegionClippingTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ShapesTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/SpiralTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/StarPolyTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/TextAntialiasTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ace_club.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ace_diamond.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ace_hearts.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ace_spade.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/alpha_img1.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/alpha_img2.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/back.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/cube.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/db.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/font.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/help.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/home_nav.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/houses.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/irmaos.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/maze.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/next.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ovals.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/pattern1.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/pattern2.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/pattern3.jpg examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/pause.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/play.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/swap.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/swt.png examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/task.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/AirbrushTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/BasicPaintSession.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContainerFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/EllipseFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/EllipseTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/Figure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/FigureDrawContext.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/LineFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/LineTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintExample.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSession.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSurface.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PencilTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PointFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PolyLineTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RectangleFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RectangleTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextFigure.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/TextTool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/Tool.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ToolSettings.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/fill_none.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/fill_outline.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/fill_solid.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/linestyle_dash.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/linestyle_dashdot.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/linestyle_dot.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/linestyle_solid.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/options_font.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_airbrush.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_ellipse.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_line.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_pencil.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_polyline.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_rectangle.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_roundedrectangle.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/tool_text.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/italic.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/italic_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/strikeout.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/strikeout_mask.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/underline.bmp examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/underline_mask.bmp examples/org.eclipse.swt.opengl.examples/.classpath examples/org.eclipse.swt.opengl.examples/.cvsignore examples/org.eclipse.swt.opengl.examples/.project examples/org.eclipse.swt.opengl.examples/about.html examples/org.eclipse.swt.opengl.examples/build.properties examples/org.eclipse.swt.opengl.examples/plugin.properties examples/org.eclipse.swt.opengl.examples/plugin.xml examples/org.eclipse.swt.opengl.examples/src/examples_opengl.properties examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AntialiasingTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AreaTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ColorSelectionGroup.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/GradientTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/IColorSelectionListener.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ImageDataUtil.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LWJGLExample.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LightTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/NurbTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ObjectsTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLExample.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ReflectionTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/StencilTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TextureTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TransparencyTab.java examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Ball.jpg examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Box.bmp examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Floor.jpg examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/splash.bmp examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/untitled.jpg examples/org.eclipse.swt.snippets/.classpath examples/org.eclipse.swt.snippets/.cvsignore examples/org.eclipse.swt.snippets/.project examples/org.eclipse.swt.snippets/about.html examples/org.eclipse.swt.snippets/build.properties examples/org.eclipse.swt.snippets/plugin.properties examples/org.eclipse.swt.snippets/plugin.xml examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet100.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet101.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet102.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet103.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet104.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet105.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet106.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet107.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet109.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet11.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet110.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet112.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet113.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet114.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet116.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet117.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet12.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet120.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet121.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet126.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet129.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet13.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet131.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet137.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet139.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet145.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet148.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet155.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet158.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet160.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet161.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet164.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet166.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet167.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet168.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet17.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet175.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet176.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet177.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet178.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet18.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet181.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet183.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.html examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet188.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet19.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet191.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet192.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet193.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet197.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet198.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet199.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet200.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet201.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet202.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet203.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet204.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet205.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet209.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet216.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet219.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet22.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet221.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet225.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet226.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet227.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet229.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet23.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet230.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet231.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet232.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet233.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet234.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet236.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet238.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet239.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet240.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet241.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet246.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet248.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet249.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet252.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet256.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet259.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet26.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet260.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet261.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet262.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet263.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet264.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet265.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet266.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet267.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet27.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet270.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet271.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet272.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet273.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet277.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet278.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet279.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet28.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet280.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet281.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet283.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet284.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet285.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet286.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet291.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet295.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet296.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet297.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet3.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet30.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet31.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet32.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet34.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet35.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet36.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet37.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet38.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet4.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet40.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet41.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet47.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet48.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet50.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet51.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet52.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet53.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet54.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet55.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet57.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet59.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet61.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet63.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet64.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet65.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet69.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet70.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet71.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet73.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet76.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet77.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet78.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet83.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet85.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet86.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet87.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet88.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet89.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet90.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet91.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet99.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetLauncher.java examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/cancel.gif examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/eclipse.png --- examples/org.eclipse.swt.snippets/.classpath | 7 - examples/org.eclipse.swt.snippets/.cvsignore | 1 - examples/org.eclipse.swt.snippets/.project | 28 -- examples/org.eclipse.swt.snippets/about.html | 22 -- examples/org.eclipse.swt.snippets/build.properties | 11 - .../org.eclipse.swt.snippets/plugin.properties | 12 - examples/org.eclipse.swt.snippets/plugin.xml | 13 - .../src/org/eclipse/swt/snippets/Snippet1.java | 32 --- .../src/org/eclipse/swt/snippets/Snippet10.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet100.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet101.java | 44 --- .../src/org/eclipse/swt/snippets/Snippet102.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet103.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet104.java | 85 ------ .../src/org/eclipse/swt/snippets/Snippet105.java | 30 -- .../src/org/eclipse/swt/snippets/Snippet106.java | 65 ----- .../src/org/eclipse/swt/snippets/Snippet107.java | 77 ----- .../src/org/eclipse/swt/snippets/Snippet108.java | 56 ---- .../src/org/eclipse/swt/snippets/Snippet109.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet11.java | 42 --- .../src/org/eclipse/swt/snippets/Snippet110.java | 76 ----- .../src/org/eclipse/swt/snippets/Snippet111.java | 112 -------- .../src/org/eclipse/swt/snippets/Snippet112.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet113.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet114.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet115.java | 68 ----- .../src/org/eclipse/swt/snippets/Snippet116.java | 61 ---- .../src/org/eclipse/swt/snippets/Snippet117.java | 63 ---- .../src/org/eclipse/swt/snippets/Snippet118.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet119.java | 125 -------- .../src/org/eclipse/swt/snippets/Snippet12.java | 42 --- .../src/org/eclipse/swt/snippets/Snippet120.java | 42 --- .../src/org/eclipse/swt/snippets/Snippet121.java | 38 --- .../src/org/eclipse/swt/snippets/Snippet122.java | 83 ------ .../src/org/eclipse/swt/snippets/Snippet123.java | 198 ------------- .../src/org/eclipse/swt/snippets/Snippet124.java | 100 ------- .../src/org/eclipse/swt/snippets/Snippet125.java | 113 -------- .../src/org/eclipse/swt/snippets/Snippet126.java | 66 ----- .../src/org/eclipse/swt/snippets/Snippet127.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet128.java | 138 --------- .../src/org/eclipse/swt/snippets/Snippet129.java | 78 ----- .../src/org/eclipse/swt/snippets/Snippet13.java | 37 --- .../src/org/eclipse/swt/snippets/Snippet130.java | 84 ------ .../src/org/eclipse/swt/snippets/Snippet131.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet132.java | 64 ----- .../src/org/eclipse/swt/snippets/Snippet133.java | 316 --------------------- .../src/org/eclipse/swt/snippets/Snippet134.java | 97 ------- .../src/org/eclipse/swt/snippets/Snippet135.java | 276 ------------------ .../src/org/eclipse/swt/snippets/Snippet136.java | 52 ---- .../src/org/eclipse/swt/snippets/Snippet137.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet138.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet139.java | 137 --------- .../src/org/eclipse/swt/snippets/Snippet14.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet140.java | 105 ------- .../src/org/eclipse/swt/snippets/Snippet141.java | 157 ---------- .../src/org/eclipse/swt/snippets/Snippet142.java | 70 ----- .../src/org/eclipse/swt/snippets/Snippet143.java | 83 ------ .../src/org/eclipse/swt/snippets/Snippet144.java | 62 ---- .../src/org/eclipse/swt/snippets/Snippet145.java | 66 ----- .../src/org/eclipse/swt/snippets/Snippet146.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet147.java | 61 ---- .../src/org/eclipse/swt/snippets/Snippet148.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet149.java | 59 ---- .../src/org/eclipse/swt/snippets/Snippet15.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet150.java | 78 ----- .../src/org/eclipse/swt/snippets/Snippet151.java | 76 ----- .../src/org/eclipse/swt/snippets/Snippet152.java | 97 ------- .../src/org/eclipse/swt/snippets/Snippet153.java | 58 ---- .../src/org/eclipse/swt/snippets/Snippet154.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet155.java | 56 ---- .../src/org/eclipse/swt/snippets/Snippet156.java | 201 ------------- .../src/org/eclipse/swt/snippets/Snippet157.java | 73 ----- .../src/org/eclipse/swt/snippets/Snippet158.java | 127 --------- .../src/org/eclipse/swt/snippets/Snippet159.java | 68 ----- .../src/org/eclipse/swt/snippets/Snippet16.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet160.java | 76 ----- .../src/org/eclipse/swt/snippets/Snippet161.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet162.java | 132 --------- .../src/org/eclipse/swt/snippets/Snippet163.java | 59 ---- .../src/org/eclipse/swt/snippets/Snippet164.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet165.java | 81 ------ .../src/org/eclipse/swt/snippets/Snippet166.java | 70 ----- .../src/org/eclipse/swt/snippets/Snippet167.java | 75 ----- .../src/org/eclipse/swt/snippets/Snippet168.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet169.java | 54 ---- .../src/org/eclipse/swt/snippets/Snippet17.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet170.java | 63 ---- .../src/org/eclipse/swt/snippets/Snippet171.java | 290 ------------------- .../src/org/eclipse/swt/snippets/Snippet172.java | 88 ------ .../src/org/eclipse/swt/snippets/Snippet173.java | 99 ------- .../src/org/eclipse/swt/snippets/Snippet174.java | 101 ------- .../src/org/eclipse/swt/snippets/Snippet175.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet176.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet177.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet178.java | 131 --------- .../src/org/eclipse/swt/snippets/Snippet179.java | 136 --------- .../src/org/eclipse/swt/snippets/Snippet18.java | 39 --- .../src/org/eclipse/swt/snippets/Snippet180.java | 63 ---- .../src/org/eclipse/swt/snippets/Snippet181.java | 81 ------ .../src/org/eclipse/swt/snippets/Snippet182.java | 40 --- .../src/org/eclipse/swt/snippets/Snippet183.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet184.java | 44 --- .../src/org/eclipse/swt/snippets/Snippet185.java | 122 -------- .../src/org/eclipse/swt/snippets/Snippet186.html | 16 -- .../src/org/eclipse/swt/snippets/Snippet186.java | 202 ------------- .../src/org/eclipse/swt/snippets/Snippet187.html | 16 -- .../src/org/eclipse/swt/snippets/Snippet187.java | 100 ------- .../src/org/eclipse/swt/snippets/Snippet188.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet189.java | 62 ---- .../src/org/eclipse/swt/snippets/Snippet19.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet190.java | 59 ---- .../src/org/eclipse/swt/snippets/Snippet191.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet192.java | 104 ------- .../src/org/eclipse/swt/snippets/Snippet193.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet194.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet195.java | 134 --------- .../src/org/eclipse/swt/snippets/Snippet196.java | 140 --------- .../src/org/eclipse/swt/snippets/Snippet197.java | 54 ---- .../src/org/eclipse/swt/snippets/Snippet198.java | 61 ---- .../src/org/eclipse/swt/snippets/Snippet199.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet2.java | 82 ------ .../src/org/eclipse/swt/snippets/Snippet20.java | 44 --- .../src/org/eclipse/swt/snippets/Snippet200.java | 74 ----- .../src/org/eclipse/swt/snippets/Snippet201.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet202.java | 54 ---- .../src/org/eclipse/swt/snippets/Snippet203.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet204.java | 103 ------- .../src/org/eclipse/swt/snippets/Snippet205.java | 93 ------ .../src/org/eclipse/swt/snippets/Snippet206.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet207.java | 119 -------- .../src/org/eclipse/swt/snippets/Snippet208.java | 110 ------- .../src/org/eclipse/swt/snippets/Snippet209.java | 137 --------- .../src/org/eclipse/swt/snippets/Snippet21.java | 89 ------ .../src/org/eclipse/swt/snippets/Snippet210.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet211.java | 83 ------ .../src/org/eclipse/swt/snippets/Snippet212.java | 153 ---------- .../src/org/eclipse/swt/snippets/Snippet213.java | 54 ---- .../src/org/eclipse/swt/snippets/Snippet214.java | 66 ----- .../src/org/eclipse/swt/snippets/Snippet215.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet216.java | 75 ----- .../src/org/eclipse/swt/snippets/Snippet217.java | 125 -------- .../src/org/eclipse/swt/snippets/Snippet218.java | 71 ----- .../src/org/eclipse/swt/snippets/Snippet219.java | 94 ------ .../src/org/eclipse/swt/snippets/Snippet22.java | 37 --- .../src/org/eclipse/swt/snippets/Snippet220.java | 88 ------ .../src/org/eclipse/swt/snippets/Snippet221.java | 152 ---------- .../src/org/eclipse/swt/snippets/Snippet222.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet223.java | 118 -------- .../src/org/eclipse/swt/snippets/Snippet224.java | 58 ---- .../src/org/eclipse/swt/snippets/Snippet225.java | 60 ---- .../src/org/eclipse/swt/snippets/Snippet226.java | 116 -------- .../src/org/eclipse/swt/snippets/Snippet227.java | 120 -------- .../src/org/eclipse/swt/snippets/Snippet228.java | 88 ------ .../src/org/eclipse/swt/snippets/Snippet229.java | 98 ------- .../src/org/eclipse/swt/snippets/Snippet23.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet230.java | 86 ------ .../src/org/eclipse/swt/snippets/Snippet231.java | 101 ------- .../src/org/eclipse/swt/snippets/Snippet232.java | 96 ------- .../src/org/eclipse/swt/snippets/Snippet233.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet234.java | 123 -------- .../src/org/eclipse/swt/snippets/Snippet235.java | 112 -------- .../src/org/eclipse/swt/snippets/Snippet236.java | 78 ----- .../src/org/eclipse/swt/snippets/Snippet237.java | 77 ----- .../src/org/eclipse/swt/snippets/Snippet238.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet239.java | 95 ------- .../src/org/eclipse/swt/snippets/Snippet24.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet240.java | 100 ------- .../src/org/eclipse/swt/snippets/Snippet241.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet242.java | 55 ---- .../src/org/eclipse/swt/snippets/Snippet243.java | 47 --- .../src/org/eclipse/swt/snippets/Snippet244.java | 55 ---- .../src/org/eclipse/swt/snippets/Snippet245.java | 42 --- .../src/org/eclipse/swt/snippets/Snippet246.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet247.java | 56 ---- .../src/org/eclipse/swt/snippets/Snippet248.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet249.java | 70 ----- .../src/org/eclipse/swt/snippets/Snippet25.java | 145 ---------- .../src/org/eclipse/swt/snippets/Snippet250.java | 52 ---- .../src/org/eclipse/swt/snippets/Snippet251.java | 68 ----- .../src/org/eclipse/swt/snippets/Snippet252.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet253.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet256.java | 60 ---- .../src/org/eclipse/swt/snippets/Snippet257.java | 124 -------- .../src/org/eclipse/swt/snippets/Snippet258.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet259.java | 144 ---------- .../src/org/eclipse/swt/snippets/Snippet26.java | 38 --- .../src/org/eclipse/swt/snippets/Snippet260.java | 47 --- .../src/org/eclipse/swt/snippets/Snippet261.java | 68 ----- .../src/org/eclipse/swt/snippets/Snippet262.java | 95 ------- .../src/org/eclipse/swt/snippets/Snippet263.java | 70 ----- .../src/org/eclipse/swt/snippets/Snippet264.java | 70 ----- .../src/org/eclipse/swt/snippets/Snippet265.java | 96 ------- .../src/org/eclipse/swt/snippets/Snippet266.java | 81 ------ .../src/org/eclipse/swt/snippets/Snippet267.java | 89 ------ .../src/org/eclipse/swt/snippets/Snippet268.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet269.java | 42 --- .../src/org/eclipse/swt/snippets/Snippet27.java | 34 --- .../src/org/eclipse/swt/snippets/Snippet270.java | 89 ------ .../src/org/eclipse/swt/snippets/Snippet271.java | 58 ---- .../src/org/eclipse/swt/snippets/Snippet272.java | 73 ----- .../src/org/eclipse/swt/snippets/Snippet273.java | 101 ------- .../src/org/eclipse/swt/snippets/Snippet274.java | 91 ------ .../src/org/eclipse/swt/snippets/Snippet275.java | 65 ----- .../src/org/eclipse/swt/snippets/Snippet276.java | 47 --- .../src/org/eclipse/swt/snippets/Snippet277.java | 152 ---------- .../src/org/eclipse/swt/snippets/Snippet278.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet279.java | 59 ---- .../src/org/eclipse/swt/snippets/Snippet28.java | 34 --- .../src/org/eclipse/swt/snippets/Snippet280.java | 60 ---- .../src/org/eclipse/swt/snippets/Snippet281.java | 61 ---- .../src/org/eclipse/swt/snippets/Snippet282.java | 108 ------- .../src/org/eclipse/swt/snippets/Snippet283.java | 110 ------- .../src/org/eclipse/swt/snippets/Snippet284.java | 81 ------ .../src/org/eclipse/swt/snippets/Snippet285.java | 106 ------- .../src/org/eclipse/swt/snippets/Snippet286.java | 61 ---- .../src/org/eclipse/swt/snippets/Snippet287.java | 109 ------- .../src/org/eclipse/swt/snippets/Snippet288.java | 188 ------------ .../src/org/eclipse/swt/snippets/Snippet289.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet29.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet290.java | 45 --- .../src/org/eclipse/swt/snippets/Snippet291.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet292.java | 70 ----- .../src/org/eclipse/swt/snippets/Snippet293.java | 51 ---- .../src/org/eclipse/swt/snippets/Snippet294.java | 81 ------ .../src/org/eclipse/swt/snippets/Snippet295.java | 102 ------- .../src/org/eclipse/swt/snippets/Snippet296.java | 80 ------ .../src/org/eclipse/swt/snippets/Snippet297.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet3.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet30.java | 31 -- .../src/org/eclipse/swt/snippets/Snippet31.java | 65 ----- .../src/org/eclipse/swt/snippets/Snippet32.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet33.java | 36 --- .../src/org/eclipse/swt/snippets/Snippet34.java | 46 --- .../src/org/eclipse/swt/snippets/Snippet35.java | 41 --- .../src/org/eclipse/swt/snippets/Snippet36.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet37.java | 38 --- .../src/org/eclipse/swt/snippets/Snippet38.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet39.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet4.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet40.java | 44 --- .../src/org/eclipse/swt/snippets/Snippet41.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet42.java | 28 -- .../src/org/eclipse/swt/snippets/Snippet43.java | 54 ---- .../src/org/eclipse/swt/snippets/Snippet44.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet45.java | 37 --- .../src/org/eclipse/swt/snippets/Snippet46.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet47.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet48.java | 119 -------- .../src/org/eclipse/swt/snippets/Snippet49.java | 48 ---- .../src/org/eclipse/swt/snippets/Snippet5.java | 60 ---- .../src/org/eclipse/swt/snippets/Snippet50.java | 38 --- .../src/org/eclipse/swt/snippets/Snippet51.java | 41 --- .../src/org/eclipse/swt/snippets/Snippet52.java | 41 --- .../src/org/eclipse/swt/snippets/Snippet53.java | 49 ---- .../src/org/eclipse/swt/snippets/Snippet54.java | 41 --- .../src/org/eclipse/swt/snippets/Snippet55.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet56.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet57.java | 39 --- .../src/org/eclipse/swt/snippets/Snippet58.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet59.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet6.java | 61 ---- .../src/org/eclipse/swt/snippets/Snippet60.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet61.java | 76 ----- .../src/org/eclipse/swt/snippets/Snippet62.java | 66 ----- .../src/org/eclipse/swt/snippets/Snippet63.java | 57 ---- .../src/org/eclipse/swt/snippets/Snippet64.java | 56 ---- .../src/org/eclipse/swt/snippets/Snippet65.java | 81 ------ .../src/org/eclipse/swt/snippets/Snippet66.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet67.java | 55 ---- .../src/org/eclipse/swt/snippets/Snippet68.java | 60 ---- .../src/org/eclipse/swt/snippets/Snippet69.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet7.java | 63 ---- .../src/org/eclipse/swt/snippets/Snippet70.java | 67 ----- .../src/org/eclipse/swt/snippets/Snippet71.java | 58 ---- .../src/org/eclipse/swt/snippets/Snippet72.java | 39 --- .../src/org/eclipse/swt/snippets/Snippet73.java | 59 ---- .../src/org/eclipse/swt/snippets/Snippet74.java | 35 --- .../src/org/eclipse/swt/snippets/Snippet75.java | 100 ------- .../src/org/eclipse/swt/snippets/Snippet76.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet77.java | 82 ------ .../src/org/eclipse/swt/snippets/Snippet78.java | 75 ----- .../src/org/eclipse/swt/snippets/Snippet79.java | 193 ------------- .../src/org/eclipse/swt/snippets/Snippet8.java | 72 ----- .../src/org/eclipse/swt/snippets/Snippet80.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet81.java | 157 ---------- .../src/org/eclipse/swt/snippets/Snippet82.java | 69 ----- .../src/org/eclipse/swt/snippets/Snippet83.java | 169 ----------- .../src/org/eclipse/swt/snippets/Snippet84.java | 98 ------- .../src/org/eclipse/swt/snippets/Snippet85.java | 53 ---- .../src/org/eclipse/swt/snippets/Snippet86.java | 37 --- .../src/org/eclipse/swt/snippets/Snippet87.java | 43 --- .../src/org/eclipse/swt/snippets/Snippet88.java | 84 ------ .../src/org/eclipse/swt/snippets/Snippet89.java | 50 ---- .../src/org/eclipse/swt/snippets/Snippet9.java | 85 ------ .../src/org/eclipse/swt/snippets/Snippet90.java | 51 ---- .../src/org/eclipse/swt/snippets/Snippet91.java | 157 ---------- .../src/org/eclipse/swt/snippets/Snippet92.java | 77 ----- .../src/org/eclipse/swt/snippets/Snippet93.java | 42 --- .../src/org/eclipse/swt/snippets/Snippet94.java | 83 ------ .../src/org/eclipse/swt/snippets/Snippet95.java | 77 ----- .../src/org/eclipse/swt/snippets/Snippet96.java | 172 ----------- .../src/org/eclipse/swt/snippets/Snippet97.java | 55 ---- .../src/org/eclipse/swt/snippets/Snippet98.java | 66 ----- .../src/org/eclipse/swt/snippets/Snippet99.java | 43 --- .../org/eclipse/swt/snippets/SnippetLauncher.java | 95 ------- .../src/org/eclipse/swt/snippets/cancel.gif | Bin 143 -> 0 bytes .../src/org/eclipse/swt/snippets/eclipse.png | Bin 3353 -> 0 bytes 307 files changed, 22789 deletions(-) delete mode 100644 examples/org.eclipse.swt.snippets/.classpath delete mode 100644 examples/org.eclipse.swt.snippets/.cvsignore delete mode 100644 examples/org.eclipse.swt.snippets/.project delete mode 100644 examples/org.eclipse.swt.snippets/about.html delete mode 100644 examples/org.eclipse.swt.snippets/build.properties delete mode 100644 examples/org.eclipse.swt.snippets/plugin.properties delete mode 100644 examples/org.eclipse.swt.snippets/plugin.xml delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet100.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet101.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet102.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet103.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet104.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet105.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet106.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet107.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet109.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet11.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet110.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet112.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet113.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet114.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet116.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet117.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet12.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet120.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet121.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet126.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet129.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet13.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet131.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet137.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet139.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet145.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet148.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet155.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet158.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet160.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet161.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet164.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet166.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet167.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet168.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet17.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet175.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet176.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet177.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet178.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet18.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet181.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet183.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.html delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet188.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet19.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet191.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet192.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet193.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet197.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet198.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet199.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet200.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet201.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet202.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet203.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet204.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet205.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet209.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet216.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet219.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet22.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet221.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet225.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet226.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet227.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet228.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet229.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet23.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet230.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet231.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet232.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet233.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet234.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet236.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet238.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet239.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet240.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet241.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet243.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet246.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet248.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet249.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet252.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet256.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet257.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet259.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet26.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet260.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet261.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet262.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet263.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet264.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet265.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet266.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet267.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet27.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet270.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet271.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet272.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet273.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet274.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet277.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet278.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet279.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet28.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet280.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet281.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet283.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet284.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet285.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet286.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet287.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet291.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet295.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet296.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet297.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet3.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet30.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet31.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet32.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet34.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet35.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet36.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet37.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet38.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet4.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet40.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet41.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet47.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet48.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet50.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet51.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet52.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet53.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet54.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet55.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet57.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet59.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet61.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet63.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet64.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet65.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet69.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet70.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet71.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet73.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet76.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet77.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet78.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet83.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet85.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet86.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet87.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet88.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet89.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet90.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet91.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet99.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetLauncher.java delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/cancel.gif delete mode 100644 examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/eclipse.png (limited to 'examples/org.eclipse.swt.snippets') diff --git a/examples/org.eclipse.swt.snippets/.classpath b/examples/org.eclipse.swt.snippets/.classpath deleted file mode 100644 index 751c8f2e50..0000000000 --- a/examples/org.eclipse.swt.snippets/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/examples/org.eclipse.swt.snippets/.cvsignore b/examples/org.eclipse.swt.snippets/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.snippets/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/.project b/examples/org.eclipse.swt.snippets/.project deleted file mode 100644 index da5ce161c6..0000000000 --- a/examples/org.eclipse.swt.snippets/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.swt.snippets - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - diff --git a/examples/org.eclipse.swt.snippets/about.html b/examples/org.eclipse.swt.snippets/about.html deleted file mode 100644 index 6f6b96c4c8..0000000000 --- a/examples/org.eclipse.swt.snippets/about.html +++ /dev/null @@ -1,22 +0,0 @@ - - - -About - - - -

About This Content

- -

February 24, 2005

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content.

- - - \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/build.properties b/examples/org.eclipse.swt.snippets/build.properties deleted file mode 100644 index ceaaa93d20..0000000000 --- a/examples/org.eclipse.swt.snippets/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2004 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -source.swtsnippets.jar = src/ diff --git a/examples/org.eclipse.swt.snippets/plugin.properties b/examples/org.eclipse.swt.snippets/plugin.properties deleted file mode 100644 index d1e0212280..0000000000 --- a/examples/org.eclipse.swt.snippets/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2004 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -pluginName = SWT Snippets -providerName = Eclipse.org diff --git a/examples/org.eclipse.swt.snippets/plugin.xml b/examples/org.eclipse.swt.snippets/plugin.xml deleted file mode 100644 index b73d5a6407..0000000000 --- a/examples/org.eclipse.swt.snippets/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java deleted file mode 100644 index 7ba0b1ce28..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: Hello World - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.widgets.*; - -public class Snippet1 { - -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 (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.java deleted file mode 100644 index 1b74eb9e85..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Draw using transformations, paths and alpha blending - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet10 { - public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setText("Advanced Graphics"); - FontData fd = shell.getFont().getFontData()[0]; - final Font font = new Font(display, fd.getName(), 60, SWT.BOLD | SWT.ITALIC); - final Image image = new Image(display, 640, 480); - final Rectangle rect = image.getBounds(); - GC gc = new GC(image); - gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); - gc.fillOval(rect.x, rect.y, rect.width, rect.height); - gc.dispose(); - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event event) { - GC gc = event.gc; - Transform tr = new Transform(display); - tr.translate(50, 120); - tr.rotate(-30); - gc.drawImage(image, 0, 0, rect.width, rect.height, 0, 0, rect.width / 2, rect.height / 2); - gc.setAlpha(100); - gc.setTransform(tr); - Path path = new Path(display); - path.addString("SWT", 0, 0, font); - gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); - gc.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); - gc.fillPath(path); - gc.drawPath(path); - tr.dispose(); - path.dispose(); - } - }); - shell.setSize(shell.computeSize(rect.width / 2, rect.height / 2)); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - image.dispose(); - font.dispose(); - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet100.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet100.java deleted file mode 100644 index 2fff80ae56..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet100.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Font example snippet: create a large font for use by a text widget - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet100 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setBounds(10, 10, 200, 200); - Text text = new Text(shell, SWT.MULTI); - text.setBounds(10, 10, 150, 150); - Font initialFont = text.getFont(); - FontData[] fontData = initialFont.getFontData(); - for (int i = 0; i < fontData.length; i++) { - fontData[i].setHeight(24); - } - Font newFont = new Font(display, fontData); - text.setFont(newFont); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - newFont.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet101.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet101.java deleted file mode 100644 index d70e976232..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet101.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: insert a table item (at an index) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet101 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Table table = new Table (shell, SWT.BORDER | SWT.MULTI); - table.setSize (200, 200); - for (int i=0; i<12; i++) { - TableItem item = new TableItem (table, SWT.NONE); - item.setText ("Item " + i); - } - TableItem item = new TableItem (table, SWT.NONE, 1); - item.setText ("*** New Item " + table.indexOf (item) + " ***"); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet102.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet102.java deleted file mode 100644 index 23056b65ce..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet102.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tree example snippet: insert a tree item (at an index) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet102 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI); - tree.setSize (200, 200); - for (int i=0; i<12; i++) { - TreeItem item = new TreeItem (tree, SWT.NONE); - item.setText ("Item " + i); - } - TreeItem item = new TreeItem (tree, SWT.NONE, 1); - TreeItem [] items = tree.getItems (); - int index = 0; - while (index < items.length && items [index] != item) index++; - item.setText ("*** New Item " + index + " ***"); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet103.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet103.java deleted file mode 100644 index 5ab73fb70a..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet103.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: update table item text - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet103 { - -static char content = 'a'; -public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setBounds(10, 10, 200, 240); - Table table = new Table(shell, SWT.NONE); - table.setBounds(10, 10, 160, 160); - - final TableItem[] items = new TableItem[4]; - for (int i = 0; i < 4; i++) { - new TableColumn(table, SWT.NONE).setWidth(40); - } - for (int i = 0; i < 4; i++) { - items[i] = new TableItem(table, SWT.NONE); - populateItem(items[i]); - } - - Button button = new Button(shell, SWT.PUSH); - button.setText("Change"); - button.pack(); - button.setLocation(10, 180); - button.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - for (int i = 0; i < 4; i++) { - populateItem(items[i]); - } - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} - -static void populateItem(TableItem item) { - String stringContent = String.valueOf(content); - item.setText( - new String[] { - stringContent, - stringContent, - stringContent, - stringContent }); - content++; - if (content > 'z') content = 'a'; -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet104.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet104.java deleted file mode 100644 index 4dd38d2313..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet104.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Shell example snippet: create a splash screen - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet104 { - -public static void main(String[] args) { - final Display display = new Display(); - final int [] count = new int [] {4}; - final Image image = new Image(display, 300, 300); - GC gc = new GC(image); - gc.setBackground(display.getSystemColor(SWT.COLOR_CYAN)); - gc.fillRectangle(image.getBounds()); - gc.drawText("Splash Screen", 10, 10); - gc.dispose(); - final Shell splash = new Shell(SWT.ON_TOP); - final ProgressBar bar = new ProgressBar(splash, SWT.NONE); - bar.setMaximum(count[0]); - Label label = new Label(splash, SWT.NONE); - label.setImage(image); - FormLayout layout = new FormLayout(); - splash.setLayout(layout); - FormData labelData = new FormData (); - labelData.right = new FormAttachment (100, 0); - labelData.bottom = new FormAttachment (100, 0); - label.setLayoutData(labelData); - FormData progressData = new FormData (); - progressData.left = new FormAttachment (0, 5); - progressData.right = new FormAttachment (100, -5); - progressData.bottom = new FormAttachment (100, -5); - bar.setLayoutData(progressData); - splash.pack(); - Rectangle splashRect = splash.getBounds(); - Rectangle displayRect = display.getBounds(); - int x = (displayRect.width - splashRect.width) / 2; - int y = (displayRect.height - splashRect.height) / 2; - splash.setLocation(x, y); - splash.open(); - display.asyncExec(new Runnable() { - public void run() { - Shell [] shells = new Shell[count[0]]; - for (int i=0; i 0); - // is paste valid? - TransferData[] available = cb.getAvailableTypes(); - boolean enabled = false; - for (int i = 0; i < available.length; i++) { - if (TextTransfer.getInstance().isSupportedType(available[i])) { - enabled = true; - break; - } - } - pasteItem.setEnabled(enabled); - } - }); - text.setMenu (menu); - - shell.setSize(200, 200); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - cb.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java deleted file mode 100644 index 2dc6dfcb12..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * OLE and ActiveX example snippet: get events from IE control (win32 only) - * - * This snippet only runs as-is on 32-bit architectures because it uses - * java integers to represent native pointers. "long" comments are included - * throughout the snippet to show where int should be changed to long in - * order to run on a 64-bit architecture. - * - * NOTE: This snippet uses internal SWT packages that are - * subject to change without notice. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.ole.win32.*; -import org.eclipse.swt.internal.ole.win32.*; -import org.eclipse.swt.internal.win32.OS; - -public class Snippet123 { - -public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - OleControlSite controlSite; - try { - OleFrame frame = new OleFrame(shell, SWT.NONE); - controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer"); - controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE); - } catch (SWTError e) { - System.out.println("Unable to open activeX control"); - return; - } - shell.open(); - - // IWebBrowser - final OleAutomation webBrowser = new OleAutomation(controlSite); - - // When a new document is loaded, access the document object for the new page. - int DownloadComplete = 104; - controlSite.addEventListener(DownloadComplete, new OleListener() { - public void handleEvent(OleEvent event) { - int[] htmlDocumentID = webBrowser.getIDsOfNames(new String[]{"Document"}); - if (htmlDocumentID == null) return; - Variant pVarResult = webBrowser.getProperty(htmlDocumentID[0]); - if (pVarResult == null || pVarResult.getType() == 0) return; - //IHTMLDocument2 - OleAutomation htmlDocument = pVarResult.getAutomation(); - - // Request to be notified of click, double click and key down events - EventDispatch myDispatch = new EventDispatch(EventDispatch.onclick); - IDispatch idispatch = new IDispatch(myDispatch.getAddress()); - Variant dispatch = new Variant(idispatch); - htmlDocument.setProperty(EventDispatch.onclick, dispatch); - - myDispatch = new EventDispatch(EventDispatch.ondblclick); - idispatch = new IDispatch(myDispatch.getAddress()); - dispatch = new Variant(idispatch); - htmlDocument.setProperty(EventDispatch.ondblclick, dispatch); - - myDispatch = new EventDispatch(EventDispatch.onkeydown); - idispatch = new IDispatch(myDispatch.getAddress()); - dispatch = new Variant(idispatch); - htmlDocument.setProperty(EventDispatch.onkeydown, dispatch); - - //Remember to release OleAutomation Object - htmlDocument.dispose(); - } - }); - - // Navigate to a web site - int[] ids = webBrowser.getIDsOfNames(new String[]{"Navigate", "URL"}); - Variant[] rgvarg = new Variant[] {new Variant("http://www.google.com")}; - int[] rgdispidNamedArgs = new int[]{ids[1]}; - webBrowser.invoke(ids[0], rgvarg, rgdispidNamedArgs); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - //Remember to release OleAutomation Object - webBrowser.dispose(); - display.dispose(); - -} -} -// EventDispatch implements a simple IDispatch interface which will be called -// when the event is fired. -class EventDispatch { - private COMObject iDispatch; - private int refCount = 0; - private int eventID; - - final static int onhelp = 0x8001177d; - final static int onclick = 0x80011778; - final static int ondblclick = 0x80011779; - final static int onkeyup = 0x80011776; - final static int onkeydown = 0x80011775; - final static int onkeypress = 0x80011777; - final static int onmouseup = 0x80011773; - final static int onmousedown = 0x80011772; - final static int onmousemove = 0x80011774; - final static int onmouseout = 0x80011771; - final static int onmouseover = 0x80011770; - final static int onreadystatechange = 0x80011789; - final static int onafterupdate = 0x80011786; - final static int onrowexit= 0x80011782; - final static int onrowenter = 0x80011783; - final static int ondragstart = 0x80011793; - final static int onselectstart = 0x80011795; - - EventDispatch(int eventID) { - this.eventID = eventID; - createCOMInterfaces(); - } - int /*long*/ getAddress() { - return iDispatch.getAddress(); - } - private void createCOMInterfaces() { - iDispatch = new COMObject(new int[]{2, 0, 0, 1, 3, 4, 8}){ - public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);} - public int /*long*/ method1(int /*long*/[] args) {return AddRef();} - public int /*long*/ method2(int /*long*/[] args) {return Release();} - // method3 GetTypeInfoCount - not implemented - // method4 GetTypeInfo - not implemented - // method5 GetIDsOfNames - not implemented - public int /*long*/ method6(int /*long*/[] args) {return Invoke((int)/*64*/args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7]);} - }; - } - private void disposeCOMInterfaces() { - if (iDispatch != null) - iDispatch.dispose(); - iDispatch = null; - - } - private int AddRef() { - refCount++; - return refCount; - } - private int Invoke(int dispIdMember, int /*long*/ riid, int lcid, int dwFlags, int /*long*/ pDispParams, int /*long*/ pVarResult, int /*long*/ pExcepInfo, int /*long*/ pArgErr) { - switch (eventID) { - case onhelp: System.out.println("onhelp"); break; - case onclick: System.out.println("onclick"); break; - case ondblclick: System.out.println("ondblclick"); break; - case onkeyup: System.out.println("onkeyup"); break; - case onkeydown: System.out.println("onkeydown"); break; - case onkeypress: System.out.println("onkeypress"); break; - case onmouseup: System.out.println("onmouseup"); break; - case onmousedown: System.out.println("onmousedown"); break; - case onmousemove: System.out.println("onmousemove"); break; - case onmouseout: System.out.println("onmouseout"); break; - case onmouseover: System.out.println("onmouseover"); break; - case onreadystatechange: System.out.println("onreadystatechange"); break; - case onafterupdate: System.out.println("onafterupdate"); break; - case onrowexit: System.out.println("onrowexit"); break; - case onrowenter: System.out.println("onrowenter"); break; - case ondragstart: System.out.println("ondragstart"); break; - case onselectstart: System.out.println("onselectstart"); break; - } - return COM.S_OK; - } - private int QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) { - if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG; - GUID guid = new GUID(); - COM.MoveMemory(guid, riid, GUID.sizeof); - - if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch)) { - COM.MoveMemory(ppvObject, new int /*long*/[] {iDispatch.getAddress()}, OS.PTR_SIZEOF); - AddRef(); - return COM.S_OK; - } - COM.MoveMemory(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF); - return COM.E_NOINTERFACE; - } - int Release() { - refCount--; - if (refCount == 0) { - disposeCOMInterfaces(); - } - return refCount; - } -} - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java deleted file mode 100644 index 6b01fbd5b2..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TableEditor example snippet: edit a cell in a table (in place, fancy) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.custom.*; - -public class Snippet124 { -public static void main (String[] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout (new FillLayout ()); - final Table table = new Table(shell, SWT.BORDER | SWT.MULTI); - table.setLinesVisible (true); - for (int i=0; i<3; i++) { - TableColumn column = new TableColumn (table, SWT.NONE); - column.setWidth(100); - } - for (int i=0; i<3; i++) { - TableItem item = new TableItem (table, SWT.NONE); - item.setText(new String [] {"" + i, "" + i , "" + i}); - } - final TableEditor editor = new TableEditor (table); - editor.horizontalAlignment = SWT.LEFT; - editor.grabHorizontal = true; - table.addListener (SWT.MouseDown, new Listener () { - public void handleEvent (Event event) { - Rectangle clientArea = table.getClientArea (); - Point pt = new Point (event.x, event.y); - int index = table.getTopIndex (); - while (index < table.getItemCount ()) { - boolean visible = false; - final TableItem item = table.getItem (index); - for (int i=0; i 0) { - buffer.append(readBuffer, 0, n); - } - textString = buffer.toString(); - stream.close(); - } catch (IOException e) { - MessageBox box = new MessageBox(shell, SWT.ICON_ERROR); - box.setMessage("Error reading file:\n" + name); - box.open(); - return; - } - } catch (FileNotFoundException e) { - MessageBox box = new MessageBox(shell, SWT.ICON_ERROR); - box.setMessage("File not found:\n" + name); - box.open(); - return; - } - text.setText(textString); - } - - void menuFont() { - FontDialog fontDialog = new FontDialog(shell); - fontDialog.setFontList(text.getFont().getFontData()); - FontData fontData = fontDialog.open(); - if (fontData != null) { - if (font != null) font.dispose(); - font = new Font(display, fontData); - text.setFont(font); - } - } - - void menuForegroundColor() { - ColorDialog colorDialog = new ColorDialog(shell); - colorDialog.setRGB(text.getForeground().getRGB()); - RGB rgb = colorDialog.open(); - if (rgb != null) { - if (foregroundColor != null) foregroundColor.dispose(); - foregroundColor = new Color(display, rgb); - text.setForeground(foregroundColor); - } - } - - void menuBackgroundColor() { - ColorDialog colorDialog = new ColorDialog(shell); - colorDialog.setRGB(text.getBackground().getRGB()); - RGB rgb = colorDialog.open(); - if (rgb != null) { - if (backgroundColor != null) backgroundColor.dispose(); - backgroundColor = new Color(display, rgb); - text.setBackground(backgroundColor); - } - } - - void menuPrint() { - PrintDialog dialog = new PrintDialog(shell, SWT.NONE); - PrinterData data = dialog.open(); - if (data == null) return; - if (data.printToFile) { - data.fileName = "print.out"; // you probably want to ask the user for a filename - } - - /* Get the text to print from the Text widget (you could get it from anywhere, i.e. your java model) */ - textToPrint = text.getText(); - - /* Get the font & foreground & background data. */ - printerFontData = text.getFont().getFontData(); - printerForeground = text.getForeground().getRGB(); - printerBackground = text.getBackground().getRGB(); - - /* Do the printing in a background thread so that spooling does not freeze the UI. */ - printer = new Printer(data); - Thread printingThread = new Thread("Printing") { - public void run() { - print(printer); - printer.dispose(); - } - }; - printingThread.start(); - } - - void print(Printer printer) { - if (printer.startJob("Text")) { // the string is the job name - shows up in the printer's job list - Rectangle clientArea = printer.getClientArea(); - Rectangle trim = printer.computeTrim(0, 0, 0, 0); - Point dpi = printer.getDPI(); - leftMargin = dpi.x + trim.x; // one inch from left side of paper - rightMargin = clientArea.width - dpi.x + trim.x + trim.width; // one inch from right side of paper - topMargin = dpi.y + trim.y; // one inch from top edge of paper - bottomMargin = clientArea.height - dpi.y + trim.y + trim.height; // one inch from bottom edge of paper - - /* Create a buffer for computing tab width. */ - int tabSize = 4; // is tab width a user setting in your UI? - StringBuffer tabBuffer = new StringBuffer(tabSize); - for (int i = 0; i < tabSize; i++) tabBuffer.append(' '); - tabs = tabBuffer.toString(); - - /* Create printer GC, and create and set the printer font & foreground color. */ - gc = new GC(printer); - Font printerFont = new Font(printer, printerFontData); - Color printerForegroundColor = new Color(printer, printerForeground); - Color printerBackgroundColor = new Color(printer, printerBackground); - - gc.setFont(printerFont); - gc.setForeground(printerForegroundColor); - gc.setBackground(printerBackgroundColor); - tabWidth = gc.stringExtent(tabs).x; - lineHeight = gc.getFontMetrics().getHeight(); - - /* Print text to current gc using word wrap */ - printText(); - printer.endJob(); - - /* Cleanup graphics resources used in printing */ - printerFont.dispose(); - printerForegroundColor.dispose(); - printerBackgroundColor.dispose(); - gc.dispose(); - } - } - - void printText() { - printer.startPage(); - wordBuffer = new StringBuffer(); - x = leftMargin; - y = topMargin; - index = 0; - end = textToPrint.length(); - while (index < end) { - char c = textToPrint.charAt(index); - index++; - if (c != 0) { - if (c == 0x0a || c == 0x0d) { - if (c == 0x0d && index < end && textToPrint.charAt(index) == 0x0a) { - index++; // if this is cr-lf, skip the lf - } - printWordBuffer(); - newline(); - } else { - if (c != '\t') { - wordBuffer.append(c); - } - if (Character.isWhitespace(c)) { - printWordBuffer(); - if (c == '\t') { - x += tabWidth; - } - } - } - } - } - if (y + lineHeight <= bottomMargin) { - printer.endPage(); - } - } - - void printWordBuffer() { - if (wordBuffer.length() > 0) { - String word = wordBuffer.toString(); - int wordWidth = gc.stringExtent(word).x; - if (x + wordWidth > rightMargin) { - /* word doesn't fit on current line, so wrap */ - newline(); - } - gc.drawString(word, x, y, false); - x += wordWidth; - wordBuffer = new StringBuffer(); - } - } - - void newline() { - x = leftMargin; - y += lineHeight; - if (y + lineHeight > bottomMargin) { - printer.endPage(); - if (index + 1 < end) { - y = topMargin; - printer.startPage(); - } - } - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.java deleted file mode 100644 index c8d819a826..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Shell example snippet: create a non-rectangular window - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet134 { - -static int[] circle(int r, int offsetX, int offsetY) { - int[] polygon = new int[8 * r + 4]; - //x^2 + y^2 = r^2 - for (int i = 0; i < 2 * r + 1; i++) { - int x = i - r; - int y = (int)Math.sqrt(r*r - x*x); - polygon[2*i] = offsetX + x; - polygon[2*i+1] = offsetY + y; - polygon[8*r - 2*i - 2] = offsetX + x; - polygon[8*r - 2*i - 1] = offsetY - y; - } - return polygon; -} - -public static void main(String[] args) { - final Display display = new Display(); - //Shell must be created with style SWT.NO_TRIM - final Shell shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP); - shell.setBackground(display.getSystemColor(SWT.COLOR_RED)); - //define a region that looks like a key hole - Region region = new Region(); - region.add(circle(67, 67, 67)); - region.subtract(circle(20, 67, 50)); - region.subtract(new int[]{67, 50, 55, 105, 79, 105}); - //define the shape of the shell using setRegion - shell.setRegion(region); - Rectangle size = region.getBounds(); - shell.setSize(size.width, size.height); - //add ability to move shell around - Listener l = new Listener() { - Point origin; - public void handleEvent(Event e) { - switch (e.type) { - case SWT.MouseDown: - origin = new Point(e.x, e.y); - break; - case SWT.MouseUp: - origin = null; - break; - case SWT.MouseMove: - if (origin != null) { - Point p = display.map(shell, null, e.x, e.y); - shell.setLocation(p.x - origin.x, p.y - origin.y); - } - break; - } - } - }; - shell.addListener(SWT.MouseDown, l); - shell.addListener(SWT.MouseUp, l); - shell.addListener(SWT.MouseMove, l); - //add ability to close shell - Button b = new Button(shell, SWT.PUSH); - b.setBackground(shell.getBackground()); - b.setText("close"); - b.pack(); - b.setLocation(10, 68); - b.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - shell.close(); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - region.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java deleted file mode 100644 index b28f714121..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: embed Swing/AWT in SWT - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import java.awt.EventQueue; -import java.io.*; -import java.util.*; -import javax.swing.*; -import javax.swing.table.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.awt.SWT_AWT; - -public class Snippet135 { - - static class FileTableModel extends AbstractTableModel { - File[] files; - String[] columnsName = {"Name", "Size", "Date Modified"}; - - public FileTableModel (File[] files) { - this.files = files; - } - public int getColumnCount () { - return columnsName.length; - } - public Class getColumnClass (int col) { - if (col == 1) return Long.class; - if (col == 2) return Date.class; - return String.class; - } - public int getRowCount () { - return files == null ? 0 : files.length; - } - public Object getValueAt (int row, int col) { - if (col == 0) return files[row].getName(); - if (col == 1) return new Long(files[row].length()); - if (col == 2) return new Date(files[row].lastModified()); - return ""; - } - public String getColumnName (int col) { - return columnsName[col]; - } - } - - public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setText("SWT and Swing/AWT Example"); - - Listener exitListener = new Listener() { - public void handleEvent(Event e) { - MessageBox dialog = new MessageBox(shell, SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION); - dialog.setText("Question"); - dialog.setMessage("Exit?"); - if (e.type == SWT.Close) e.doit = false; - if (dialog.open() != SWT.OK) return; - shell.dispose(); - } - }; - Listener aboutListener = new Listener() { - public void handleEvent(Event e) { - final Shell s = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); - s.setText("About"); - GridLayout layout = new GridLayout(1, false); - layout.verticalSpacing = 20; - layout.marginHeight = layout.marginWidth = 10; - s.setLayout(layout); - Label label = new Label(s, SWT.NONE); - label.setText("SWT and AWT Example."); - Button button = new Button(s, SWT.PUSH); - button.setText("OK"); - GridData data = new GridData(); - data.horizontalAlignment = GridData.CENTER; - button.setLayoutData(data); - button.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - s.dispose(); - } - }); - s.pack(); - Rectangle parentBounds = shell.getBounds(); - Rectangle bounds = s.getBounds(); - int x = parentBounds.x + (parentBounds.width - bounds.width) / 2; - int y = parentBounds.y + (parentBounds.height - bounds.height) / 2; - s.setLocation(x, y); - s.open(); - while (!s.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - } - }; - shell.addListener(SWT.Close, exitListener); - Menu mb = new Menu(shell, SWT.BAR); - MenuItem fileItem = new MenuItem(mb, SWT.CASCADE); - fileItem.setText("&File"); - Menu fileMenu = new Menu(shell, SWT.DROP_DOWN); - fileItem.setMenu(fileMenu); - MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); - exitItem.setText("&Exit\tCtrl+X"); - exitItem.setAccelerator(SWT.CONTROL + 'X'); - exitItem.addListener(SWT.Selection, exitListener); - MenuItem aboutItem = new MenuItem(fileMenu, SWT.PUSH); - aboutItem.setText("&About\tCtrl+A"); - aboutItem.setAccelerator(SWT.CONTROL + 'A'); - aboutItem.addListener(SWT.Selection, aboutListener); - shell.setMenuBar(mb); - - RGB color = shell.getBackground().getRGB(); - Label separator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); - Label locationLb = new Label(shell, SWT.NONE); - locationLb.setText("Location:"); - Composite locationComp = new Composite(shell, SWT.EMBEDDED); - ToolBar toolBar = new ToolBar(shell, SWT.FLAT); - ToolItem exitToolItem = new ToolItem(toolBar, SWT.PUSH); - exitToolItem.setText("&Exit"); - exitToolItem.addListener(SWT.Selection, exitListener); - ToolItem aboutToolItem = new ToolItem(toolBar, SWT.PUSH); - aboutToolItem.setText("&About"); - aboutToolItem.addListener(SWT.Selection, aboutListener); - Label separator2 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); - final Composite comp = new Composite(shell, SWT.NONE); - final Tree fileTree = new Tree(comp, SWT.SINGLE | SWT.BORDER); - Sash sash = new Sash(comp, SWT.VERTICAL); - Composite tableComp = new Composite(comp, SWT.EMBEDDED); - Label separator3 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); - Composite statusComp = new Composite(shell, SWT.EMBEDDED); - - java.awt.Frame locationFrame = SWT_AWT.new_Frame(locationComp); - final java.awt.TextField locationText = new java.awt.TextField(); - locationFrame.add(locationText); - - java.awt.Frame fileTableFrame = SWT_AWT.new_Frame(tableComp); - java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout()); - fileTableFrame.add(panel); - final JTable fileTable = new JTable(new FileTableModel(null)); - fileTable.setDoubleBuffered(true); - fileTable.setShowGrid(false); - fileTable.createDefaultColumnsFromModel(); - JScrollPane scrollPane = new JScrollPane(fileTable); - panel.add(scrollPane); - - java.awt.Frame statusFrame = SWT_AWT.new_Frame(statusComp); - statusFrame.setBackground(new java.awt.Color(color.red, color.green, color.blue)); - final java.awt.Label statusLabel = new java.awt.Label(); - statusFrame.add(statusLabel); - statusLabel.setText("Select a file"); - - sash.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (e.detail == SWT.DRAG) return; - GridData data = (GridData)fileTree.getLayoutData(); - Rectangle trim = fileTree.computeTrim(0, 0, 0, 0); - data.widthHint = e.x - trim.width; - comp.layout(); - } - }); - - File[] roots = File.listRoots(); - for (int i = 0; i < roots.length; i++) { - File file = roots[i]; - TreeItem treeItem = new TreeItem(fileTree, SWT.NONE); - treeItem.setText(file.getAbsolutePath()); - treeItem.setData(file); - new TreeItem(treeItem, SWT.NONE); - } - fileTree.addListener(SWT.Expand, new Listener() { - public void handleEvent(Event e) { - TreeItem item = (TreeItem)e.item; - if (item == null) return; - if (item.getItemCount() == 1) { - TreeItem firstItem = item.getItems()[0]; - if (firstItem.getData() != null) return; - firstItem.dispose(); - } else { - return; - } - File root = (File)item.getData(); - File[] files = root.listFiles(); - if (files == null) return; - for (int i = 0; i < files.length; i++) { - File file = files[i]; - if (file.isDirectory()) { - TreeItem treeItem = new TreeItem(item, SWT.NONE); - treeItem.setText(file.getName()); - treeItem.setData(file); - new TreeItem(treeItem, SWT.NONE); - } - } - } - }); - fileTree.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - TreeItem item = (TreeItem)e.item; - if (item == null) return; - final File root = (File)item.getData(); - EventQueue.invokeLater(new Runnable() { - public void run() { - statusLabel.setText(root.getAbsolutePath()); - locationText.setText(root.getAbsolutePath()); - fileTable.setModel(new FileTableModel(root.listFiles())); - } - }); - } - }); - - GridLayout layout = new GridLayout(4, false); - layout.marginWidth = layout.marginHeight = 0; - layout.horizontalSpacing = layout.verticalSpacing = 1; - shell.setLayout(layout); - GridData data; - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 4; - separator1.setLayoutData(data); - data = new GridData(); - data.horizontalSpan = 1; - data.horizontalIndent = 10; - locationLb.setLayoutData(data); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - data.heightHint = locationText.getPreferredSize().height; - locationComp.setLayoutData(data); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 1; - toolBar.setLayoutData(data); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 4; - separator2.setLayoutData(data); - data = new GridData(GridData.FILL_BOTH); - data.horizontalSpan = 4; - comp.setLayoutData(data); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 4; - separator3.setLayoutData(data); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 4; - data.heightHint = statusLabel.getPreferredSize().height; - statusComp.setLayoutData(data); - - layout = new GridLayout(3, false); - layout.marginWidth = layout.marginHeight = 0; - layout.horizontalSpacing = layout.verticalSpacing = 1; - comp.setLayout(layout); - data = new GridData(GridData.FILL_VERTICAL); - data.widthHint = 200; - fileTree.setLayoutData(data); - data = new GridData(GridData.FILL_VERTICAL); - sash.setLayoutData(data); - data = new GridData(GridData.FILL_BOTH); - tableComp.setLayoutData(data); - - shell.open(); - while(!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java deleted file mode 100644 index d7150ac335..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Browser example snippet: render HTML from memory - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet136 { - public static void main(String [] args) { - String html = "HTML Test"; - for (int i = 0; i < 100; i++) html += "

This is line "+i+"

"; - html += ""; - - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser; - try { - browser = new Browser(shell, SWT.NONE); - } catch (SWTError e) { - System.out.println("Could not instantiate Browser: " + e.getMessage()); - return; - } - browser.setText(html); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet137.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet137.java deleted file mode 100644 index 1acf749ec8..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet137.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Browser example snippet: render HTML that includes relative links from memory - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet137 { - -public static void main(String [] args) { - /* Relative links: use the HTML base tag */ - String html = ""+ - ""+ - "HTML Test"+ - "local link"; - - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser; - try { - browser = new Browser(shell, SWT.NONE); - } catch (SWTError e) { - System.out.println("Could not instantiate Browser: " + e.getMessage()); - return; - } - browser.setText(html); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.java deleted file mode 100644 index 72c84259e8..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: set icons with different resolutions - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet138 { - public static void main(String[] args) { - Display display = new Display(); - - Image small = new Image(display, 16, 16); - GC gc = new GC(small); - gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); - gc.fillArc(0, 0, 16, 16, 45, 270); - gc.dispose(); - - Image large = new Image(display, 32, 32); - gc = new GC(large); - gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); - gc.fillArc(0, 0, 32, 32, 45, 270); - gc.dispose(); - - /* Provide different resolutions for icons to get - * high quality rendering wherever the OS needs - * large icons. For example, the ALT+TAB window - * on certain systems uses a larger icon. - */ - Shell shell = new Shell(display); - shell.setText("Small and Large icons"); - shell.setImages(new Image[] {small, large}); - - /* No large icon: the OS will scale up the - * small icon when it needs a large one. - */ - Shell shell2 = new Shell(display); - shell2.setText("Small icon"); - shell2.setImage(small); - - shell.open(); - shell2.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - small.dispose(); - large.dispose(); - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet139.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet139.java deleted file mode 100644 index bf49faee57..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet139.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * This snippet was adapted from org.eclipse.draw2d.ImageUtilities in - * http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.draw2d/?cvsroot=Tools_Project - * by Pratik Shah. - * - * example snippet: rotate and flip an image - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet139 { - -static ImageData rotate(ImageData srcData, int direction) { - int bytesPerPixel = srcData.bytesPerLine / srcData.width; - int destBytesPerLine = (direction == SWT.DOWN)? srcData.width * bytesPerPixel : srcData.height * bytesPerPixel; - byte[] newData = new byte[(direction == SWT.DOWN)? srcData.height * destBytesPerLine : srcData.width * destBytesPerLine]; - int width = 0, height = 0; - for (int srcY = 0; srcY < srcData.height; srcY++) { - for (int srcX = 0; srcX < srcData.width; srcX++) { - int destX = 0, destY = 0, destIndex = 0, srcIndex = 0; - switch (direction){ - case SWT.LEFT: // left 90 degrees - destX = srcY; - destY = srcData.width - srcX - 1; - width = srcData.height; - height = srcData.width; - break; - case SWT.RIGHT: // right 90 degrees - destX = srcData.height - srcY - 1; - destY = srcX; - width = srcData.height; - height = srcData.width; - break; - case SWT.DOWN: // 180 degrees - destX = srcData.width - srcX - 1; - destY = srcData.height - srcY - 1; - width = srcData.width; - height = srcData.height; - break; - } - destIndex = (destY * destBytesPerLine) + (destX * bytesPerPixel); - srcIndex = (srcY * srcData.bytesPerLine) + (srcX * bytesPerPixel); - System.arraycopy(srcData.data, srcIndex, newData, destIndex, bytesPerPixel); - } - } - // destBytesPerLine is used as scanlinePad to ensure that no padding is required - return new ImageData(width, height, srcData.depth, srcData.palette, srcData.scanlinePad, newData); -} -static ImageData flip(ImageData srcData, boolean vertical) { - int bytesPerPixel = srcData.bytesPerLine / srcData.width; - int destBytesPerLine = srcData.width * bytesPerPixel; - byte[] newData = new byte[srcData.data.length]; - for (int srcY = 0; srcY < srcData.height; srcY++) { - for (int srcX = 0; srcX < srcData.width; srcX++) { - int destX = 0, destY = 0, destIndex = 0, srcIndex = 0; - if (vertical){ - destX = srcX; - destY = srcData.height - srcY - 1; - } else { - destX = srcData.width - srcX - 1; - destY = srcY; - } - destIndex = (destY * destBytesPerLine) + (destX * bytesPerPixel); - srcIndex = (srcY * srcData.bytesPerLine) + (srcX * bytesPerPixel); - System.arraycopy(srcData.data, srcIndex, newData, destIndex, bytesPerPixel); - } - } - // destBytesPerLine is used as scanlinePad to ensure that no padding is required - return new ImageData(srcData.width, srcData.height, srcData.depth, srcData.palette, srcData.scanlinePad, newData); -} - -public static void main(String[] args) { - Display display = new Display(); - - // create an image with the word "hello" on it - final Image image0 = new Image(display, 50, 30); - GC gc = new GC(image0); - gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); - gc.fillRectangle(image0.getBounds()); - gc.drawString("hello", 5, 5, true); - gc.dispose(); - - ImageData data = image0.getImageData(); - // rotate and flip this image - final Image image1 = new Image(display, rotate(data, SWT.LEFT)); - final Image image2 = new Image(display, rotate(data, SWT.RIGHT)); - final Image image3 = new Image(display, rotate(data, SWT.DOWN)); - final Image image4 = new Image(display, flip(data, true)); - final Image image5 = new Image(display, flip(data, false)); - - Shell shell = new Shell(display); - // draw the results on the shell - shell.addPaintListener(new PaintListener(){ - public void paintControl(PaintEvent e) { - e.gc.drawText("Original Image:", 10, 10, true); - e.gc.drawImage(image0, 10, 40); - e.gc.drawText("Left, Right, 180:", 10, 80, true); - e.gc.drawImage(image1, 10, 110); - e.gc.drawImage(image2, 50, 110); - e.gc.drawImage(image3, 90, 110); - e.gc.drawText("Flipped Vertical, Horizontal:", 10, 170, true); - e.gc.drawImage(image4, 10, 200); - e.gc.drawImage(image5, 70, 200); - } - }); - shell.setSize(300, 300); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - image0.dispose(); - image1.dispose(); - image2.dispose(); - image3.dispose(); - image4.dispose(); - image5.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.java deleted file mode 100644 index d26c6ba47a..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Control example snippet: detect mouse enter, exit and hover events - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet14 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setSize (100, 100); - shell.addListener (SWT.MouseEnter, new Listener () { - public void handleEvent (Event e) { - System.out.println ("ENTER"); - } - }); - shell.addListener (SWT.MouseExit, new Listener () { - public void handleEvent (Event e) { - System.out.println ("EXIT"); - } - }); - shell.addListener (SWT.MouseHover, new Listener () { - public void handleEvent (Event e) { - System.out.println ("HOVER"); - } - }); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.java deleted file mode 100644 index ea3e8cb9d9..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * CoolBar example snippet: drop-down a chevron menu containing hidden tool items - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; - -public class Snippet140 { - static Display display; - static Shell shell; - static CoolBar coolBar; - static Menu chevronMenu = null; - -public static void main (String [] args) { - display = new Display (); - shell = new Shell (display); - shell.setLayout(new GridLayout()); - coolBar = new CoolBar(shell, SWT.FLAT | SWT.BORDER); - coolBar.setLayoutData(new GridData(GridData.FILL_BOTH)); - ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT | SWT.WRAP); - int minWidth = 0; - for (int j = 0; j < 5; j++) { - int width = 0; - ToolItem item = new ToolItem(toolBar, SWT.PUSH); - item.setText("B" + j); - width = item.getWidth(); - /* find the width of the widest tool */ - if (width > minWidth) minWidth = width; - } - CoolItem coolItem = new CoolItem(coolBar, SWT.DROP_DOWN); - coolItem.setControl(toolBar); - Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point coolSize = coolItem.computeSize (size.x, size.y); - coolItem.setMinimumSize(minWidth, coolSize.y); - coolItem.setPreferredSize(coolSize); - coolItem.setSize(coolSize); - coolItem.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent event) { - if (event.detail == SWT.ARROW) { - CoolItem item = (CoolItem) event.widget; - Rectangle itemBounds = item.getBounds (); - Point pt = coolBar.toDisplay(new Point(itemBounds.x, itemBounds.y)); - itemBounds.x = pt.x; - itemBounds.y = pt.y; - ToolBar bar = (ToolBar) item.getControl (); - ToolItem[] tools = bar.getItems (); - - int i = 0; - while (i < tools.length) { - Rectangle toolBounds = tools[i].getBounds (); - pt = bar.toDisplay(new Point(toolBounds.x, toolBounds.y)); - toolBounds.x = pt.x; - toolBounds.y = pt.y; - - /* Figure out the visible portion of the tool by looking at the - * intersection of the tool bounds with the cool item bounds. */ - Rectangle intersection = itemBounds.intersection (toolBounds); - - /* If the tool is not completely within the cool item bounds, then it - * is partially hidden, and all remaining tools are completely hidden. */ - if (!intersection.equals (toolBounds)) break; - i++; - } - - /* Create a menu with items for each of the completely hidden buttons. */ - if (chevronMenu != null) chevronMenu.dispose(); - chevronMenu = new Menu (coolBar); - for (int j = i; j < tools.length; j++) { - MenuItem menuItem = new MenuItem (chevronMenu, SWT.PUSH); - menuItem.setText (tools[j].getText()); - } - - /* Drop down the menu below the chevron, with the left edges aligned. */ - pt = coolBar.toDisplay(new Point(event.x, event.y)); - chevronMenu.setLocation (pt.x, pt.y); - chevronMenu.setVisible (true); - } - } - }); - - shell.pack(); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java deleted file mode 100644 index faa1e6d629..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Image example snippet: display an animated GIF - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet141 { - static Display display; - static Shell shell; - static GC shellGC; - static Color shellBackground; - static ImageLoader loader; - static ImageData[] imageDataArray; - static Thread animateThread; - static Image image; - static final boolean useGIFBackground = false; - - public static void main(String[] args) { - display = new Display(); - shell = new Shell(display); - shell.setSize(300, 300); - shell.open(); - shellGC = new GC(shell); - shellBackground = shell.getBackground(); - - FileDialog dialog = new FileDialog(shell); - dialog.setFilterExtensions(new String[] {"*.gif"}); - String fileName = dialog.open(); - if (fileName != null) { - loader = new ImageLoader(); - try { - imageDataArray = loader.load(fileName); - if (imageDataArray.length > 1) { - animateThread = new Thread("Animation") { - public void run() { - /* Create an off-screen image to draw on, and fill it with the shell background. */ - Image offScreenImage = new Image(display, loader.logicalScreenWidth, loader.logicalScreenHeight); - GC offScreenImageGC = new GC(offScreenImage); - offScreenImageGC.setBackground(shellBackground); - offScreenImageGC.fillRectangle(0, 0, loader.logicalScreenWidth, loader.logicalScreenHeight); - - try { - /* Create the first image and draw it on the off-screen image. */ - int imageDataIndex = 0; - ImageData imageData = imageDataArray[imageDataIndex]; - if (image != null && !image.isDisposed()) image.dispose(); - image = new Image(display, imageData); - offScreenImageGC.drawImage( - image, - 0, - 0, - imageData.width, - imageData.height, - imageData.x, - imageData.y, - imageData.width, - imageData.height); - - /* Now loop through the images, creating and drawing each one - * on the off-screen image before drawing it on the shell. */ - int repeatCount = loader.repeatCount; - while (loader.repeatCount == 0 || repeatCount > 0) { - switch (imageData.disposalMethod) { - case SWT.DM_FILL_BACKGROUND: - /* Fill with the background color before drawing. */ - Color bgColor = null; - if (useGIFBackground && loader.backgroundPixel != -1) { - bgColor = new Color(display, imageData.palette.getRGB(loader.backgroundPixel)); - } - offScreenImageGC.setBackground(bgColor != null ? bgColor : shellBackground); - offScreenImageGC.fillRectangle(imageData.x, imageData.y, imageData.width, imageData.height); - if (bgColor != null) bgColor.dispose(); - break; - case SWT.DM_FILL_PREVIOUS: - /* Restore the previous image before drawing. */ - offScreenImageGC.drawImage( - image, - 0, - 0, - imageData.width, - imageData.height, - imageData.x, - imageData.y, - imageData.width, - imageData.height); - break; - } - - imageDataIndex = (imageDataIndex + 1) % imageDataArray.length; - imageData = imageDataArray[imageDataIndex]; - image.dispose(); - image = new Image(display, imageData); - offScreenImageGC.drawImage( - image, - 0, - 0, - imageData.width, - imageData.height, - imageData.x, - imageData.y, - imageData.width, - imageData.height); - - /* Draw the off-screen image to the shell. */ - shellGC.drawImage(offScreenImage, 0, 0); - - /* Sleep for the specified delay time (adding commonly-used slow-down fudge factors). */ - try { - int ms = imageData.delayTime * 10; - if (ms < 20) ms += 30; - if (ms < 30) ms += 10; - Thread.sleep(ms); - } catch (InterruptedException e) { - } - - /* If we have just drawn the last image, decrement the repeat count and start again. */ - if (imageDataIndex == imageDataArray.length - 1) repeatCount--; - } - } catch (SWTException ex) { - System.out.println("There was an error animating the GIF"); - } finally { - if (offScreenImage != null && !offScreenImage.isDisposed()) offScreenImage.dispose(); - if (offScreenImageGC != null && !offScreenImageGC.isDisposed()) offScreenImageGC.dispose(); - if (image != null && !image.isDisposed()) image.dispose(); - } - } - }; - animateThread.setDaemon(true); - animateThread.start(); - } - } catch (SWTException ex) { - System.out.println("There was an error loading the GIF"); - } - } - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.java deleted file mode 100644 index 7caf14b7d7..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * UI Automation (for testing tools) snippet: post mouse events - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet142 { - -public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - final Button button = new Button(shell,SWT.NONE); - button.setSize(100,100); - button.setText("Click"); - shell.pack(); - shell.open(); - button.addListener(SWT.MouseDown, new Listener() { - public void handleEvent(Event e){ - System.out.println("Mouse Down (button: " + e.button + " x: " + e.x + " y: " + e.y + ")"); - } - }); - final Point pt = display.map(shell, null, 50, 50); - new Thread(){ - Event event; - public void run(){ - try { - Thread.sleep(300); - } catch (InterruptedException e) {} - event = new Event(); - event.type = SWT.MouseMove; - event.x = pt.x; - event.y = pt.y; - display.post(event); - try { - Thread.sleep(300); - } catch (InterruptedException e) {} - event.type = SWT.MouseDown; - event.button = 1; - display.post(event); - try { - Thread.sleep(300); - } catch (InterruptedException e) {} - event.type = SWT.MouseUp; - display.post(event); - } - }.start(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java deleted file mode 100644 index 314a925b06..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tray example snippet: place an icon with a popup menu on the system tray - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet143 { - -public static void main(String[] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Image image = new Image (display, 16, 16); - final Tray tray = display.getSystemTray (); - if (tray == null) { - System.out.println ("The system tray is not available"); - } else { - final TrayItem item = new TrayItem (tray, SWT.NONE); - item.setToolTipText("SWT TrayItem"); - item.addListener (SWT.Show, new Listener () { - public void handleEvent (Event event) { - System.out.println("show"); - } - }); - item.addListener (SWT.Hide, new Listener () { - public void handleEvent (Event event) { - System.out.println("hide"); - } - }); - item.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - System.out.println("selection"); - } - }); - item.addListener (SWT.DefaultSelection, new Listener () { - public void handleEvent (Event event) { - System.out.println("default selection"); - } - }); - final Menu menu = new Menu (shell, SWT.POP_UP); - for (int i = 0; i < 8; i++) { - MenuItem mi = new MenuItem (menu, SWT.PUSH); - mi.setText ("Item" + i); - mi.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - System.out.println("selection " + event.widget); - } - }); - if (i == 0) menu.setDefaultItem(mi); - } - item.addListener (SWT.MenuDetect, new Listener () { - public void handleEvent (Event event) { - menu.setVisible (true); - } - }); - item.setImage (image); - } - shell.setBounds(50, 50, 300, 200); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - image.dispose (); - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.java deleted file mode 100644 index a569625a43..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Virtual Table example snippet: create a table with 1,000,000 items (lazy) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet144 { - -static final int COUNT = 1000000; - -public static void main(String[] args) { - Display display = new Display (); - final Shell shell = new Shell (display); - shell.setLayout (new RowLayout (SWT.VERTICAL)); - final Table table = new Table (shell, SWT.VIRTUAL | SWT.BORDER); - table.addListener (SWT.SetData, new Listener () { - public void handleEvent (Event event) { - TableItem item = (TableItem) event.item; - int index = table.indexOf (item); - item.setText ("Item " + index); - System.out.println (item.getText ()); - } - }); - table.setLayoutData (new RowData (200, 200)); - Button button = new Button (shell, SWT.PUSH); - button.setText ("Add Items"); - final Label label = new Label(shell, SWT.NONE); - button.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - long t1 = System.currentTimeMillis (); - table.setItemCount (COUNT); - long t2 = System.currentTimeMillis (); - label.setText ("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms)"); - shell.layout (); - } - }); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet145.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet145.java deleted file mode 100644 index 07c650f130..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet145.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TextLayout example snippet: draw internationalized styled text on a shell - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -public class Snippet145 { - - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell (display); - - Font font1 = new Font(display, "Tahoma", 14, SWT.BOLD); - Font font2 = new Font(display, "MS Mincho", 20, SWT.ITALIC); - Font font3 = new Font(display, "Arabic Transparent", 18, SWT.NORMAL); - - Color blue = display.getSystemColor(SWT.COLOR_BLUE); - Color green = display.getSystemColor(SWT.COLOR_GREEN); - Color yellow = display.getSystemColor(SWT.COLOR_YELLOW); - Color gray = display.getSystemColor(SWT.COLOR_GRAY); - - final TextLayout layout = new TextLayout(display); - TextStyle style1 = new TextStyle(font1, yellow, blue); - TextStyle style2 = new TextStyle(font2, green, null); - TextStyle style3 = new TextStyle(font3, blue, gray); - - layout.setText("English \u65E5\u672C\u8A9E \u0627\u0644\u0639\u0631\u0628\u064A\u0651\u0629"); - layout.setStyle(style1, 0, 6); - layout.setStyle(style2, 8, 10); - layout.setStyle(style3, 13, 21); - - shell.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent (Event event) { - layout.draw(event.gc, 10, 10); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - font1.dispose(); - font2.dispose(); - font3.dispose(); - layout.dispose(); - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java deleted file mode 100644 index 2b229af031..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * UI Automation (for testing tools) snippet: post key events - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet146 { - -public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - final Text text = new Text(shell, SWT.BORDER); - text.setSize(text.computeSize(150, SWT.DEFAULT)); - shell.pack(); - shell.open(); - new Thread(){ - public void run(){ - String string = "Love the method."; - for (int i = 0; i < string.length(); i++) { - char ch = string.charAt(i); - boolean shift = Character.isUpperCase(ch); - ch = Character.toLowerCase(ch); - if (shift) { - Event event = new Event(); - event.type = SWT.KeyDown; - event.keyCode = SWT.SHIFT; - display.post(event); - } - Event event = new Event(); - event.type = SWT.KeyDown; - event.character = ch; - display.post(event); - try { - Thread.sleep(10); - } catch (InterruptedException e) {} - event.type = SWT.KeyUp; - display.post(event); - try { - Thread.sleep(100); - } catch (InterruptedException e) {} - if (shift) { - event = new Event(); - event.type = SWT.KeyUp; - event.keyCode = SWT.SHIFT; - display.post(event); - } - } - } - }.start(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.java deleted file mode 100644 index 6b2be0a65d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Combo example snippet: stop CR from going to the default button - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet147 { -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new GridLayout()); - Combo combo = new Combo(shell, SWT.NONE); - combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - combo.setText("Here is some text"); - combo.addSelectionListener(new SelectionAdapter() { - public void widgetDefaultSelected(SelectionEvent e) { - System.out.println("Combo default selected (overrides default button)"); - } - }); - combo.addTraverseListener(new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - e.doit = false; - e.detail = SWT.TRAVERSE_NONE; - } - } - }); - Button button = new Button(shell, SWT.PUSH); - button.setText("Ok"); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - System.out.println("Button selected"); - } - }); - shell.setDefaultButton(button); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet148.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet148.java deleted file mode 100644 index d395c286cd..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet148.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Text example snippet: check if the browser is available or not - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.browser.*; - -public class Snippet148 { - - public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser = null; - try { - browser = new Browser(shell, SWT.NONE); - } catch (SWTError e) { - /* The Browser widget throws an SWTError if it fails to - * instantiate properly. Application code should catch - * this SWTError and disable any feature requiring the - * Browser widget. - * Platform requirements for the SWT Browser widget are available - * from the SWT FAQ website. - */ - } - if (browser != null) { - /* The Browser widget can be used */ - browser.setUrl("http://www.eclipse.org"); - } - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java deleted file mode 100644 index ed363155d5..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TableEditor example snippet: place a progress bar in a table - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; - -public class Snippet149 { - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout (new FillLayout ()); - Table table = new Table (shell, SWT.BORDER); - table.setHeaderVisible (true); - table.setLinesVisible(true); - for (int i=0; i<2; i++) { - new TableColumn (table, SWT.NONE); - } - table.getColumn (0).setText ("Task"); - table.getColumn (1).setText ("Progress"); - for (int i=0; i<40; i++) { - TableItem item = new TableItem (table, SWT.NONE); - item.setText ("Task " + i); - if ( i % 5 == 0) { - ProgressBar bar = new ProgressBar (table, SWT.NONE); - bar.setSelection (i); - TableEditor editor = new TableEditor (table); - editor.grabHorizontal = editor.grabVertical = true; - editor.setEditor (bar, item, 1); - } - } - table.getColumn (0).pack (); - table.getColumn (1).setWidth (128); - shell.pack (); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.java deleted file mode 100644 index eafedc7ad4..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tree example snippet: create a tree - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet15 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - final Tree tree = new Tree (shell, SWT.BORDER); - for (int i=0; i<4; i++) { - TreeItem iItem = new TreeItem (tree, 0); - iItem.setText ("TreeItem (0) -" + i); - for (int j=0; j<4; j++) { - TreeItem jItem = new TreeItem (iItem, 0); - jItem.setText ("TreeItem (1) -" + j); - for (int k=0; k<4; k++) { - TreeItem kItem = new TreeItem (jItem, 0); - kItem.setText ("TreeItem (2) -" + k); - for (int l=0; l<4; l++) { - TreeItem lItem = new TreeItem (kItem, 0); - lItem.setText ("TreeItem (3) -" + l); - } - } - } - } - shell.setSize (200, 200); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java deleted file mode 100644 index 53f12f08da..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * CoolBar example snippet: create a coolbar (relayout when resized) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet150 { - -static int itemCount; -static CoolItem createItem(CoolBar coolBar, int count) { - ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT); - for (int i = 0; i < count; i++) { - ToolItem item = new ToolItem(toolBar, SWT.PUSH); - item.setText(itemCount++ +""); - } - toolBar.pack(); - Point size = toolBar.getSize(); - CoolItem item = new CoolItem(coolBar, SWT.NONE); - item.setControl(toolBar); - Point preferred = item.computeSize(size.x, size.y); - item.setPreferredSize(preferred); - return item; -} - -public static void main(String[] args) { - Display display = new Display(); - final Shell shell = new Shell(display); - CoolBar coolBar = new CoolBar(shell, SWT.NONE); - createItem(coolBar, 3); - createItem(coolBar, 2); - createItem(coolBar, 3); - createItem(coolBar, 4); - int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL; - Text text = new Text(shell, style); - FormLayout layout = new FormLayout(); - shell.setLayout(layout); - FormData coolData = new FormData(); - coolData.left = new FormAttachment(0); - coolData.right = new FormAttachment(100); - coolData.top = new FormAttachment(0); - coolBar.setLayoutData(coolData); - coolBar.addListener(SWT.Resize, new Listener() { - public void handleEvent(Event event) { - shell.layout(); - } - }); - FormData textData = new FormData(); - textData.left = new FormAttachment(0); - textData.right = new FormAttachment(100); - textData.top = new FormAttachment(coolBar); - textData.bottom = new FormAttachment(100); - text.setLayoutData(textData); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java deleted file mode 100644 index f9ab2debc5..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Create a virtual table and add 1000 entries to it every 500 ms. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import java.util.*; -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet151 { - -static int[] data = new int[0]; - -public static void main (String [] args) { - final Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - final Table table = new Table(shell, SWT.BORDER | SWT.VIRTUAL); - table.addListener(SWT.SetData, new Listener() { - public void handleEvent(Event e) { - TableItem item = (TableItem)e.item; - int index = table.indexOf(item); - item.setText("Item "+data[index]); - } - }); - Thread thread = new Thread() { - public void run() { - int count = 0; - Random random = new Random(); - while (count++ < 500) { - if (table.isDisposed()) return; - // add 10 random numbers to array and sort - int grow = 10; - int[] newData = new int[data.length + grow]; - System.arraycopy(data, 0, newData, 0, data.length); - int index = data.length; - data = newData; - for (int j = 0; j < grow; j++) { - data[index++] = random.nextInt(); - } - Arrays.sort(data); - display.syncExec(new Runnable() { - public void run() { - if (table.isDisposed()) return; - table.setItemCount(data.length); - table.clearAll(); - } - }); - try {Thread.sleep(500);} catch (Throwable t) {} - } - } - }; - thread.start(); - shell.open (); - while (!shell.isDisposed() || thread.isAlive()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java deleted file mode 100644 index 96a2d52534..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Control example snippet: update a status line when an item is armed - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet152 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - FormLayout layout = new FormLayout(); - shell.setLayout(layout); - final Label label = new Label(shell, SWT.BORDER); - Listener armListener = new Listener() { - public void handleEvent(Event event) { - MenuItem item = (MenuItem) event.widget; - label.setText(item.getText()); - label.update(); - } - }; - Listener showListener = new Listener() { - public void handleEvent(Event event) { - Menu menu = (Menu) event.widget; - MenuItem item = menu.getParentItem(); - if (item != null) { - label.setText(item.getText()); - label.update(); - } - } - }; - Listener hideListener = new Listener() { - public void handleEvent(Event event) { - label.setText(""); - label.update(); - } - }; - FormData labelData = new FormData(); - labelData.left = new FormAttachment(0); - labelData.right = new FormAttachment(100); - labelData.bottom = new FormAttachment(100); - label.setLayoutData(labelData); - Menu menuBar = new Menu(shell, SWT.BAR); - shell.setMenuBar(menuBar); - MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE); - fileItem.setText("File"); - fileItem.addListener(SWT.Arm, armListener); - MenuItem editItem = new MenuItem(menuBar, SWT.CASCADE); - editItem.setText("Edit"); - editItem.addListener(SWT.Arm, armListener); - Menu fileMenu = new Menu(shell, SWT.DROP_DOWN); - fileMenu.addListener(SWT.Hide, hideListener); - fileMenu.addListener(SWT.Show, showListener); - fileItem.setMenu(fileMenu); - String[] fileStrings = { "New", "Close", "Exit" }; - for (int i = 0; i < fileStrings.length; i++) { - MenuItem item = new MenuItem(fileMenu, SWT.PUSH); - item.setText(fileStrings[i]); - item.addListener(SWT.Arm, armListener); - } - Menu editMenu = new Menu(shell, SWT.DROP_DOWN); - editMenu.addListener(SWT.Hide, hideListener); - editMenu.addListener(SWT.Show, showListener); - String[] editStrings = { "Cut", "Copy", "Paste" }; - editItem.setMenu(editMenu); - for (int i = 0; i < editStrings.length; i++) { - MenuItem item = new MenuItem(editMenu, SWT.PUSH); - item.setText(editStrings[i]); - item.addListener(SWT.Arm, armListener); - } - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java deleted file mode 100644 index 5b6862fb71..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ToolBar example snippet: update a status line when the pointer enters a ToolItem - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet153 { - -static String statusText = ""; -public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setBounds(10, 10, 200, 200); - final ToolBar bar = new ToolBar(shell, SWT.BORDER); - bar.setBounds(10, 10, 150, 50); - final Label statusLine = new Label(shell, SWT.BORDER); - statusLine.setBounds(10, 90, 150, 30); - new ToolItem(bar, SWT.NONE).setText("item 1"); - new ToolItem(bar, SWT.NONE).setText("item 2"); - new ToolItem(bar, SWT.NONE).setText("item 3"); - bar.addMouseMoveListener(new MouseMoveListener() { - public void mouseMove(MouseEvent e) { - ToolItem item = bar.getItem(new Point(e.x, e.y)); - String name = ""; - if (item != null) { - name = item.getText(); - } - if (!statusText.equals(name)) { - statusLine.setText(name); - statusText = name; - } - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java deleted file mode 100644 index f997ca07bb..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: embed a JTable in SWT (no flicker) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.Panel; -import javax.swing.*; -import java.util.Vector; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.awt.SWT_AWT; - -public class Snippet154 { - - public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - - Composite composite = new Composite(shell, SWT.NO_BACKGROUND | SWT.EMBEDDED); - - /* - * Set a Windows specific AWT property that prevents heavyweight - * components from erasing their background. Note that this - * is a global property and cannot be scoped. It might not be - * suitable for your application. - */ - try { - System.setProperty("sun.awt.noerasebackground","true"); - } catch (NoSuchMethodError error) {} - - /* Create and setting up frame */ - Frame frame = SWT_AWT.new_Frame(composite); - Panel panel = new Panel(new BorderLayout()) { - public void update(java.awt.Graphics g) { - /* Do not erase the background */ - paint(g); - } - }; - frame.add(panel); - JRootPane root = new JRootPane(); - panel.add(root); - java.awt.Container contentPane = root.getContentPane(); - - /* Creating components */ - int nrows = 1000, ncolumns = 10; - Vector rows = new Vector(); - for (int i = 0; i < nrows; i++) { - Vector row = new Vector(); - for (int j = 0; j < ncolumns; j++) { - row.addElement("Item " + i + "-" + j); - } - rows.addElement(row); - } - Vector columns = new Vector(); - for (int i = 0; i < ncolumns; i++) { - columns.addElement("Column " + i); - } - JTable table = new JTable(rows, columns); - table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - table.createDefaultColumnsFromModel(); - JScrollPane scrollPane = new JScrollPane(table); - contentPane.setLayout(new BorderLayout()); - contentPane.add(scrollPane); - - shell.open(); - while(!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet155.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet155.java deleted file mode 100644 index 1b3d8edb28..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet155.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: draw an X using AWT Graphics - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import java.awt.Frame; -import java.awt.Canvas; -import java.awt.Graphics; -import java.awt.Dimension; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.awt.SWT_AWT; - -public class Snippet155 { - - public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Composite composite = new Composite(shell, SWT.EMBEDDED); - - /* Draw an X using AWT */ - Frame frame = SWT_AWT.new_Frame(composite); - Canvas canvas = new Canvas() { - public void paint (Graphics g) { - Dimension d = getSize(); - g.drawLine(0, 0, d.width, d.height); - g.drawLine(d.width, 0, 0, d.height); - } - }; - frame.add(canvas); - - shell.open(); - while(!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java deleted file mode 100644 index 9710946a9e..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: convert between SWT Image and AWT BufferedImage - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Insets; -import java.awt.image.BufferedImage; -import java.awt.image.ColorModel; -import java.awt.image.DirectColorModel; -import java.awt.image.IndexColorModel; -import java.awt.image.WritableRaster; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -public class Snippet156 { - -static BufferedImage convertToAWT(ImageData data) { - ColorModel colorModel = null; - PaletteData palette = data.palette; - if (palette.isDirect) { - colorModel = new DirectColorModel(data.depth, palette.redMask, palette.greenMask, palette.blueMask); - BufferedImage bufferedImage = new BufferedImage(colorModel, colorModel.createCompatibleWritableRaster(data.width, data.height), false, null); - WritableRaster raster = bufferedImage.getRaster(); - int[] pixelArray = new int[3]; - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - int pixel = data.getPixel(x, y); - RGB rgb = palette.getRGB(pixel); - pixelArray[0] = rgb.red; - pixelArray[1] = rgb.green; - pixelArray[2] = rgb.blue; - raster.setPixels(x, y, 1, 1, pixelArray); - } - } - return bufferedImage; - } else { - RGB[] rgbs = palette.getRGBs(); - byte[] red = new byte[rgbs.length]; - byte[] green = new byte[rgbs.length]; - byte[] blue = new byte[rgbs.length]; - for (int i = 0; i < rgbs.length; i++) { - RGB rgb = rgbs[i]; - red[i] = (byte)rgb.red; - green[i] = (byte)rgb.green; - blue[i] = (byte)rgb.blue; - } - if (data.transparentPixel != -1) { - colorModel = new IndexColorModel(data.depth, rgbs.length, red, green, blue, data.transparentPixel); - } else { - colorModel = new IndexColorModel(data.depth, rgbs.length, red, green, blue); - } - BufferedImage bufferedImage = new BufferedImage(colorModel, colorModel.createCompatibleWritableRaster(data.width, data.height), false, null); - WritableRaster raster = bufferedImage.getRaster(); - int[] pixelArray = new int[1]; - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - int pixel = data.getPixel(x, y); - pixelArray[0] = pixel; - raster.setPixel(x, y, pixelArray); - } - } - return bufferedImage; - } -} - -static ImageData convertToSWT(BufferedImage bufferedImage) { - if (bufferedImage.getColorModel() instanceof DirectColorModel) { - DirectColorModel colorModel = (DirectColorModel)bufferedImage.getColorModel(); - PaletteData palette = new PaletteData(colorModel.getRedMask(), colorModel.getGreenMask(), colorModel.getBlueMask()); - ImageData data = new ImageData(bufferedImage.getWidth(), bufferedImage.getHeight(), colorModel.getPixelSize(), palette); - WritableRaster raster = bufferedImage.getRaster(); - int[] pixelArray = new int[3]; - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - raster.getPixel(x, y, pixelArray); - int pixel = palette.getPixel(new RGB(pixelArray[0], pixelArray[1], pixelArray[2])); - data.setPixel(x, y, pixel); - } - } - return data; - } else if (bufferedImage.getColorModel() instanceof IndexColorModel) { - IndexColorModel colorModel = (IndexColorModel)bufferedImage.getColorModel(); - int size = colorModel.getMapSize(); - byte[] reds = new byte[size]; - byte[] greens = new byte[size]; - byte[] blues = new byte[size]; - colorModel.getReds(reds); - colorModel.getGreens(greens); - colorModel.getBlues(blues); - RGB[] rgbs = new RGB[size]; - for (int i = 0; i < rgbs.length; i++) { - rgbs[i] = new RGB(reds[i] & 0xFF, greens[i] & 0xFF, blues[i] & 0xFF); - } - PaletteData palette = new PaletteData(rgbs); - ImageData data = new ImageData(bufferedImage.getWidth(), bufferedImage.getHeight(), colorModel.getPixelSize(), palette); - data.transparentPixel = colorModel.getTransparentPixel(); - WritableRaster raster = bufferedImage.getRaster(); - int[] pixelArray = new int[1]; - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - raster.getPixel(x, y, pixelArray); - data.setPixel(x, y, pixelArray[0]); - } - } - return data; - } - return null; -} - -static ImageData createSampleImage(Display display) { - Image image = new Image(display, 100, 100); - Rectangle bounds = image.getBounds(); - GC gc = new GC(image); - gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); - gc.fillRectangle(bounds); - gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); - gc.fillOval(0, 0, bounds.width, bounds.height); - gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); - gc.drawLine(0, 0, bounds.width, bounds.height); - gc.drawLine(bounds.width, 0, 0, bounds.height); - gc.dispose(); - ImageData data = image.getImageData(); - image.dispose(); - return data; -} - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setText("SWT Image"); - ImageData data; - if (args.length > 0) { - String fileName = args[0]; - data = new ImageData(fileName); - } else { - data = createSampleImage(display); - } - final Image swtImage = new Image(display, data); - final BufferedImage awtImage = convertToAWT(data); - final Image swtImage2 = new Image(display, convertToSWT(awtImage)); - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event e) { - int y = 10; - if (swtImage != null) { - e.gc.drawImage(swtImage, 10, y); - y += swtImage.getBounds().height + 10; - } - if (swtImage2 != null) { - e.gc.drawImage(swtImage2, 10, y); - } - } - }); - Frame frame = new Frame() { - public void paint(Graphics g) { - Insets insets = getInsets(); - if (awtImage != null) { - g.drawImage(awtImage, 10 + insets.left, 10 + insets.top, null); - } - } - }; - frame.setTitle("AWT Image"); - shell.setLocation(50, 50); - Rectangle bounds = swtImage.getBounds(); - shell.setSize(bounds.width + 50, bounds.height * 2 + 100); - Point size = shell.getSize(); - Point location = shell.getLocation(); - Insets insets = frame.getInsets(); - frame.setLocation(location.x + size.x + 10, location.y); - frame.setSize(size.x - (insets.left + insets.right), size.y - (insets.top + insets.bottom)); - frame.setVisible(true); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - if (swtImage != null) swtImage.dispose(); - if (swtImage2 != null) swtImage.dispose(); - frame.dispose(); - display.dispose(); - /* Note: If you are using JDK 1.3.x, you need to use System.exit(0) at the end of your program to exit AWT. - * This is because in 1.3.x, AWT does not exit when the frame is disposed, because the AWT thread is not a daemon. - * This was fixed in JDK 1.4.x with the addition of the AWT Shutdown thread. - */ -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java deleted file mode 100644 index de1cdf54c1..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * example snippet: Embed Word in an applet (win32 only) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ - -import java.applet.*; - -public class Snippet157 extends Applet { - - org.eclipse.swt.widgets.Display display; - org.eclipse.swt.widgets.Shell swtParent; - java.awt.Canvas awtParent; - -public void init () { - Thread thread = new Thread (new Runnable () { - public void run () { - setLayout(new java.awt.GridLayout (1, 1)); - awtParent = new java.awt.Canvas (); - add (awtParent); - display = new org.eclipse.swt.widgets.Display (); - swtParent = org.eclipse.swt.awt.SWT_AWT.new_Shell (display, awtParent); - swtParent.setLayout (new org.eclipse.swt.layout.FillLayout ()); - org.eclipse.swt.ole.win32.OleFrame frame = new org.eclipse.swt.ole.win32.OleFrame (swtParent, org.eclipse.swt.SWT.NONE); - org.eclipse.swt.ole.win32.OleClientSite site; - try { - site = new org.eclipse.swt.ole.win32.OleClientSite (frame, org.eclipse.swt.SWT.NONE, "Word.Document"); - } catch (org.eclipse.swt.SWTException e) { - String str = "Create OleClientSite Error" + e.toString (); - System.out.println (str); - return; - } - setSize (500, 500); - validate (); - site.doVerb (org.eclipse.swt.ole.win32.OLE.OLEIVERB_SHOW); - - while (swtParent != null && !swtParent.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - } - }); - thread.start (); -} - public void stop (){ - if (display != null && !display.isDisposed ()){ - display.syncExec(new Runnable () { - public void run () { - if (swtParent != null && !swtParent.isDisposed ()) swtParent.dispose (); - swtParent = null; - display.dispose (); - display = null; - } - }); - remove (awtParent); - awtParent = null; - } - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet158.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet158.java deleted file mode 100644 index 2379fdf81b..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet158.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: determine native data types available (motif only) - * NOTE: This snippet uses internal SWT packages that are - * subject to change without notice. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.motif.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet158 extends ByteArrayTransfer { - -private static Snippet158 _instance = new Snippet158(); -private int[] ids; -private String[] names; - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Table control = new Table(shell, SWT.NONE); - TableItem item = new TableItem(control, SWT.NONE); - item.setText("Drag data over this site to see the native transfer type."); - DropTarget target = new DropTarget(control, DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_MOVE); - target.setTransfer(new Transfer[] {Snippet158.getInstance()}); - target.addDropListener(new DropTargetAdapter() { - public void dragEnter(DropTargetEvent event) { - String ops = ""; - if ((event.operations & DND.DROP_COPY) != 0) ops += "Copy;"; - if ((event.operations & DND.DROP_MOVE) != 0) ops += "Move;"; - if ((event.operations & DND.DROP_LINK) != 0) ops += "Link;"; - control.removeAll(); - TableItem item1 = new TableItem(control,SWT.NONE); - item1.setText("Allowed Operations are "+ops); - - if (event.detail == DND.DROP_DEFAULT) { - if ((event.operations & DND.DROP_COPY) != 0) { - event.detail = DND.DROP_COPY; - } else if ((event.operations & DND.DROP_LINK) != 0) { - event.detail = DND.DROP_LINK; - } else if ((event.operations & DND.DROP_MOVE) != 0) { - event.detail = DND.DROP_MOVE; - } - } - - TransferData[] data = event.dataTypes; - for (int i = 0; i < data.length; i++) { - int id = data[i].type; - String name = getNameFromId(id); - TableItem item2 = new TableItem(control,SWT.NONE); - item2.setText("Data type is "+id+" "+name); - } - } - }); - - shell.setSize(400, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} - -public static Snippet158 getInstance () { - return _instance; -} -Snippet158() { -} -public void javaToNative (Object object, TransferData transferData) { -} -public Object nativeToJava(TransferData transferData){ - return "Hello World"; -} -protected String[] getTypeNames(){ - return names; -} -static int shellHandle; -protected int[] getTypeIds(){ - if (ids == null) { - Display display = Display.getCurrent(); - int widgetClass = OS.topLevelShellWidgetClass (); - shellHandle = OS.XtAppCreateShell (null, null, widgetClass, display.xDisplay, null, 0); - OS.XtSetMappedWhenManaged (shellHandle, false); - OS.XtRealizeWidget (shellHandle); - - ids = new int[840]; - names = new String[840]; - for (int i = 0; i < ids.length; i++) { - ids[i] = i+i; - names[i] = getNameFromId(i+1); - } - } - return ids; -} -static String getNameFromId(int id) { - int xDisplay = OS.XtDisplay (shellHandle); - int ptr = 0; - try { - ptr = OS.XmGetAtomName(xDisplay, id); - } catch (Throwable t) { - } - if (ptr == 0) return "invalid "+id; - int length = OS.strlen(ptr); - byte[] nameBuf = new byte[length]; - OS.memmove(nameBuf, ptr, length); - OS.XFree(ptr); - return new String(Converter.mbcsToWcs(null, nameBuf)).toLowerCase(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java deleted file mode 100644 index a1932bc9c9..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Browser example snippet: modify HTML title tag - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet159 { - public static void main(String [] args) { - final String newTitle = "New Value for Title"; - Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser; - try { - browser = new Browser(shell, SWT.NONE); - } catch (SWTError e) { - System.out.println("Could not instantiate Browser: " + e.getMessage()); - return; - } - browser.addTitleListener(new TitleListener() { - public void changed(TitleEvent event) { - System.out.println("TitleEvent: "+event.title); - shell.setText(event.title); - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - /* Set HTML title tag using JavaScript and DOM when page has been loaded */ - boolean result = browser.execute("document.title='"+newTitle+"'"); - if (!result) { - /* Script may fail or may not be supported on certain platforms. */ - System.out.println("Script was not executed."); - } - } - }); - /* Load an HTML document */ - browser.setUrl("http://www.eclipse.org"); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.java deleted file mode 100644 index 7c6ca33f8f..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Display example snippet: create one repeating timer (every 500 ms) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet16 { - -public static void main (String [] args) { - final Display display = new Display (); - final Shell shell = new Shell (display); - final int time = 500; - Runnable timer = new Runnable () { - public void run () { - Point point = display.getCursorLocation (); - Rectangle rect = shell.getBounds (); - if (rect.contains (point)) { - System.out.println ("In"); - } else { - System.out.println ("Out"); - } - display.timerExec (time, this); - } - }; - display.timerExec (time, timer); - shell.setSize (200, 200); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet160.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet160.java deleted file mode 100644 index 4f5ba2b89a..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet160.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Browser example snippet: query DOM node value - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet160 { - public static void main(String [] args) { - final String html = "Snippet

Best Friends

Cat and Dog

"; - Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser; - try { - browser = new Browser(shell, SWT.NONE); - } catch (SWTError e) { - System.out.println("Could not instantiate Browser: " + e.getMessage()); - return; - } - browser.addStatusTextListener(new StatusTextListener() { - public void changed(StatusTextEvent event) { - browser.setData("query", event.text); - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - /* - * Use JavaScript to query the desired node content through the Document Object Model - * - * Assign result to the window property status to pass the result to the StatusTextListener - * This trick is required since execute does not return the String - * directly. - */ - boolean result = browser.execute("window.status=document.getElementById('myid').childNodes[0].nodeValue;"); - if (!result) { - /* Script may fail or may not be supported on certain platforms. */ - System.out.println("Script was not executed."); - return; - } - String value = (String)browser.getData("query"); - System.out.println("Node value: "+value); - } - }); - /* Load an HTML document */ - browser.setText(html); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet161.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet161.java deleted file mode 100644 index 9a43d89aa6..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet161.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Browser example snippet: modify DOM (executing javascript) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet161 { - public static void main(String [] args) { - final String html = "Snippet

Best Friends

Cat and Dog

"; - Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser; - try { - browser = new Browser(shell, SWT.BORDER); - } catch (SWTError e) { - System.out.println("Could not instantiate Browser: " + e.getMessage()); - return; - } - Composite comp = new Composite(shell, SWT.NONE); - comp.setLayout(new FillLayout(SWT.VERTICAL)); - final Text text = new Text(comp, SWT.MULTI); - text.setText("var newNode = document.createElement('P'); \r\n"+ - "var text = document.createTextNode('At least when I am around');\r\n"+ - "newNode.appendChild(text);\r\n"+ - "document.getElementById('myid').appendChild(newNode);\r\n"+ - "\r\n"+ - "document.bgColor='yellow';"); - final Button button = new Button(comp, SWT.PUSH); - button.setText("Execute Script"); - button.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - boolean result = browser.execute(text.getText()); - if (!result) { - /* Script may fail or may not be supported on certain platforms. */ - System.out.println("Script was not executed."); - } - } - }); - browser.setText(html); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.java deleted file mode 100644 index 92d286a53b..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Adding an accessible listener to provide state information - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.accessibility.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet162 { - -final static String STATE = "CheckedIndices"; - -public static void main (String [] args) { - final Display display = new Display (); - Image checkedImage = getCheckedImage (display); - Image uncheckedImage = getUncheckedImage (display); - Shell shell = new Shell (display); - shell.setLayout (new FillLayout ()); - final Table table = new Table (shell, SWT.BORDER); - TableColumn column1 = new TableColumn (table, SWT.NONE); - TableColumn column2 = new TableColumn (table, SWT.NONE); - TableColumn column3 = new TableColumn (table, SWT.NONE); - TableItem item1 = new TableItem (table, SWT.NONE); - item1.setText (new String [] {"first item", "a", "b"}); - item1.setImage (1, uncheckedImage); - item1.setImage (2, uncheckedImage); - item1.setData (STATE, null); - TableItem item2 = new TableItem (table, SWT.NONE); - item2.setText (new String [] {"second item", "c", "d"}); - item2.setImage (1, uncheckedImage); - item2.setImage (2, checkedImage); - item2.setData (STATE, new int [] {2}); - TableItem item3 = new TableItem (table, SWT.NONE); - item3.setText (new String [] {"third", "e", "f"}); - item3.setImage (1, checkedImage); - item3.setImage (2, checkedImage); - item3.setData (STATE, new int [] {1, 2}); - column1.pack (); - column2.pack (); - column3.pack (); - Accessible accessible = table.getAccessible (); - accessible.addAccessibleListener (new AccessibleAdapter () { - public void getName (AccessibleEvent e) { - super.getName (e); - if (e.childID >= 0 && e.childID < table.getItemCount ()) { - TableItem item = table.getItem (e.childID); - Point pt = display.getCursorLocation (); - pt = display.map (null, table, pt); - for (int i = 0; i < table.getColumnCount (); i++) { - if (item.getBounds (i).contains (pt)) { - int [] data = (int []) item.getData (STATE); - boolean checked = false; - if (data != null) { - for (int j = 0; j < data.length; j++) { - if (data [j] == i) { - checked = true; - break; - } - } - } - e.result = item.getText (i) + " " + (checked ? "checked" : "unchecked"); - break; - } - } - } - } - }); - accessible.addAccessibleControlListener (new AccessibleControlAdapter () { - public void getState (AccessibleControlEvent e) { - super.getState (e); - if (e.childID >= 0 && e.childID < table.getItemCount ()) { - TableItem item = table.getItem (e.childID); - int [] data = (int []) item.getData (STATE); - if (data != null) { - Point pt = display.getCursorLocation (); - pt = display.map (null, table, pt); - for (int i = 0; i < data.length; i++) { - if (item.getBounds (data [i]).contains (pt)) { - e.detail |= ACC.STATE_CHECKED; - break; - } - } - } - } - } - }); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - checkedImage.dispose (); - uncheckedImage.dispose (); - display.dispose (); -} - -static Image getCheckedImage (Display display) { - Image image = new Image (display, 16, 16); - GC gc = new GC (image); - gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW)); - gc.fillOval (0, 0, 16, 16); - gc.setForeground (display.getSystemColor (SWT.COLOR_DARK_GREEN)); - gc.drawLine (0, 0, 16, 16); - gc.drawLine (16, 0, 0, 16); - gc.dispose (); - return image; -} - -static Image getUncheckedImage (Display display) { - Image image = new Image (display, 16, 16); - GC gc = new GC (image); - gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW)); - gc.fillOval (0, 0, 16, 16); - gc.dispose (); - return image; -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.java deleted file mode 100644 index f97fd4b800..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Setting the font style, foreground and background colors of StyledText - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet163 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - StyledText text = new StyledText (shell, SWT.BORDER); - text.setText("0123456789 ABCDEFGHIJKLM NOPQRSTUVWXYZ"); - // make 0123456789 appear bold - StyleRange style1 = new StyleRange(); - style1.start = 0; - style1.length = 10; - style1.fontStyle = SWT.BOLD; - text.setStyleRange(style1); - // make ABCDEFGHIJKLM have a red font - StyleRange style2 = new StyleRange(); - style2.start = 11; - style2.length = 13; - style2.foreground = display.getSystemColor(SWT.COLOR_RED); - text.setStyleRange(style2); - // make NOPQRSTUVWXYZ have a blue background - StyleRange style3 = new StyleRange(); - style3.start = 25; - style3.length = 13; - style3.background = display.getSystemColor(SWT.COLOR_BLUE); - text.setStyleRange(style3); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet164.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet164.java deleted file mode 100644 index 2f945f4660..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet164.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Override the text that is spoken for a native Button. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.accessibility.*; -import org.eclipse.swt.widgets.*; - -public class Snippet164 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setBounds(10, 10, 200, 200); - - Button button1 = new Button (shell, SWT.PUSH); - button1.setText("&Typical button"); - button1.setBounds(10,10,180,30); - Button button2 = new Button (shell, SWT.PUSH); - button2.setText("&Overidden button"); - button2.setBounds(10,50,180,30); - button2.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent e) { - e.result = "Speak this instead of the button text"; - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.java deleted file mode 100644 index b5cb18b7bc..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Create a CTabFolder with min and max buttons, as well as close button and - * image only on selected tab. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet165 { - -public static void main (String [] args) { - Display display = new Display (); - Image image = new Image(display, 16, 16); - GC gc = new GC(image); - gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); - gc.fillRectangle(0, 0, 16, 16); - gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); - gc.fillRectangle(3, 3, 10, 10); - gc.dispose(); - final Shell shell = new Shell (display); - shell.setLayout(new GridLayout()); - final CTabFolder folder = new CTabFolder(shell, SWT.BORDER); - folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - folder.setSimple(false); - folder.setUnselectedImageVisible(false); - folder.setUnselectedCloseVisible(false); - for (int i = 0; i < 8; i++) { - CTabItem item = new CTabItem(folder, SWT.CLOSE); - item.setText("Item "+i); - item.setImage(image); - Text text = new Text(folder, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); - text.setText("Text for item "+i+"\n\none, two, three\n\nabcdefghijklmnop"); - item.setControl(text); - } - folder.setMinimizeVisible(true); - folder.setMaximizeVisible(true); - folder.addCTabFolder2Listener(new CTabFolder2Adapter() { - public void minimize(CTabFolderEvent event) { - folder.setMinimized(true); - shell.layout(true); - } - public void maximize(CTabFolderEvent event) { - folder.setMaximized(true); - folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - shell.layout(true); - } - public void restore(CTabFolderEvent event) { - folder.setMinimized(false); - folder.setMaximized(false); - folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - shell.layout(true); - } - }); - shell.setSize(300, 300); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - image.dispose(); - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet166.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet166.java deleted file mode 100644 index 14727f0357..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet166.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Create a ScrolledComposite with wrapping content. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet166 { - -public static void main(String[] args) { - Display display = new Display(); - Image image1 = display.getSystemImage(SWT.ICON_WORKING); - Image image2 = display.getSystemImage(SWT.ICON_QUESTION); - Image image3 = display.getSystemImage(SWT.ICON_ERROR); - - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - - final ScrolledComposite scrollComposite = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.BORDER); - - final Composite parent = new Composite(scrollComposite, SWT.NONE); - for(int i = 0; i <= 50; i++) { - Label label = new Label(parent, SWT.NONE); - if (i % 3 == 0) label.setImage(image1); - if (i % 3 == 1) label.setImage(image2); - if (i % 3 == 2) label.setImage(image3); - } - RowLayout layout = new RowLayout(SWT.HORIZONTAL); - layout.wrap = true; - parent.setLayout(layout); - - scrollComposite.setContent(parent); - scrollComposite.setExpandVertical(true); - scrollComposite.setExpandHorizontal(true); - scrollComposite.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - Rectangle r = scrollComposite.getClientArea(); - scrollComposite.setMinSize(parent.computeSize(r.width, SWT.DEFAULT)); - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet167.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet167.java deleted file mode 100644 index 9b6211b7ec..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet167.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Create two ScrolledComposites that scroll in tandem. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet167 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - - final ScrolledComposite sc1 = new ScrolledComposite (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - Button button1 = new Button (sc1, SWT.PUSH); - button1.setText ("Button 1"); - button1.setSize (400, 300); - sc1.setContent (button1); - - final ScrolledComposite sc2 = new ScrolledComposite (shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - Button button2 = new Button(sc2, SWT.PUSH); - button2.setText ("Button 2"); - button2.setSize (300, 400); - sc2.setContent (button2); - - final ScrollBar vBar1 = sc1.getVerticalBar (); - final ScrollBar vBar2 = sc2.getVerticalBar (); - final ScrollBar hBar1 = sc1.getHorizontalBar (); - final ScrollBar hBar2 = sc2.getHorizontalBar (); - SelectionListener listener1 = new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - int x = hBar1.getSelection() * (hBar2.getMaximum() - hBar2.getThumb()) / Math.max(1, hBar1.getMaximum() - hBar1.getThumb()); - int y = vBar1.getSelection() * (vBar2.getMaximum() - vBar2.getThumb()) / Math.max(1, vBar1.getMaximum() - vBar1.getThumb()); - sc2.setOrigin (x, y); - } - }; - SelectionListener listener2 = new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - int x = hBar2.getSelection() * (hBar1.getMaximum() - hBar1.getThumb()) / Math.max(1, hBar2.getMaximum() - hBar2.getThumb()); - int y = vBar2.getSelection() * (vBar1.getMaximum() - vBar1.getThumb()) / Math.max(1, vBar2.getMaximum() - vBar2.getThumb()); - sc1.setOrigin (x, y); - } - }; - vBar1.addSelectionListener (listener1); - hBar1.addSelectionListener (listener1); - vBar2.addSelectionListener (listener2); - hBar2.addSelectionListener (listener2); - - shell.setSize (400, 300); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet168.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet168.java deleted file mode 100644 index e74245e6eb..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet168.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Draw lines and polygons with different cap and join styles - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet168 { - -public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event event) { - int x = 20, y = 20, w = 120, h = 60; - GC gc = event.gc; - gc.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); - gc.setLineWidth(10); - int[] caps = {SWT.CAP_FLAT, SWT.CAP_ROUND, SWT.CAP_SQUARE}; - for (int i = 0; i < caps.length; i++) { - gc.setLineCap(caps[i]); - gc.drawLine(x, y, x + w, y); - y += 20; - } - int[] joins = {SWT.JOIN_BEVEL, SWT.JOIN_MITER, SWT.JOIN_ROUND}; - for (int i = 0; i < joins.length; i++) { - gc.setLineJoin(joins[i]); - gc.drawPolygon(new int[] {x, y, x + w/2, y + h, x + w, y}); - y += h + 20; - } - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.java deleted file mode 100644 index c3da321f2f..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Make a toggle button have radio behavior - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet169 { -public static void main (String [] args) { - Display display = new Display (); - final Shell shell = new Shell (display); - shell.setLayout (new FillLayout ()); - Listener listener = new Listener () { - public void handleEvent (Event e) { - Control [] children = shell.getChildren (); - for (int i=0; i " + string); - } - }); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.java deleted file mode 100644 index 3bdc3b9ef8..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tree example snippet: Create a Tree with columns - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet170 { - public static void main(String[] args) { - Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Tree tree = new Tree(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - tree.setHeaderVisible(true); - TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); - column1.setText("Column 1"); - column1.setWidth(200); - TreeColumn column2 = new TreeColumn(tree, SWT.CENTER); - column2.setText("Column 2"); - column2.setWidth(200); - TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT); - column3.setText("Column 3"); - column3.setWidth(200); - for (int i = 0; i < 4; i++) { - TreeItem item = new TreeItem(tree, SWT.NONE); - item.setText(new String[] { "item " + i, "abc", "defghi" }); - for (int j = 0; j < 4; j++) { - TreeItem subItem = new TreeItem(item, SWT.NONE); - subItem.setText(new String[] { "subitem " + j, "jklmnop", "qrs" }); - for (int k = 0; k < 4; k++) { - TreeItem subsubItem = new TreeItem(subItem, SWT.NONE); - subsubItem.setText(new String[] { "subsubitem " + k, "tuv", "wxyz" }); - } - } - } - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java deleted file mode 100644 index 797baece29..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: define data transfer types that subclass each - * other - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import java.io.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet171 { - -/* - * The data being transferred is an array of type MyType where - * MyType is define as: - */ -static class MyType { - String fileName; - long fileLength; - long lastModified; -} - -static class MyTransfer extends ByteArrayTransfer { - - private static final String MYTYPENAME = "MytypeTransfer"; - private static final int MYTYPEID = registerType(MYTYPENAME); - private static MyTransfer _instance = new MyTransfer(); - - public static Transfer getInstance() { - return _instance; - } - - byte[] javaToByteArray(Object object) { - MyType data = (MyType) object; - try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - DataOutputStream writeOut = new DataOutputStream(out); - byte[] buffer = data.fileName.getBytes(); - writeOut.writeInt(buffer.length); - writeOut.write(buffer); - writeOut.writeLong(data.fileLength); - writeOut.writeLong(data.lastModified); - buffer = out.toByteArray(); - writeOut.close(); - return buffer; - } catch (IOException e) { - } - return null; - } - - Object byteArrayToJava(byte[] bytes) { - MyType data = new MyType(); - try { - ByteArrayInputStream in = new ByteArrayInputStream(bytes); - DataInputStream readIn = new DataInputStream(in); - int size = readIn.readInt(); - byte[] buffer = new byte[size]; - readIn.read(buffer); - data.fileName = new String(buffer); - data.fileLength = readIn.readLong(); - data.lastModified = readIn.readLong(); - readIn.close(); - } catch (IOException ex) { - return null; - } - return data; - } - - public void javaToNative(Object object, TransferData transferData) { - if (!checkMyType(object) || !isSupportedType(transferData)) { - DND.error(DND.ERROR_INVALID_DATA); - } - byte[] buffer = javaToByteArray(object); - super.javaToNative(buffer, transferData); - } - - public Object nativeToJava(TransferData transferData) { - if (isSupportedType(transferData)) { - byte[] buffer = (byte[]) super.nativeToJava(transferData); - if (buffer == null) - return null; - return byteArrayToJava(buffer); - } - return null; - } - - protected String[] getTypeNames() { - return new String[] { MYTYPENAME }; - } - - protected int[] getTypeIds() { - return new int[] { MYTYPEID }; - } - - boolean checkMyType(Object object) { - return object != null && object instanceof MyType; - } - - protected boolean validate(Object object) { - return checkMyType(object); - } -} - -/* - * The data being transferred is an array of type MyType2 - * where MyType2 is define as: - */ -static class MyType2 extends MyType { - String version; -} - -static class MyTransfer2 extends MyTransfer { - - private static final String MYTYPE2NAME = "Mytype2Transfer"; - private static final int MYTYPE2ID = registerType(MYTYPE2NAME); - private static MyTransfer _instance = new MyTransfer2(); - - public static Transfer getInstance() { - return _instance; - } - - protected String[] getTypeNames() { - return new String[] { MYTYPE2NAME }; - } - - protected int[] getTypeIds() { - return new int[] { MYTYPE2ID }; - } - - byte[] javaToByteArray(Object object) { - MyType2 data = (MyType2) object; - try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - DataOutputStream writeOut = new DataOutputStream(out); - byte[] buffer = data.fileName.getBytes(); - writeOut.writeInt(buffer.length); - writeOut.write(buffer); - writeOut.writeLong(data.fileLength); - writeOut.writeLong(data.lastModified); - buffer = data.version.getBytes(); - writeOut.writeInt(buffer.length); - writeOut.write(buffer); - buffer = out.toByteArray(); - writeOut.close(); - return buffer; - } catch (IOException e) { - } - return null; - } - - Object byteArrayToJava(byte[] bytes) { - MyType2 data = new MyType2(); - try { - ByteArrayInputStream in = new ByteArrayInputStream(bytes); - DataInputStream readIn = new DataInputStream(in); - int size = readIn.readInt(); - byte[] buffer = new byte[size]; - readIn.read(buffer); - data.fileName = new String(buffer); - data.fileLength = readIn.readLong(); - data.lastModified = readIn.readLong(); - size = readIn.readInt(); - buffer = new byte[size]; - readIn.read(buffer); - data.version = new String(buffer); - readIn.close(); - } catch (IOException ex) { - return null; - } - return data; - } - - public void javaToNative(Object object, TransferData transferData) { - if (!checkMyType2(object)) { - DND.error(DND.ERROR_INVALID_DATA); - } - super.javaToNative(object, transferData); - } - - boolean checkMyType2(Object object) { - if (!checkMyType(object)) - return false; - return object != null && object instanceof MyType2; - } - - protected boolean validate(Object object) { - return checkMyType2(object); - } -} - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Label label1 = new Label(shell, SWT.BORDER | SWT.WRAP); - label1.setText("Drag Source for MyData and MyData2"); - final Label label2 = new Label(shell, SWT.BORDER | SWT.WRAP); - label2.setText("Drop Target for MyData"); - final Label label3 = new Label(shell, SWT.BORDER | SWT.WRAP); - label3.setText("Drop Target for MyData2"); - - DragSource source = new DragSource(label1, DND.DROP_COPY); - source.setTransfer(new Transfer[] { MyTransfer.getInstance(), - MyTransfer2.getInstance() }); - source.addDragListener(new DragSourceAdapter() { - public void dragSetData(DragSourceEvent event) { - MyType2 myType = new MyType2(); - myType.fileName = "C:\\abc.txt"; - myType.fileLength = 1000; - myType.lastModified = 12312313; - myType.version = "version 2"; - event.data = myType; - } - }); - DropTarget targetMyType = new DropTarget(label2, DND.DROP_COPY | DND.DROP_DEFAULT); - targetMyType.setTransfer(new Transfer[] { MyTransfer.getInstance() }); - targetMyType.addDropListener(new DropTargetAdapter() { - public void dragEnter(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) - event.detail = DND.DROP_COPY; - } - - public void dragOperationChanged(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) - event.detail = DND.DROP_COPY; - } - - public void drop(DropTargetEvent event) { - if (event.data != null) { - MyType myType = (MyType) event.data; - if (myType != null) { - String string = "MyType: " + myType.fileName; - label2.setText(string); - } - } - } - - }); - DropTarget targetMyType2 = new DropTarget(label3, DND.DROP_COPY | DND.DROP_DEFAULT); - targetMyType2.setTransfer(new Transfer[] { MyTransfer2.getInstance() }); - targetMyType2.addDropListener(new DropTargetAdapter() { - public void dragEnter(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) - event.detail = DND.DROP_COPY; - } - - public void dragOperationChanged(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) - event.detail = DND.DROP_COPY; - } - - public void drop(DropTargetEvent event) { - if (event.data != null) { - MyType2 myType = (MyType2) event.data; - if (myType != null) { - String string = "MyType2: " + myType.fileName + ":" - + myType.version; - label3.setText(string); - } - } - } - - }); - shell.setSize(300, 200); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java deleted file mode 100644 index 671eff6ff3..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * GridLayout snippet: align widgets in a GridLayout - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet172 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - GridLayout layout = new GridLayout(4, false); - shell.setLayout(layout); - - Button b = new Button(shell, SWT.PUSH); - b.setText("LEFT, TOP"); - b.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("LEFT, CENTER"); - b.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("LEFT, BOTTOM"); - b.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("LEFT, FILL"); - b.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("CENTER, TOP"); - b.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("CENTER, CENTER"); - b.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("CENTER, BOTTOM"); - b.setLayoutData(new GridData(SWT.CENTER, SWT.BOTTOM, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("CENTER, FILL"); - b.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("RIGHT, TOP"); - b.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("RIGHT, CENTER"); - b.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("RIGHT, BOTTOM"); - b.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("RIGHT, FILL"); - b.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("FILL, TOP"); - b.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("FILL, CENTER"); - b.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("FILL, BOTTOM"); - b.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 1, 1)); - b = new Button(shell, SWT.PUSH); - b.setText("FILL, FILL"); - b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java deleted file mode 100644 index f5f7ee4d74..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Browser snippet: bring up a browser with pop-up blocker - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; - -public class Snippet173 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setText("Main Window"); - shell.setLayout(new FillLayout()); - final Browser browser; - try { - browser = new Browser(shell, SWT.NONE); - } catch (SWTError e) { - System.out.println("Could not instantiate Browser: " + e.getMessage()); - return; - } - initialize(display, browser); - shell.open(); - /* any website with popups */ - browser.setUrl("http://www.cnn.com"); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } - -/* register WindowEvent listeners */ -static void initialize(final Display display, Browser browser) { - browser.addOpenWindowListener(new OpenWindowListener() { - public void open(WindowEvent event) { - Shell shell = new Shell(display); - shell.setText("New Window"); - shell.setLayout(new FillLayout()); - Browser browser = new Browser(shell, SWT.NONE); - initialize(display, browser); - event.browser = browser; - } - }); - browser.addVisibilityWindowListener(new VisibilityWindowListener() { - public void hide(WindowEvent event) { - Browser browser = (Browser)event.widget; - Shell shell = browser.getShell(); - shell.setVisible(false); - } - public void show(WindowEvent event) { - Browser browser = (Browser)event.widget; - final Shell shell = browser.getShell(); - /* popup blocker - ignore windows with no style */ - if (!event.addressBar && !event.menuBar && !event.statusBar && !event.toolBar) { - System.out.println("Popup blocked."); - event.display.asyncExec(new Runnable() { - public void run() { - shell.close(); - } - }); - return; - } - if (event.location != null) shell.setLocation(event.location); - if (event.size != null) { - Point size = event.size; - shell.setSize(shell.computeSize(size.x, size.y)); - } - shell.open(); - } - }); - browser.addCloseWindowListener(new CloseWindowListener() { - public void close(WindowEvent event) { - Browser browser = (Browser)event.widget; - Shell shell = browser.getShell(); - shell.close(); - } - }); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java deleted file mode 100644 index 7ced2f7419..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sebastian Davids - initial implementation - * IBM Corporation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * SWT OpenGL snippet: draw a square - * - * This snippet requires the experimental org.eclipse.swt.opengl plugin, which - * is not included in SWT by default and should only be used with versions of - * SWT prior to 3.2. For information on using OpenGL in SWT see - * http://www.eclipse.org/swt/opengl/ . - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.opengl.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -public class Snippet174 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setText("OpenGL in SWT"); - shell.setLayout(new FillLayout()); - GLData data = new GLData(); - data.doubleBuffer = true; - final GLCanvas canvas = new GLCanvas(shell, SWT.NO_BACKGROUND, data); - canvas.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - resize(canvas); - } - }); - init(canvas); - new Runnable() { - public void run() { - if (canvas.isDisposed()) return; - render(); - canvas.swapBuffers(); - canvas.getDisplay().timerExec(50, this); - } - }.run(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} - -static void init(GLCanvas canvas) { - canvas.setCurrent(); - resize(canvas); - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glColor3f(0.0f, 0.0f, 0.0f); - GL.glClearDepth(1.0f); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); -} - -static void render() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(0.0f, 0.0f, -6.0f); - GL.glBegin(GL.GL_QUADS); - GL.glVertex3f(-1.0f, 1.0f, 0.0f); - GL.glVertex3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(1.0f, -1.0f, 0.0f); - GL.glVertex3f(-1.0f, -1.0f, 0.0f); - GL.glEnd(); -} - -static void resize(GLCanvas canvas) { - canvas.setCurrent(); - Rectangle rect = canvas.getClientArea(); - int width = rect.width; - int height = Math.max(rect.height, 1); - GL.glViewport(0, 0, width, height); - GL.glMatrixMode(GL.GL_PROJECTION); - GL.glLoadIdentity(); - float aspect = (float) width / (float) height; - GLU.gluPerspective(45.0f, aspect, 0.5f, 400.0f); - GL.glMatrixMode(GL.GL_MODELVIEW); - GL.glLoadIdentity(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet175.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet175.java deleted file mode 100644 index a4fc973ead..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet175.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/* - * Exclude a widget from a GridLayout - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ - -public class Snippet175 { - -public static void main(String[] args) { - - Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new GridLayout(3, false)); - - Button b = new Button(shell, SWT.PUSH); - b.setText("Button 0"); - - final Button bHidden = new Button(shell, SWT.PUSH); - bHidden.setText("Button 1"); - GridData data = new GridData(); - data.exclude = true; - data.horizontalSpan = 2; - data.horizontalAlignment = SWT.FILL; - bHidden.setLayoutData(data); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 2"); - b = new Button(shell, SWT.PUSH); - b.setText("Button 3"); - b = new Button(shell, SWT.PUSH); - b.setText("Button 4"); - - b = new Button(shell, SWT.CHECK); - b.setText("hide"); - b.setSelection(true); - b.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - Button b = (Button) e.widget; - GridData data = (GridData) bHidden.getLayoutData(); - data.exclude = b.getSelection(); - bHidden.setVisible(!data.exclude); - shell.layout(false); - } - }); - shell.setSize(400, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet176.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet176.java deleted file mode 100644 index f2af754908..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet176.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * RowLayout snippet: align widgets in a row - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet176 { - - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - RowLayout layout = new RowLayout(SWT.HORIZONTAL); - layout.wrap = true; - layout.fill = false; - layout.justify = true; - shell.setLayout(layout); - - Button b = new Button(shell, SWT.PUSH); - b.setText("Button 1"); - b = new Button(shell, SWT.PUSH); - - b.setText("Button 2"); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 3"); - - b = new Button(shell, SWT.PUSH); - b.setText("Not shown"); - b.setVisible(false); - RowData data = new RowData(); - data.exclude = true; - b.setLayoutData(data); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 200 high"); - data = new RowData(); - data.height = 200; - b.setLayoutData(data); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 200 wide"); - data = new RowData(); - data.width = 200; - b.setLayoutData(data); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet177.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet177.java deleted file mode 100644 index e6a8eca72a..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet177.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * RowLayout snippet: align widgets in a column - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet177 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - RowLayout layout = new RowLayout(SWT.VERTICAL); - layout.wrap = true; - layout.fill = true; - layout.justify = false; - shell.setLayout(layout); - - Button b = new Button(shell, SWT.PUSH); - b.setText("Button 1"); - b = new Button(shell, SWT.PUSH); - - b.setText("Button 2"); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 3"); - - b = new Button(shell, SWT.PUSH); - b.setText("Not shown"); - b.setVisible(false); - RowData data = new RowData(); - data.exclude = true; - b.setLayoutData(data); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 200 high"); - data = new RowData(); - data.height = 200; - b.setLayoutData(data); - - b = new Button(shell, SWT.PUSH); - b.setText("Button 200 wide"); - data = new RowData(); - data.width = 200; - b.setLayoutData(data); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet178.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet178.java deleted file mode 100644 index 30754bc139..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet178.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * How to access About, Preferences and Quit menus on carbon. - * NOTE: This snippet uses internal SWT packages that are - * subject to change without notice. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ - -import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.carbon.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet178 { - - private static final int kHICommandPreferences = ('p' << 24) + ('r' << 16) - + ('e' << 8) + 'f'; - - private static final int kHICommandAbout = ('a' << 24) + ('b' << 16) - + ('o' << 8) + 'u'; - - private static final int kHICommandServices = ('s' << 24) + ('e' << 16) - + ('r' << 8) + 'v'; - -public static void main(String[] arg) { - Display.setAppName("AppMenu"); // sets name in Dock - Display display = new Display(); - hookApplicationMenu(display, "About AppMenu"); - Shell shell = new Shell(display); - shell.setText("Main Window"); - shell.open(); - while (!shell.isDisposed()) - if (!display.readAndDispatch()) - display.sleep(); - - display.dispose(); -} - -static void hookApplicationMenu(Display display, final String aboutName) { - // Callback target - Object target = new Object() { - int commandProc(int nextHandler, int theEvent, int userData) { - if (OS.GetEventKind(theEvent) == OS.kEventProcessCommand) { - HICommand command = new HICommand(); - OS.GetEventParameter(theEvent, OS.kEventParamDirectObject, - OS.typeHICommand, null, HICommand.sizeof, null, - command); - switch (command.commandID) { - case kHICommandPreferences: - return handleCommand("Preferences"); //$NON-NLS-1$ - case kHICommandAbout: - return handleCommand(aboutName); - default: - break; - } - } - return OS.eventNotHandledErr; - } - - int handleCommand(String command) { - Shell shell = new Shell(); - MessageBox preferences = new MessageBox(shell, SWT.ICON_WARNING); - preferences.setText(command); - preferences.open(); - shell.dispose(); - return OS.noErr; - } - }; - - final Callback commandCallback = new Callback(target, "commandProc", 3); //$NON-NLS-1$ - int commandProc = commandCallback.getAddress(); - if (commandProc == 0) { - commandCallback.dispose(); - return; // give up - } - - // Install event handler for commands - int[] mask = new int[] { OS.kEventClassCommand, OS.kEventProcessCommand }; - OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, - mask.length / 2, mask, 0, null); - - // create About ... menu command - int[] outMenu = new int[1]; - short[] outIndex = new short[1]; - if (OS.GetIndMenuItemWithCommandID(0, kHICommandPreferences, 1, - outMenu, outIndex) == OS.noErr - && outMenu[0] != 0) { - int menu = outMenu[0]; - - int l = aboutName.length(); - char buffer[] = new char[l]; - aboutName.getChars(0, l, buffer, 0); - int str = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, - buffer, l); - OS.InsertMenuItemTextWithCFString(menu, str, (short) 0, 0, - kHICommandAbout); - OS.CFRelease(str); - - // add separator between About & Preferences - OS.InsertMenuItemTextWithCFString(menu, 0, (short) 1, - OS.kMenuItemAttrSeparator, 0); - - // enable pref menu - OS.EnableMenuCommand(menu, kHICommandPreferences); - - // disable services menu - OS.DisableMenuCommand(menu, kHICommandServices); - } - - // schedule disposal of callback object - display.disposeExec(new Runnable() { - public void run() { - commandCallback.dispose(); - } - }); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java deleted file mode 100644 index 13805f8014..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Text example snippet: verify input (format for date) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import java.util.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet179 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new GridLayout()); - final Text text = new Text(shell, SWT.BORDER); - text.setText("YYYY/MM/DD");; - final Calendar calendar = Calendar.getInstance(); - text.addListener(SWT.Verify, new Listener() { - boolean ignore; - public void handleEvent(Event e) { - if (ignore) return; - e.doit = false; - StringBuffer buffer = new StringBuffer(e.text); - char[] chars = new char[buffer.length()]; - buffer.getChars(0, chars.length, chars, 0); - if (e.character == '\b') { - for (int i = e.start; i < e.end; i++) { - switch (i) { - case 0: /* [Y]YYY */ - case 1: /* Y[Y]YY */ - case 2: /* YY[Y]Y */ - case 3: /* YYY[Y] */ { - buffer.append('Y'); break; - } - case 5: /* [M]M*/ - case 6: /* M[M] */{ - buffer.append('M'); break; - } - case 8: /* [D]D */ - case 9: /* D[D] */ { - buffer.append('D'); break; - } - case 4: /* YYYY[/]MM */ - case 7: /* MM[/]DD */ { - buffer.append('/'); break; - } - default: - return; - } - } - text.setSelection(e.start, e.start + buffer.length()); - ignore = true; - text.insert(buffer.toString()); - ignore = false; - text.setSelection(e.start, e.start); - return; - } - - int start = e.start; - if (start > 9) return; - int index = 0; - for (int i = 0; i < chars.length; i++) { - if (start + index == 4 || start + index == 7) { - if (chars[i] == '/') { - index++; - continue; - } - buffer.insert(index++, '/'); - } - if (chars[i] < '0' || '9' < chars[i]) return; - if (start + index == 5 && '1' < chars[i]) return; /* [M]M */ - if (start + index == 8 && '3' < chars[i]) return; /* [D]D */ - index++; - } - String newText = buffer.toString(); - int length = newText.length(); - StringBuffer date = new StringBuffer(text.getText()); - date.replace(e.start, e.start + length, newText); - calendar.set(Calendar.YEAR, 1901); - calendar.set(Calendar.MONTH, Calendar.JANUARY); - calendar.set(Calendar.DATE, 1); - String yyyy = date.substring(0, 4); - if (yyyy.indexOf('Y') == -1) { - int year = Integer.parseInt(yyyy); - calendar.set(Calendar.YEAR, year); - } - String mm = date.substring(5, 7); - if (mm.indexOf('M') == -1) { - int month = Integer.parseInt(mm) - 1; - int maxMonth = calendar.getActualMaximum(Calendar.MONTH); - if (0 > month || month > maxMonth) return; - calendar.set(Calendar.MONTH, month); - } - String dd = date.substring(8,10); - if (dd.indexOf('D') == -1) { - int day = Integer.parseInt(dd); - int maxDay = calendar.getActualMaximum(Calendar.DATE); - if (1 > day || day > maxDay) return; - calendar.set(Calendar.DATE, day); - } else { - if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY) { - char firstChar = date.charAt(8); - if (firstChar != 'D' && '2' < firstChar) return; - } - } - text.setSelection(e.start, e.start + length); - ignore = true; - text.insert(newText); - ignore = false; - } - }); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet18.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet18.java deleted file mode 100644 index 808bfb9ded..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet18.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ToolBar example snippet: create a tool bar (text) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet18 { - -public static void main (String [] args) { - Shell shell = new Shell (); - ToolBar bar = new ToolBar (shell, SWT.BORDER); - for (int i=0; i<8; i++) { - ToolItem item = new ToolItem (bar, SWT.PUSH); - item.setText ("Item " + i); - } - bar.pack (); - shell.open (); - Display display = shell.getDisplay (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java deleted file mode 100644 index 0e7f31cb34..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Create a non-rectangular shell to simulate transparency - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet180 { - -public static void main(String[] args) { - Display display = new Display(); - final Image image = display.getSystemImage(SWT.ICON_WARNING); - //Shell must be created with style SWT.NO_TRIM - final Shell shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP); - shell.setBackground(display.getSystemColor(SWT.COLOR_RED)); - //define a region - Region region = new Region(); - Rectangle pixel = new Rectangle(0, 0, 1, 1); - for (int y = 0; y < 200; y+=2) { - for (int x = 0; x < 200; x+=2) { - pixel.x = x; - pixel.y = y; - region.add(pixel); - } - } - //define the shape of the shell using setRegion - shell.setRegion(region); - Rectangle size = region.getBounds(); - shell.setSize(size.width, size.height); - shell.addPaintListener(new PaintListener() { - public void paintControl(PaintEvent e) { - Rectangle bounds = image.getBounds(); - Point size = shell.getSize(); - e.gc.drawImage(image, 0, 0, bounds.width, bounds.height, 10, 10, size.x-20, size.y-20); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - region.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet181.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet181.java deleted file mode 100644 index 2dd1588108..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet181.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Allow user to reorder columns and reorder columns programmatically. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet181 { - - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new RowLayout(SWT.HORIZONTAL)); - final Table table = new Table(shell, SWT.BORDER | SWT.CHECK); - table.setLayoutData(new RowData(-1, 300)); - table.setHeaderVisible(true); - TableColumn column = new TableColumn(table, SWT.LEFT); - column.setText("Column 0"); - column = new TableColumn(table, SWT.CENTER); - column.setText("Column 1"); - column = new TableColumn(table, SWT.CENTER); - column.setText("Column 2"); - column = new TableColumn(table, SWT.CENTER); - column.setText("Column 3"); - column = new TableColumn(table, SWT.CENTER); - column.setText("Column 4"); - for (int i = 0; i < 100; i++) { - TableItem item = new TableItem(table, SWT.NONE); - String[] text = new String[]{i+" 0", i+" 1", i+" 2", i+" 3", i+" 4"}; - item.setText(text); - } - Listener listener = new Listener() { - public void handleEvent(Event e) { - System.out.println("Move "+e.widget); - } - }; - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < columns.length; i++) { - columns[i].pack(); - columns[i].setMoveable(true); - columns[i].addListener(SWT.Move, listener); - } - Button b = new Button(shell, SWT.PUSH); - b.setText("invert column order"); - b.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - int[] order = table.getColumnOrder(); - for (int i = 0; i < order.length / 2; i++) { - int temp = order[i]; - order[i] = order[order.length - i - 1]; - order[order.length - i - 1] = temp; - } - table.setColumnOrder(order); - } - }); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java deleted file mode 100644 index f710f219fb..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Link example snippet: create a link widget - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet182 { - - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - Link link = new Link(shell, SWT.BORDER); - link.setText("This a very simple link widget."); - link.setSize(140, 40); - shell.pack (); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet183.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet183.java deleted file mode 100644 index 88c5a1e8bd..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet183.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Link example snippet: detect selection events in a link widget - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; - -public class Snippet183 { - - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - Link link = new Link(shell, SWT.NONE); - String text = "The SWT component is designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented."; - link.setText(text); - link.setSize(400, 400); - link.addListener (SWT.Selection, new Listener () { - public void handleEvent(Event event) { - System.out.println("Selection: " + event.text); - } - }); - shell.pack (); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.java deleted file mode 100644 index 331895ae22..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Spinner example snippet: create and initialize a spinner widget - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet184 { - - public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - Spinner spinner = new Spinner (shell, SWT.BORDER); - spinner.setMinimum(0); - spinner.setMaximum(1000); - spinner.setSelection(500); - spinner.setIncrement(1); - spinner.setPageIncrement(100); - spinner.pack(); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java deleted file mode 100644 index d94d7c7c2f..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Make a dropped data type depend on a target item in table - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import java.io.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet185 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - Label label1 = new Label(shell, SWT.BORDER); - label1.setText("Drag Source"); - final Table table = new Table(shell, SWT.BORDER); - for (int i = 0; i < 4; i++) { - TableItem item = new TableItem(table, SWT.NONE); - if (i % 2 == 0) item.setText("Drop a file"); - if (i % 2 == 1) item.setText("Drop text"); - } - DragSource dragSource = new DragSource(label1, DND.DROP_COPY); - dragSource.setTransfer(new Transfer[] {TextTransfer.getInstance(), FileTransfer.getInstance()}); - dragSource.addDragListener(new DragSourceAdapter() { - public void dragSetData(DragSourceEvent event) { - if (FileTransfer.getInstance().isSupportedType(event.dataType)) { - File file = new File("temp"); - event.data = new String[] {file.getAbsolutePath()}; - } - if (TextTransfer.getInstance().isSupportedType(event.dataType)) { - event.data = "once upon a time"; - } - } - }); - DropTarget dropTarget = new DropTarget(table, DND.DROP_COPY | DND.DROP_DEFAULT); - dropTarget.setTransfer(new Transfer[] {TextTransfer.getInstance(), FileTransfer.getInstance()}); - dropTarget.addDropListener(new DropTargetAdapter() { - FileTransfer fileTransfer = FileTransfer.getInstance(); - TextTransfer textTransfer = TextTransfer.getInstance(); - public void dragEnter(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) event.detail = DND.DROP_COPY; - } - public void dragOperationChanged(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) event.detail = DND.DROP_COPY; - } - public void dragOver(DropTargetEvent event) { - event.detail = DND.DROP_NONE; - TableItem item = (TableItem)event.item; - if (item == null) return; - int itemIndex = table.indexOf(item); - if (itemIndex % 2 == 0) { - int index = 0; - while (index < event.dataTypes.length) { - if (fileTransfer.isSupportedType(event.dataTypes[index])) break; - index++; - } - if (index < event.dataTypes.length) { - event.currentDataType = event.dataTypes[index]; - event.detail = DND.DROP_COPY; - return; - } - } else { - int index = 0; - while (index < event.dataTypes.length) { - if (textTransfer.isSupportedType(event.dataTypes[index])) break; - index++; - } - if (index < event.dataTypes.length) { - event.currentDataType = event.dataTypes[index]; - event.detail = DND.DROP_COPY; - return; - } - } - } - - public void drop(DropTargetEvent event) { - TableItem item = (TableItem)event.item; - if (item == null) { - event.detail = DND.DROP_NONE; - return; - } - if (fileTransfer.isSupportedType(event.currentDataType)) { - String[] files = (String[])event.data; - if (files != null && files.length > 0) { - item.setText(files[0]); - } - } - if (textTransfer.isSupportedType(event.currentDataType)) { - String text = (String)event.data; - if (text != null) { - item.setText(text); - } - } - } - - }); - shell.setSize(300, 150); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.html b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.html deleted file mode 100644 index d9f880333b..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.html +++ /dev/null @@ -1,16 +0,0 @@ - - - Post -

Test for Posting Data in IE

- - - - -
- -
- - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java deleted file mode 100644 index 7602c2d4bf..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Reading and writing to a SAFEARRAY - * - * This example reads from a PostData object in a BeforeNavigate2 event and - * creates a PostData object in a call to Navigate (32-bit win32 only). - * NOTE: This snippet uses internal SWT packages that are - * subject to change without notice. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.internal.win32.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.ole.win32.*; -import org.eclipse.swt.widgets.*; - -public class Snippet186 { - -static int CodePage = OS.GetACP(); - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new GridLayout(2, false)); - - final Text text = new Text(shell, SWT.BORDER); - text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - Button go = new Button(shell, SWT.PUSH); - go.setText("Go"); - OleFrame oleFrame = new OleFrame(shell, SWT.NONE); - oleFrame.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); - OleControlSite controlSite; - OleAutomation automation; - try { - controlSite = new OleControlSite(oleFrame, SWT.NONE, "Shell.Explorer"); - automation = new OleAutomation(controlSite); - controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE); - } catch (SWTException ex) { - return; - } - - final OleAutomation auto = automation; - go.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - String url = text.getText(); - int[] rgdispid = auto.getIDsOfNames(new String[]{"Navigate", "URL"}); - int dispIdMember = rgdispid[0]; - Variant[] rgvarg = new Variant[1]; - rgvarg[0] = new Variant(url); - int[] rgdispidNamedArgs = new int[1]; - rgdispidNamedArgs[0] = rgdispid[1]; - auto.invoke(dispIdMember, rgvarg, rgdispidNamedArgs); - } - }); - - - // Read PostData whenever we navigate to a site that uses it - int BeforeNavigate2 = 0xfa; - controlSite.addEventListener(BeforeNavigate2, new OleListener() { - public void handleEvent(OleEvent event) { - Variant url = event.arguments[1]; - Variant postData = event.arguments[4]; - if (postData != null) { - System.out.println("PostData = "+readSafeArray(postData)+", URL = "+url.getString()); - } - } - }); - - // Navigate to this web site which uses post data to fill in the text field - // and put the string "hello world" into the text box - text.setText("file://"+Snippet186.class.getResource("Snippet186.html").getFile()); - int[] rgdispid = automation.getIDsOfNames(new String[]{"Navigate", "URL", "PostData"}); - int dispIdMember = rgdispid[0]; - Variant[] rgvarg = new Variant[2]; - rgvarg[0] = new Variant(text.getText()); - rgvarg[1] = writeSafeArray("hello world"); - int[] rgdispidNamedArgs = new int[2]; - rgdispidNamedArgs[0] = rgdispid[1]; - rgdispidNamedArgs[1] = rgdispid[2]; - automation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs); - - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -// The following structs are accessed in the readSafeArray and writeSafeArray -// functions: -// -// VARIANT: -// short vt -// short wReserved1 -// short wReserved2 -// short wReserved3 -// int parray -// -// SAFEARRAY: -// short cDims // Count of dimensions in this array -// short fFeatures // Flags used by the SafeArray -// int cbElements // Size of an element of the array -// int cLocks // Number of times the array has been locked without corresponding unlock -// int pvData // Pointer to the data -// SAFEARRAYBOUND[] rgsabound // One bound for each dimension -// -// SAFEARRAYBOUND: -// int cElements // the number of elements in the dimension -// int lLbound // the lower bound of the dimension - -static String readSafeArray(Variant variantByRef) { - // Read a safearray that contains data of - // type VT_UI1 (unsigned shorts) which contains - // a text stream. - int pPostData = variantByRef.getByRef(); - short[] vt_type = new short[1]; - OS.MoveMemory(vt_type, pPostData, 2); - String result = null; - if (vt_type[0] == (short)(OLE.VT_BYREF | OLE.VT_VARIANT)) { - int[] pVariant = new int[1]; - OS.MoveMemory(pVariant, pPostData + 8, 4); - vt_type = new short[1]; - OS.MoveMemory(vt_type, pVariant[0], 2); - if (vt_type[0] == (short)(OLE.VT_ARRAY | OLE.VT_UI1)) { - int[] pSafearray = new int[1]; - OS.MoveMemory(pSafearray, pVariant[0] + 8, 4); - short[] cDims = new short[1]; - OS.MoveMemory(cDims, pSafearray[0], 2); - int[] pvData = new int[1]; - OS.MoveMemory(pvData, pSafearray[0] + 12, 4); - int safearrayboundOffset = 0; - for (int i = 0; i < cDims[0]; i++) { - int[] cElements = new int[1]; - OS.MoveMemory(cElements, pSafearray[0] + 16 + safearrayboundOffset, 4); - safearrayboundOffset += 8; - int cchWideChar = OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, pvData[0], -1, null, 0); - if (cchWideChar == 0) return null; - char[] lpWideCharStr = new char [cchWideChar - 1]; - OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, pvData[0], -1, lpWideCharStr, lpWideCharStr.length); - result = new String(lpWideCharStr); - } - } - } - return result; -} - -static Variant writeSafeArray (String string) { - // Create a one dimensional safearray containing two VT_UI1 values - // where VT_UI1 is an unsigned char - - // Define cDims, fFeatures and cbElements - short cDims = 1; - short FADF_FIXEDSIZE = 0x10; - short FADF_HAVEVARTYPE = 0x80; - short fFeatures = (short)(FADF_FIXEDSIZE | FADF_HAVEVARTYPE); - int cbElements = 1; - // Create a pointer and copy the data into it - int count = string.length(); - char[] chars = new char[count + 1]; - string.getChars(0, count, chars, 0); - int cchMultiByte = OS.WideCharToMultiByte(CodePage, 0, chars, -1, null, 0, null, null); - if (cchMultiByte == 0) return null; - int pvData = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, cchMultiByte); - OS.WideCharToMultiByte(CodePage, 0, chars, -1, pvData, cchMultiByte, null, null); - int cElements1 = cchMultiByte; - int lLbound1 = 0; - // Create a safearray in memory - // 12 bytes for cDims, fFeatures and cbElements + 4 bytes for pvData + number of dimensions * (size of safearraybound) - int sizeofSafeArray = 12 + 4 + 1*8; - int pSafeArray = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, sizeofSafeArray); - // Copy the data into the safe array - int offset = 0; - OS.MoveMemory(pSafeArray + offset, new short[] {cDims}, 2); offset += 2; - OS.MoveMemory(pSafeArray + offset, new short[] {fFeatures}, 2); offset += 2; - OS.MoveMemory(pSafeArray + offset, new int[] {cbElements}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {0}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {pvData}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {cElements1}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {lLbound1}, 4); offset += 4; - // Create a variant in memory to hold the safearray - int pVariant = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof); - short vt = (short)(OLE.VT_ARRAY | OLE.VT_UI1); - OS.MoveMemory(pVariant, new short[] {vt}, 2); - OS.MoveMemory(pVariant + 8, new int[]{pSafeArray}, 4); - // Create a by ref variant - Variant variantByRef = new Variant(pVariant, (short)(OLE.VT_BYREF | OLE.VT_VARIANT)); - return variantByRef; -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html deleted file mode 100644 index c9b2762044..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html +++ /dev/null @@ -1,16 +0,0 @@ - - - Evaluate -

Test for IE Script

- - - - - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.java deleted file mode 100644 index ccb01620c9..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.ole.win32.*; -import org.eclipse.swt.widgets.*; - -/* - * Running a script within IE. (win32 only) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ - -public class Snippet187 { - -public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - OleControlSite controlSite; - try { - OleFrame frame = new OleFrame(shell, SWT.NONE); - controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer"); - controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE); - } catch (SWTError e) { - System.out.println("Unable to open activeX control"); - return; - } - - // IWebBrowser - final OleAutomation webBrowser = new OleAutomation(controlSite); - - // When the document is loaded, access the document object for the new page - // and evalute expression using Script. - int DownloadComplete = 104; - controlSite.addEventListener(DownloadComplete, new OleListener() { - public void handleEvent(OleEvent event) { - int[] htmlDocumentID = webBrowser.getIDsOfNames(new String[]{"Document"}); - if (htmlDocumentID == null) return; - Variant pVarResult = webBrowser.getProperty(htmlDocumentID[0]); - if (pVarResult == null || pVarResult.getType() == 0) return; - //IHTMLDocument2 - OleAutomation htmlDocument = null; - try { - htmlDocument = pVarResult.getAutomation(); - pVarResult.dispose(); - - int[] scriptID = htmlDocument.getIDsOfNames(new String[]{"Script"}); - if (scriptID == null) return; - pVarResult = htmlDocument.getProperty(scriptID[0]); - if (pVarResult == null || pVarResult.getType() == 0) return; - OleAutomation htmlWindow = null; - try { - //IHTMLWindow2 - htmlWindow = pVarResult.getAutomation(); - pVarResult.dispose(); - int[] evaluateID = htmlWindow.getIDsOfNames(new String[] {"evaluate"}); - if (evaluateID == null) return; - String expression = "5+Math.sin(9)"; - Variant[] rgvarg = new Variant[] {new Variant(expression)}; - pVarResult = htmlWindow.invoke(evaluateID[0], rgvarg, null); - if (pVarResult == null || pVarResult.getType() == 0) return; - System.out.println(expression+" ="+pVarResult.getString()); - } finally { - htmlWindow.dispose(); - } - } finally { - htmlDocument.dispose(); - } - } - }); - - // Navigate to a web site - int[] ids = webBrowser.getIDsOfNames(new String[]{"Navigate", "URL"}); - Variant[] rgvarg = new Variant[] {new Variant("http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html")}; - int[] rgdispidNamedArgs = new int[]{ids[1]}; - webBrowser.invoke(ids[0], rgvarg, rgdispidNamedArgs); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - //Remember to release OleAutomation Object - webBrowser.dispose(); - display.dispose(); - -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet188.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet188.java deleted file mode 100644 index 13044c2d2b..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet188.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/* - * Scroll a widget into view on focus in - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ - -public class Snippet188 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new GridLayout()); - final ScrolledComposite sc = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - Composite c = new Composite(sc, SWT.NONE); - c.setLayout(new GridLayout(10, true)); - for (int i = 0 ; i < 300; i++) { - Button b = new Button(c, SWT.PUSH); - b.setText("Button "+i); - } - sc.setContent(c); - sc.setExpandHorizontal(true); - sc.setExpandVertical(true); - sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT)); - - Listener listener = new Listener() { - public void handleEvent(Event e) { - Control child = (Control)e.widget; - Rectangle bounds = child.getBounds(); - Rectangle area = sc.getClientArea(); - Point origin = sc.getOrigin(); - if (origin.x > bounds.x) origin.x = Math.max(0, bounds.x); - if (origin.y > bounds.y) origin.y = Math.max(0, bounds.y); - if (origin.x + area.width < bounds.x + bounds.width) origin.x = Math.max(0, bounds.x + bounds.width - area.width); - if (origin.y + area.height < bounds.y + bounds.height) origin.y = Math.max(0, bounds.y + bounds.height - area.height); - sc.setOrigin(origin); - } - }; - Control[] controls = c.getChildren(); - for (int i = 0; i < controls.length; i++) { - controls[i].addListener(SWT.Activate, listener); - } - - shell.setSize(300, 500); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.java deleted file mode 100644 index 54f30b2a71..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/* - * Text with underline and strike through - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ - -public class Snippet189 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setText("StyledText with underline and strike through"); - shell.setLayout(new FillLayout()); - StyledText text = new StyledText (shell, SWT.BORDER); - text.setText("0123456789 ABCDEFGHIJKLM NOPQRSTUVWXYZ"); - // make 0123456789 appear underlined - StyleRange style1 = new StyleRange(); - style1.start = 0; - style1.length = 10; - style1.underline = true; - text.setStyleRange(style1); - // make ABCDEFGHIJKLM have a strike through - StyleRange style2 = new StyleRange(); - style2.start = 11; - style2.length = 13; - style2.strikeout = true; - text.setStyleRange(style2); - // make NOPQRSTUVWXYZ appear underlined and have a strike through - StyleRange style3 = new StyleRange(); - style3.start = 25; - style3.length = 13; - style3.underline = true; - style3.strikeout = true; - text.setStyleRange(style3); - shell.pack(); - shell.open(); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet19.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet19.java deleted file mode 100644 index be6916966b..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet19.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Text example snippet: verify input (only allow digits) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet19 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Text text = new Text (shell, SWT.BORDER | SWT.V_SCROLL); - text.setBounds (10, 10, 200, 200); - text.addListener (SWT.Verify, new Listener () { - public void handleEvent (Event e) { - String string = e.text; - char [] chars = new char [string.length ()]; - string.getChars (0, chars.length, chars, 0); - for (int i=0; i= 0; i--) { - float theta1 = theta + ringDelta; - float cosTheta1 = (float) Math.cos(theta1); - float sinTheta1 = (float) Math.sin(theta1); - GL11.glBegin(GL11.GL_QUAD_STRIP); - float phi = 0.0f; - for (int j = nsides; j >= 0; j--) { - phi += sideDelta; - float cosPhi = (float) Math.cos(phi); - float sinPhi = (float) Math.sin(phi); - float dist = R + r * cosPhi; - GL11.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - GL11.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); - GL11.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - GL11.glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); - } - GL11.glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } - } - - public static void main(String [] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Composite comp = new Composite(shell, SWT.NONE); - comp.setLayout(new FillLayout()); - GLData data = new GLData (); - data.doubleBuffer = true; - final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); - - canvas.setCurrent(); - try { - GLContext.useContext(canvas); - } catch(LWJGLException e) { e.printStackTrace(); } - - canvas.addListener(SWT.Resize, new Listener() { - public void handleEvent(Event event) { - Rectangle bounds = canvas.getBounds(); - float fAspect = (float) bounds.width / (float) bounds.height; - canvas.setCurrent(); - try { - GLContext.useContext(canvas); - } catch(LWJGLException e) { e.printStackTrace(); } - GL11.glViewport(0, 0, bounds.width, bounds.height); - GL11.glMatrixMode(GL11.GL_PROJECTION); - GL11.glLoadIdentity(); - GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glLoadIdentity(); - } - }); - - GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL11.glColor3f(1.0f, 0.0f, 0.0f); - GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); - GL11.glClearDepth(1.0); - GL11.glLineWidth(2); - GL11.glEnable(GL11.GL_DEPTH_TEST); - - shell.setText("SWT/LWJGL Example"); - shell.setSize(640, 480); - shell.open(); - - display.asyncExec(new Runnable() { - int rot = 0; - public void run() { - if (!canvas.isDisposed()) { - canvas.setCurrent(); - try { - GLContext.useContext(canvas); - } catch(LWJGLException e) { e.printStackTrace(); } - GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); - GL11.glClearColor(.3f, .5f, .8f, 1.0f); - GL11.glLoadIdentity(); - GL11.glTranslatef(0.0f, 0.0f, -10.0f); - float frot = rot; - GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); - GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); - rot++; - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); - GL11.glColor3f(0.9f, 0.9f, 0.9f); - drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); - canvas.swapBuffers(); - display.asyncExec(this); - } - } - }); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java deleted file mode 100644 index 98081d4454..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Text example snippet: use a regular expression to verify input - * In this case a phone number is used. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import java.util.regex.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet196 { - /* - * Phone numbers follow the rule [(][1-9][1-9][1-9][)][1-9][1-9][1-9][-][1-9][1-9][1-9][1-9] - */ - private static final String REGEX = "[(]\\d{3}[)]\\d{3}[-]\\d{4}"; //$NON-NLS-1$ - private static final String template = "(###)###-####"; //$NON-NLS-1$ - private static final String defaultText = "(000)000-0000"; //$NON-NLS-1$ - - -public static void main(String[] args) { - - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new GridLayout()); - final Text text = new Text(shell, SWT.BORDER); - Font font = new Font(display, "Courier New", 10, SWT.NONE); //$NON-NLS-1$ - text.setFont(font); - text.setText(template); - text.addListener(SWT.Verify, new Listener() { - //create the pattern for verification - Pattern pattern = Pattern.compile(REGEX); - //ignore event when caused by inserting text inside event handler - boolean ignore; - public void handleEvent(Event e) { - if (ignore) return; - e.doit = false; - if (e.start > 13 || e.end > 14) return; - StringBuffer buffer = new StringBuffer(e.text); - - //handle backspace - if (e.character == '\b') { - for (int i = e.start; i < e.end; i++) { - // skip over separators - switch (i) { - case 0: - if (e.start + 1 == e.end) { - return; - } else { - buffer.append('('); - } - break; - case 4: - if (e.start + 1 == e.end) { - buffer.append(new char [] {'#',')'}); - e.start--; - } else { - buffer.append(')'); - } - break; - case 8: - if (e.start + 1 == e.end) { - buffer.append(new char [] {'#','-'}); - e.start--; - } else { - buffer.append('-'); - } - break; - default: buffer.append('#'); - } - } - text.setSelection(e.start, e.start + buffer.length()); - ignore = true; - text.insert(buffer.toString()); - ignore = false; - // move cursor backwards over separators - if (e.start == 5 || e.start == 9) e.start--; - text.setSelection(e.start, e.start); - return; - } - - StringBuffer newText = new StringBuffer(defaultText); - char[] chars = e.text.toCharArray(); - int index = e.start - 1; - for (int i = 0; i < e.text.length(); i++) { - index++; - switch (index) { - case 0: - if (chars[i] == '(') continue; - index++; - break; - case 4: - if (chars[i] == ')') continue; - index++; - break; - case 8: - if (chars[i] == '-') continue; - index++; - break; - } - if (index >= newText.length()) return; - newText.setCharAt(index, chars[i]); - } - // if text is selected, do not paste beyond range of selection - if (e.start < e.end && index + 1 != e.end) return; - Matcher matcher = pattern.matcher(newText); - if (matcher.lookingAt()) { - text.setSelection(e.start, index + 1); - ignore = true; - text.insert(newText.substring(e.start, index + 1)); - ignore = false; - } - } - }); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - font.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet197.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet197.java deleted file mode 100644 index 3a609bc64e..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet197.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Draw wrapped text using TextLayout - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet197 { - final static String longString = "The preferred size of a widget is the minimum size needed to show its content. In the case of a Composite, the preferred size is the smallest rectangle that contains all of its children. If children have been positioned by the application, the Composite computes its own preferred size based on the size and position of the children. If a Composite is using a layout class to position its children, it asks the Layout to compute the size of its clientArea, and then it adds in the trim to determine its preferred size."; -public static void main(String[] args) { - Display display = new Display(); - final Shell shell = new Shell(display); - final TextLayout layout = new TextLayout(display); - layout.setText(longString); - Listener listener = new Listener() { - public void handleEvent (Event event) { - switch (event.type) { - case SWT.Paint: - layout.draw(event.gc, 10, 10); - break; - case SWT.Resize: - layout.setWidth(shell.getSize().x - 20); - break; - } - } - }; - shell.addListener(SWT.Paint, listener); - shell.addListener(SWT.Resize, listener); - shell.setSize(300, 300); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet198.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet198.java deleted file mode 100644 index 26621fd9e3..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet198.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Create a path from some text - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet198 { -public static void main(String[] args) { - Display display = new Display(); - FontData data = display.getSystemFont().getFontData()[0]; - Font font = new Font(display, data.getName(), 96, SWT.BOLD | SWT.ITALIC); - final Color green = display.getSystemColor(SWT.COLOR_GREEN); - final Color blue = display.getSystemColor(SWT.COLOR_BLUE); - final Path path; - try { - path = new Path(display); - path.addString("SWT", 0, 0, font); - } catch (SWTException e) { - //Advanced Graphics not supported. - //This new API requires the Cairo Vector engine on GTK and Motif and GDI+ on Windows. - System.out.println(e.getMessage()); - return; - } - Shell shell = new Shell(display); - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event e) { - GC gc = e.gc; - gc.setBackground(green); - gc.setForeground(blue); - gc.fillPath(path); - gc.drawPath(path); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - path.dispose(); - font.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet199.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet199.java deleted file mode 100644 index 4b6f831c10..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet199.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Listen for events in Excel (win32 only) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.ole.win32.*; -import org.eclipse.swt.widgets.*; - -public class Snippet199 { - static String IID_AppEvents = "{00024413-0000-0000-C000-000000000046}"; - // Event ID - static int NewWorkbook = 0x0000061d; - static int SheetSelectionChange = 0x00000616; - static int SheetBeforeDoubleClick = 0x00000617; - static int SheetBeforeRightClick = 0x00000618; - static int SheetActivate = 0x00000619; - static int SheetDeactivate = 0x0000061a; - static int SheetCalculate = 0x0000061b; - static int SheetChange = 0x0000061c; - static int WorkbookOpen = 0x0000061f; - static int WorkbookActivate = 0x00000620; - static int WorkbookDeactivate = 0x00000621; - static int WorkbookBeforeClose = 0x00000622; - static int WorkbookBeforeSave = 0x00000623; - static int WorkbookBeforePrint = 0x00000624; - static int WorkbookNewSheet = 0x00000625; - static int WorkbookAddinInstall = 0x00000626; - static int WorkbookAddinUninstall = 0x00000627; - static int WindowResize = 0x00000612; - static int WindowActivate = 0x00000614; - static int WindowDeactivate = 0x00000615; - static int SheetFollowHyperlink = 0x0000073e; - - public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - OleControlSite controlSite; - try { - OleFrame frame = new OleFrame(shell, SWT.NONE); - controlSite = new OleControlSite(frame, SWT.NONE, "Excel.Sheet"); - controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE); - } catch (SWTError e) { - System.out.println("Unable to open activeX control"); - return; - } - shell.open(); - - OleAutomation excelSheet = new OleAutomation(controlSite); - int[] dispIDs = excelSheet.getIDsOfNames(new String[] {"Application"}); - Variant pVarResult = excelSheet.getProperty(dispIDs[0]); - OleAutomation application = pVarResult.getAutomation(); - pVarResult.dispose(); - excelSheet.dispose(); - - int eventID = SheetSelectionChange; - OleListener listener = new OleListener() { - public void handleEvent (OleEvent e) { - System.out.println("selection has changed"); - // two arguments which must be released (row and column) - Variant[] args = e.arguments; - for (int i = 0; i < args.length; i++) { - System.out.println(args[i]); - args [i].dispose(); - } - } - }; - controlSite.addEventListener(application, IID_AppEvents, eventID, listener); - - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - application.dispose(); - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java deleted file mode 100644 index 78e5bd6ca0..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: sort a table by column - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import java.text.*; -import java.util.*; - -public class Snippet2 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - final Table table = new Table(shell, SWT.BORDER); - table.setHeaderVisible(true); - final TableColumn column1 = new TableColumn(table, SWT.NONE); - column1.setText("Column 1"); - final TableColumn column2 = new TableColumn(table, SWT.NONE); - column2.setText("Column 2"); - TableItem item = new TableItem(table, SWT.NONE); - item.setText(new String[] {"a", "3"}); - item = new TableItem(table, SWT.NONE); - item.setText(new String[] {"b", "2"}); - item = new TableItem(table, SWT.NONE); - item.setText(new String[] {"c", "1"}); - column1.setWidth(100); - column2.setWidth(100); - Listener sortListener = new Listener() { - public void handleEvent(Event e) { - TableItem[] items = table.getItems(); - Collator collator = Collator.getInstance(Locale.getDefault()); - TableColumn column = (TableColumn)e.widget; - int index = column == column1 ? 0 : 1; - for (int i = 1; i < items.length; i++) { - String value1 = items[i].getText(index); - for (int j = 0; j < i; j++){ - String value2 = items[j].getText(index); - if (collator.compare(value1, value2) < 0) { - String[] values = {items[i].getText(0), items[i].getText(1)}; - items[i].dispose(); - TableItem item = new TableItem(table, SWT.NONE, j); - item.setText(values); - items = table.getItems(); - break; - } - } - } - table.setSortColumn(column); - } - }; - column1.addListener(SWT.Selection, sortListener); - column2.addListener(SWT.Selection, sortListener); - table.setSortColumn(column1); - table.setSortDirection(SWT.UP); - shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300); - shell.open(); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.java deleted file mode 100644 index 46f0bd9eb7..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * CoolBar example snippet: create a cool bar - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet20 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - CoolBar bar = new CoolBar (shell, SWT.BORDER); - for (int i=0; i<2; i++) { - CoolItem item = new CoolItem (bar, SWT.NONE); - Button button = new Button (bar, SWT.PUSH); - button.setText ("Button " + i); - Point size = button.computeSize (SWT.DEFAULT, SWT.DEFAULT); - item.setPreferredSize (item.computeSize (size.x, size.y)); - item.setControl (button); - } - bar.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet200.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet200.java deleted file mode 100644 index 5cd43da90d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet200.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Fill a shape with a predefined pattern - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet200 { -public static void main(String[] args) { - Display display = new Display(); - //define a pattern on an image - final Image image = new Image(display, 1000, 1000); - Color blue = display.getSystemColor(SWT.COLOR_BLUE); - Color yellow = display.getSystemColor(SWT.COLOR_YELLOW); - Color white = display.getSystemColor(SWT.COLOR_WHITE); - GC gc = new GC(image); - gc.setBackground(white); - gc.setForeground(yellow); - gc.fillGradientRectangle(0, 0, 1000, 1000, true); - for (int i=-500; i<1000; i+=10) { - gc.setForeground(blue); - gc.drawLine(i, 0, 500 + i, 1000); - gc.drawLine(500 + i, 0, i, 1000); - } - gc.dispose(); - final Pattern pattern; - try { - pattern = new Pattern(display, image); - } catch (SWTException e) { - //Advanced Graphics not supported. - //This new API requires the Cairo Vector engine on GTK and Motif and GDI+ on Windows. - System.out.println(e.getMessage()); - return; - } - - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Composite c = new Composite(shell, SWT.DOUBLE_BUFFERED); - c.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event event) { - Rectangle r = ((Composite)event.widget).getClientArea(); - GC gc = event.gc; - gc.setBackgroundPattern(pattern); - gc.fillOval(5, 5, r.width - 10, r.height - 10); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - image.dispose(); - pattern.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet201.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet201.java deleted file mode 100644 index 35a1cb772c..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet201.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Virtual Table example snippet: create a table with 1,000,000 items (lazy, page size 64) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet201 { - -static final int PAGE_SIZE = 64; -static final int COUNT = 100000; - -public static void main(String[] args) { - Display display = new Display (); - final Shell shell = new Shell (display); - shell.setLayout (new RowLayout (SWT.VERTICAL)); - final Table table = new Table (shell, SWT.VIRTUAL | SWT.BORDER); - table.addListener (SWT.SetData, new Listener () { - public void handleEvent (Event event) { - TableItem item = (TableItem) event.item; - int index = table.indexOf (item); - int start = index / PAGE_SIZE * PAGE_SIZE; - int end = Math.min (start + PAGE_SIZE, table.getItemCount ()); - for (int i = start; i < end; i++) { - item = table.getItem (i); - item.setText ("Item " + i); - } - } - }); - table.setLayoutData (new RowData (200, 200)); - Button button = new Button (shell, SWT.PUSH); - button.setText ("Add Items"); - final Label label = new Label(shell, SWT.NONE); - button.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - long t1 = System.currentTimeMillis (); - table.setItemCount (COUNT); - long t2 = System.currentTimeMillis (); - label.setText ("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms) [page=" + PAGE_SIZE + "]"); - shell.layout (); - } - }); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet202.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet202.java deleted file mode 100644 index 3eb904761d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet202.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Virtual Tree example snippet: populate tree lazily - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet202 { - -public static void main(String[] args) { - Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout (new FillLayout()); - final Tree tree = new Tree(shell, SWT.VIRTUAL | SWT.BORDER); - tree.addListener(SWT.SetData, new Listener() { - public void handleEvent(Event event) { - TreeItem item = (TreeItem)event.item; - TreeItem parentItem = item.getParentItem(); - String text = null; - if (parentItem == null) { - text = "node "+tree.indexOf(item); - } else { - text = parentItem.getText()+" - "+parentItem.indexOf(item); - } - item.setText(text); - item.setItemCount(10); - } - }); - tree.setItemCount(20); - shell.setSize(400, 300); - shell.open(); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet203.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet203.java deleted file mode 100644 index 6fb6de8236..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet203.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TextLayout example snippet: using TextLayout justify, alignment and indent - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -public class Snippet203 { - -public static void main(String[] args) { - Display display = new Display(); - final Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); - shell.setText("Indent, Justify, Align"); - String[] texts = { - "Plans do not materialize out of nowhere, nor are they entirely static. To ensure the planning process is transparent and open to the entire Eclipse community, we (the Eclipse PMC) post plans in an embryonic form and revise them throughout the release cycle.", - "The first part of the plan deals with the important matters of release deliverables, release milestones, target operating environments, and release-to-release compatibility. These are all things that need to be clear for any release, even if no features were to change.", - "The remainder of the plan consists of plan items for the various Eclipse subprojects. Each plan item covers a feature or API that is to be added to Eclipse, or some aspect of Eclipse that is to be improved. Each plan item has its own entry in the Eclipse bugzilla database, with a title and a concise summary (usually a single paragraph) that explains the work item at a suitably high enough level so that everyone can readily understand what the work item is without having to understand the nitty-gritty detail.", - }; - int[] alignments = {SWT.LEFT, SWT.CENTER, SWT.RIGHT}; - final TextLayout[] layouts = new TextLayout[texts.length]; - for (int i = 0; i < layouts.length; i++) { - TextLayout layout = new TextLayout(display); - layout.setText(texts[i]); - layout.setIndent(30); - layout.setJustify(true); - layout.setAlignment(alignments[i]); - layouts[i] = layout; - } - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event event) { - Point point = new Point(10, 10); - int width = shell.getClientArea().width - 2 * point.x; - for (int i = 0; i < layouts.length; i++) { - TextLayout layout = layouts[i]; - layout.setWidth(width); - layout.draw(event.gc, point.x, point.y); - point.y += layout.getBounds().height + 10; - } - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - for (int i = 0; i < layouts.length; i++) { - layouts[i].dispose(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet204.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet204.java deleted file mode 100644 index d4b608d0ca..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet204.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TextLayout example snippet: using the rise field of a TextStyle. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -public class Snippet204 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); - shell.setText("Modify Rise"); - FontData data = display.getSystemFont().getFontData()[0]; - Font font = new Font(display, data.getName(), 24, SWT.NORMAL); - Font smallFont = new Font(display, data.getName(), 8, SWT.NORMAL); - GC gc = new GC(shell); - gc.setFont(smallFont); - FontMetrics smallMetrics = gc.getFontMetrics(); - final int smallBaseline = smallMetrics.getAscent() + smallMetrics.getLeading(); - gc.setFont(font); - FontMetrics metrics = gc.getFontMetrics(); - final int baseline = metrics.getAscent() + metrics.getLeading(); - gc.dispose(); - - final TextLayout layout0 = new TextLayout(display); - layout0.setText("SubscriptScriptSuperscript"); - layout0.setFont(font); - TextStyle subscript0 = new TextStyle(smallFont, null, null); - TextStyle superscript0 = new TextStyle(smallFont, null, null); - superscript0.rise = baseline - smallBaseline; - layout0.setStyle(subscript0, 0, 8); - layout0.setStyle(superscript0, 15, 25); - - final TextLayout layout1 = new TextLayout(display); - layout1.setText("SubscriptScriptSuperscript"); - layout1.setFont(font); - TextStyle subscript1 = new TextStyle(smallFont, null, null); - subscript1.rise = -smallBaseline; - TextStyle superscript1 = new TextStyle(smallFont, null, null); - superscript1.rise = baseline; - layout1.setStyle(subscript1, 0, 8); - layout1.setStyle(superscript1, 15, 25); - - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event event) { - Display display = event.display; - GC gc = event.gc; - - Rectangle rect0 = layout0.getBounds(); - rect0.x += 10; - rect0.y += 10; - gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); - gc.fillRectangle(rect0); - layout0.draw(gc, rect0.x, rect0.y); - gc.setForeground(display.getSystemColor(SWT.COLOR_MAGENTA)); - gc.drawLine(rect0.x, rect0.y, rect0.x + rect0.width, rect0.y); - gc.drawLine(rect0.x, rect0.y + baseline, rect0.x + rect0.width, rect0.y + baseline); - gc.drawLine(rect0.x + rect0.width / 2, rect0.y, rect0.x + rect0.width / 2, rect0.y + rect0.height); - - Rectangle rect1 = layout1.getBounds(); - rect1.x += 10; - rect1.y += 20 + rect0.height; - gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); - gc.fillRectangle(rect1); - layout1.draw(gc, rect1.x, rect1.y); - - gc.setForeground(display.getSystemColor(SWT.COLOR_MAGENTA)); - gc.drawLine(rect1.x, rect1.y + smallBaseline, rect1.x + rect1.width, rect1.y + smallBaseline); - gc.drawLine(rect1.x, rect1.y + baseline + smallBaseline, rect1.x + rect1.width, rect1.y + baseline + smallBaseline); - gc.drawLine(rect1.x + rect1.width / 2, rect1.y, rect1.x + rect1.width / 2, rect1.y + rect1.height); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - layout0.dispose(); - layout1.dispose(); - smallFont.dispose(); - font.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet205.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet205.java deleted file mode 100644 index 978f135715..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet205.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TextLayout example snippet: using the GlyphMetrics to embedded images in - * a TextLayout. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - - -public class Snippet205 { - -public static void main(String[] args) { - Display display = new Display(); - final Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED); - shell.setText("Embedding objects in text"); - final Image[] images = {new Image(display, 32, 32), new Image(display, 20, 40), new Image(display, 40, 20)}; - int[] colors = {SWT.COLOR_BLUE, SWT.COLOR_MAGENTA, SWT.COLOR_GREEN}; - for (int i = 0; i < images.length; i++) { - GC gc = new GC(images[i]); - gc.setBackground(display.getSystemColor(colors[i])); - gc.fillRectangle(images[i].getBounds()); - gc.dispose(); - } - - final Button button = new Button(shell, SWT.PUSH); - button.setText("Button"); - button.pack(); - String text = "Here is some text with a blue image \uFFFC, a magenta image \uFFFC, a green image \uFFFC, and a button: \uFFFC."; - final int[] imageOffsets = {36, 55, 72}; - final TextLayout layout = new TextLayout(display); - layout.setText(text); - for (int i = 0; i < images.length; i++) { - Rectangle bounds = images[i].getBounds(); - TextStyle imageStyle = new TextStyle(null, null, null); - imageStyle.metrics = new GlyphMetrics(bounds.height, 0, bounds.width); - layout.setStyle(imageStyle, imageOffsets[i], imageOffsets[i]); - } - Rectangle bounds = button.getBounds(); - TextStyle buttonStyle = new TextStyle(null, null, null); - buttonStyle.metrics = new GlyphMetrics(bounds.height, 0, bounds.width); - final int buttonOffset = text.length() - 2; - layout.setStyle(buttonStyle, buttonOffset, buttonOffset); - - shell.addListener(SWT.Paint, new Listener() { - public void handleEvent(Event event) { - GC gc = event.gc; - Point margin = new Point(10, 10); - layout.setWidth(shell.getClientArea().width - 2 * margin.x); - layout.draw(event.gc, margin.x, margin.y); - for (int i = 0; i < images.length; i++) { - int offset = imageOffsets[i]; - int lineIndex = layout.getLineIndex(offset); - FontMetrics lineMetrics = layout.getLineMetrics(lineIndex); - Point point = layout.getLocation(offset, false); - GlyphMetrics glyphMetrics = layout.getStyle(offset).metrics; - gc.drawImage(images[i], point.x + margin.x, point.y + margin.y + lineMetrics.getAscent() - glyphMetrics.ascent); - } - int lineIndex = layout.getLineIndex(buttonOffset); - FontMetrics lineMetrics = layout.getLineMetrics(lineIndex); - Point point = layout.getLocation(buttonOffset, false); - GlyphMetrics glyphMetrics = layout.getStyle(buttonOffset).metrics; - button.setLocation(point.x + margin.x, point.y + margin.y + lineMetrics.getAscent() - glyphMetrics.ascent); - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - layout.dispose(); - for (int i = 0; i < images.length; i++) { - images[i].dispose(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.java deleted file mode 100644 index 81ab5012e3..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Button example snippet: a Button with text and image - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet206 { - -public static void main(String[] args) { - Display display = new Display(); - Image image = display.getSystemImage(SWT.ICON_QUESTION); - Shell shell = new Shell(display); - shell.setLayout (new GridLayout()); - Button button = new Button(shell, SWT.PUSH); - button.setImage(image); - button.setText("Button"); - shell.setSize(300, 300); - shell.open(); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.java deleted file mode 100644 index 35e090e3e3..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Use transformation matrices to reflect, rotate and shear images - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet207 { - public static void main(String[] args) { - final Display display = new Display(); - - final Image image = new Image(display, 110, 60); - GC gc = new GC(image); - Font font = new Font(display, "Times", 30, SWT.BOLD); - gc.setFont(font); - gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); - gc.fillRectangle(0, 0, 110, 60); - gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); - gc.drawText("SWT", 10, 10, true); - font.dispose(); - gc.dispose(); - - final Rectangle rect = image.getBounds(); - Shell shell = new Shell(display); - shell.setText("Matrix Tranformations"); - shell.setLayout(new FillLayout()); - final Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED); - canvas.addPaintListener(new PaintListener () { - public void paintControl(PaintEvent e) { - GC gc = e.gc; - gc.setAdvanced(true); - if (!gc.getAdvanced()){ - gc.drawText("Advanced graphics not supported", 30, 30, true); - return; - } - - // Original image - int x = 30, y = 30; - gc.drawImage(image, x, y); - x += rect.width + 30; - - Transform transform = new Transform(display); - - // Note that the tranform is applied to the whole GC therefore - // the coordinates need to be adjusted too. - - // Reflect around the y axis. - transform.setElements(-1, 0, 0, 1, 0 ,0); - gc.setTransform(transform); - gc.drawImage(image, -1*x-rect.width, y); - - x = 30; y += rect.height + 30; - - // Reflect around the x axis. - transform.setElements(1, 0, 0, -1, 0, 0); - gc.setTransform(transform); - gc.drawImage(image, x, -1*y-rect.height); - - x += rect.width + 30; - - // Reflect around the x and y axes - transform.setElements(-1, 0, 0, -1, 0, 0); - gc.setTransform(transform); - gc.drawImage(image, -1*x-rect.width, -1*y-rect.height); - - x = 30; y += rect.height + 30; - - // Shear in the x-direction - transform.setElements(1, 0, -1, 1, 0, 0); - gc.setTransform(transform); - gc.drawImage(image, 300, y); - - // Shear in y-direction - transform.setElements(1, -1, 0, 1, 0, 0); - gc.setTransform(transform); - gc.drawImage(image, 150, 475); - - // Rotate by 45 degrees - float cos45 = (float)Math.cos(45); - float sin45 = (float)Math.sin(45); - transform.setElements(cos45, sin45, -sin45, cos45, 0, 0); - gc.setTransform(transform); - gc.drawImage(image, 350, 100); - - transform.dispose(); - } - }); - - shell.setSize(350, 550); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - image.dispose(); - display.dispose(); - } -} - - - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.java deleted file mode 100644 index 7a8865cb28..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Change hue, saturation and brightness of a color - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet208 { - -public static void main (String [] args) { - PaletteData palette = new PaletteData(0xff, 0xff00, 0xff0000); - - // ImageData showing variations of hue - ImageData hueData = new ImageData(360, 100, 24, palette); - float hue = 0; - for (int x = 0; x < hueData.width; x++) { - for (int y = 0; y < hueData.height; y++) { - int pixel = palette.getPixel(new RGB(hue, 1f, 1f)); - hueData.setPixel(x, y, pixel); - } - hue += 360f / hueData.width; - } - - // ImageData showing saturation on x axis and brightness on y axis - ImageData saturationBrightnessData = new ImageData(360, 360, 24, palette); - float saturation = 0f; - float brightness = 1f; - for (int x = 0; x < saturationBrightnessData.width; x++) { - brightness = 1f; - for (int y = 0; y < saturationBrightnessData.height; y++) { - int pixel = palette.getPixel(new RGB(360f, saturation, brightness)); - saturationBrightnessData.setPixel(x, y, pixel); - brightness -= 1f / saturationBrightnessData.height; - } - saturation += 1f / saturationBrightnessData.width; - } - - Display display = new Display(); - Image hueImage = new Image(display, hueData); - Image saturationImage = new Image(display, saturationBrightnessData); - Shell shell = new Shell(display); - shell.setText("Hue, Saturation, Brightness"); - GridLayout gridLayout = new GridLayout(2, false); - gridLayout.verticalSpacing = 10; - gridLayout.marginWidth = gridLayout.marginHeight = 16; - shell.setLayout(gridLayout); - - Label label = new Label(shell, SWT.CENTER); - label.setImage(hueImage); - GridData data = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 2, 1); - label.setLayoutData(data); - - label = new Label(shell, SWT.CENTER); //spacer - label = new Label(shell, SWT.CENTER); - label.setText("Hue"); - data = new GridData(SWT.CENTER, SWT.CENTER, false, false); - label.setLayoutData(data); - label = new Label(shell, SWT.CENTER); //spacer - data = new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1); - label.setLayoutData(data); - - label = new Label(shell, SWT.LEFT); - label.setText("Brightness"); - data = new GridData(SWT.LEFT, SWT.CENTER, false, false); - label.setLayoutData(data); - - label = new Label(shell, SWT.CENTER); - label.setImage(saturationImage); - data = new GridData(SWT.CENTER, SWT.CENTER, false, false); - label.setLayoutData (data); - - label = new Label(shell, SWT.CENTER); //spacer - label = new Label(shell, SWT.CENTER); - label.setText("Saturation"); - data = new GridData(SWT.CENTER, SWT.CENTER, false, false); - label.setLayoutData(data); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - hueImage.dispose(); - saturationImage.dispose(); - display.dispose(); -} - -} - - diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet209.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet209.java deleted file mode 100644 index 8992502c91..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet209.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * SWT OpenGL snippet: use JOGL to draw to an SWT GLCanvas - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.opengl.GLCanvas; -import org.eclipse.swt.opengl.GLData; - -import javax.media.opengl.GL; -import javax.media.opengl.GLContext; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.glu.GLU; - -public class Snippet209 { - static void drawTorus(GL gl, float r, float R, int nsides, int rings) { - float ringDelta = 2.0f * (float) Math.PI / rings; - float sideDelta = 2.0f * (float) Math.PI / nsides; - float theta = 0.0f, cosTheta = 1.0f, sinTheta = 0.0f; - for (int i = rings - 1; i >= 0; i--) { - float theta1 = theta + ringDelta; - float cosTheta1 = (float) Math.cos(theta1); - float sinTheta1 = (float) Math.sin(theta1); - gl.glBegin(GL.GL_QUAD_STRIP); - float phi = 0.0f; - for (int j = nsides; j >= 0; j--) { - phi += sideDelta; - float cosPhi = (float) Math.cos(phi); - float sinPhi = (float) Math.sin(phi); - float dist = R + r * cosPhi; - gl.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - gl.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); - gl.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - gl.glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); - } - gl.glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } - } - - public static void main(String [] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Composite comp = new Composite(shell, SWT.NONE); - comp.setLayout(new FillLayout()); - GLData data = new GLData (); - data.doubleBuffer = true; - final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); - - canvas.setCurrent(); - final GLContext context = GLDrawableFactory.getFactory().createExternalGLContext(); - - canvas.addListener(SWT.Resize, new Listener() { - public void handleEvent(Event event) { - Rectangle bounds = canvas.getBounds(); - float fAspect = (float) bounds.width / (float) bounds.height; - canvas.setCurrent(); - context.makeCurrent(); - GL gl = context.getGL (); - gl.glViewport(0, 0, bounds.width, bounds.height); - gl.glMatrixMode(GL.GL_PROJECTION); - gl.glLoadIdentity(); - GLU glu = new GLU(); - glu.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glLoadIdentity(); - context.release(); - } - }); - - context.makeCurrent(); - GL gl = context.getGL (); - gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - gl.glColor3f(1.0f, 0.0f, 0.0f); - gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); - gl.glClearDepth(1.0); - gl.glLineWidth(2); - gl.glEnable(GL.GL_DEPTH_TEST); - context.release(); - - shell.setText("SWT/JOGL Example"); - shell.setSize(640, 480); - shell.open(); - - display.asyncExec(new Runnable() { - int rot = 0; - public void run() { - if (!canvas.isDisposed()) { - canvas.setCurrent(); - context.makeCurrent(); - GL gl = context.getGL (); - gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glClearColor(.3f, .5f, .8f, 1.0f); - gl.glLoadIdentity(); - gl.glTranslatef(0.0f, 0.0f, -10.0f); - float frot = rot; - gl.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); - gl.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); - rot++; - gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE); - gl.glColor3f(0.9f, 0.9f, 0.9f); - drawTorus(gl, 1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); - canvas.swapBuffers(); - context.release(); - display.asyncExec(this); - } - } - }); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java deleted file mode 100644 index 42ba0083f1..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Canvas example snippet: implement tab traversal (behave like a tab group) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet21 { - -public static void main (String [] args) { - Display display = new Display (); - final Color red = display.getSystemColor (SWT.COLOR_RED); - final Color blue = display.getSystemColor (SWT.COLOR_BLUE); - Shell shell = new Shell (display); - Button b = new Button (shell, SWT.PUSH); - b.setBounds (10, 10, 100, 32); - b.setText ("Button"); - shell.setDefaultButton (b); - final Canvas c = new Canvas (shell, SWT.BORDER); - c.setBounds (10, 50, 100, 32); - c.addListener (SWT.Traverse, new Listener () { - public void handleEvent (Event e) { - switch (e.detail) { - /* Do tab group traversal */ - case SWT.TRAVERSE_ESCAPE: - case SWT.TRAVERSE_RETURN: - case SWT.TRAVERSE_TAB_NEXT: - case SWT.TRAVERSE_TAB_PREVIOUS: - case SWT.TRAVERSE_PAGE_NEXT: - case SWT.TRAVERSE_PAGE_PREVIOUS: - e.doit = true; - break; - } - } - }); - c.addListener (SWT.FocusIn, new Listener () { - public void handleEvent (Event e) { - c.setBackground (red); - } - }); - c.addListener (SWT.FocusOut, new Listener () { - public void handleEvent (Event e) { - c.setBackground (blue); - } - }); - c.addListener (SWT.KeyDown, new Listener () { - public void handleEvent (Event e) { - System.out.println ("KEY"); - for (int i=0; i<64; i++) { - Color c1 = red, c2 = blue; - if (c.isFocusControl ()) { - c1 = blue; c2 = red; - } - c.setBackground (c1); - c.update (); - c.setBackground (c2); - } - } - }); - Text t = new Text (shell, SWT.SINGLE | SWT.BORDER); - t.setBounds (10, 85, 100, 32); - - Text r = new Text (shell, SWT.MULTI | SWT.BORDER); - r.setBounds (10, 120, 100, 32); - - c.setFocus (); - shell.setSize (200, 200); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java deleted file mode 100644 index 5be6a607d8..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet210.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag text between two StyledText widgets - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet210 { - static String string1 = "A drag source is the provider of data in a Drag and Drop data transfer as well as "+ - "the originator of the Drag and Drop operation. The data provided by the drag source "+ - "may be transferred to another location in the same widget, to a different widget "+ - "within the same application, or to a different application altogether. For example, "+ - "you can drag text from your application and drop it on an email application, or you "+ - "could drag an item in a tree and drop it below a different node in the same tree."; - - static String string2 = "A drop target receives data in a Drag and Drop operation. The data received by "+ - "the drop target may have come from the same widget, from a different widget within "+ - "the same application, or from a different application altogether. For example, you "+ - "can drag text from an email application and drop it on your application, or you could "+ - "drag an item in a tree and drop it below a different node in the same tree."; - -public static void main (String [] args) { - final Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - int style = SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; - final StyledText text1 = new StyledText(shell, style); - text1.setText(string1); - DragSource source = new DragSource(text1, DND.DROP_COPY | DND.DROP_MOVE); - source.setTransfer(new Transfer[] {TextTransfer.getInstance()}); - source.addDragListener(new DragSourceAdapter() { - Point selection; - public void dragStart(DragSourceEvent e) { - selection = text1.getSelection(); - e.doit = selection.x != selection.y; - } - public void dragSetData(DragSourceEvent e) { - e.data = text1.getText(selection.x, selection.y-1); - } - public void dragFinished(DragSourceEvent e) { - if (e.detail == DND.DROP_MOVE) { - text1.replaceTextRange(selection.x, selection.y - selection.x, ""); - } - selection = null; - } - }); - - final StyledText text2 = new StyledText(shell, style); - text2.setText(string2); - DropTarget target = new DropTarget(text2, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK); - target.setTransfer(new Transfer[] {TextTransfer.getInstance()}); - target.addDropListener(new DropTargetAdapter() { - public void dragEnter(DropTargetEvent e) { - if (e.detail == DND.DROP_DEFAULT) - e.detail = DND.DROP_COPY; - } - public void dragOperationChanged(DropTargetEvent e) { - if (e.detail == DND.DROP_DEFAULT) - e.detail = DND.DROP_COPY; - } - public void drop(DropTargetEvent e) { - text2.insert((String)e.data); - } - }); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.java deleted file mode 100644 index 038598cd2c..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * SWT StyledText snippet: use rise and font with StyleRange. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.custom.*; - -public class Snippet211 { - - static String text = - "You can set any font you want in a range. You can also set a baseline rise and all other old features" + - " like background and foreground, and mix them any way you want. Totally awesome."; - - public static void main(String [] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER); - styledText.setText(text); - FontData data = styledText.getFont().getFontData()[0]; - Font font1 = new Font(display, data.getName(), data.getHeight() * 2, data.getStyle()); - Font font2 = new Font(display, data.getName(), data.getHeight() * 4 / 5, data.getStyle()); - StyleRange[] styles = new StyleRange[8]; - styles[0] = new StyleRange(); - styles[0].font = font1; - styles[1] = new StyleRange(); - styles[1].rise = data.getHeight() / 3; - styles[2] = new StyleRange(); - styles[2].background = display.getSystemColor(SWT.COLOR_GREEN); - styles[3] = new StyleRange(); - styles[3].foreground = display.getSystemColor(SWT.COLOR_MAGENTA); - styles[4] = new StyleRange(); - styles[4].font = font2; - styles[4].foreground = display.getSystemColor(SWT.COLOR_BLUE);; - styles[4].underline = true; - styles[5] = new StyleRange(); - styles[5].rise = -data.getHeight() / 3; - styles[5].strikeout = true; - styles[5].underline = true; - styles[6] = new StyleRange(); - styles[6].font = font1; - styles[6].foreground = display.getSystemColor(SWT.COLOR_YELLOW); - styles[6].background = display.getSystemColor(SWT.COLOR_BLUE); - styles[7] = new StyleRange(); - styles[7].rise = data.getHeight() / 3; - styles[7].underline = true; - styles[7].fontStyle = SWT.BOLD; - styles[7].foreground = display.getSystemColor(SWT.COLOR_RED); - styles[7].background = display.getSystemColor(SWT.COLOR_BLACK); - - int[] ranges = new int[] {16, 4, 61, 13, 107, 10, 122, 10, 134, 3, 143, 6, 160, 7, 168, 7}; - styledText.setStyleRanges(ranges, styles); - - shell.setSize(300, 300); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - font1.dispose(); - font2.dispose(); - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.java deleted file mode 100644 index 3bef3b747d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.custom.*; - -/** - * StyledText snippet: embed images - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -public class Snippet212 { - - static StyledText styledText; - static String text = - "This snippet shows how to embed images in a StyledText.\n"+ - "Here is one: \uFFFC, and here is another: \uFFFC."+ - "Use the add button to add an image from your filesystem to the StyledText at the current caret offset."; - static Image[] images; - static int[] offsets; - - static void addImage(Image image, int offset) { - StyleRange style = new StyleRange (); - style.start = offset; - style.length = 1; - Rectangle rect = image.getBounds(); - style.metrics = new GlyphMetrics(rect.height, 0, rect.width); - styledText.setStyleRange(style); - } - - public static void main(String [] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new GridLayout()); - styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER); - styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - styledText.setText(text); - images = new Image[] { - display.getSystemImage(SWT.ICON_QUESTION), - display.getSystemImage(SWT.ICON_INFORMATION), - }; - offsets = new int[images.length]; - int lastOffset = 0; - for (int i = 0; i < images.length; i++) { - int offset = text.indexOf("\uFFFC", lastOffset); - offsets[i] = offset; - addImage(images[i], offset); - lastOffset = offset + 1; - } - - // use a verify listener to keep the offsets up to date - styledText.addVerifyListener(new VerifyListener() { - public void verifyText(VerifyEvent e) { - int start = e.start; - int replaceCharCount = e.end - e.start; - int newCharCount = e.text.length(); - for (int i = 0; i < offsets.length; i++) { - int offset = offsets[i]; - if (start <= offset && offset < start + replaceCharCount) { - // this image is being deleted from the text - if (images[i] != null && !images[i].isDisposed()) { - images[i].dispose(); - images[i] = null; - } - offset = -1; - } - if (offset != -1 && offset >= start) offset += newCharCount - replaceCharCount; - offsets[i] = offset; - } - } - }); - styledText.addPaintObjectListener(new PaintObjectListener() { - public void paintObject(PaintObjectEvent event) { - GC gc = event.gc; - StyleRange style = event.style; - int start = style.start; - for (int i = 0; i < offsets.length; i++) { - int offset = offsets[i]; - if (start == offset) { - Image image = images[i]; - int x = event.x; - int y = event.y + event.ascent - style.metrics.ascent; - gc.drawImage(image, x, y); - } - } - } - }); - - Button button = new Button (shell, SWT.PUSH); - button.setText("Add Image"); - button.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); - button.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - FileDialog dialog = new FileDialog(shell); - String filename = dialog.open(); - if (filename != null) { - try { - Image image = new Image(display, filename); - int offset = styledText.getCaretOffset(); - styledText.replaceTextRange(offset, 0, "\uFFFC"); - int index = 0; - while (index < offsets.length) { - if (offsets[index] == -1 && images[index] == null) break; - index++; - } - if (index == offsets.length) { - int[] tmpOffsets = new int[index + 1]; - System.arraycopy(offsets, 0, tmpOffsets, 0, offsets.length); - offsets = tmpOffsets; - Image[] tmpImages = new Image[index + 1]; - System.arraycopy(images, 0, tmpImages, 0, images.length); - images = tmpImages; - } - offsets[index] = offset; - images[index] = image; - addImage(image, offset); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - }); - shell.setSize(400, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - for (int i = 0; i < images.length; i++) { - Image image = images[i]; - if (image != null && !image.isDisposed()) { - image.dispose(); - } - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.java deleted file mode 100644 index e49b430d4f..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * SWT StyledText snippet: use indent, alignment and justify. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; - -public class Snippet213 { - - static String text = - "The first paragraph has an indentation of fifty pixels. Indentation is the amount of white space in front of the first line of a paragraph. If this paragraph wraps to several lines you should see the indentation only on the first line.\n\n" + - "The second paragraph is center aligned. Alignment only works when the StyledText is using word wrap. Alignment, as with all other line attributes, can be set for the whole widget or just for a set of lines.\n\n" + - "The third paragraph is justified. Like alignment, justify only works when the StyledText is using word wrap. If the paragraph wraps to several lines, the justification is performed on all lines but the last one.\n\n" + - "The last paragraph is justified and right aligned. In this case, the alignment is only noticeable in the final line."; - - public static void main(String [] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER); - styledText.setText(text); - styledText.setLineIndent(0, 1, 50); - styledText.setLineAlignment(2, 1, SWT.CENTER); - styledText.setLineJustify(4, 1, true); - styledText.setLineAlignment(6, 1, SWT.RIGHT); - styledText.setLineJustify(6, 1, true); - - shell.setSize(300, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.java deleted file mode 100644 index ef004659d0..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Control example snippet: set a background image (a dynamic gradient) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet214 { - static Image oldImage; - public static void main(String [] args) { - final Display display = new Display (); - final Shell shell = new Shell (display); - shell.setBackgroundMode (SWT.INHERIT_DEFAULT); - FillLayout layout1 = new FillLayout (SWT.VERTICAL); - layout1.marginWidth = layout1.marginHeight = 10; - shell.setLayout (layout1); - Group group = new Group (shell, SWT.NONE); - group.setText ("Group "); - RowLayout layout2 = new RowLayout (SWT.VERTICAL); - layout2.marginWidth = layout2.marginHeight = layout2.spacing = 10; - group.setLayout (layout2); - for (int i=0; i<8; i++) { - Button button = new Button (group, SWT.RADIO); - button.setText ("Button " + i); - } - shell.addListener (SWT.Resize, new Listener () { - public void handleEvent (Event event) { - Rectangle rect = shell.getClientArea (); - Image newImage = new Image (display, Math.max (1, rect.width), 1); - GC gc = new GC (newImage); - gc.setForeground (display.getSystemColor (SWT.COLOR_WHITE)); - gc.setBackground (display.getSystemColor (SWT.COLOR_BLUE)); - gc.fillGradientRectangle (rect.x, rect.y, rect.width, 1, false); - gc.dispose (); - shell.setBackgroundImage (newImage); - if (oldImage != null) oldImage.dispose (); - oldImage = newImage; - } - }); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - if (oldImage != null) oldImage.dispose (); - display.dispose (); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java deleted file mode 100644 index 0d7331f559..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * GC example snippet: take a screen shot with a GC - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.custom.*; - -public class Snippet215 { - -public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Button button = new Button(shell, SWT.PUSH); - button.setText("Capture"); - button.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - - /* Take the screen shot */ - GC gc = new GC(display); - final Image image = new Image(display, display.getBounds()); - gc.copyArea(image, 0, 0); - gc.dispose(); - - Shell popup = new Shell(shell, SWT.SHELL_TRIM); - popup.setLayout(new FillLayout()); - popup.setText("Image"); - popup.setBounds(50, 50, 200, 200); - popup.addListener(SWT.Close, new Listener() { - public void handleEvent(Event e) { - image.dispose(); - } - }); - - ScrolledComposite sc = new ScrolledComposite (popup, SWT.V_SCROLL | SWT.H_SCROLL); - Canvas canvas = new Canvas(sc, SWT.NONE); - sc.setContent(canvas); - canvas.setBounds(display.getBounds ()); - canvas.addPaintListener(new PaintListener() { - public void paintControl(PaintEvent e) { - e.gc.drawImage(image, 0, 0); - } - }); - popup.open(); - } - }); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet216.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet216.java deleted file mode 100644 index ee8f7c4c00..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet216.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tool Tips example snippet: show a tool tip inside a rectangle - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet216 { - public static void main (String [] args) { - Display display = new Display (); - final Color [] colors = { - display.getSystemColor (SWT.COLOR_RED), - display.getSystemColor (SWT.COLOR_GREEN), - display.getSystemColor (SWT.COLOR_BLUE), - }; - final Rectangle [] rects = { - new Rectangle (10, 10, 30, 30), - new Rectangle (20, 45, 25, 35), - new Rectangle (80, 80, 10, 10), - }; - final Shell shell = new Shell (display); - Listener mouseListener = new Listener () { - public void handleEvent (Event event) { - switch (event.type) { - case SWT.MouseEnter: - case SWT.MouseMove: - for (int i=0; i= start) offset += newCharCount - replaceCharCount; - offsets[i] = offset; - } - } - }); - - // reposition widgets on paint event - styledText.addPaintObjectListener(new PaintObjectListener() { - public void paintObject(PaintObjectEvent event) { - StyleRange style = event.style; - int start = style.start; - for (int i = 0; i < offsets.length; i++) { - int offset = offsets[i]; - if (start == offset) { - Point pt = controls[i].getSize(); - int x = event.x + MARGIN; - int y = event.y + event.ascent - 2*pt.y/3; - controls[i].setLocation(x, y); - break; - } - } - } - }); - - shell.setSize(400, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - font.dispose(); - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.java deleted file mode 100644 index fd24a402d4..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * SWT StyledText snippet: use gradient background. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.graphics.*; - -public class Snippet218 { - - static String text = "Plans do not materialize out of nowhere, nor are they entirely static. To ensure the planning process is " + - "transparent and open to the entire Eclipse community, we (the Eclipse PMC) post plans in an embryonic "+ - "form and revise them throughout the release cycle. \n"+ - "The first part of the plan deals with the important matters of release deliverables, release milestones, target "+ - "operating environments, and release-to-release compatibility. These are all things that need to be clear for "+ - "any release, even if no features were to change. \n"; - static Image oldImage; - - public static void main(String [] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER); - styledText.setText(text); - FontData data = display.getSystemFont().getFontData()[0]; - Font font = new Font(display, data.getName(), 16, SWT.BOLD); - styledText.setFont(font); - styledText.setForeground(display.getSystemColor (SWT.COLOR_BLUE)); - styledText.addListener (SWT.Resize, new Listener () { - public void handleEvent (Event event) { - Rectangle rect = styledText.getClientArea (); - Image newImage = new Image (display, 1, Math.max (1, rect.height)); - GC gc = new GC (newImage); - gc.setForeground (display.getSystemColor (SWT.COLOR_WHITE)); - gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW)); - gc.fillGradientRectangle (rect.x, rect.y, 1, rect.height, true); - gc.dispose (); - styledText.setBackgroundImage (newImage); - if (oldImage != null) oldImage.dispose (); - oldImage = newImage; - } - }); - shell.setSize(700, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - if (oldImage != null) oldImage.dispose (); - font.dispose(); - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet219.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet219.java deleted file mode 100644 index ae37609757..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet219.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Region snippet: Create non-rectangular shell from an image with transparency - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ -public class Snippet219 { - public static void main(String[] args) { - final Display display = new Display (); - final Image image = display.getSystemImage(SWT.ICON_INFORMATION); - final Shell shell = new Shell (display, SWT.NO_TRIM); - Region region = new Region(); - final ImageData imageData = image.getImageData(); - if (imageData.alphaData != null) { - Rectangle pixel = new Rectangle(0, 0, 1, 1); - for (int y = 0; y < imageData.height; y++) { - for (int x = 0; x < imageData.width; x++) { - if (imageData.getAlpha(x, y) == 255) { - pixel.x = imageData.x + x; - pixel.y = imageData.y + y; - region.add(pixel); - } - } - } - } else { - ImageData mask = imageData.getTransparencyMask(); - Rectangle pixel = new Rectangle(0, 0, 1, 1); - for (int y = 0; y < mask.height; y++) { - for (int x = 0; x < mask.width; x++) { - if (mask.getPixel(x, y) != 0) { - pixel.x = imageData.x + x; - pixel.y = imageData.y + y; - region.add(pixel); - } - } - } - } - shell.setRegion(region); - - Listener l = new Listener() { - int startX, startY; - public void handleEvent(Event e) { - if (e.type == SWT.KeyDown && e.character == SWT.ESC) { - shell.dispose(); - } - if (e.type == SWT.MouseDown && e.button == 1) { - startX = e.x; - startY = e.y; - } - if (e.type == SWT.MouseMove && (e.stateMask & SWT.BUTTON1) != 0) { - Point p = shell.toDisplay(e.x, e.y); - p.x -= startX; - p.y -= startY; - shell.setLocation(p); - } - if (e.type == SWT.Paint) { - e.gc.drawImage(image, imageData.x, imageData.y); - } - } - }; - shell.addListener(SWT.KeyDown, l); - shell.addListener(SWT.MouseDown, l); - shell.addListener(SWT.MouseMove, l); - shell.addListener(SWT.Paint, l); - - shell.setSize(imageData.x + imageData.width, imageData.y + imageData.height); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) - display.sleep (); - } - region.dispose(); - image.dispose (); - display.dispose (); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet22.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet22.java deleted file mode 100644 index 765b5badb0..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet22.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Text example snippet: select all the text in the control - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.widgets.*; - -public class Snippet22 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Text text = new Text (shell, 0); - text.setText ("ASDF"); - text.setSize (64, 32); - text.selectAll (); - shell.pack (); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.java deleted file mode 100644 index b8825164cc..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; -/* - * Tree example snippet: Images on the right side of the TreeItem - * - * For a detailed explanation of this snippet see - * http://www.eclipse.org/articles/Article-CustomDrawingTableAndTreeItems/customDraw.htm#_example5 - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet220 { - -public static void main(String [] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setBounds(10, 10, 350, 200); - Image xImage = new Image (display, 16, 16); - GC gc = new GC(xImage); - gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); - gc.drawLine(1, 1, 14, 14); - gc.drawLine(1, 14, 14, 1); - gc.drawOval(2, 2, 11, 11); - gc.dispose(); - final int IMAGE_MARGIN = 2; - final Tree tree = new Tree(shell, SWT.CHECK); - tree.setBounds(10, 10, 300, 150); - TreeItem item = new TreeItem(tree, SWT.NONE); - item.setText("root item"); - for (int i = 0; i < 4; i++) { - TreeItem newItem = new TreeItem(item, SWT.NONE); - newItem.setText("descendent " + i); - if (i % 2 == 0) newItem.setData(xImage); - item.setExpanded(true); - item = newItem; - } - - /* - * NOTE: MeasureItem and PaintItem are called repeatedly. Therefore it is - * critical for performance that these methods be as efficient as possible. - */ - tree.addListener(SWT.MeasureItem, new Listener() { - public void handleEvent(Event event) { - TreeItem item = (TreeItem)event.item; - Image trailingImage = (Image)item.getData(); - if (trailingImage != null) { - event.width += trailingImage.getBounds().width + IMAGE_MARGIN; - } - } - }); - tree.addListener(SWT.PaintItem, new Listener() { - public void handleEvent(Event event) { - TreeItem item = (TreeItem)event.item; - Image trailingImage = (Image)item.getData(); - if (trailingImage != null) { - int x = event.x + event.width + IMAGE_MARGIN; - int itemHeight = tree.getItemHeight(); - int imageHeight = trailingImage.getBounds().height; - int y = event.y + (itemHeight - imageHeight) / 2; - event.gc.drawImage(trailingImage, x, y); - } - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - xImage.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet221.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet221.java deleted file mode 100644 index 6b606925db..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet221.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; -/* - * example snippet: Scroll tree when mouse at top or bottom - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet221 { - static Runnable Heartbeat; - static boolean Tracking; - static int ScrollSpeed = 40; - -public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Tree tree = new Tree(shell, SWT.FULL_SELECTION | SWT.BORDER); - tree.setHeaderVisible(true); - TreeColumn column0 = new TreeColumn(tree, SWT.LEFT); - column0.setText("Column 0"); - TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); - column1.setText("Column 1"); - TreeColumn column2 = new TreeColumn(tree, SWT.LEFT); - column2.setText("Column 2"); - for (int i = 0; i < 9; i++) { - TreeItem item = new TreeItem(tree, SWT.NONE); - item.setText("item "+i); - item.setText(1, "column 1 - "+i); - item.setText(2, "column 2 - "+i); - for (int j = 0; j < 9; j++) { - TreeItem subItem = new TreeItem(item, SWT.NONE); - subItem.setText("item "+i+" "+j); - subItem.setText(1, "column 1 - "+i+" "+j); - subItem.setText(2, "column 2 - "+i+" "+j); - for (int k = 0; k < 9; k++) { - TreeItem subsubItem = new TreeItem(subItem, SWT.NONE); - subsubItem.setText("item "+i+" "+j+" "+k); - subsubItem.setText(1, "column 1 - "+i+" "+j+" "+k); - subsubItem.setText(2, "column 2 - "+i+" "+j+" "+k); - } - } - } - column0.pack(); - column1.pack(); - column2.pack(); - - Heartbeat = new Runnable() { - public void run() { - if (!Tracking || tree.isDisposed()) return; - Point cursor = display.getCursorLocation(); - cursor = display.map(null, tree, cursor); - Scroll(tree, cursor.x, cursor.y); - display.timerExec(ScrollSpeed, Heartbeat); - } - }; - Listener listener = new Listener() { - public void handleEvent(Event event) { - switch (event.type) { - case SWT.MouseEnter: - Tracking = true; - display.timerExec(0, Heartbeat); - break; - case SWT.MouseExit: - Tracking = false; - break; - } - } - }; - tree.addListener(SWT.MouseEnter, listener); - tree.addListener(SWT.MouseExit, listener); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -static void Scroll(Tree tree, int x, int y) { - TreeItem item = tree.getItem(new Point(x, y)); - if (item == null) return; - Rectangle area = tree.getClientArea(); - int headerHeight = tree.getHeaderHeight(); - int itemHeight= tree.getItemHeight(); - TreeItem nextItem = null; - if (y < area.y + headerHeight + 2 * itemHeight) { - nextItem = PreviousItem(tree, item); - } - if (y > area.y + area.height - 2 * itemHeight) { - nextItem = NextItem(tree, item); - } - if (nextItem != null) tree.showItem(nextItem); -} - -static TreeItem PreviousItem(Tree tree, TreeItem item) { - if (item == null) return null; - TreeItem childItem = item; - TreeItem parentItem = childItem.getParentItem(); - int index = parentItem == null ? tree.indexOf(childItem) : parentItem.indexOf(childItem); - if (index == 0) { - return parentItem; - } else { - TreeItem nextItem = parentItem == null ? tree.getItem(index-1) : parentItem.getItem(index-1); - int count = nextItem.getItemCount(); - while (count > 0 && nextItem.getExpanded()) { - nextItem = nextItem.getItem(count - 1); - count = nextItem.getItemCount(); - } - return nextItem; - } -} -static TreeItem NextItem(Tree tree, TreeItem item) { - if (item == null) return null; - if (item.getExpanded()) { - return item.getItem(0); - } else { - TreeItem childItem = item; - TreeItem parentItem = childItem.getParentItem(); - int index = parentItem == null ? tree.indexOf(childItem) : parentItem.indexOf(childItem); - int count = parentItem == null ? tree.getItemCount() : parentItem.getItemCount(); - while (true) { - if (index + 1 < count) { - return parentItem == null ? tree.getItem(index + 1) : parentItem.getItem(index + 1); - } else { - if (parentItem == null) { - return null; - } else { - childItem = parentItem; - parentItem = childItem.getParentItem(); - index = parentItem == null ? tree.indexOf(childItem) : parentItem.indexOf(childItem); - count = parentItem == null ? tree.getItemCount() : parentItem.getItemCount(); - } - } - } - } -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java deleted file mode 100644 index 2f99385d07..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; -/* - * example snippet: StyledText bulleted list example - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; - -public class Snippet222 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setText("StyledText Bullet Example"); - shell.setLayout(new FillLayout()); - final StyledText styledText = new StyledText (shell, SWT.FULL_SELECTION | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); - StringBuffer text = new StringBuffer(); - text.append("Here is StyledText with some bulleted lists:\n\n"); - for (int i = 0; i < 4; i++) text.append("Red Bullet List Item " + i + "\n"); - text.append("\n"); - for (int i = 0; i < 2; i++) text.append("Numbered List Item " + i + "\n"); - for (int i = 0; i < 4; i++) text.append("Sub List Item " + i + "\n"); - for (int i = 0; i < 2; i++) text.append("Numbered List Item " + (2 + i) + "\n"); - text.append("\n"); - for (int i = 0; i < 4; i++) text.append("Custom Draw List Item " + i + "\n"); - styledText.setText(text.toString()); - - StyleRange style0 = new StyleRange(); - style0.metrics = new GlyphMetrics(0, 0, 40); - style0.foreground = display.getSystemColor(SWT.COLOR_RED); - Bullet bullet0 = new Bullet (style0); - StyleRange style1 = new StyleRange(); - style1.metrics = new GlyphMetrics(0, 0, 50); - style1.foreground = display.getSystemColor(SWT.COLOR_BLUE); - Bullet bullet1 = new Bullet (ST.BULLET_NUMBER | ST.BULLET_TEXT, style1); - bullet1.text = "."; - StyleRange style2 = new StyleRange(); - style2.metrics = new GlyphMetrics(0, 0, 80); - style2.foreground = display.getSystemColor(SWT.COLOR_GREEN); - Bullet bullet2 = new Bullet (ST.BULLET_TEXT, style2); - bullet2.text = "\u2713"; - StyleRange style3 = new StyleRange(); - style3.metrics = new GlyphMetrics(0, 0, 50); - Bullet bullet3 = new Bullet (ST.BULLET_CUSTOM, style2); - - styledText.setLineBullet(2, 4, bullet0); - styledText.setLineBullet(7, 2, bullet1); - styledText.setLineBullet(9, 4, bullet2); - styledText.setLineBullet(13, 2, bullet1); - styledText.setLineBullet(16, 4, bullet3); - - styledText.addPaintObjectListener(new PaintObjectListener() { - public void paintObject(PaintObjectEvent event) { - Display display = event.display; - StyleRange style = event.style; - Font font = style.font; - if (font == null) font = styledText.getFont(); - TextLayout layout = new TextLayout(display); - layout.setAscent(event.ascent); - layout.setDescent(event.descent); - layout.setFont(font); - layout.setText("\u2023 1." + event.bulletIndex + ")"); - layout.draw(event.gc, event.x + 10, event.y); - layout.dispose(); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.java deleted file mode 100644 index 96844d2c0d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; -/* - * example snippet: ExpandBar example - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -public class Snippet223 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - shell.setText("ExpandBar Example"); - ExpandBar bar = new ExpandBar (shell, SWT.V_SCROLL); - Image image = new Image(display, Snippet223.class.getResourceAsStream("eclipse.png")); - - // First item - Composite composite = new Composite (bar, SWT.NONE); - GridLayout layout = new GridLayout (); - layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; - layout.verticalSpacing = 10; - composite.setLayout(layout); - Button button = new Button (composite, SWT.PUSH); - button.setText("SWT.PUSH"); - button = new Button (composite, SWT.RADIO); - button.setText("SWT.RADIO"); - button = new Button (composite, SWT.CHECK); - button.setText("SWT.CHECK"); - button = new Button (composite, SWT.TOGGLE); - button.setText("SWT.TOGGLE"); - ExpandItem item0 = new ExpandItem (bar, SWT.NONE, 0); - item0.setText("What is your favorite button"); - item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); - item0.setControl(composite); - item0.setImage(image); - - // Second item - composite = new Composite (bar, SWT.NONE); - layout = new GridLayout (2, false); - layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; - layout.verticalSpacing = 10; - composite.setLayout(layout); - Label label = new Label (composite, SWT.NONE); - label.setImage(display.getSystemImage(SWT.ICON_ERROR)); - label = new Label (composite, SWT.NONE); - label.setText("SWT.ICON_ERROR"); - label = new Label (composite, SWT.NONE); - label.setImage(display.getSystemImage(SWT.ICON_INFORMATION)); - label = new Label (composite, SWT.NONE); - label.setText("SWT.ICON_INFORMATION"); - label = new Label (composite, SWT.NONE); - label.setImage(display.getSystemImage(SWT.ICON_WARNING)); - label = new Label (composite, SWT.NONE); - label.setText("SWT.ICON_WARNING"); - label = new Label (composite, SWT.NONE); - label.setImage(display.getSystemImage(SWT.ICON_QUESTION)); - label = new Label (composite, SWT.NONE); - label.setText("SWT.ICON_QUESTION"); - ExpandItem item1 = new ExpandItem (bar, SWT.NONE, 1); - item1.setText("What is your favorite icon"); - item1.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); - item1.setControl(composite); - item1.setImage(image); - - // Third item - composite = new Composite (bar, SWT.NONE); - layout = new GridLayout (2, true); - layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; - layout.verticalSpacing = 10; - composite.setLayout(layout); - label = new Label (composite, SWT.NONE); - label.setText("Scale"); - new Scale (composite, SWT.NONE); - label = new Label (composite, SWT.NONE); - label.setText("Spinner"); - new Spinner (composite, SWT.BORDER); - label = new Label (composite, SWT.NONE); - label.setText("Slider"); - new Slider (composite, SWT.NONE); - ExpandItem item2 = new ExpandItem (bar, SWT.NONE, 2); - item2.setText("What is your favorite range widget"); - item2.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); - item2.setControl(composite); - item2.setImage(image); - - item1.setExpanded(true); - bar.setSpacing(8); - shell.setSize(400, 350); - shell.open(); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) { - display.sleep (); - } - } - image.dispose(); - display.dispose(); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.java deleted file mode 100644 index 125087e3df..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * implement radio behavior for setSelection() - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.2 - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet224 { -public static void main (String [] args) { - Display display = new Display (); - final Shell shell = new Shell (display); - shell.setLayout (new RowLayout (SWT.VERTICAL)); - for (int i=0; i<8; i++) { - Button button = new Button (shell, SWT.RADIO); - button.setText ("B" + i); - if (i == 0) button.setSelection (true); - } - Button button = new Button (shell, SWT.PUSH); - button.setText ("Set Selection to B4"); - button.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - Control [] children = shell.getChildren (); - Button newButton = (Button) children [4]; - for (int i=0; i 0) { - Region region = new Region(); - gc.getClipping(region); - region.add(event.x, event.y, width, event.height); - gc.setClipping(region); - region.dispose(); - } - } - gc.setAdvanced(true); - if (gc.getAdvanced()) gc.setAlpha(127); - Rectangle rect = event.getBounds(); - Color foreground = gc.getForeground(); - Color background = gc.getBackground(); - gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); - gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); - gc.fillGradientRectangle(0, rect.y, 500, rect.height, false); - // restore colors for subsequent drawing - gc.setForeground(foreground); - gc.setBackground(background); - event.detail &= ~SWT.SELECTED; - } - } - }); - for (int i=0; i 0) { - Region region = new Region(); - gc.getClipping(region); - region.add(event.x, event.y, width, event.height); - gc.setClipping(region); - region.dispose(); - } - } - gc.setAdvanced(true); - if (gc.getAdvanced()) gc.setAlpha(127); - Rectangle rect = event.getBounds(); - Color foreground = gc.getForeground(); - Color background = gc.getBackground(); - gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); - gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); - gc.fillGradientRectangle(0, rect.y, 500, rect.height, false); - // restore colors for subsequent drawing - gc.setForeground(foreground); - gc.setBackground(background); - event.detail &= ~SWT.SELECTED; - } - } - }); - for (int i=0; i 0) { - try { - loadAllImages(new File(filename).getParent(), filenames); - } catch (SWTException e) { - System.err.println("There was an error loading an image."); - e.printStackTrace(); - } - ToolBar toolBar = new ToolBar (shell, SWT.FLAT | SWT.BORDER | SWT.WRAP); - item = new ToolItem[numToolBarItems]; - for (int i = 0; i < numToolBarItems; i++) { - item[i] = new ToolItem (toolBar, SWT.PUSH); - item[i].setImage(image[i][0]); - } - toolBar.pack (); - shell.open (); - - startAnimationThreads(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - - for (int i = 0; i < numToolBarItems; i++) { - for (int j = 0; j < image[i].length; j++) { - image[i][j].dispose(); - } - } - display.dispose (); - } - } - - private static void loadAllImages(String directory, String[] filenames) throws SWTException { - int numItems = filenames.length; - loader = new ImageLoader[numItems]; - imageDataArray = new ImageData[numItems][]; - image = new Image[numItems][]; - for (int i = 0; i < numItems; i++) { - loader[i] = new ImageLoader(); - int fullWidth = loader[i].logicalScreenWidth; - int fullHeight = loader[i].logicalScreenHeight; - imageDataArray[i] = loader[i].load(directory + File.separator + filenames[i]); - int numFramesOfAnimation = imageDataArray[i].length; - image[i] = new Image[numFramesOfAnimation]; - for (int j = 0; j < numFramesOfAnimation; j++) { - if (j == 0) { - //for the first frame of animation, just draw the first frame - image[i][j] = new Image(display, imageDataArray[i][j]); - fullWidth = imageDataArray[i][j].width; - fullHeight = imageDataArray[i][j].height; - } - else { - //after the first frame of animation, draw the background or previous frame first, then the new image data - image[i][j] = new Image(display, fullWidth, fullHeight); - GC gc = new GC(image[i][j]); - gc.setBackground(shellBackground); - gc.fillRectangle(0, 0, fullWidth, fullHeight); - ImageData imageData = imageDataArray[i][j]; - switch (imageData.disposalMethod) { - case SWT.DM_FILL_BACKGROUND: - /* Fill with the background color before drawing. */ - Color bgColor = null; - if (useGIFBackground && loader[i].backgroundPixel != -1) { - bgColor = new Color(display, imageData.palette.getRGB(loader[i].backgroundPixel)); - } - gc.setBackground(bgColor != null ? bgColor : shellBackground); - gc.fillRectangle(imageData.x, imageData.y, imageData.width, imageData.height); - if (bgColor != null) bgColor.dispose(); - break; - default: - /* Restore the previous image before drawing. */ - gc.drawImage( - image[i][j-1], - 0, - 0, - fullWidth, - fullHeight, - 0, - 0, - fullWidth, - fullHeight); - break; - } - Image newFrame = new Image(display, imageData); - gc.drawImage(newFrame, - 0, - 0, - imageData.width, - imageData.height, - imageData.x, - imageData.y, - imageData.width, - imageData.height); - newFrame.dispose(); - gc.dispose(); - } - } - } - } - - private static void startAnimationThreads() { - animateThread = new Thread[image.length]; - for (int ii = 0; ii < image.length; ii++) { - final int i = ii; - animateThread[i] = new Thread("Animation "+i) { - int imageDataIndex = 0; - public void run() { - try { - int repeatCount = loader[i].repeatCount; - while (loader[i].repeatCount == 0 || repeatCount > 0) { - imageDataIndex = (imageDataIndex + 1) % imageDataArray[i].length; - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!item[i].isDisposed()) - item[i].setImage(image[i][imageDataIndex]); - } - }); - } - - /* Sleep for the specified delay time (adding commonly-used slow-down fudge factors). */ - try { - int ms = imageDataArray[i][imageDataIndex].delayTime * 10; - if (ms < 20) ms += 30; - if (ms < 30) ms += 10; - Thread.sleep(ms); - } catch (InterruptedException e) { - } - - /* If we have just drawn the last image, decrement the repeat count and start again. */ - if (imageDataIndex == imageDataArray[i].length - 1) repeatCount--; - } - } catch (SWTException ex) { - System.out.println("There was an error animating the GIF"); - ex.printStackTrace(); - } - } - }; - animateThread[i].setDaemon(true); - animateThread[i].start(); - } - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.java deleted file mode 100644 index 59e69fef98..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Combo example snippet: add an item to a combo box - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet289 { -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Combo combo = new Combo(shell, SWT.NONE); - combo.setItems(new String [] {"1111", "2222", "3333", "4444"}); - combo.setText(combo.getItem(0)); - combo.addVerifyListener(new VerifyListener() { - public void verifyText(VerifyEvent e) { - String newText = e.text; - try { - Integer.parseInt(newText); - } catch (NumberFormatException ex) { - e.doit = false; - } - } - }); - combo.addTraverseListener(new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - e.doit = false; - e.detail = SWT.TRAVERSE_NONE; - String newText = combo.getText(); - try { - Integer.parseInt(newText); - combo.add(newText); - combo.setSelection(new Point(0, newText.length())); - } catch (NumberFormatException ex) { - } - } - } - }); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.java deleted file mode 100644 index 8c8c36f891..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Menu example snippet: create a bar and pull down menu (accelerators, mnemonics) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet29 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Menu bar = new Menu (shell, SWT.BAR); - shell.setMenuBar (bar); - MenuItem fileItem = new MenuItem (bar, SWT.CASCADE); - fileItem.setText ("&File"); - Menu submenu = new Menu (shell, SWT.DROP_DOWN); - fileItem.setMenu (submenu); - MenuItem item = new MenuItem (submenu, SWT.PUSH); - item.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - System.out.println ("Select All"); - } - }); - item.setText ("Select &All\tCtrl+A"); - item.setAccelerator (SWT.MOD1 + 'A'); - shell.setSize (200, 200); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java deleted file mode 100644 index eb91c12670..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Canvas snippet: ignore 2nd mouse up event after double-click - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; - -public class Snippet290 { - -public static void main(String [] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.addMouseListener(new MouseAdapter() { - public void mouseUp(MouseEvent e) { - if (e.count == 1) { - System.out.println("Mouse up"); - } - } - public void mouseDoubleClick(MouseEvent e) { - System.out.println("Double-click"); - } - }); - shell.setBounds(10, 10, 200, 200); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet291.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet291.java deleted file mode 100644 index fc6ba89814..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet291.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Give accessible names to a tree and its tree items - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.accessibility.*; - -public class Snippet291 { - public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Tree tree = new Tree(shell, SWT.BORDER); - for (int i = 0; i < 5; i++) { - TreeItem treeItem = new TreeItem (tree, SWT.NULL); - treeItem.setText ("item" + i); - for (int j = 0; j < 3; j++) { - TreeItem subItem = new TreeItem(treeItem, SWT.NONE); - subItem.setText("item" + i + j); - } - } - tree.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent e) { - if (e.childID == ACC.CHILDID_SELF) { - e.result = "This is the Accessible Name for the Tree"; - } else { - TreeItem item = (TreeItem)display.findWidget(tree, e.childID); - if (item != null) { - e.result = "This is the Accessible Name for the TreeItem: " + item.getText(); - } - } - } - }); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java deleted file mode 100644 index 0436d6cce1..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Take a snapshot of a control - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet292 { - public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - final Tree tree = new Tree(shell, SWT.BORDER); - for (int i = 0; i < 5; i++) { - TreeItem treeItem = new TreeItem (tree, SWT.NULL); - treeItem.setText ("TreeItem " + i); - for (int j = 0; j < 3; j++) { - TreeItem subItem = new TreeItem(treeItem, SWT.NONE); - subItem.setText("SubItem " + i + "-" + j); - } - if (i % 3 == 0) treeItem.setExpanded (true); - } - final Label label = new Label (shell, SWT.NONE); - label.addListener (SWT.Dispose, new Listener () { - public void handleEvent (Event e) { - Image image = label.getImage (); - if (image != null) image.dispose (); - } - }); - Button button = new Button (shell, SWT.PUSH); - button.setText ("Snapshot"); - button.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - Image image = label.getImage (); - if (image != null) image.dispose (); - image = new Image (display, tree.getBounds ()); - GC gc = new GC (image); - tree.print (gc); - gc.dispose (); - label.setImage (image); - } - }); - GridLayout layout = new GridLayout (2, true); - shell.setLayout(layout); - tree.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true)); - label.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true)); - button.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1)); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java deleted file mode 100644 index b4bc599264..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * create a tri-state button. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet293 { - - public static void main(java.lang.String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new GridLayout()); - - Button b1 = new Button (shell, SWT.CHECK); - b1.setText("State 1"); - b1.setSelection(true); - - Button b2 = new Button (shell, SWT.CHECK); - b2.setText("State 2"); - b2.setSelection(false); - - Button b3 = new Button (shell, SWT.CHECK); - b3.setText("State 3"); - b3.setSelection(true); - b3.setGrayed(true); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.java deleted file mode 100644 index 6f8d668272..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/* - * Region on a control: create a non-rectangular button - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.4 - */ - -public class Snippet294 { - - static int[] circle(int r, int offsetX, int offsetY) { - int[] polygon = new int[8 * r + 4]; - // x^2 + y^2 = r^2 - for (int i = 0; i < 2 * r + 1; i++) { - int x = i - r; - int y = (int)Math.sqrt(r*r - x*x); - polygon[2*i] = offsetX + x; - polygon[2*i+1] = offsetY + y; - polygon[8*r - 2*i - 2] = offsetX + x; - polygon[8*r - 2*i - 1] = offsetY - y; - } - return polygon; - } - - public static void main(String[] args) { - final Display display = new Display(); - - final Shell shell = new Shell(display); - shell.setText("Regions on a Control"); - shell.setLayout(new FillLayout()); - shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_RED)); - - Button b2 = new Button(shell, SWT.PUSH); - b2.setText("Button with Regions"); - - // define a region that looks like a circle with two holes in ot - Region region = new Region(); - region.add(circle(67, 87, 77)); - region.subtract(circle(20, 87, 47)); - region.subtract(circle(20, 87, 113)); - - // define the shape of the button using setRegion - b2.setRegion(region); - b2.setLocation(100,50); - - b2.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - shell.close(); - } - }); - - shell.setSize(200,200); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - region.dispose(); - display.dispose(); - } - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet295.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet295.java deleted file mode 100644 index aec424263d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet295.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * create a dialog Shell and prompt for a text string - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet295 { - -public static void main (String [] args) { - Display display = new Display (); - final Shell shell = new Shell (display); - shell.setText("Shell"); - FillLayout fillLayout = new FillLayout(); - fillLayout.marginWidth = 10; - fillLayout.marginHeight = 10; - shell.setLayout(fillLayout); - - Button open = new Button (shell, SWT.PUSH); - open.setText ("Prompt for a String"); - open.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - final Shell dialog = new Shell (shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); - dialog.setText("Dialog Shell"); - FormLayout formLayout = new FormLayout (); - formLayout.marginWidth = 10; - formLayout.marginHeight = 10; - formLayout.spacing = 10; - dialog.setLayout (formLayout); - - Label label = new Label (dialog, SWT.NONE); - label.setText ("Type a String:"); - FormData data = new FormData (); - label.setLayoutData (data); - - Button cancel = new Button (dialog, SWT.PUSH); - cancel.setText ("Cancel"); - data = new FormData (); - data.width = 60; - data.right = new FormAttachment (100, 0); - data.bottom = new FormAttachment (100, 0); - cancel.setLayoutData (data); - cancel.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - System.out.println("User cancelled dialog"); - dialog.close (); - } - }); - - final Text text = new Text (dialog, SWT.BORDER); - data = new FormData (); - data.width = 200; - data.left = new FormAttachment (label, 0, SWT.DEFAULT); - data.right = new FormAttachment (100, 0); - data.top = new FormAttachment (label, 0, SWT.CENTER); - data.bottom = new FormAttachment (cancel, 0, SWT.DEFAULT); - text.setLayoutData (data); - - Button ok = new Button (dialog, SWT.PUSH); - ok.setText ("OK"); - data = new FormData (); - data.width = 60; - data.right = new FormAttachment (cancel, 0, SWT.DEFAULT); - data.bottom = new FormAttachment (100, 0); - ok.setLayoutData (data); - ok.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - System.out.println ("User typed: " + text.getText ()); - dialog.close (); - } - }); - - dialog.setDefaultButton (ok); - dialog.pack (); - dialog.open (); - } - }); - shell.pack (); - shell.open (); - - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet296.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet296.java deleted file mode 100644 index e1c048ec8a..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet296.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ScrolledComposite snippet: use a ScrolledComposite to scroll a Tree vertically - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -public class Snippet296 { - -public static void main (String[] args) { - final Display display = new Display (); - Shell shell = new Shell (display); - shell.setBounds (10, 10, 200, 300); - final ScrolledComposite sc = new ScrolledComposite (shell, SWT.VERTICAL); - sc.setBounds (10, 10, 180, 200); - final int clientWidth = sc.getClientArea ().width; - - final Tree tree = new Tree (sc, SWT.NONE); - for (int i = 0; i < 99; i++) { - TreeItem item = new TreeItem (tree, SWT.NONE); - item.setText ("item " + i); - new TreeItem (item, SWT.NONE).setText ("child"); - } - sc.setContent (tree); - int prefHeight = tree.computeSize (SWT.DEFAULT, SWT.DEFAULT).y; - tree.setSize (clientWidth, prefHeight); - /* - * The following listener ensures that the Tree is always large - * enough to not need to show its own vertical scrollbar. - */ - tree.addTreeListener (new TreeListener () { - public void treeExpanded (TreeEvent e) { - int prefHeight = tree.computeSize (SWT.DEFAULT, SWT.DEFAULT).y; - tree.setSize (clientWidth, prefHeight); - } - public void treeCollapsed (TreeEvent e) { - int prefHeight = tree.computeSize (SWT.DEFAULT, SWT.DEFAULT).y; - tree.setSize (clientWidth, prefHeight); - } - }); - - Button downButton = new Button (shell, SWT.PUSH); - downButton.setBounds (10, 220, 80, 30); - downButton.setText ("Down 10px"); - downButton.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - sc.setOrigin (0, sc.getOrigin ().y + 10); - } - }); - Button upButton = new Button (shell, SWT.PUSH); - upButton.setBounds (100, 220, 80, 30); - upButton.setText ("Up 10px"); - upButton.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - sc.setOrigin (0, sc.getOrigin ().y - 10); - } - }); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet297.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet297.java deleted file mode 100644 index f4c71283ee..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet297.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: create a table with column header images - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet297 { - -public static void main (String [] args) { - Display display = new Display (); - Image images[] = new Image[] { - display.getSystemImage(SWT.ICON_INFORMATION), - display.getSystemImage(SWT.ICON_ERROR), - display.getSystemImage(SWT.ICON_QUESTION), - display.getSystemImage(SWT.ICON_WARNING), - }; - String[] titles = {"Information", "Error", "Question", "Warning"}; - String[] questions = {"who?", "what?", "where?", "when?", "why?"}; - Shell shell = new Shell (display); - shell.setLayout(new GridLayout()); - Table table = new Table (shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); - GridData data = new GridData (SWT.FILL, SWT.FILL, true, true); - data.heightHint = 200; - table.setLayoutData (data); - table.setLinesVisible (true); - table.setHeaderVisible (true); - for (int i=0; i= hPage) { - if (hPage <= 0) hSelection = 0; - origin.x = -hSelection; - } - if (vSelection >= vPage) { - if (vPage <= 0) vSelection = 0; - origin.y = -vSelection; - } - canvas.redraw (); - } - }); - canvas.addListener (SWT.Paint, new Listener () { - public void handleEvent (Event e) { - GC gc = e.gc; - gc.drawImage (image, origin.x, origin.y); - Rectangle rect = image.getBounds (); - Rectangle client = canvas.getClientArea (); - int marginWidth = client.width - rect.width; - if (marginWidth > 0) { - gc.fillRectangle (rect.width, 0, marginWidth, client.height); - } - int marginHeight = client.height - rect.height; - if (marginHeight > 0) { - gc.fillRectangle (0, rect.height, client.width, marginHeight); - } - } - }); - shell.setSize (200, 150); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - originalImage.dispose(); - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.java deleted file mode 100644 index b66a128d9e..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ToolBar example snippet: create tool bar (wrap on resize) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet49 { - -public static void main (String [] args) { - Display display = new Display (); - final Shell shell = new Shell (display); - final ToolBar toolBar = new ToolBar (shell, SWT.WRAP); - for (int i=0; i<12; i++) { - ToolItem item = new ToolItem (toolBar, SWT.PUSH); - item.setText ("Item " + i); - } - shell.addListener (SWT.Resize, new Listener () { - public void handleEvent (Event e) { - Rectangle rect = shell.getClientArea (); - Point size = toolBar.computeSize (rect.width, SWT.DEFAULT); - toolBar.setSize (size); - } - }); - toolBar.pack (); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java deleted file mode 100644 index e3ea978bff..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ScrolledComposite example snippet: scroll a control in a scrolled composite - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.custom.*; - -public class Snippet5 { - -public static void main (String [] args) -{ - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - - // this button is always 400 x 400. Scrollbars appear if the window is resized to be - // too small to show part of the button - ScrolledComposite c1 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - Button b1 = new Button(c1, SWT.PUSH); - b1.setText("fixed size button"); - b1.setSize(400, 400); - c1.setContent(b1); - - // this button has a minimum size of 400 x 400. If the window is resized to be big - // enough to show more than 400 x 400, the button will grow in size. If the window - // is made too small to show 400 x 400, scrollbars will appear. - ScrolledComposite c2 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - Button b2 = new Button(c2, SWT.PUSH); - b2.setText("expanding button"); - c2.setContent(b2); - c2.setExpandHorizontal(true); - c2.setExpandVertical(true); - c2.setMinWidth(400); - c2.setMinHeight(400); - - shell.setSize(600, 300); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet50.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet50.java deleted file mode 100644 index 786d299b58..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet50.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Shell example snippet: create a dialog shell - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.widgets.*; - -public class Snippet50 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setText ("Shell"); - shell.setSize (200, 200); - shell.open (); - Shell dialog = new Shell (shell); - dialog.setText ("Dialog"); - dialog.setSize (200, 200); - dialog.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet51.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet51.java deleted file mode 100644 index 301bd7495e..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet51.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: scroll a table (set the top index) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet51 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Table table = new Table (shell, SWT.BORDER | SWT.MULTI); - table.setSize (200, 200); - for (int i=0; i<128; i++) { - TableItem item = new TableItem (table, SWT.NONE); - item.setText ("Item " + i); - } - table.setTopIndex (95); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet52.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet52.java deleted file mode 100644 index 344246011c..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet52.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: select an index (select and scroll) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet52 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Table table = new Table (shell, SWT.BORDER | SWT.MULTI); - table.setSize (200, 200); - for (int i=0; i<128; i++) { - TableItem item = new TableItem (table, SWT.NONE); - item.setText ("Item " + i); - } - table.setSelection (95); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet53.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet53.java deleted file mode 100644 index 26cae45e55..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet53.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Table example snippet: remove selected items - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet53 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - final Table table = new Table (shell, SWT.BORDER | SWT.MULTI); - table.setSize (200, 200); - for (int i=0; i<128; i++) { - TableItem item = new TableItem (table, SWT.NONE); - item.setText ("Item " + i); - } - Menu menu = new Menu (shell, SWT.POP_UP); - table.setMenu (menu); - MenuItem item = new MenuItem (menu, SWT.PUSH); - item.setText ("Delete Selection"); - item.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event event) { - table.remove (table.getSelectionIndices ()); - } - }); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet54.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet54.java deleted file mode 100644 index 910b3a4aa9..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet54.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Sash example snippet: create a sash (allow it to be moved) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet54 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - final Sash sash = new Sash (shell, SWT.BORDER | SWT.VERTICAL); - sash.setBounds (10, 10, 32, 100); - sash.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - sash.setBounds (e.x, e.y, e.width, e.height); - } - }); - shell.open (); - sash.setFocus (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet55.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet55.java deleted file mode 100644 index 0e6a83f2c6..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet55.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Text example snippet: resize a text control (show about 10 characters) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet55 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Text text = new Text (shell, SWT.BORDER); - int columns = 10; - GC gc = new GC (text); - FontMetrics fm = gc.getFontMetrics (); - int width = columns * fm.getAverageCharWidth (); - int height = fm.getHeight (); - gc.dispose (); - text.setSize (text.computeSize (width, height)); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java deleted file mode 100644 index 9eeabb81ea..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ProgressBar example snippet: update a progress bar (from another thread) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet56 { - - public static void main(String[] args) { - final Display display = new Display(); - Shell shell = new Shell(display); - final ProgressBar bar = new ProgressBar(shell, SWT.SMOOTH); - bar.setBounds(10, 10, 200, 32); - shell.open(); - final int maximum = bar.getMaximum(); - new Thread() { - public void run() { - for (final int[] i = new int[1]; i[0] <= maximum; i[0]++) { - try {Thread.sleep (100);} catch (Throwable th) {} - if (display.isDisposed()) return; - display.asyncExec(new Runnable() { - public void run() { - if (bar.isDisposed ()) return; - bar.setSelection(i[0]); - } - }); - } - } - }.start(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose(); - } -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet57.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet57.java deleted file mode 100644 index 84295f6a36..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet57.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ProgressBar example snippet: update a progress bar (from the UI thread) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet57 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - ProgressBar bar = new ProgressBar (shell, SWT.SMOOTH); - bar.setBounds (10, 10, 200, 32); - shell.open (); - for (int i=0; i<=bar.getMaximum (); i++) { - try {Thread.sleep (100);} catch (Throwable th) {} - bar.setSelection (i); - } - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.java deleted file mode 100644 index a914414180..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * ToolBar example snippet: place a combo box in a tool bar - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet58 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - ToolBar bar = new ToolBar (shell, SWT.BORDER); - for (int i=0; i<4; i++) { - ToolItem item = new ToolItem (bar, 0); - item.setText ("Item " + i); - } - ToolItem sep = new ToolItem (bar, SWT.SEPARATOR); - int start = bar.getItemCount (); - for (int i=start; i area.height + table.getHeaderHeight()) { - // Subtract the scrollbar width from the total column width - // if a vertical scrollbar will be required - Point vBarSize = vBar.getSize(); - width -= vBarSize.x; - } - Point oldSize = table.getSize(); - if (oldSize.x > area.width) { - // table is getting smaller so make the columns - // smaller first and then resize the table to - // match the client area width - column1.setWidth(width/3); - column2.setWidth(width - column1.getWidth()); - table.setSize(area.width, area.height); - } else { - // table is getting bigger so make the table - // bigger first and then make the columns wider - // to match the client area width - table.setSize(area.width, area.height); - column1.setWidth(width/3); - column2.setWidth(width - column1.getWidth()); - } - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet78.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet78.java deleted file mode 100644 index e81da90eea..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet78.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: drag text between two labels - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet78 { - -public static void main (String [] args) { - - Display display = new Display (); - final Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - final Label label1 = new Label (shell, SWT.BORDER); - label1.setText ("TEXT"); - final Label label2 = new Label (shell, SWT.BORDER); - setDragDrop (label1); - setDragDrop (label2); - shell.setSize (200, 200); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -public static void setDragDrop (final Label label) { - - Transfer[] types = new Transfer[] {TextTransfer.getInstance()}; - int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK; - - final DragSource source = new DragSource (label, operations); - source.setTransfer(types); - source.addDragListener (new DragSourceListener () { - public void dragStart(DragSourceEvent event) { - event.doit = (label.getText ().length () != 0); - } - public void dragSetData (DragSourceEvent event) { - event.data = label.getText (); - } - public void dragFinished(DragSourceEvent event) { - if (event.detail == DND.DROP_MOVE) - label.setText (""); - } - }); - - DropTarget target = new DropTarget(label, operations); - target.setTransfer(types); - target.addDropListener (new DropTargetAdapter() { - public void drop(DropTargetEvent event) { - if (event.data == null) { - event.detail = DND.DROP_NONE; - return; - } - label.setText ((String) event.data); - } - }); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java deleted file mode 100644 index 945d35f774..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: define my own data transfer type - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.1 - */ -import java.io.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet79 { - -/* The data being transferred is an array of type MyType where MyType is define as: */ -static class MyType { - String fileName; - long fileLength; - long lastModified; -} - -static class MyTransfer extends ByteArrayTransfer { - - private static final String MYTYPENAME = "name_for_my_type"; - private static final int MYTYPEID = registerType (MYTYPENAME); - private static MyTransfer _instance = new MyTransfer (); - -public static MyTransfer getInstance () { - return _instance; -} - -public void javaToNative (Object object, TransferData transferData) { - if (!checkMyType(object) || !isSupportedType (transferData)) { - DND.error(DND.ERROR_INVALID_DATA); - } - MyType [] myTypes = (MyType []) object; - try { - // write data to a byte array and then ask super to convert to pMedium - ByteArrayOutputStream out = new ByteArrayOutputStream (); - DataOutputStream writeOut = new DataOutputStream (out); - for (int i = 0, length = myTypes.length; i < length; i++) { - byte [] buffer = myTypes [i].fileName.getBytes (); - writeOut.writeInt (buffer.length); - writeOut.write (buffer); - writeOut.writeLong (myTypes [i].fileLength); - writeOut.writeLong (myTypes [i].lastModified); - } - byte [] buffer = out.toByteArray (); - writeOut.close (); - super.javaToNative (buffer, transferData); - } - catch (IOException e) {} -} - -public Object nativeToJava (TransferData transferData) { - if (isSupportedType (transferData)) { - byte [] buffer = (byte []) super.nativeToJava (transferData); - if (buffer == null) return null; - - MyType [] myData = new MyType [0]; - try { - ByteArrayInputStream in = new ByteArrayInputStream (buffer); - DataInputStream readIn = new DataInputStream (in); - while (readIn.available () > 20) { - MyType datum = new MyType (); - int size = readIn.readInt (); - byte [] name = new byte [size]; - readIn.read (name); - datum.fileName = new String (name); - datum.fileLength = readIn.readLong (); - datum.lastModified = readIn.readLong (); - MyType [] newMyData = new MyType [myData.length + 1]; - System.arraycopy (myData, 0, newMyData, 0, myData.length); - newMyData [myData.length] = datum; - myData = newMyData; - } - readIn.close (); - } - catch (IOException ex) { - return null; - } - return myData; - } - - return null; -} - -protected String [] getTypeNames () { - return new String [] {MYTYPENAME}; -} - -protected int [] getTypeIds () { - return new int [] {MYTYPEID}; -} - -boolean checkMyType(Object object) { - if (object == null || - !(object instanceof MyType[]) || - ((MyType[])object).length == 0) { - return false; - } - MyType[] myTypes = (MyType[])object; - for (int i = 0; i < myTypes.length; i++) { - if (myTypes[i] == null || - myTypes[i].fileName == null || - myTypes[i].fileName.length() == 0) { - return false; - } - } - return true; -} - -protected boolean validate(Object object) { - return checkMyType(object); -} -} - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout (new FillLayout ()); - final Label label1 = new Label (shell, SWT.BORDER | SWT.WRAP); - label1.setText ("Drag Source for MyData[]"); - final Label label2 = new Label (shell, SWT.BORDER | SWT.WRAP); - label2.setText ("Drop Target for MyData[]"); - - DragSource source = new DragSource (label1, DND.DROP_COPY); - source.setTransfer (new Transfer [] {MyTransfer.getInstance ()}); - source.addDragListener (new DragSourceAdapter () { - public void dragSetData (DragSourceEvent event) { - MyType myType1 = new MyType (); - myType1.fileName = "C:\\abc.txt"; - myType1.fileLength = 1000; - myType1.lastModified = 12312313; - MyType myType2 = new MyType (); - myType2.fileName = "C:\\xyz.txt"; - myType2.fileLength = 500; - myType2.lastModified = 12312323; - event.data = new MyType [] {myType1, myType2}; - } - }); - DropTarget target = new DropTarget (label2, DND.DROP_COPY | DND.DROP_DEFAULT); - target.setTransfer (new Transfer [] {MyTransfer.getInstance ()}); - target.addDropListener (new DropTargetAdapter () { - public void dragEnter (DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) { - event.detail = DND.DROP_COPY; - } - } - - public void dragOperationChanged (DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) { - event.detail = DND.DROP_COPY; - } - } - - public void drop (DropTargetEvent event) { - if (event.data != null) { - MyType [] myTypes = (MyType []) event.data; - if (myTypes != null) { - String string = ""; - for (int i = 0; i < myTypes.length; i++) { - string += myTypes [i].fileName + " "; - } - label2.setText (string); - } - } - } - - }); - shell.setSize (200, 200); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} \ No newline at end of file diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.java deleted file mode 100644 index 0912b79fda..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tree example snippet: create a tree (lazy) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -import java.io.*; - -public class Snippet8 { - -public static void main (String [] args) { - final Display display = new Display (); - final Shell shell = new Shell (display); - shell.setText ("Lazy Tree"); - shell.setLayout (new FillLayout ()); - final Tree tree = new Tree (shell, SWT.BORDER); - File [] roots = File.listRoots (); - for (int i=0; i 0) { - TreeItem[] newSelection = new TreeItem[revisedSelection.length + 1]; - System.arraycopy(revisedSelection, 0, newSelection, 0, revisedSelection.length); - newSelection[revisedSelection.length] = selection[i]; - revisedSelection = newSelection; - } - } - tree.setSelection(revisedSelection); - } - }); - - shell.setSize(300, 300); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java deleted file mode 100644 index de57edd70d..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * OLE and ActiveX example snippet: browse the typelibinfo for a program id (win32 only) - * NOTE: This snippet uses internal SWT packages that are - * subject to change without notice. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.internal.ole.win32.*; -import org.eclipse.swt.ole.win32.*; -import org.eclipse.swt.widgets.*; - -public class Snippet81 { - -public static void main(String[] args) { - - if (args.length == 0) { - System.out.println("Usage: java Main "); - return; - } - - String progID = args[0]; - - Display display = new Display(); - Shell shell = new Shell(display); - - OleFrame frame = new OleFrame(shell, SWT.NONE); - OleControlSite site = null; - OleAutomation auto = null; - try { - site = new OleControlSite(frame, SWT.NONE, progID); - auto = new OleAutomation(site); - } catch (SWTException ex) { - System.out.println("Unable to open type library for "+progID); - return; - } - - printTypeInfo(auto); - - auto.dispose(); - shell.dispose(); - display.dispose(); - -} - -private static void printTypeInfo(OleAutomation auto) { - TYPEATTR typeattr = auto.getTypeInfoAttributes(); - if (typeattr != null) { - if (typeattr.cFuncs > 0) System.out.println("Functions :\n"); - for (int i = 0; i < typeattr.cFuncs; i++) { - OleFunctionDescription data = auto.getFunctionDescription(i); - String argList = ""; - int firstOptionalArgIndex = data.args.length - data.optionalArgCount; - for (int j = 0; j < data.args.length; j++) { - argList += "["; - if (j >= firstOptionalArgIndex) argList += "optional, "; - argList += getDirection(data.args[j].flags)+"] "+getTypeName(data.args[j].type)+" "+data.args[j].name; - if ( j < data.args.length - 1) argList += ", "; - } - System.out.println(getInvokeKind(data.invokeKind)+" (id = "+data.id+") : " - +"\n\tSignature : "+getTypeName(data.returnType)+" "+data.name+"("+argList+")" - +"\n\tDescription : "+data.documentation - +"\n\tHelp File : "+data.helpFile+"\n"); - } - - if (typeattr.cVars > 0) System.out.println("\n\nVariables :\n"); - for (int i = 0; i < typeattr.cVars; i++) { - OlePropertyDescription data = auto.getPropertyDescription(i); - System.out.println("PROPERTY (id = "+data.id+") :" - +"\n\tName : "+data.name - +"\n\tType : "+getTypeName(data.type)+"\n"); - } - } -} -private static String getTypeName(int type) { - switch (type) { - case OLE.VT_BOOL : return "boolean"; - case OLE.VT_R4 : return "float"; - case OLE.VT_R8 : return "double"; - case OLE.VT_I4 : return "int"; - case OLE.VT_DISPATCH : return "IDispatch"; - case OLE.VT_UNKNOWN : return "IUnknown"; - case OLE.VT_I2 : return "short"; - case OLE.VT_BSTR : return "String"; - case OLE.VT_VARIANT : return "Variant"; - case OLE.VT_CY : return "Currency"; - case OLE.VT_DATE : return "Date"; - case OLE.VT_UI1 : return "unsigned char"; - case OLE.VT_UI4 : return "unsigned int"; - case OLE.VT_USERDEFINED : return "UserDefined"; - case OLE.VT_HRESULT : return "int"; - case OLE.VT_VOID : return "void"; - - case OLE.VT_BYREF | OLE.VT_BOOL : return "boolean *"; - case OLE.VT_BYREF | OLE.VT_R4 : return "float *"; - case OLE.VT_BYREF | OLE.VT_R8 : return "double *"; - case OLE.VT_BYREF | OLE.VT_I4 : return "int *"; - case OLE.VT_BYREF | OLE.VT_DISPATCH : return "IDispatch *"; - case OLE.VT_BYREF | OLE.VT_UNKNOWN : return "IUnknown *"; - case OLE.VT_BYREF | OLE.VT_I2 : return "short *"; - case OLE.VT_BYREF | OLE.VT_BSTR : return "String *"; - case OLE.VT_BYREF | OLE.VT_VARIANT : return "Variant *"; - case OLE.VT_BYREF | OLE.VT_CY : return "Currency *"; - case OLE.VT_BYREF | OLE.VT_DATE : return "Date *"; - case OLE.VT_BYREF | OLE.VT_UI1 : return "unsigned char *"; - case OLE.VT_BYREF | OLE.VT_UI4 : return "unsigned int *"; - case OLE.VT_BYREF | OLE.VT_USERDEFINED : return "UserDefined *"; - } - return "unknown "+ type; -} -private static String getDirection(int direction){ - String dirString = ""; - boolean comma = false; - if ((direction & OLE.IDLFLAG_FIN) != 0) { - dirString += "in"; - comma = true; - } - if ((direction & OLE.IDLFLAG_FOUT) != 0){ - if (comma) dirString += ", "; - dirString += "out"; - comma = true; - } - if ((direction & OLE.IDLFLAG_FLCID) != 0){ - if (comma) dirString += ", "; - dirString += "lcid"; - comma = true; - } - if ((direction & OLE.IDLFLAG_FRETVAL) != 0){ - if (comma) dirString += ", "; - dirString += "retval"; - } - - return dirString; -} -private static String getInvokeKind(int invKind) { - switch (invKind) { - case OLE.INVOKE_FUNC : return "METHOD"; - case OLE.INVOKE_PROPERTYGET : return "PROPERTY GET"; - case OLE.INVOKE_PROPERTYPUT : return "PROPERTY PUT"; - case OLE.INVOKE_PROPERTYPUTREF : return "PROPERTY PUT BY REF"; - } - return "unknown "+invKind; -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.java deleted file mode 100644 index 2bd72321d3..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * CTabFolder example snippet: prevent an item from closing - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - * - * @since 3.0 - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet82 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - CTabFolder folder = new CTabFolder(shell, SWT.BORDER); - for (int i = 0; i < 4; i++) { - CTabItem item = new CTabItem(folder, SWT.CLOSE); - item.setText("Item "+i); - Text text = new Text(folder, SWT.MULTI); - text.setText("Content for Item "+i); - item.setControl(text); - } - - final CTabItem specialItem = new CTabItem(folder, SWT.CLOSE); - specialItem.setText("Don't Close Me"); - Text text = new Text(folder, SWT.MULTI); - text.setText("This tab can never be closed"); - specialItem.setControl(text); - - folder.addCTabFolder2Listener(new CTabFolder2Adapter() { - public void close(CTabFolderEvent event) { - if (event.item.equals(specialItem)) { - event.doit = false; - } - } - }); - - final CTabItem noCloseItem = new CTabItem(folder, SWT.NONE); - noCloseItem.setText("No Close Button"); - Text text2 = new Text(folder, SWT.MULTI); - text2.setText("This tab does not have a close button"); - noCloseItem.setControl(text2); - - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet83.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet83.java deleted file mode 100644 index eff8fcdc00..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet83.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: determine data types available (win32 only) - * NOTE: This snippet uses internal SWT packages that are - * subject to change without notice. - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.internal.ole.win32.*; -import org.eclipse.swt.internal.win32.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet83 extends ByteArrayTransfer { - -private static Snippet83 _instance = new Snippet83(); -private int[] ids; -private String[] names; - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Table control = new Table(shell, SWT.NONE); - TableItem item = new TableItem(control, SWT.NONE); - item.setText("Drag data over this site to see the native transfer type."); - DropTarget target = new DropTarget(control, DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_MOVE); - target.setTransfer(new Transfer[] {Snippet83.getInstance()}); - target.addDropListener(new DropTargetAdapter() { - public void dragEnter(DropTargetEvent event) { - String ops = ""; - if ((event.operations & DND.DROP_COPY) != 0) ops += "Copy;"; - if ((event.operations & DND.DROP_MOVE) != 0) ops += "Move;"; - if ((event.operations & DND.DROP_LINK) != 0) ops += "Link;"; - control.removeAll(); - TableItem item1 = new TableItem(control,SWT.NONE); - item1.setText("Allowed Operations are "+ops); - - if (event.detail == DND.DROP_DEFAULT) { - if ((event.operations & DND.DROP_COPY) != 0) { - event.detail = DND.DROP_COPY; - } else if ((event.operations & DND.DROP_LINK) != 0) { - event.detail = DND.DROP_LINK; - } else if ((event.operations & DND.DROP_MOVE) != 0) { - event.detail = DND.DROP_MOVE; - } - } - - TransferData[] data = event.dataTypes; - for (int i = 0; i < data.length; i++) { - int id = data[i].type; - String name = getNameFromId(id); - TableItem item2 = new TableItem(control,SWT.NONE); - item2.setText("Data type is "+id+" "+name); - } - } - }); - - shell.setSize(400, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} - -public static Snippet83 getInstance () { - return _instance; -} -Snippet83() { - ids = new int[80000]; - names = new String[80000]; - for (int i = 0; i < ids.length; i++) { - ids[i] = i; - names[i] = getNameFromId(i); - } -} -public void javaToNative (Object object, TransferData transferData) { -} -public Object nativeToJava(TransferData transferData){ - return "Hello World"; -} -protected String[] getTypeNames(){ - return names; -} -protected int[] getTypeIds(){ - return ids; -} -static String getNameFromId(int id) { - String name = null; - int maxSize = 128; - TCHAR buffer = new TCHAR(0, maxSize); - int size = COM.GetClipboardFormatName(id, buffer, maxSize); - if (size != 0) { - name = buffer.toString(0, size); - } else { - switch (id) { - case COM.CF_HDROP: - name = "CF_HDROP"; - break; - case COM.CF_TEXT: - name = "CF_TEXT"; - break; - case COM.CF_BITMAP: - name = "CF_BITMAP"; - break; - case COM.CF_METAFILEPICT: - name = "CF_METAFILEPICT"; - break; - case COM.CF_SYLK: - name = "CF_SYLK"; - break; - case COM.CF_DIF: - name = "CF_DIF"; - break; - case COM.CF_TIFF: - name = "CF_TIFF"; - break; - case COM.CF_OEMTEXT: - name = "CF_OEMTEXT"; - break; - case COM.CF_DIB: - name = "CF_DIB"; - break; - case COM.CF_PALETTE: - name = "CF_PALETTE"; - break; - case COM.CF_PENDATA: - name = "CF_PENDATA"; - break; - case COM.CF_RIFF: - name = "CF_RIFF"; - break; - case COM.CF_WAVE: - name = "CF_WAVE"; - break; - case COM.CF_UNICODETEXT: - name = "CF_UNICODETEXT"; - break; - case COM.CF_ENHMETAFILE: - name = "CF_ENHMETAFILE"; - break; - case COM.CF_LOCALE: - name = "CF_LOCALE"; - break; - case COM.CF_MAX: - name = "CF_MAX"; - break; - } - - } - return name; -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java deleted file mode 100644 index 01ff11392b..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: define a default operation (in this example, Copy) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet84 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - - final Label label = new Label(shell, SWT.BORDER); - label.setText("Drag Source"); - DragSource source = new DragSource(label, DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK); - source.setTransfer(new Transfer[] {TextTransfer.getInstance()}); - source.addDragListener(new DragSourceAdapter() { - public void dragSetData(DragSourceEvent event) { - event.data = "Text Transferred"; - } - public void dragFinished(DragSourceEvent event) { - if (event.doit) { - String operation = null; - switch (event.detail) { - case DND.DROP_MOVE: - operation = "moved"; break; - case DND.DROP_COPY: - operation = "copied"; break; - case DND.DROP_LINK: - operation = "linked"; break; - case DND.DROP_NONE: - operation = "disallowed"; break; - default: - operation = "unknown"; break; - } - label.setText("Drag Source (data "+operation+")"); - } else { - label.setText("Drag Source (drag cancelled)"); - } - } - }); - - final Text text = new Text(shell, SWT.BORDER | SWT.MULTI); - text.setText("Drop Target"); - DropTarget target = new DropTarget(text, DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK); - target.setTransfer(new Transfer[] {TextTransfer.getInstance()}); - target.addDropListener(new DropTargetAdapter() { - public void dragEnter(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) event.detail = DND.DROP_COPY; - } - public void dragOperationChanged(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) event.detail = DND.DROP_COPY; - } - public void drop(DropTargetEvent event) { - String operation = null; - switch (event.detail) { - case DND.DROP_MOVE: - operation = "moved"; break; - case DND.DROP_COPY: - operation = "copied"; break; - case DND.DROP_LINK: - operation = "linked"; break; - case DND.DROP_NONE: - operation = "disallowed"; break; - default: - operation = "unknown"; break; - } - text.append("\n"+operation+(String)event.data); - } - }); - - shell.setSize(400, 400); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet85.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet85.java deleted file mode 100644 index 22cd08d066..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet85.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * PocketPC example snippet: Hello World - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet85 { - -public static void main(String[] args) { - Display display = new Display(); - - /* - * Create a Shell with the default style - * i.e. full screen, no decoration on PocketPC. - */ - Shell shell = new Shell(display); - - /* - * Set a text so that the top level Shell - * also appears in the PocketPC task list - */ - shell.setText("Main"); - - /* - * Set a menubar to follow UI guidelines - * on PocketPC - */ - Menu mb = new Menu(shell, SWT.BAR); - shell.setMenuBar(mb); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet86.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet86.java deleted file mode 100644 index 52992490f1..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet86.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * PocketPC Shell example snippet: 'Ok' button - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet86 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display, SWT.CLOSE); - shell.setText("Main"); - Menu mb = new Menu(shell, SWT.BAR); - shell.setMenuBar(mb); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet87.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet87.java deleted file mode 100644 index a400686377..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet87.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * PocketPC Shell example snippet: resize automatically as SIP is on or off - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet87 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display, SWT.RESIZE); - shell.setText("Main"); - Menu mb = new Menu(shell, SWT.BAR); - shell.setMenuBar(mb); - /* Add a button to make the resize more visual */ - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - Button button = new Button(shell, SWT.PUSH); - button.setText("Main"); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet88.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet88.java deleted file mode 100644 index 36c60df6d9..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet88.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TableEditor example snippet: edit the text of a table item (in place) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet88 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Table table = new Table(shell, SWT.FULL_SELECTION | SWT.HIDE_SELECTION); - TableColumn column1 = new TableColumn(table, SWT.NONE); - TableColumn column2 = new TableColumn(table, SWT.NONE); - for (int i = 0; i < 10; i++) { - TableItem item = new TableItem(table, SWT.NONE); - item.setText(new String[] {"item " + i, "edit this value"}); - } - column1.pack(); - column2.pack(); - - final TableEditor editor = new TableEditor(table); - //The editor must have the same size as the cell and must - //not be any smaller than 50 pixels. - editor.horizontalAlignment = SWT.LEFT; - editor.grabHorizontal = true; - editor.minimumWidth = 50; - // editing the second column - final int EDITABLECOLUMN = 1; - - table.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - // Clean up any previous editor control - Control oldEditor = editor.getEditor(); - if (oldEditor != null) oldEditor.dispose(); - - // Identify the selected row - TableItem item = (TableItem)e.item; - if (item == null) return; - - // The control that will be the editor must be a child of the Table - Text newEditor = new Text(table, SWT.NONE); - newEditor.setText(item.getText(EDITABLECOLUMN)); - newEditor.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent me) { - Text text = (Text)editor.getEditor(); - editor.getItem().setText(EDITABLECOLUMN, text.getText()); - } - }); - newEditor.selectAll(); - newEditor.setFocus(); - editor.setEditor(newEditor, item, EDITABLECOLUMN); - } - }); - shell.setSize(300, 300); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet89.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet89.java deleted file mode 100644 index f6725bc983..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet89.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Menu example snippet: create a menu with radio items - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; - -public class Snippet89 { -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - Menu menu = new Menu (shell, SWT.POP_UP); - for (int i=0; i<4; i++) { - MenuItem item = new MenuItem (menu, SWT.RADIO); - item.setText ("Item " + i); - item.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - MenuItem item = (MenuItem)e.widget; - if (item.getSelection ()) { - System.out.println (item + " selected"); - } else { - System.out.println (item + " unselected"); - } - } - }); - } - shell.setMenu (menu); - shell.setSize (300, 300); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.java deleted file mode 100644 index e55be2fdce..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Composite example snippet: scroll a child control automatically - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet9 { - -public static void main (String [] args) { - Display display = new Display (); - final Shell shell = new Shell (display, SWT.SHELL_TRIM | SWT.H_SCROLL | SWT.V_SCROLL); - final Composite composite = new Composite (shell, SWT.BORDER); - composite.setSize (700, 600); - final Color red = display.getSystemColor (SWT.COLOR_RED); - composite.addPaintListener (new PaintListener() { - public void paintControl (PaintEvent e) { - e.gc.setBackground (red); - e.gc.fillOval (5, 5, 690, 590); - } - }); - final ScrollBar hBar = shell.getHorizontalBar (); - hBar.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - Point location = composite.getLocation (); - location.x = -hBar.getSelection (); - composite.setLocation (location); - } - }); - final ScrollBar vBar = shell.getVerticalBar (); - vBar.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - Point location = composite.getLocation (); - location.y = -vBar.getSelection (); - composite.setLocation (location); - } - }); - shell.addListener (SWT.Resize, new Listener () { - public void handleEvent (Event e) { - Point size = composite.getSize (); - Rectangle rect = shell.getClientArea (); - hBar.setMaximum (size.x); - vBar.setMaximum (size.y); - hBar.setThumb (Math.min (size.x, rect.width)); - vBar.setThumb (Math.min (size.y, rect.height)); - int hPage = size.x - rect.width; - int vPage = size.y - rect.height; - int hSelection = hBar.getSelection (); - int vSelection = vBar.getSelection (); - Point location = composite.getLocation (); - if (hSelection >= hPage) { - if (hPage <= 0) hSelection = 0; - location.x = -hSelection; - } - if (vSelection >= vPage) { - if (vPage <= 0) vSelection = 0; - location.y = -vSelection; - } - composite.setLocation (location); - } - }); - shell.open (); - while (!shell.isDisposed()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet90.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet90.java deleted file mode 100644 index 7bf13cdfa0..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet90.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Tree example snippet: detect mouse down in a tree item - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet90 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - final Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI); - for (int i=0; i<12; i++) { - TreeItem treeItem = new TreeItem (tree, SWT.NONE); - treeItem.setText ("Item " + i); - } - tree.addListener (SWT.MouseDown, new Listener () { - public void handleEvent (Event event) { - Point point = new Point (event.x, event.y); - TreeItem item = tree.getItem (point); - if (item != null) { - System.out.println ("Mouse down: " + item); - } - } - }); - tree.setSize (200, 200); - shell.setSize (300, 300); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} - -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet91.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet91.java deleted file mode 100644 index cff95357cf..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet91.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Drag and Drop example snippet: drag leaf items in a tree - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet91 { - -public static void main (String [] args) { - - final Display display = new Display (); - final Shell shell = new Shell (display); - shell.setLayout(new FillLayout()); - final Tree tree = new Tree(shell, SWT.BORDER); - for (int i = 0; i < 3; i++) { - TreeItem item = new TreeItem(tree, SWT.NONE); - item.setText("item "+i); - for (int j = 0; j < 3; j++) { - TreeItem subItem = new TreeItem(item, SWT.NONE); - subItem.setText("item "+i+" "+j); - for (int k = 0; k < 3; k++) { - TreeItem subsubItem = new TreeItem(subItem, SWT.NONE); - subsubItem.setText("item "+i+" "+j+" "+k); - } - } - } - - Transfer[] types = new Transfer[] {TextTransfer.getInstance()}; - int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK; - - final DragSource source = new DragSource (tree, operations); - source.setTransfer(types); - final TreeItem[] dragSourceItem = new TreeItem[1]; - source.addDragListener (new DragSourceListener () { - public void dragStart(DragSourceEvent event) { - TreeItem[] selection = tree.getSelection(); - if (selection.length > 0 && selection[0].getItemCount() == 0) { - event.doit = true; - dragSourceItem[0] = selection[0]; - } else { - event.doit = false; - } - }; - public void dragSetData (DragSourceEvent event) { - event.data = dragSourceItem[0].getText(); - } - public void dragFinished(DragSourceEvent event) { - if (event.detail == DND.DROP_MOVE) - dragSourceItem[0].dispose(); - dragSourceItem[0] = null; - } - }); - - DropTarget target = new DropTarget(tree, operations); - target.setTransfer(types); - target.addDropListener (new DropTargetAdapter() { - public void dragOver(DropTargetEvent event) { - event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL; - if (event.item != null) { - TreeItem item = (TreeItem)event.item; - Point pt = display.map(null, tree, event.x, event.y); - Rectangle bounds = item.getBounds(); - if (pt.y < bounds.y + bounds.height/3) { - event.feedback |= DND.FEEDBACK_INSERT_BEFORE; - } else if (pt.y > bounds.y + 2*bounds.height/3) { - event.feedback |= DND.FEEDBACK_INSERT_AFTER; - } else { - event.feedback |= DND.FEEDBACK_SELECT; - } - } - } - public void drop(DropTargetEvent event) { - if (event.data == null) { - event.detail = DND.DROP_NONE; - return; - } - String text = (String)event.data; - if (event.item == null) { - TreeItem item = new TreeItem(tree, SWT.NONE); - item.setText(text); - } else { - TreeItem item = (TreeItem)event.item; - Point pt = display.map(null, tree, event.x, event.y); - Rectangle bounds = item.getBounds(); - TreeItem parent = item.getParentItem(); - if (parent != null) { - TreeItem[] items = parent.getItems(); - int index = 0; - for (int i = 0; i < items.length; i++) { - if (items[i] == item) { - index = i; - break; - } - } - if (pt.y < bounds.y + bounds.height/3) { - TreeItem newItem = new TreeItem(parent, SWT.NONE, index); - newItem.setText(text); - } else if (pt.y > bounds.y + 2*bounds.height/3) { - TreeItem newItem = new TreeItem(parent, SWT.NONE, index+1); - newItem.setText(text); - } else { - TreeItem newItem = new TreeItem(item, SWT.NONE); - newItem.setText(text); - } - - } else { - TreeItem[] items = tree.getItems(); - int index = 0; - for (int i = 0; i < items.length; i++) { - if (items[i] == item) { - index = i; - break; - } - } - if (pt.y < bounds.y + bounds.height/3) { - TreeItem newItem = new TreeItem(tree, SWT.NONE, index); - newItem.setText(text); - } else if (pt.y > bounds.y + 2*bounds.height/3) { - TreeItem newItem = new TreeItem(tree, SWT.NONE, index+1); - newItem.setText(text); - } else { - TreeItem newItem = new TreeItem(item, SWT.NONE); - newItem.setText(text); - } - } - - - } - } - }); - - shell.setSize (400, 400); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.java deleted file mode 100644 index 75a7108a74..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Cursor example snippet: create a cursor from a source and a mask - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet92 { - -public static void main (String [] args) { - Display display = new Display(); - Color white = display.getSystemColor (SWT.COLOR_WHITE); - Color black = display.getSystemColor (SWT.COLOR_BLACK); - - //Create a source ImageData of depth 1 (monochrome) - PaletteData palette = new PaletteData (new RGB [] {white.getRGB(), black.getRGB(),}); - ImageData sourceData = new ImageData (20, 20, 1, palette); - for (int i = 0; i < 10; i ++) { - for (int j = 0; j < 20; j++) { - sourceData.setPixel(i, j, 1); - } - } - - //Create a mask ImageData of depth 1 (monochrome) - palette = new PaletteData (new RGB [] {white.getRGB(), black.getRGB(),}); - ImageData maskData = new ImageData (20, 20, 1, palette); - for (int i = 0; i < 20; i ++) { - for (int j = 0; j < 10; j++) { - maskData.setPixel(i, j, 1); - } - } - //Create cursor - Cursor cursor = new Cursor(display, sourceData, maskData, 10, 10); - - Shell shell = new Shell(display); - final Image source = new Image (display,sourceData); - final Image mask = new Image (display, maskData); - //Draw source and mask just to show what they look like - shell.addPaintListener(new PaintListener() { - public void paintControl(PaintEvent e) { - GC gc = e.gc; - gc.drawString("source: ", 10, 10); - gc.drawImage(source, 0, 0, 20, 20, 60, 10, 20, 20); - gc.drawString("mask: ",10, 40); - gc.drawImage(mask, 0, 0, 20, 20, 60, 40, 20, 20); - } - }); - shell.setSize(150, 150); - shell.open(); - shell.setCursor(cursor); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - cursor.dispose(); - source.dispose(); - mask.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java deleted file mode 100644 index 255729d147..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * GC example snippet: measure a string - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -public class Snippet93 { - -public static void main (String [] args) { - Display display = new Display (); - Shell shell = new Shell (display); - shell.setLayout (new RowLayout ()); - Label label = new Label (shell, SWT.NONE); - GC gc = new GC (label); - Point size = gc.textExtent ("Hello"); - gc.dispose (); - label.setText ("Hello -> " + size); - shell.pack (); - shell.open (); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - display.dispose (); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java deleted file mode 100644 index 9b26e214ab..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Clipboard example snippet: copy and paste data with the clipboard - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet94 { - -public static void main( String[] args) { - Display display = new Display (); - final Clipboard cb = new Clipboard(display); - final Shell shell = new Shell (display); - shell.setLayout(new FormLayout()); - final Text text = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); - - Button copy = new Button(shell, SWT.PUSH); - copy.setText("Copy"); - copy.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - String textData = text.getSelectionText(); - if (textData.length() > 0) { - TextTransfer textTransfer = TextTransfer.getInstance(); - cb.setContents(new Object[]{textData}, new Transfer[]{textTransfer}); - } - } - }); - - Button paste = new Button(shell, SWT.PUSH); - paste.setText("Paste"); - paste.addListener (SWT.Selection, new Listener () { - public void handleEvent (Event e) { - TextTransfer transfer = TextTransfer.getInstance(); - String data = (String)cb.getContents(transfer); - if (data != null) { - text.insert(data); - } - } - }); - - FormData data = new FormData(); - data.left = new FormAttachment(paste, 0, SWT.LEFT); - data.right = new FormAttachment(100, -5); - data.top = new FormAttachment(0, 5); - copy.setLayoutData(data); - - data = new FormData(); - data.right = new FormAttachment(100, -5); - data.top = new FormAttachment(copy, 5); - paste.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 5); - data.top = new FormAttachment(0, 5); - data.right = new FormAttachment(paste, -5); - data.bottom = new FormAttachment(100, -5); - text.setLayoutData(data); - - shell.setSize(200, 200); - shell.open(); - while (!shell.isDisposed ()) { - if (!display.readAndDispatch ()) display.sleep (); - } - cb.dispose(); - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java deleted file mode 100644 index 35dc1013b5..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * GC example snippet: capture a widget image with a GC - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -public class Snippet95 { - -public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setText("Widget"); - - final Table table = new Table(shell, SWT.MULTI); - table.setLinesVisible(true); - table.setBounds(10, 10, 100, 100); - for (int i = 0; i < 9; i++) { - new TableItem(table, SWT.NONE).setText("item" + i); - } - - Button button = new Button(shell, SWT.PUSH); - button.setText("Capture"); - button.pack(); - button.setLocation(10, 140); - button.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - Point tableSize = table.getSize(); - GC gc = new GC(table); - final Image image = - new Image(display, tableSize.x, tableSize.y); - gc.copyArea(image, 0, 0); - gc.dispose(); - - Shell popup = new Shell(shell); - popup.setText("Image"); - popup.addListener(SWT.Close, new Listener() { - public void handleEvent(Event e) { - image.dispose(); - } - }); - - Canvas canvas = new Canvas(popup, SWT.NONE); - canvas.setBounds(10, 10, tableSize.x+10, tableSize.y+10); - canvas.addPaintListener(new PaintListener() { - public void paintControl(PaintEvent e) { - e.gc.drawImage(image, 0, 0); - } - }); - popup.pack(); - popup.open(); - } - }); - shell.pack(); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java deleted file mode 100644 index cfe2485864..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * TableCursor example snippet: navigate a table cells with arrow keys. - * Edit when user hits Return key. Exit edit mode by hitting Escape (cancels edit) - * or Return (applies edit to table). - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class Snippet96 { - -public static void main(String[] args) { - Display display = new Display(); - Shell shell = new Shell(display); - shell.setLayout(new GridLayout()); - - // create a a table with 3 columns and fill with data - final Table table = new Table(shell, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - TableColumn column1 = new TableColumn(table, SWT.NONE); - TableColumn column2 = new TableColumn(table, SWT.NONE); - TableColumn column3 = new TableColumn(table, SWT.NONE); - for (int i = 0; i < 100; i++) { - TableItem item = new TableItem(table, SWT.NONE); - item.setText(new String[] {"cell " + i + " 0", "cell " + i + " 1", "cell " + i + " 2" }); - } - column1.pack(); - column2.pack(); - column3.pack(); - - // create a TableCursor to navigate around the table - final TableCursor cursor = new TableCursor(table, SWT.NONE); - // create an editor to edit the cell when the user hits "ENTER" - // while over a cell in the table - final ControlEditor editor = new ControlEditor(cursor); - editor.grabHorizontal = true; - editor.grabVertical = true; - - cursor.addSelectionListener(new SelectionAdapter() { - // when the TableEditor is over a cell, select the corresponding row in - // the table - public void widgetSelected(SelectionEvent e) { - table.setSelection(new TableItem[] { cursor.getRow()}); - } - // when the user hits "ENTER" in the TableCursor, pop up a text editor so that - // they can change the text of the cell - public void widgetDefaultSelected(SelectionEvent e) { - final Text text = new Text(cursor, SWT.NONE); - TableItem row = cursor.getRow(); - int column = cursor.getColumn(); - text.setText(row.getText(column)); - text.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - // close the text editor and copy the data over - // when the user hits "ENTER" - if (e.character == SWT.CR) { - TableItem row = cursor.getRow(); - int column = cursor.getColumn(); - row.setText(column, text.getText()); - text.dispose(); - } - // close the text editor when the user hits "ESC" - if (e.character == SWT.ESC) { - text.dispose(); - } - } - }); - // close the text editor when the user tabs away - text.addFocusListener(new FocusAdapter() { - public void focusLost(FocusEvent e) { - text.dispose(); - } - }); - editor.setEditor(text); - text.setFocus(); - } - }); - // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key. - // This alows the user to select multiple items in the table. - cursor.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CTRL - || e.keyCode == SWT.SHIFT - || (e.stateMask & SWT.CONTROL) != 0 - || (e.stateMask & SWT.SHIFT) != 0) { - cursor.setVisible(false); - } - } - }); - // When the user double clicks in the TableCursor, pop up a text editor so that - // they can change the text of the cell - cursor.addMouseListener(new MouseAdapter() { - public void mouseDown(MouseEvent e) { - final Text text = new Text(cursor, SWT.NONE); - TableItem row = cursor.getRow(); - int column = cursor.getColumn(); - text.setText(row.getText(column)); - text.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - // close the text editor and copy the data over - // when the user hits "ENTER" - if (e.character == SWT.CR) { - TableItem row = cursor.getRow(); - int column = cursor.getColumn(); - row.setText(column, text.getText()); - text.dispose(); - } - // close the text editor when the user hits "ESC" - if (e.character == SWT.ESC) { - text.dispose(); - } - } - }); - // close the text editor when the user clicks away - text.addFocusListener(new FocusAdapter() { - public void focusLost(FocusEvent e) { - text.dispose(); - } - }); - editor.setEditor(text); - text.setFocus(); - } - }); - - // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key. - // This signals the end of the multiple selection task. - table.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { - if (e.keyCode == SWT.CONTROL && (e.stateMask & SWT.SHIFT) != 0) - return; - if (e.keyCode == SWT.SHIFT && (e.stateMask & SWT.CONTROL) != 0) - return; - if (e.keyCode != SWT.CONTROL - && (e.stateMask & SWT.CONTROL) != 0) - return; - if (e.keyCode != SWT.SHIFT && (e.stateMask & SWT.SHIFT) != 0) - return; - - TableItem[] selection = table.getSelection(); - TableItem row = (selection.length == 0) ? table.getItem(table.getTopIndex()) : selection[0]; - table.showItem(row); - cursor.setSelection(row, 0); - cursor.setVisible(true); - cursor.setFocus(); - } - }); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); -} -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.java deleted file mode 100644 index 1d0174c66e..0000000000 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.snippets; - -/* - * Menu example snippet: fill a menu dynamically (when menu shown) - * - * For a list of all SWT example snippets see - * http://www.eclipse.org/swt/snippets/ - */ -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -public class Snippet97 { - -public static void main (String [] args) { - final Display display = new Display (); - Shell shell = new Shell (display); - final Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI); - final Menu menu = new Menu (shell, SWT.POP_UP); - tree.setMenu (menu); - for (int i=0; i<12; i++) { - TreeItem item = new TreeItem (tree, SWT.NONE); - item.setText ("Item " + i); - } - menu.addListener (SWT.Show, new Listener () { - public void handleEvent (Event event) { - MenuItem [] menuItems = menu.getItems (); - for (int i=0; i 0) count = files.length; - } - for (int i = 1; i < count; i++) { - if (i == 136 || i == 151 || i == 180 || i == 219) continue; - String className = "Snippet" + i; - Class clazz = null; - try { - clazz = Class.forName("org.eclipse.swt.snippets." + className); - } catch (ClassNotFoundException e) {} - if (clazz != null) { - System.out.println("\n" + clazz.getName()); - if (hasSource) { - File sourceFile = new File(sourceDir, className + ".java"); - try { - FileReader reader = new FileReader(sourceFile); - char [] buffer = new char [(int)sourceFile.length()]; - reader.read(buffer); - String source = String.valueOf(buffer); - int start = source.indexOf("package"); - start = source.indexOf("/*", start); - int end = source.indexOf("* For a list of all"); - System.out.println(source.substring(start, end-3)); - boolean skip = false; - String platform = SWT.getPlatform(); - if (source.indexOf("PocketPC") != -1) { - platform = "PocketPC"; - skip = true; - } else if (source.indexOf("OpenGL") != -1) { - platform = "OpenGL"; - skip = true; - } else if (source.indexOf("JavaXPCOM") != -1) { - platform = "JavaXPCOM"; - skip = true; - } else { - String [] platforms = {"win32", "motif", "gtk", "photon", "carbon"}; - for (int p = 0; p < platforms.length; p++) { - if (!platforms[p].equals(platform) && source.indexOf("." + platforms[p]) != -1) { - platform = platforms[p]; - skip = true; - break; - } - } - } - if (skip) { - System.out.println("...skipping " + platform + " example..."); - continue; - } - } catch (Exception e) {} - } - Method method = null; - String [] param = new String [0]; - if (i == 81) param = new String[] {"Shell.Explorer"}; - try { - method = clazz.getMethod("main", new Class[] {param.getClass()}); - } catch (NoSuchMethodException e) { - System.out.println(" Did not find main(String [])"); - } - if (method != null) { - try { - method.invoke(clazz, new Object [] {param}); - } catch (IllegalAccessException e) { - System.out.println(" Failed to launch (illegal access)"); - } catch (IllegalArgumentException e) { - System.out.println(" Failed to launch (illegal argument to main)"); - } catch (InvocationTargetException e) { - System.out.println(" Exception in Snippet: " + e.getTargetException()); - } - } - } - } - } -} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/cancel.gif b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/cancel.gif deleted file mode 100644 index 6f647666d3..0000000000 Binary files a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/cancel.gif and /dev/null differ diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/eclipse.png b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/eclipse.png deleted file mode 100644 index 73975241eb..0000000000 Binary files a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/eclipse.png and /dev/null differ -- cgit