Introduction 3 - Start from the Start.
Every GUI in the world starts with a main window, in which things are displayed. There are three main types of windows in Swing, an Applet, a Dialog and a Frame. This site primarily focuses on a Frame, the window of a standalone application. It contains a titlebar, with buttons to resize and close the frame.
A Frame object in Swing is called a JFrame, which abides by the naming conventions of Swing where default widgets have a J at the start (i.e JButton, JLabel etc). The JFrame is described as a 'Top-Level' container, as the JFrame does not need to attach itself to another object to be displayed.
The JFrame is split into 'panes' - like panes of glass - that are positioned on top of one another. There is a Root Pane, a Layered Pane, a Content Pane and a Glass Pane. Each pane carries out a different function and we will cover these in a later tutorial. We do need to talk about one of the panes now however, the Content Pane.
The Content Pane is where you put all the text, buttons and funky graphics (widgets) that you wish to put on your program. We work with the Content Pane for most of the tutorials in this site.
As you can see from this example though, the JFrame consists of several different components. To add and display widgets, we need to specify that it's the content pane we add to.
The Content Pane is at the top of a containment hierarchy. A containment hierarchy is a tree of components that has a top-level container (in this case the JFrame) as its root. As you start to work down the tree, we use other non-top-level containers such as a JPanel to hold widgets.
To start with, let's look at how to create a JFrame in Java.