Layout manager

Last updated

Layout managers are software components used in widget toolkits which have the ability to lay out graphical control elements 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:




In XUL, like the vbox container to stack components on top of each other.

<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?><windowid="vbox example"title="Example"xmlns=""><vbox><buttonid="yes"label="Yes"/><buttonid="no"label="No"/><buttonid="maybe"label="Maybe"/></vbox></window>

This piece of code shows 3 buttons stacked on top of each other in a vertical box.


The DockPanel container lays out children components according to their Dock properties.

<Pagexmlns=""WindowTitle="myDock Panel"><DockPanel><TextBlockDockPanel.Dock="Top">Top 1</TextBlock><TextBlockDockPanel.Dock="Top">Top 2</TextBlock><TextBlockDockPanel.Dock="Top">Top 3</TextBlock><TextBlockDockPanel.Dock="Top">Top 4</TextBlock></DockPanel></Page>

This code shows 4 text blocks on top of each other.


The 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. Other layout managers are GridLayout managers which arrange the components in grid form and BorderLayout managers which also arranges the component in five parts of the frame, thus: south, north, west, east and center.

importjavax.swing.JFrame;importjavax.swing.JButton;importjava.awt.FlowLayout;importjava.awt.Container;publicclassExample{privateJFrameframe;publicExample(){frame=newJFrame("FlowLayout Demo");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setLayout(newFlowLayout());frame.add((newJButton("Button 1")));frame.add((newJButton("Button 2")));frame.add((newJButton("Button 3")));frame.add((newJButton("Long-Named Button 4")));frame.add((newJButton("5")));frame.pack();frame.setVisible(true);}publicstaticvoidmain(String[]args){Exampleex=newExample();}}

This code shows 5 buttons alongside each other on the same line:


Related Research Articles

XUL, which stands for XML User Interface Language, is a user interface markup language developed by Mozilla. XUL is implemented as an XML dialect, enabling graphical user interfaces to be written in a similar manner to web pages. Such applications must be created using the Mozilla codebase ; the most prominent example is the Firefox web browser.

Swing (Java) Java GUI widget toolkit

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.

Standard Widget Toolkit graphical widget toolkit for use with the Java platform

The Standard Widget Toolkit (SWT) is a graphical widget toolkit for use with the Java platform. It was originally developed by Stephen Northover at IBM and is now maintained by the Eclipse Foundation in tandem with the Eclipse IDE. It is an alternative to the Abstract Window Toolkit (AWT) and Swing Java graphical user interface (GUI) toolkits provided by Sun Microsystems as part of the Java Platform, Standard Edition (J2SE).

Extensible Application Markup Language is a declarative XML-based language developed by Microsoft that is used for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. The acronym originally stood for Extensible Avalon Markup Language, Avalon being the code-name for Windows Presentation Foundation (WPF).

Graphical widget Element of interaction in a graphical user interface

A graphical widget in a graphical user interface is an element of interaction, such as a button or a scroll bar. Controls are software components that a computer user interacts with through direct manipulation to read or edit information about an application. User interface libraries such as Windows Presentation Foundation, GTK, and Cocoa, contain a collection of controls and the logic to render these.

The FOX toolkit is an open-source, cross-platform widget toolkit, i.e. a library of basic elements for building a graphical user interface (GUI). FOX stands for Free Objects for X.

Java TV is a Java-based software framework designed for use on TV set-top boxes, based on components called Xlets. It is currently used only on the Connected Device Configuration, specifically for iTV applications development.

The event dispatching thread (EDT) is a background thread used in Java to process events from the Abstract Window Toolkit (AWT) graphical user interface event queue. It is an example of the generic concept of event-driven programming, that is popular in many other contexts than Java, for example, web browsers, or web servers.

A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and extra scriptability.

Yoix high-level, general-purpose, interpreted, dynamic programming language

In computer programming, Yoix is a high-level, general-purpose, interpreted, dynamic programming language. The Yoix interpreter is implemented using standard Java technology without any add-on packages and requires only a Sun-compliant JVM to operate. Initially developed by AT&T Labs researchers for internal use, it has been available as free and open source software since late 2000.

Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and Mac OS X installs of Python.

Java Media Framework Java library for audio, video and other time-based media

The Java Media Framework (JMF) is a Java library that enables audio, video and other time-based media to be added to Java applications and applets. This optional package, which can capture, play, stream, and transcode multiple media formats, extends the Java Platform, Standard Edition and allows development of cross-platform multimedia applications.

A panel is "a particular arrangement of information grouped together for presentation to users in a window or pop-up". In ISPF, a panel is "a predefined display image that you see on a display screen".

ARINC 661 is a standard which aims to normalize the definition of a Cockpit Display System (CDS), and the communication between the CDS and User Applications (UA) which manage aircraft avionics functions. The GUI definition is completely defined in binary Definition Files (DF).

BD-J, or Blu-ray Disc Java, is a specification supporting Java ME Xlets for advanced content on Blu-ray Disc and the Packaged Media profile of Globally Executable MHP (GEM).


Vaadin is an open-source platform for web application development. The Vaadin Platform includes a set of web components, a Java web framework, and a set of tools and application starters. Its flagship product, Vaadin Platform allows the implementation of HTML5 web user interfaces using the Java Programming Language.

Abstract Window Toolkit standard Java library for graphical user interfaces, succeeded by Swing

The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. AWT is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support the Abstract Window Toolkit.

JWt is an open-source widget-centric web application framework for the Java programming language developed by Emweb. It has an API that uses established GUI application development patterns. The programming model is component-based and event-driven, similar to Swing.

Fyne (software) Graphical toolkit for building cross platform GUIs

Fyne is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs) across desktop and mobile platforms. It is inspired by the principles of Material Design to create applications that look and behave consistently across all platforms. It is licensed under the terms of the 3-clause BSD License, supporting the creation of free and proprietary applications. In December 2019 Fyne became the most popular GUI toolkit for Go, by GitHub star count and in early February 2020 it was trending as #1 project in GitHub trending ranks.