JavaSwingMiscellaneous: Container


Container

Container children queries

Function

Container

JLayeredPane

JToolBarJPopupMenu

JMenuBar

size

getComponentCount

getMenuCount

at

getComponent

getComponentAtIndex

(deprecated in JMenuBar)

(used from BasicToolBarUI)

getMenu (if JMenu)

toArray

getComponents

contains

by getParent

indexOf

loop

getIndexOf

getComponentIndex (brilliant implementation)

(used from BasicToolBarUI/internally)

Container children commands

Command

Container

JPopupMenu

add

add

addAt

add

insert (really ingenious implementation, seems the writer was not aware add(index) existed)

(used internally, from JMenu)

multiple add

loop over add

replace, set

not directly, remove + add

move

add (constraints are lost)

setComponentZOrder (1.5)

remove

remove

remove(index)

remove

multiple remove

loop over remove

clear

removeAll

Container extensions

Command

JMenuBar

JMenu

JPopupMenu

JToolBar

add

add(JMenu)

add(JMenuItem)

add(Action)

add(String)

addSeparator

add(JMenuItem)

add(Action)

add(String)

addSeparator

add(Action)

add(Separator) (2x)

addAt

insert(JMenuItem)

insert(Action)

insert(String)

insertSeparator

insert(Action)

(and insert(Component), see above)

Container modification implementations

JToolBar: addImpl: overridden to setDefaultCapable to false for JButton

CellRendererPane: addImpl: don't do anything if already a child

JRootPane: always move glass pane to front afterwards (breaks some invariants)

JViewport: addImpl calls setView, which calls super.addImpl; remove(component) removes listener (broken)

JTabbedPane: calls addImpl directly; add does much magic; remove delegates to removeTabAt

JApplet/JDialog/JFrame/JWindow/JInternalFrame: root pane checking

JSplitPane: add removes old component in same place, remove(2x)/removeAll reset cached components, all call revalidate/repaint???

JTabbedPane: remove

JMenu: delegates to its popup menu

JPopupMenu: remove with new IllegalArgumentException (purpose?), insert(Component ,index)

JLayeredPane: index/layer conversion; validateOptimizedDrawing

Container modification delegates:

JScrollPane: setCorner, setViewport(View), setXXXHeader(View), setXXXScrollBar

JViewport: setView

JSplitPane: setXXXComponent

JTabbedPane: addTab (3x), insertTab, removeTabAt

JSlider: setLabelTable

JLayeredPane: setLayer <- setLayer, setPosition <- moveToFront, moveToBack

JRootPane/RootPaneContainer: setXXXPane

Container notification

JComponent: both: "ancestor" property, more

JMenuBar: (un-)register with KeyboardManager

JRootPane: internal, enable key events?

JTable: scroll pane, focus property change listener

JTextComponent: clear focused component (why?)

Other

JColorChooser: panels

JFileChooser: accessory

JTextPane: insertComponent (-:

JToolBar:

margin/borderPainted

weird LayoutManager strategy

invalidate from updateUI?


(C) 2001-2009 Christian Kaufhold (swing@chka.de)