
Signature
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
>> I am migrating a traditional JBuilder project to more standard IDEs
>> (IJ, NetBeans, Eclipse, new JBuilder) ones.
[quoted text clipped - 20 lines]
>> // xYLayout2.setWidth(496);
>> // xYLayout2.setHeight(168);
Presumably you can set the container's dimensions? Could you post a
SSCCE? (Google if puzzled).
>> Your expert suggestions are most welcome...
>>
> You might find RiverLayout useful: http://www.datadosen.se/riverlayout/
> I find it useful for forms and dialogue boxes. I know what you mean
> about GridLayout:
> I tend to do other windows with nested Box layouts.
Ditto.
RiverLayout is concise and easy to understand but I use MigLayout.
http://www.miglayout.com/QuickStart.pdf
Heres the example at the RiverLayout website
JFrame f = new JFrame("Our window");
Container c = f.getContentPane();
c.setLayout(new RiverLayout());
c.add("center", new JLabel("Registration form"));
c.add("p left", new JLabel("Name"));
c.add("tab hfill", new JTextField());
c.add("br", new JLabel("Age"));
c.add("tab", new JTextField(3));
c.add("br vtop", new JLabel("Comment"));
c.add("tab hfill vfill", new JScrollPane(new JTextArea()));
c.add("p center", new JButton("Ok"));
f.pack();
f.setVisible(true);
An equivalent in MigLayout is
JFrame f = new JFrame("Our Window");
Container c = f.getContentPane();
c.setLayout(new MigLayout("wrap", "[][grow]", "[][][][top,grow][]"));
c.add(new JLabel("Registration form"), "span, center, wrap");
c.add(new JLabel("Name"));
c.add(new JTextField(), "growx");
c.add(new JLabel("Age"));
c.add(new JTextField(3));
c.add(new JLabel("Comment"));
c.add(new JScrollPane(new JTextArea()), "grow");
c.add(new JButton("Ok"), "span, center");
f.pack();
f.setVisible(true);
MigLayout has a lot more capabilities than RiverLayout, so it's a bit
harder to learn than RiverLayout.
You could do the same layout in the standard GridBagLayout, but I'd not
be able to do it as concisely or clearly. I leave this as a challenge :-)
Every time I do this sort of exercise, I toy with the idea of creating a
web page showing various layouts (e.g. the main example from each layout
manager's home page) implemented in each of the other main Layout
managers. Maybe one day I'll get around to it :-)