{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

GUIbuild - window by calling the add method on the window's...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
GUI Build The application instantiates the Window object (actually it's child: JFrame) and "intermediate containers" like JPanel. The application calls the window's getContentPane() method to get addressability to the window's Container. (The Container manages the window's contents, and has the add() method and the setLayout() method.) The application instantiates buttons, text fields, and other GUI objects it wants to show in the window. The application typically adds GUI objects to "intermediate containers" like a JPanel so it can handle GUI objects as a group. The application can optionally set a LayoutManager on the Container to specify a layout style. (In our application TellerGUI this week, we used the default BorderLayout for the window and the default FlowLayout for the panel. GridLayout is also often used for panels.) The application then adds a panel (with buttons etc. in it) to the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: window by calling the add() method on the window's Container. (A second parameter of the Container's add() method can specify a general area of the screen like "North", "South", "East","West", or "Center".) • The application typically sets an initial size for the window by calling setSize() on the window (not the Container!). • The application then must show the window by calling setVisible(true) on the window (not the Container!). JVM ______________________________________________________________________ | | | JButton JTextField Window | | JFrame | | | | setSize() | | | |Application setVisible() | | JPanel | | | | getContentPane() | | Container | | | | add() | | GridLayout | | setLayout() | | | | | |______________________________________________________________________|...
View Full Document

{[ snackBarMessage ]}