To develop user friendly and good look environment, the layout of the components in a container is very important to the programmer like the selection of colors and fonts for graphics. The user should feel free and comfortable to stay some time in GUI. To give attractive graphical user interface design, the AWT package comes with panels, layout managers and components. Panels are used very extensively along with layout managers.
Every component comes with a size. The size of a component is decided by the layout manager and not by the programmer or by the component itself. You know earlier the component in BorderLayout occupies complete space of north, south, east or west. In GridLayout it occupies the whole cell. With FlowLayout it is completely different.
What is Java Component Preferred Size?
The minimum size of the component, enough to display its label is known as preferred size of the component. For example, the button size should display its label with platform-specific decoration like dotted lines around the label etc. The FlowLayout manager gives the preferred size to a component.
FlowLayout is illustrated in Java "AWT FlowLayout Manager".
Programming User Interface
Programming interface is the way how an actual user interfaces (giving input and taking output) with a running program (while execution is going on). It is of two types.
1. Using command prompt like scanf (in Java System.in).
2. Using GUI.
The second is the most wanted and used in software development and Java supports. Java gives PUI (Programming User Interface) with two packages – java.awt and javax.swing. javax.swing comes with many advanced components like scroll pane, color chooser etc. apart ordinary buttons and check boxes.