... the grid. An anchor
value is not specified in constraints
, so the default CENTER
is used. We do not use variable anchor
in this application, so all the components will use the default. Line 40 calls our utility method addComponent
(declared at lines 69–78). The JTextArea
object, the row, the column, the number of columns to span and the number of rows to span are passed as arguments.
JButton button1
JButton
button1
is the next component added (lines 43–44). By default, the weightx
and weighty
values are still zero. The fill
variable is set to HORIZONTAL
—the component will always fill its area in the horizontal direction. The vertical direction is not filled. The weighty
value is zero, so the button will become taller only if another component in ...
Get Java How to Program, Early Objects, 11th 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.