Class FlatInspector

java.lang.Object
com.formdev.flatlaf.extras.FlatInspector

public class FlatInspector extends Object
A simple UI inspector that shows information about UI component at mouse location in a tooltip.

To use it in an application install it with:

 FlatInspector.install( "ctrl shift alt X" );
 
This can be done e.g. in the main() method and allows enabling (and disabling) the UI inspector for the active window with the given keystroke.

When the UI inspector is active some additional keys are available:

  • press Esc key to disable UI inspector
  • press Ctrl key to increase inspection level, which shows information about parent of UI component at mouse location
  • press Shift key to decrease inspection level
  • Field Details

    • HIGHLIGHT_LAYER

      private static final Integer HIGHLIGHT_LAYER
    • KEY_MODIFIERS_MASK

      private static final int KEY_MODIFIERS_MASK
      See Also:
    • rootPane

      private final JRootPane rootPane
    • mouseMotionListener

      private final MouseMotionListener mouseMotionListener
    • keyListener

      private final AWTEventListener keyListener
    • propertyChangeSupport

      private final PropertyChangeSupport propertyChangeSupport
    • windowListener

      private final WindowListener windowListener
    • window

      private Window window
    • enabled

      private boolean enabled
    • oldGlassPaneFullHeight

      private Object oldGlassPaneFullHeight
    • lastComponent

      private Component lastComponent
    • lastX

      private int lastX
    • lastY

      private int lastY
    • inspectParentLevel

      private int inspectParentLevel
    • wasModifierKeyPressed

      private boolean wasModifierKeyPressed
    • showClassHierarchy

      private boolean showClassHierarchy
    • lastWhen

      private long lastWhen
    • highlightFigure

      private JComponent highlightFigure
  • Constructor Details

    • FlatInspector

      public FlatInspector(JRootPane rootPane)
  • Method Details

    • install

      public static void install(String activationKeys)
      Installs a key listener into the application that allows enabling and disabling the UI inspector with the given keystroke (e.g. "ctrl shift alt X").
      Parameters:
      activationKeys - a keystroke (e.g. "ctrl shift alt X")
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener l)
    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public void setEnabled(boolean enabled)
    • hidePopup

      private void hidePopup()
    • update

      public void update()
    • inspect

      private int inspect(int x, int y)
    • getDeepestComponentAt

      private Component getDeepestComponentAt(Component parent, int x, int y)
    • highlight

      private void highlight(Component c)
    • createHighlightFigure

      private JComponent createHighlightFigure()
    • showToolTip

      private void showToolTip(Component c, int x, int y, int parentLevel)
    • buildToolTipText

      private static String buildToolTipText(Component c, int parentLevel, boolean classHierarchy)
    • appendRow

      private static void appendRow(StringBuilder buf, String key, String value)
    • toString

      private static String toString(Class<?> cls, boolean classHierarchy)
    • toString

      private static String toString(Insets insets)
    • toString

      private static String toString(Color c)
    • toString

      private static String toString(Font f)
    • toString

      private static String toString(Border b, boolean classHierarchy)
    • toDimmedText

      private static String toDimmedText(String text)