Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Lecture 19
1. Core Java
Debasish Pratihari
Swing
Swing provides rich set of Components for
building GUI.
Swing provides a feature called pluggable
look-and-feel that makes possible to change
the appearance of a component.
Swing is a part of Java Foundation
Classes(JFC).
Swing gives Undo support.
Unlike AWT components, swing components are
not implemented by platform-specific code.
Instead, they are written entirely in java and
therefore, are platform independent. This
types of components are termed as light
weight components.
For Swing Components, you have to import
javax.swing package.
Highlights of Swing Components :
Pluggable look-and –feel
Similar looks in cross-platform
ToolTip test
Decorative Borders
Icons for many Components
Lecture/core/swing/19
Page #1
feel the Technology…
5. Core Java
Debasish Pratihari
Top Level- Containers:
Swing provides three useful top-level container
classes as follows
JFrame
JDialog
JApplet
You can optionally add a menu bar to a toplevel container. The menu bar is by convention
positioned within the top-level container, but
outside the content pane.
To be displayed on a screen, every GUI
Component must be part of a Containment
hierarchy.
A Containment hierarchy is a tree of
Components that has a top-level Container as
its root.
As a rule, a standalone application with a Swingbased GUI has at least one containment
hierarchy with a JFrame as its root.
A Swing-based applet has at least one
containment hierarchy, exactly one of which is
rooted by a JApplet object.
Window Panes :
Note :
The area of the window below the title bar is a
JRootPane Object
Optional menubar
layeredPane object of type JLayeredPane
contentPane object of type JInternalPane
Lecture/core/swing/19
Page #5
The contentPane is where
components are added
except Menubar.
A reference to
contentPane is returned
when you call the
getContentPane( )
method for the JFrame
object.
feel the Technology…