ArithmeticLayoutManager is an arithmetic layout manager for Swing/AWT.
Version: 1.0ArithmeticLayoutManager is an arithmetic layout manager for Swing/AWT.
License: The Apache License 2.0
Operating System: Linux
The ArithmeticLayoutManager is a layout manager which can be used to specify the bounds of a component as a series of mathematical expressions which are re-evaluated every time the parent is resized.
The expressions consist of simple arithmetics combined with references to fields of other components (the parent and siblings).
ArithmeticLayoutManager was born out of dissatisfaction with existing layout managers. Although some extremely powerful layout managers exist, most of them present the programmer with a horrendous amount of complexity by requiring intricate chains of invocations, an unintuive String syntax, or a complex configuration procedure (or all of the above). As a result most developers simply use the null layout, which decreases the usability of the program. ArithmeticLayoutManager aims combine an intuitive Java/CSS-like syntax with powerful arithmetic expressions.
Lets start by doing a trick that is extremely hard to do in most layout managers:
Container panel = getContentPane();
JLabel nameLabel = new JLabel("Name:");
"name = nameLabel; "+
"top = 20; "+
"left = 20; ");
JTextField nameField = new JTextField();
"top = 20; "+
"left = nameLabel.rRight + 20; "+
"right = 20; ");
· Java Runtime Environment