JFace-Snippets are small easy understandable programming example how to use JFace API.
To browse examples, navigate to examples GIT repository.
- 1 Dialogs
- 2 Layout
- 3 Viewers
- 3.1 Snippet001TableViewer
- 3.2 Snippet002TreeViewer
- 3.3 Snippet003TableLabelProvider
- 3.4 Snippet004HideSelection
- 3.5 Snippet005TreeCustomMenu
- 3.6 Snippet006TableMultiLineCells
- 3.7 Snippet007FullSelection
- 3.8 Snippet008RevealElement
- 3.9 Snippet009CellEditors
- 3.10 Snippet010OwnerDraw
- 3.11 Snippet011CustomTooltips
- 3.12 Snippet013TableViewerNoMandatoryLabelProvider
- 3.13 Snippet014TreeViewerNoMandatoryLabelProvider
- 3.14 Snippet015CustomTooltipsForTree
- 3.15 Snippet017TableViewerHideShowColumns
- 3.16 Snippet018TableViewerAddRemoveColumnsWithEditing
- 3.17 Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI
- 3.18 Snippet021CellEditorsOnDoubleClick
- 3.19 Snippet022TableViewerRefreshNoScroll
- 3.20 Snippet024TableViewerExploreNewAPI
- 3.21 Snippet025TabEditing
- 3.22 Snippet026TreeViewerTabEditing
- 3.23 Snippet027ComboBoxCellEditors
- 3.24 Snippet029VirtualTableViewer
- 3.25 Snippet030VirtualLazyTableViewer
- 3.26 Snippet031TableViewerCustomTooltipsMultiSelection
- 3.27 Snippet033CellEditorPerRowPre33
- 3.28 Snippet034CellEditorPerRowNewAPI
- 3.29 Snippet035TableCursorCellHighlighter
- 3.30 Snippet036FocusBorderCellHighlighter
- 3.31 Snippet037FancyCustomTooltips
- 3.32 Snippet038TreeViewerInlinelEditingOldAPI
- 3.33 Snippet039ListViewer
- 3.34 Snippet040TableViewerSorting
- 3.35 Snippet041TableViewerAlternatingColors
- 3.36 Snippet042ToolTipSupportFor32API
- 3.37 Snippet043NoColumnTreeViewerKeyboardEditing
- 3.38 Snippet044NoColumnTableViewerKeyboardEditing
- 3.39 Snippet045TableViewerFillFromBackgroundThread
- 3.40 Snippet046UpdateViewerFromBackgroundThread
- 3.41 Snippet047VirtualLazyTreeViewer
- 3.42 Snippet048TreeViewerTabWithCheckboxFor3_3
- 3.43 Snippet049StyledCellLabelProvider
- 3.44 Snippet050DelegatingStyledCellLabelProvider
- 3.45 Snippet051TableCenteredImage
- 3.46 Snippet052DouleClickCellEditor
- 3.47 Snippet053StartEditorWithContextMenu
- 3.48 Snippet055HideShowColumn
- 3.49 Snippet056BooleanCellEditor
- 3.50 Snippet057TableViewerSkipHiddenCells
- 3.51 Snippet058CellNavigationIn34
- 3.52 Snippet059CellNavigationIn33
- 3.53 Snippet060TextCellEditorWithContentProposal
- 3.54 Snippet061FakedNativeCellEditor
- 3.55 Snippet062TextAndDialogCellEditor
- 3.56 Snippet063ComboViewer
- 4 Window
- 5 Wizard
Demonstrates usage of Icons in Buttons of Dialogs
Demonstrates usage of the GridLayoutFactory to make more readable
Demonstrates (dynamic)layout support for TableColumns available as of JFace 3.3
Demonstrates (dynamic)layout support for TreeColumns available as of JFace 3.3
Demonstrates tables with more than one column and the usage of ITableLabelProvider
Demonstrates how the selection can be hidden when the user click in a tablerow/column which doesn't hold any information. The standard behaviour of SWT-Table is to leave the selection on the last column. This snippet removes the selection if the user clicks in an area not selectable
Demonstrates how to create a different context menu depending on which item in the tree is currently selected this can also be used with a table of course
Demonstrates first use case for the new OwnerDraw-Support added to JFace in 3.3 (available at SWT-Level since 3.2). This example uses the new Viewers API in this special case the OwnerDrawLabelProvider to make items with more than one line of text.
Demonstrates how you can use a use inline editing in tables with multiple columns which requires to use SWT.FULL_SELECTION but hiding the selection from the user.
Demonstrates how you can scroll a TableViewer to the specific model element using TableViewer#reveal(Object)
Demonstrates minimal example when trying to add inline editing to tables to get familiar with the various classes needed (3.2 API)
Demonstrates usage of new OwnerDraw-Support feature provided by JFace in 3.3(available in SWT since 3.2). This example uses the new Viewers API in this special case the OwnerDrawLabelProvider.
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in TableViewer
Demonstrates usage of none mandatory LabelProviders in TableViewers to set colors and fonts with 3.2-API
Demonstrates usage of none mandatory LabelProviders in TreeViewers to set colors and font with 3.2-API
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in a TreeViewer
Demonstrates hiding and showing of columns (animated)
Demonstrates adding/removing of columns in conjunction with inline editing which makes this a bit tougher than without it (using 3.2 API)
Demonstrates adding/removing of columns in conjunction with the inline editing but with the new JFace-API who makes this a much easier and less error prone
Demonstrates editor activation on double-click with the 3.2 API which makes this fairly complex
Demonstrates how to refresh and viewer without scrolling the selection into after the refresh with 3.2 API. In 3.3 a special refresh-API for TableViewers is added.
Demonstrates the base classes of 3.3 API
Demonstrates how one can use the new 3.3 API to add tab-editing support to your viewer
Demonstrates all fancy things one can do with new 3.3 API (Tab-Editing, Keyboard-Navigation from Cell to Cell, Editor-Activation with the Keyboard)
Demonstrates usage of the ComboBoxCellEditor in JFace-Viewers
Demonstrates usage of JFace-Viewers in virtual mode with an ordinary content provider (often the bottel neck is not the model but the UI). Using this Virtual viewers in conjunction with an ordinary content provider has the advantage that Sorting and Filtering is supported in 3.3.
Demonstrates usage of JFace-Viewer virtual mode with a lazy content provider
Demonstrates creation of tooltips for cells for pre 3.3 users
Demonstrates how one can handle different CellEditors-Types in one COLUMN before 3.3 and how difficult this has been.
Demonstrates different CellEditor-Types in one COLUMN with 3.3-API of JFace-Viewers
Demonstrates keyboard navigation in TableViewers using a TableCursor showing the flexibility of the new cell navigation support
Demonstrates keyboard navigation by highlighting the currently selected cell with a focus border showing once more the flexibility of the new cell navigation support
Demonstrates customizability of the 3.3 JFace-Support for cell tooltips using the Browser-Widget and presenting HTML
Demonstrates editing support as of 3.2 for TreeViewers
Demonstrates a very simple usage of ListViewer
Demonstrates sorting(asc/desc) in TableViewers by clicking the column header. This snippet uses classes from JFace 3.3 but can be easily adopted to work with JFace from 3.2
Demonstrates how to achieve alternating row-colors with TableViewer and the new JFace 3.3 API which allows for faster algorithms and can be used in conjunction with virtual-bits to even work with big tables (e.g. 100,000 rows in this example).
Because ColumnViewerToolTipSupport forces one to use the new 3.3 CellLabelProvider-API it is of no use for people stuck with the old LabelProvider API. This snippet shows how a potential class for 3.2 API could look like.
Demonstrates the JFace 3.3 keyboard editing support for Trees without columns. Tabbing from editor to editor is supported since 3.4.
Demonstrates the JFace 3.3 keyboard editing support for Tables without columns. Tabbing from editor to editor is supported since 3.4.
Demonstrates how a TableViewer with a sorter can be filled from a NON-UI thread
Demonstrates how to update a viewer from a long running task (which is executed in a thread) and calls back to the UI-Thread using asyncExec
Demonstrates the usage of ILazyContentProvider in conjunction with a Virtual-TreeViewer
Demonstrates how to overcome a limitation when it comes to key-navigation and CheckBoxEditors in 3.3.1.
Demonstrates a new LabelProvider-Type which uses StyleRanges. This Snippet requires SWT/JFace 3.4.
Demonstrates how you can add styled text by wrapping an existing label provider. This Snippet requires SWT/JFace 3.4.
Demonstrate how to center an image using owner draw. This snippet requires SWT/JFace 3.3.
Demonstrate how to start cell-editors on double click. This snippet requires SWT/JFace 3.3
Demonstrate how to start up an editor with a context menu and not with mouse clicking on the cell.
Demonstrate hiding and showing columns
Demonstrate a custom cell-editor which uses a real Checkbox-Button
Example of showing how easy cell-navigation with hidden cells is in 3.4
Example for full feature cell navigation until bug 230955 is fixed
Example for full feature cell navigation in 3.3. This snippet uses internal API by reflection so its not guaranteed to work for ever. The problem of invisible cells is fixed in 3.4. The problem with horizontal scrolling is going to be fixed in 3.5.
Show how to use content-proposal inside a CellEditor
Full featured native looking viewer with checkboxes in an arbitary column
Demonstrates usage of TextAndDialogCellEditor. The email column uses the TextAndDialogCellEditor; othe columns use ordinary TextCellEditor.
Show how to use ComboViewer and set a inital selection
Demonstrates usage of new JFace 3.3 to show really cool ToolTips for your controls
Demonstrates creation of ToolTips for users pre 3.3.
Demonstrates creation of ToolTips for Tables without using the JFace-Viewers API but only JFace-Tooltips
Demonstrates how to work with JFace-Wizards and fill a TableViewer from a Background-Thread without blocking the UI showing a progress bar in the meanwhile