Method addComponent
Method addComponent
’s parameters are a Component
reference component
and integers row
, column
, width
and height
. Lines 72–73 set the GridBagConstraints
variables gridx
and gridy
. The gridx
variable is assigned the column in which the Component
will be placed, and the gridy
value is assigned the row in which the Component
will be placed. Lines 74–75 set the GridBagConstraints
variables gridwidth
and gridheight
. The gridwidth
variable specifies the number of columns the Component
will span in the grid, and the gridheight
variable specifies the number of rows the Component
will span in the grid. Line 76 sets the GridBagConstraints
for a component in the GridBagLayout
. Method setConstraints of class GridBagLayout
takes a Component ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.