GUI – Graphic User Interface Up to now in the programs we have written all output has been sent to the standard output device i.e.: the DOS console. A GUI presents a windows interface to a program. A GUI gives a distinctive “look” and “feel”.
GUI Applications and how they are built. GUI components java.awt (Abstract Window Toolkit) and javax.swing (Swing Components).
Components and the Container object. As the name suggests the Container object is an object that can contain other GUI objects. A Frame is a type of container.
import javax.swing.*; import java.awt.*;
import javax.swing.*; import java.awt.*; public class JFrameEg extends JFrame { public JFrameEg() { super("JFrameEg: Testing JFrame"); setSize(300,150); setVisible(true); } public static void main(String args[]) { JFrameEg example = new JFrameEg(); }
Can use GUI components to get input from the user and display output Components are placed in a container and the container is shown to the user in the form of a window When you create your component object you must add it to the container, otherwise it will not be visible
Components and the layout manager object. Layout manager and logical arrangement of components