Class FieldHeaderComp

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class FieldHeaderComp extends JPanel
Class manage a header for the FieldViewer.
See Also:
  • Constructor Details

    • FieldHeaderComp

      public FieldHeaderComp(FieldHeader headerPanel, int modelNumber)
      Constructs a new FieldHeader for the given model.
      Parameters:
      headerPanel - the headerPanel containing this component.
      modelNumber - the model number for this component.
  • Method Details

    • getModel

      public FieldFormatModel getModel()
      Returns the currently displayed model.
      Returns:
      the currently displayed model.
    • update

      public void update()
      Called when the model's layout changes.
    • getRow

      public int getRow(Point p)
      Returns the row in the model that the point is over.
      Parameters:
      p - the point for which to find its corresponding row
      Returns:
      the row
    • getCol

      public int getCol(int row, int x)
      Returns the index of the field on the given row containing the give x position.
      Parameters:
      row - the row on which to find the index of the field containing the x coordinate.
      x - the horizontal coordinate (in pixels)
      Returns:
      the column
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • setBounds

      public void setBounds(int x, int y, int width, int height)
      Overrides:
      setBounds in class Component
    • getFieldHeaderLocation

      public FieldHeaderLocation getFieldHeaderLocation(Point p)
      Returns a FieldHeaderLocation for the given point
      Parameters:
      p - the point to get a location for
      Returns:
      the location
    • toString

      public String toString()
      Overrides:
      toString in class Component