Package hec.gfx2d

Class LegendPanel

All Implemented Interfaces:
G2dToolbarListener, ImageObserver, MenuContainer, Serializable, Accessible

public class LegendPanel extends G2dComponent
The primary container for 2d graphic displays.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • setLayout

      public void setLayout(int layout)
      Sets the layout of this container to be vertical or horizontal. Sub components are added to the panel accordingly. This is different from the setLayout(LayoutManager) which set the layout manager i.e. GridBagLayout. The Legend used the layout manager to set the components in a vertical or horizontal fashion.
    • setLegendPosition

      public void setLegendPosition(int legendPosition)
    • setLegendPosistion

      @Deprecated public void setLegendPosistion(int legendPosition)
      Deprecated.
    • getLegendPosition

      public int getLegendPosition()
    • getTitleLabel

      public G2dLabel getTitleLabel()
    • getLeftLabel

      public G2dLabel getLeftLabel()
    • getRightLabel

      public G2dLabel getRightLabel()
    • getLegendItem

      public LegendItem getLegendItem(G2dObject g2dObject)
    • getLegendItem

      public LegendItem getLegendItem(G2dObject g2dObject, int curveNum)
    • addViewport

      public void addViewport(Viewport view)
    • refreshLegendItems

      public void refreshLegendItems()
      Refreshes the legend items so they represent what is in the plots
    • fillGlyphVector

      public void fillGlyphVector()
    • rebuildall

      public void rebuildall()
      Rebuilds the legned based on the properties.
    • getLegendLabel

      public G2dLabel getLegendLabel(String name)
      Returns the G2dLabel of the legend item with the specified name.
      Parameters:
      name - The name (default label text) of the legend item.
      Returns:
      The G2dLabel of the matching legend item.
    • getLegendLabel

      public G2dLabel getLegendLabel(String name, int curveNumber)
      Returns the G2dLabel of the legend item with the specified name for the specified curve number.
      Parameters:
      name - The name (default label text) of the legend item.
      curveNumber - The number of the curve to set
      Returns:
      The G2dLabel of the matching legend item.
    • getLegendItemCount

      public int getLegendItemCount()
      Get the number of items in the legend.
      Returns:
      the number of items in the legend
    • getLegendLabel

      public G2dLabel getLegendLabel(int index)
      Get the G2dLabel of the legend item at the specified index.
      Parameters:
      index - the index to retrieve
      Returns:
      the number of items in the legend, null if index is out of bounds
    • paint

      public void paint(Graphics g)
      Description copied from class: G2dComponent
      Paints the contents of the panel.
      Overrides:
      paint in class G2dComponent
    • objectSelect

      public boolean objectSelect(LocalPt pt, int modifiers)
    • objectPopupMenu

      public boolean objectPopupMenu(LocalPt pt, int modifiers)
      Overrides:
      objectPopupMenu in class G2dComponent
    • setTitle

      public void setTitle(String legendTitleText)
    • getToolTipText

      public String getToolTipText(MouseEvent e)
      Returns a tool tip text for the given mouse location. In this method we loop over the glyphs and see if they ha ve any tool tips. The first one that has one is returned;
      Overrides:
      getToolTipText in class G2dComponent
    • setProperties

      public void setProperties(LegendPanelProp prop)
    • getProperties

      public LegendPanelProp getProperties()
    • setBounds

      public void setBounds(Rectangle r)
      Overrides:
      setBounds in class Component
    • setBounds

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

      public void editProperties()
      Overrides:
      editProperties in class G2dComponent
    • editProperties

      public void editProperties(int tabIndex)
    • buildPropertiesPanel

      protected DefaultJPanel[] buildPropertiesPanel()