View unanswered posts | View active topics It is currently Mon May 01, 2017 1:37 am



Reply to topic  [ 1 post ] 
 MigHelper 
Author Message

Joined: Sat Jul 26, 2008 5:05 am
Posts: 1
Post MigHelper
I've recently coded a project (https://sourceforge.net/projects/entrainer, release 11 available shortly) using GridBagLayout. The limitations of this layout manager became very apparent when I recently added dynamic look and feel changing to the app, and the cross-platform discrepancies were too many to endure. Long and short, I switched to MigLayout, and I am very happy.

As part of my learning curve for MigLayout I've written a class which I find very useful, and I believe others may as well. Its called MigHelper - http://entrainer.svn.sourceforge.net/viewvc/entrainer/trunk/Entrainer/src/net/sourceforge/entrainer/guitools/MigHelper.java?view=markup (I'd attach it, but the forum won't allow me to attach any files at all...).

The usage of the class is very straightforward, and hides some of the complexities of MigLayout while still providing all its powerful layout capabilities. It chains nicely, providing very easy to use, easy to read code ie:

Code:
private Container layoutAContainer() {
  MigHelper mh = new MigHelper();

  // Set any layout constraints first
  mh.setInsets(0,0,0,0).setFillX(true);

  // adds a row, from left to right
  mh.add(comp1).add(comp2).alignWest().addLast(comp3);

  // layout other components as required

  return mh.getContainer(); // a JPanel, using the blank constructor
}


I hope others find this class as useful as I have. Thanks for the great layout manager.

Burton.


Sat Jul 26, 2008 5:27 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.