java - Using a ContentPane's JComponent functionality -
fred swartz writes in note on java gui programming (more specifically, best ways access , use component's contentpane)
... if predefined content pane [by invoking
getcontentpane()onjframe], turns out it'sjpanel, can't take advantage of functionality addedjcomponent.
-- http://www.fredosaurus.com/javabasics/gui/gui-commentary/guicom-60-contentpane.html
in case, prohibits using jcomponent functionality of jpanel? jpanel extends jcomponent, shouldn't jpanel have unhindered access jcomponent's methods?
read further in comments using returned component:
if downcast jpanel, create fragile code might break because contract getcontentpane() return container, , there no guarantee future versions continue return jpanel.
Comments
Post a Comment