Swing (Java): differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Riga 127:
// How is that done? By rendering the information in a layer 'above' the lower level
// 'content' pane. So:
// The standard way of adding a component to a 'multi-pane' container such as JFrame
// is by first establishing a reference to its 'content pane' (which is, by default
// just aJPanel with BorderLayout and adding the components the JFrame to the content
// pane and NOT directly to the JFrame. (The latest Swing releasehowever alters the
// semantics of the JFrame.add(..) to assume convenient addition to the content pane).
f.getContentPane().add(new JLabel("Hello, World!"));
|