Use UI Inspector to locate the underlying Swing component implementation or to inspect an existing UI at runtime.
Useful ClassesPackage com.intellij.ui
Package com.intellij.util.ui
Always use JBColor
instead of plain java.awt.Color
(highlighted via inspection Plugin DevKit | Code | Use Darcula aware JBColor). Custom colors must be retrieved via JBColor.namedColor()
set by the current Theme. See Exposing Theme Metadata on how to expose corresponding metadata.
If it's needed to retrieve a color from one place and use it in another, do not just retrieve once and use the retrieved value. Instead, use JBColor.lazy()
and pass in a lambda expression to retrieve the color. This lambda expression needs to be fast and safe enough, as it will be called every time the color is retrieved, for example, for painting. Following this approach ensures that the color will be properly updated if it's changed at the source, for example, due to a theme or scheme change.
Generic UI colors (e.g., for drawing borders) can be accessed via UIUtil
and JBUI
. A number of hardcoded colors is defined in JBColor
, Gray
, and LightColors
ColorUtil
allows tuning existing colors.
Use NaturalComparator
for "natural" sorting of items.
StringUtil
contains a number of useful methods for manipulating text for UI usage:
unpluralize()/pluralize()
using English rules
formatDuration()
to format duration: 2 m 3 s 456 ms
formatFileSize()
to format filesize: 1.23 KB
escapeLineBreak()
and related methods to escape special characters
shortenTextWithEllipsis()
and shortenPathWithEllipsis()
to produce abbreviated UI texts ending with 'â¦'
quote()
and unquoteString()
to wrap values: Usages of "$value$": 218 found
See Internationalization for information about internationalizing plugins.
See NlsMessages
to produce localized messages.
To store and retrieve values for Recently Used entries (e.g., filter values), use RecentsManager
.
To determine the current Theme's style, use JBColor.isBright()
.
Always create borders and insets via factory methods from JBUI.Borders
and JBUI.Insets
, which create DPI-aware instances. Using standard DPI-agnostic instances (reported by inspection and ) can result in UI layout problems.
If you use DPI-aware insets in an empty border (JBUI.Borders.empty()
), then the insets will be updated automatically, for example, if scaling is changed because the action was performed or for any other reason. If you use the insets elsewhere, you need to manually call JBInsets.update()
in your component's updateUI()
method to update the insets accordingly.
Plugins may need to override icons for existing elements, for example, for XML/JSON configuration files related its functionality.
Use FileIconProvider
registered in com.intellij.fileIconProvider
extension point to provide custom icons for Virtual Files.
For PSI elements, implement IconProvider
and register in com.intellij.iconProvider
extension point.
LoadingDecorator
provides "loading" placeholder panel.
Use IconUtil
to scale/colorize/darken/desaturate existing icons as needed.
Use RowIcon
to combine icons horizontally ($modifier$ $element$).
To stack icons, use LayeredIcon
. IconWithOverlay
additionally allows controlling the shape of the overlay icon.
If a topic is not covered in the above sections, let us know via the Was this page helpful? feedback form below or other channels.
Be specific about the topics and reasons for adding them and leave your email in case we need more details. Thanks for your feedback!
08 May 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