How can Borland's XYLayout be replaced by a standard Layout Manager?

  • Thread starter Ramon F Herrera
  • Start date
R

Ramon F Herrera

I am migrating a traditional JBuilder project to more standard IDEs
(IJ, NetBeans, Eclipse, new JBuilder) ones.

The one complain I always had about Borland's IDE was that I had to
include their own JBCL library which contains their XYLayout manager/
class.

Problem Number One:

- When I try to refactor the XYLayout, I get an error message:
"Cannot perform refactoring. Selected constructor is not located
inside the project."

So, I just did a search & replace: XYLayout --> GridLayout

which brings me to:

Problem Number Two:

- The dialog now looks terrible. One of the limitations is that
GridLayout doesn't seem to have an adequate replacement for this:

// xYLayout2.setWidth(496);
// xYLayout2.setHeight(168);

Your expert suggestions are most welcome...

TIA,

-Ramon
 
M

Martin Gregorie

Ramon said:
I am migrating a traditional JBuilder project to more standard IDEs
(IJ, NetBeans, Eclipse, new JBuilder) ones.

The one complain I always had about Borland's IDE was that I had to
include their own JBCL library which contains their XYLayout manager/
class.

Problem Number One:

- When I try to refactor the XYLayout, I get an error message:
"Cannot perform refactoring. Selected constructor is not located
inside the project."

So, I just did a search & replace: XYLayout --> GridLayout

which brings me to:

Problem Number Two:

- The dialog now looks terrible. One of the limitations is that
GridLayout doesn't seem to have an adequate replacement for this:

// xYLayout2.setWidth(496);
// xYLayout2.setHeight(168);

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.
 
R

RedGrittyBrick

Presumably you can set the container's dimensions? Could you post a
SSCCE? (Google if puzzled).
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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,269
Messages
2,571,099
Members
48,773
Latest member
Kaybee

Latest Threads

Top