Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: 3g technology full report
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
3g technology


[attachment=36628]

Layouts

Layouts tell Java where to put components in containers (JPanel, content pane, etc). Every panel (and other container) has a default layout, but it's better to set the layout explicitly for clarity.
Create a new layout object (using one of its constructors) and use the container's setLayout method to set the layout. Each layout has its own way to resize components to fit the layout, and you must become familiar with these.
Tools. Creating your layouts by hand is simple for the simple layouts, but for really good layouts using the difficult GridBagLayout, you might want to use a program to help you. A good review of some of these programs is at Java GUI Builders (www.fullspanarticles/java-gui-builders.html) by Mitch Stuart.

General advice
.
• Initial Iterations. To quickly get the first iterations of a program running, use FlowLayout. The result is often ugly, but if there are only a few components, it's quick. FlowLayout is rarely the correct layout to use in a finished program.
• Simple programs. BorderLayout is often a good layout for simple programs. More complicated layouts can often be nesting BorderLayouts within other BorderLayouts. This and FlowLayout are the most important layouts for beginners.
• Grids of equal sized elements (eg, a calculator keypad), can be created with with GridLayout.
• Single Rows or colums of components are sometimes best done with BoxLayout.
• More complicated layouts may require GridBagLayout. Getting a GridBagLayout to work correctly can be time-consuming, but it produces excellent results.
More notes
• FlowLayout - left to right, top to bottom. Good for initial testing. FlowLayout does not respect preferred size information, so it may make variable size elements (eg, a graphics panel) extremely small.
• BorderLayout - north, east, south, west, and center areas. Has various rules for how components are stretched to fit these areas. Both common and useful.
• GridLayout - equal sized grid elements.
• BoxLayout and Boxes - horizontal or vertical sequence of components.
• GridBagLayout - unequal sized grid. Can produce excellent results, but can be difficult to use.
• SpringLayout was added in Java 1.4, but is difficult for humans. It is rumored to be intended for authomatic layout programs..
• CardLayout is good for something like a wizard interface which shows one of several possible layouts (think about a stack of index cards). Tabbed panes are something like a card layout with tabs.
• The Null layout (absolute positioning) is possible, but is a bad idea.
• Tabbed panes are something like a card layout with tabs. They are not implemented as a layout, but as a type of panel.
• Non-standard layout managers. Because of deficiencies in the standard Java layout managers, several good, free, alternatives exist.


Java Notes
FlowLayout


java.awt.FlowLayout arranges components from left-to-right and top-to-bottom, centering components horizontally with a five pixel gap between them. When a container size is changed (eg, when a window is resized), FlowLayout recomputes new positions for all components subject to these constraints.
Use FlowLayout because it's quick and easy. It's a good first choice when using iterative development. I often start with a FlowLayout in an early iteration then switch to a better layout, if necessary, on a later iteration.


BorderLayout

java.awt.BorderLayout divides a container (eg, JPanel) into 5 geographical sections: North, South, East, West, and Center. This is a very commonly used layout.
Expand to fill region. Components start at their preferred size, but are expanded as needed to fill the region they are in.
Use subpanel for more than one component in a region. You can add at most one component to each region of a BorderLayout. To put more than one component in a section, put them in a JPanel (with its own layout), then add that panel to the border layout.
Where extra space goes. The size of a region is adjusted depending on what is in it. If there is nothing in an region, its size will be reduced to zero. Components in the North and South cells are stretched