Swingspector

A plugin for Intellij IDEA that helps making and debugging Swing UIs


Project maintained by ohle Hosted on GitHub Pages — Theme by mattgraham

Swingspector

Build Version Downloads

Summary

Swingspector is a plugin for Intellij IDEA that allows to analyze Java Swing components in a running application.

It is heavily inspired by the standalone Swing Explorer. (Swing Explorer does come with an Intellij plugin, but it does not offer many features). In fact, the name of the instrumentation agent (SWAG, for SWing AGent), is blatantly copied from that project.

Features

Usage

Demo

Swingspector adds a new option to run configurations. This option will instrument the application for use with the plugin.

Select “Swingspector” from the “Modify Options” menu of any run configuration that starts a Swing application, activate the checkbox and choose a shortcut. Now, when running your Swing application through this configuration, it will react to the configured shortcut by opening a tool window in IDEA with information about the Swing component under the mouse cursor.

There are two ways to open a tool window for a component:

Using the hotkey

The run configuration setup dialog includes a keyboard shortcut (default Ctrl+;). This shortcut is installed in the application being run (so be sure to choose one that doesn’t shadow an important shortcut of the application itself).

Position your mouse cursor over a component of interest and press the shortcut keys (with the keyboard focus in your application) to open a window for that component.

Using the hierarchy of the root windows

The “Swing Roots” toolwindow is populated when running an application with Swingspector active, and contains the root windows (JFrames, Dialogs, …) that the application opened. Double-clicking one of those will open the Swing Hierarchy tool window, showing the tree of components within that window. Individual components can be opened from there.

If the list of windows is empty, press the refresh button once the application is actually showing a window.

The component tool window

toolwindow The window contains three sections:

but not method references or lambda expressions.

The toolbar has buttons to open the component in the hierarchy tree, and to open the component’s parent.

Immediate child components can be opened by double-clicking. When hovering over a child component, its preferred, minimum, and maximum size are plotted, and its name is displayed in the overlay.

Installation


Plugin based on the IntelliJ Platform Plugin Template.

  1. This currently only works for regular classes (including inner classes and anonymous classes),