Class VariableCoordStack

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, CoordPanel.CoordStack

public class VariableCoordStack extends JPanel implements CoordPanel.CoordStack
Coordinate stack implementation that can hold a variable number of coordinates, which can be rearranged in the GUI. Lines may be added as required, and at any time the first N lines may be displayed without discarding the hidden ones.

The implementation of this and its interaction with the MatrixPositionCoordPanel is a bit scrappy. A rewrite including better thought out coordinate GUI pluggability in CoordPanel would not be a bad idea.

Since:
23 Jun 2023
Author:
Mark Taylor
See Also:
  • Constructor Details

    • VariableCoordStack

      public VariableCoordStack()
      Constructor.
  • Method Details

    • addCoordLine

      public JLabel addCoordLine(String labelTxt, JComponent line)
      Description copied from interface: CoordPanel.CoordStack
      Adds a labelled line to the stack of components.
      Specified by:
      addCoordLine in interface CoordPanel.CoordStack
      Parameters:
      labelTxt - text of displayed label to associate with the component
      line - component to add
      Returns:
      label component displaying supplied labelTxt
    • getPanel

      public JComponent getPanel()
      Description copied from interface: CoordPanel.CoordStack
      Returns the visual component displaying this stack.
      Specified by:
      getPanel in interface CoordPanel.CoordStack
      Returns:
      panel for user interaction
    • setCoordPanel

      public void setCoordPanel(CoordPanel coordPanel)
      Sets the coord panel with which this stack will be working. Should be called before it is used.
      Parameters:
      coordPanel - owner
    • showItems

      public void showItems(int nline)
      Configures the display of this component so that only the first nline lines are visible.
      Parameters:
      nline - number of items from the top of the list to display, or -1 for all items
    • paintComponent

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