Class GuiComponent

All Implemented Interfaces:
KeyboardInputHandler, MouseInteractionController
Direct Known Subclasses:
TextEditComponent

public class GuiComponent extends AbstractCompositeShape implements KeyboardInputHandler, MouseInteractionController
Base class for interactive GUI components rendered in 3D space.

GuiComponent combines a composite shape with keyboard and mouse interaction handling. When clicked, it acquires keyboard focus (via the KeyboardFocusStack), and a red wireframe border is displayed to indicate focus. Pressing ESC releases focus.

This class is the foundation for interactive widgets like the TextEditComponent.

Usage example - creating a custom GUI component:


 GuiComponent myWidget = new GuiComponent(
     new Transform(new Point3D(0, 0, 300)),
     viewPanel,
     new Point3D(400, 300, 0)  // width, height, depth
 );

 // Add visual content to the widget
 myWidget.addShape(someTextCanvas);

 // Add to the scene
 viewPanel.getRootShapeCollection().addShape(myWidget);
 
See Also:
  • Field Details

    • viewPanel

      public final ViewPanel viewPanel
      The view panel this component is attached to.
  • Constructor Details

    • GuiComponent

      public GuiComponent(Transform transform, ViewPanel viewPanel, Point3D size)
      Creates a GUI component with the specified transform, view panel, and bounding box size.
      Parameters:
      transform - the position and orientation of the component in 3D space
      viewPanel - the view panel this component belongs to
      size - the bounding box dimensions (width, height, depth)
  • Method Details