Class JGridBagPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, GridBagConstants
Direct Known Subclasses:
JAffineTransformChooser

public class JGridBagPanel extends JPanel implements GridBagConstants
An implementation of JPanel that uses the GridBagLayout.
Version:
$Id: JGridBagPanel.java 1808023 2017-09-11 12:43:22Z ssteiner $
See Also:
  • Field Details

  • Constructor Details

    • JGridBagPanel

      public JGridBagPanel()
      Sets the layout manager to GridBagLayout
    • JGridBagPanel

      public JGridBagPanel(JGridBagPanel.InsetsManager insetsManager)
      Initializes panel with a given insets manager
  • Method Details

    • setLayout

      public void setLayout(LayoutManager layout)
      This method only takes effect if the LayoutManager is a GridBagLayout
      Overrides:
      setLayout in class Container
    • add

      public void add(Component cmp, int gridx, int gridy, int gridwidth, int gridheight, int anchor, int fill, double weightx, double weighty)
      This version uses default insets and assumes that components are added in positive cell coordinates. Top inset for components added to the top is 0. Left inset for components added to the left is 0. For compoents at index gridx more than zero and index gridy more than zero, the insets are set to a default value.
      Parameters:
      cmp - Component to add to the panel
      gridx - x position of the cell into which component should be added
      gridy - y position of the cell into which component should be added
      gridwidth - width, in cells, of the space occupied by the component in the grid
      gridheight - height, in cells, of the space occupied by the component in the grid
      anchor - placement of the component in its allocated space: WEST, NORTH, SOUTH, NORTHWEST, ...
      fill - out should the component be resized within its space? NONE, BOTH, HORIZONTAL, VERTICAL.
      weightx - what amount of extra horizontal space, if any, should be given to this component?
      weighty - what amount of extra vertical space, if any, should be given to this component?