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() on jframe], turns out it's jpanel, can't take advantage of functionality added jcomponent.

-- 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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -