Class HighPrecisionCrosshair

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.arbergashi.charts.ui.HighPrecisionCrosshair
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public final class HighPrecisionCrosshair extends JComponent

HighPrecisionCrosshair - Professional TradingView-Style Crosshair

Enterprise-grade crosshair overlay for banking, medical, engineering, and scientific applications with smooth animations and magnetic snapping.

Professional Features:

  • Smooth Animation: 60 FPS interpolated position updates
  • Magnetic Snapping: Snaps to nearest data point
  • Axis Labels: X/Y values in professional label boxes
  • Minimal Lines: Subtle, dashed crosshair lines
  • High Contrast: Optimized for medical/engineering precision
  • Zero Lag: Hardware-accelerated rendering
  • Theme-Aware: Adapts to dark/light instantly

Design Inspiration:

  • TradingView crosshair (smooth, animated)
  • Bloomberg Terminal cursor (precise, minimal)
  • Medical imaging crosshair (high contrast)
  • CAD software precision cursor (snapping)
Since:
2026-01-01
Version:
1.0.0 - Professional Edition
Author:
Arber Gashi
See Also:
  • Constructor Details

    • HighPrecisionCrosshair

      public HighPrecisionCrosshair()
      Creates a theme-aware, animated crosshair overlay component.
  • Method Details

    • removeNotify

      public void removeNotify()
      Overrides:
      removeNotify in class JComponent
    • updatePosition

      public void updatePosition(int x, int y, String xValue, String yValue)
      Updates crosshair position with smooth animation.
    • hideCrosshair

      public void hideCrosshair()
      Hides crosshair with fade-out animation.
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables/disables crosshair rendering.
      Overrides:
      setEnabled in class JComponent
    • setAccentColor

      public void setAccentColor(Color color)
      Sets accent color for crosshair and labels.
    • setTheme

      public void setTheme(ChartTheme theme)
      Sets the chart theme used to derive colors and label styling.
      Parameters:
      theme - chart theme (falls back to default when null)
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent