Class ComponentDividerSplitPaneUI

java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.SplitPaneUI
javax.swing.plaf.basic.BasicSplitPaneUI
com.inductiveautomation.ignition.designer.gui.ComponentDividerSplitPaneUI

public class ComponentDividerSplitPaneUI extends BasicSplitPaneUI
A BasicSplitPaneUI that embeds an arbitrary component inside the split-pane divider and keeps drag feedback visually aligned with that component.

The standard Swing divider is a plain strip. This UI replaces it with a ComponentDivider that centers component within the strip. Because the divider is wider than usual, several overrides correct the drag-overlay size and position so the ghost rectangle tracks the center of the component rather than the edge of the strip.

Use the static install(JSplitPane, JComponent) factory to attach this UI to a split pane.

  • Constructor Details

    • ComponentDividerSplitPaneUI

      public ComponentDividerSplitPaneUI(JComponent component)
      Parameters:
      component - the component to embed in the divider
  • Method Details

    • createDefaultDivider

      public BasicSplitPaneDivider createDefaultDivider()
      Overrides:
      createDefaultDivider in class BasicSplitPaneUI
    • installDefaults

      protected void installDefaults()
      Temporarily injects a semi-transparent tint of Colors.Primary as the drag-overlay color before delegating to super, then immediately restores the original value.
      Overrides:
      installDefaults in class BasicSplitPaneUI
    • startDragging

      protected void startDragging()
      Narrows dividerSize to ComponentDivider.PADDING while dragging so the ghost overlay is a thin strip. Paired with the centering offset in getLastDragLocation(), this keeps the ghost visually centred on the embedded component.
      Overrides:
      startDragging in class BasicSplitPaneUI
    • finishDraggingTo

      protected void finishDraggingTo(int location)
      Resets the drag flag after the super call repositions the divider.
      Overrides:
      finishDraggingTo in class BasicSplitPaneUI
    • getLastDragLocation

      public int getLastDragLocation()
      Shifts the reported drag position right by half the component width during a drag. The divider is wider than a standard one, so without this offset the ghost rectangle would track the left edge of the strip rather than the visual center of the embedded component.
      Overrides:
      getLastDragLocation in class BasicSplitPaneUI
    • install

      public static void install(JSplitPane splitPane, JComponent component)
      Attaches this UI to splitPane and disables the built-in one-touch expand arrows, since the embedded component serves as the collapse control.