Layout managers are software components used in widget toolkits which have the ability to lay out widgets by their relative positions without using distance units. It is often more natural to define component layouts in this manner than to define their position in pixels or common distance units, so a number of popular widget toolkits include this ability by default. Widget toolkits that provide this function can generally be classified into two groups: *Those where the layout behavior is coded in special graphic containers. This is the case in XUL and the .NET Framework widget toolkit (both in Windows Forms and in XAML). *Those where the layout behavior is coded in layout managers, that can be applied to any graphic container. This is the case in the Swing widget toolkit that is part of the Java API.
Examples
XUL
In XUL, one can use elements like the [http://www.xulplanet.com/tutorials/xultu/boxes.html vbox] container to stack components on top of each other.
This piece of code shows 3 buttons stacked on top of each other in a vertical box:
XAML
The [http://msdn2.microsoft.com/en-us/library/system.windows.controls.dockpanel.aspx DockPanel] container lays out children components according to their "Dock" properties.Top 1Top 2Top 3Top 4This code shows 4 text blocks on top of each other.
Java Swing
The Javadoc:SE|java/awt|FlowLayout layout manager arranges components in a directional flow, much like lines of text in a paragraph. It arranges components horizontally until no more components fit on the same line, then it places them on another line.import javax.swing.JFrame;import javax.swing.JButton;import java.awt.FlowLayout;import java.awt.Container;
public class LayoutExample extends JFrame { public LayoutExample() { this.setTitle("FlowLayoutDemo"); // get the top-level container in the Frame (= Window) Container contentPane = this.getContentPane();
// set the layout of this container contentPane.setLayout(new FlowLayout());
// exit the application when clicking on the right close-button this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
public static void main(String [] args) { LayoutExample example = new LayoutExample(); example.setVisible(true);
This code shows 5 buttons alongside each other on the same line:
External links
* [http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html Layout tutorial on Sun website] * [http://www.xulplanet.com/tutorials/xultu/ XUL tutorial on XULplanet (see paragraphs 3 and 4)] * [http://wiki.java.net/bin/view/Javadesktop/LayoutManagerShowdown Layout Manager Showdown on java.net]
Layout — may refer to:* Page layout ** Comprehensive layout ** In computer software, a layout is the arrangement of the widgets in a graphical user interface (see Layout manager) ** In computer graphics, a layout is another name for a scene (computer… … Wikipedia
Layout engine — A layout engine, or rendering engine, is software that takes marked up content (such as HTML, XML, image files, etc.) and formatting information (such as CSS, XSL, etc.) and displays the formatted content on the screen. It paints on the content… … Wikipedia
Tastatur-Layout — Die Tastaturbelegung (auch Tastaturlayout) beschreibt sowohl die Kodierung der einzelnen Tasten als auch deren Lage und Anzahl auf der Tastatur einer Schreibmaschine oder eines Textverarbeitungssystems oder Computerterminals. Je nach Anwendung… … Deutsch Wikipedia
Tiling window manager — In computing, a tiling window manager is a window manager with an organization of the screen into mutually non overlapping frames, as opposed to the more popular approach of coordinate based stacking of overlapping objects (windows) that tries to … Wikipedia
Trident (layout engine) — Trident Developer(s) Microsoft Written in C++[1] Operating system Microsoft Windows: Windows XP to 7 (supported … Wikipedia
window manager improved — window manager improved 2 WMII mit zwei Modi: Float und Tiled Basisdaten Maintainer Kris Maglione … Deutsch Wikipedia
Dynamic window manager — dwm dwm 5.01 mit Firefox, GNU Emacs und rxvt Basisdaten Maintainer: An … Deutsch Wikipedia
Tasman (layout engine) — Tasman is the name of a layout engine developed by Microsoft, introduced with the Macintosh version of Internet Explorer 5, a new feature in the development of Internet Explorer for Mac (IE mac versions extended back to IE 2). Tasman was an… … Wikipedia
Cycling Manager — Dieser Artikel oder Abschnitt bedarf einer Überarbeitung. Näheres ist auf der Diskussionsseite angegeben. Hilf mit, ihn zu verbessern, und entferne anschließend diese Markierung. Radsport Manager Pro Entwickler … Deutsch Wikipedia