JFrame
, getLayout
doesn't return the object set by a previous setLayout(aLayout)
call. Why? Because the layout actually gets set on the JFrame
's content pane, and that's not what getLayout
is looking at.Now, I remember the days where
JFrame.add
triggered a runtime exception: "Don't use add
! Use getContentPane().add()
instead!" or something like that. Somewhere down the line, someone appears to have had the great idea of changing that so that JFrame
by deferring to the content pane, but symmetry has been broken in the process. Nice!
No comments:
Post a Comment