A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://plugins.jetbrains.com/docs/intellij/lists-and-trees.html below:

List and Tree Controls | IntelliJ Platform Plugin SDK

List and Tree Controls JBList and Tree

Whenever you would normally use a standard Swing JList component, it's recommended to use the JBList class as drop-in replacement. JBList supports the following additional features on top of JList:

Similarly, the Tree class provides a replacement for the standard Swing JTree class. In addition to the features of JBList, it supports wide selection painting (Mac style) and auto-scroll on drag & drop.

ColoredListCellRenderer and ColoredTreeCellRenderer

When you need to customize the presentation of items in a list box or a tree, it's recommended to use the ColoredListCellRenderer or ColoredTreeCellRenderer classes as the cell renderer. These classes allow you to compose the presentation out of multiple text fragments with different attributes by calling append() and to set an optional icon for the item by calling setIcon(). The renderer automatically takes care of setting the correct text color for selected items and of many other platform-specific rendering details.

ListSpeedSearch and TreeSpeedSearch

To facilitate keyboard-based selection of items in a list box or a tree, you can install a speed search handler on it using the ListSpeedSearch and TreeSpeedSearch. This can be done simply by calling new ListSpeedSearch(list) or new TreeSpeedSearch(tree). To customize the text which is used to locate the element, override the getElementText() method. Alternatively, you can pass a function to convert items to strings. A function needs to be passed as elementTextDelegate to the ListSpeedSearch constructor or as toString to the TreeSpeedSearch constructor.

A very common task in plugin development is showing a list or a tree where the user is allowed to add, remove, edit or reorder the items. The implementation of this task is greatly facilitated by the ToolbarDecorator class. This class provides a toolbar with actions on items and automatically enables drag & drop reordering of items in list boxes if supported by the underlying list model. The position of the toolbar above or below the list depends on the platform under which the IDE is running.

To use a toolbar decorator:

29 April 2025


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4