Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Ramon F Herrera - 01 Nov 2007 13:50 GMT
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
Martin Gregorie - 01 Nov 2007 19:59 GMT
> I am migrating a traditional JBuilder project to more standard IDEs
> (IJ, NetBeans, Eclipse, new JBuilder) ones.
[quoted text clipped - 22 lines]
>
> 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.

Signature

martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

RedGrittyBrick - 02 Nov 2007 12:50 GMT
>> 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 :-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.