JFaceSnippets

JFace-Snippets are small and easy understandable programming examples how to use the JFace API. To browse the examples, navigate to the examples GIT repository.

Copy Paste

The header section of each snippet is a link to the plain source. You can copy the source and paste it directly on the source folder or package in an eclipse project. The package and the class will be created automatically. * Click here for a visual explanation.

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 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 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 how to achieve alternating row-colors with TableViewer. It can also be used in conjunction with virtual-bits to even work with big tables (e.g. 100,000 rows in this example). In addition, this snippet provided a button that will demonstrate the usage of viewer filters.

Demonstrates the JFace 3.3 keyboard editing support for Trees without columns. Tabbing from editor to editor is supported since 3.4. In addition this snippet provided a button that shows how to enter in edit mode programmatically.

Demonstrates the usage of ILazyContentProvider in conjunction with a Virtual-TreeViewer. The snippet shows how using a lazy tree can minimize the memory footprint and maximize the speed when viewing large models.

Shows how to automatically reveal cells when navigating. Run the snippet and then edit the first cell by double clicking. Pressing tab will advance to the next cell in edit mode and reveal the cell if it is not in the viewport.