About

PgsSwing serves as an incubator for products that have been created as prove of concept, research or that are just to small to get a website of their own.

EGBConstraints

Most Java developers sooner or later have to face the GridBagLayout. It is hard to use and somewhat verbose. EGBConstraints was created to ease the effort of working with GridBagLayout.

A simple example of what code might look like with EGBConstraints is below:

  1. JPanel panel = new JPanel(new GridBagLayout());
  2. EGBConstraints c = new EGBConstraints(panel,
  3.     // size of rows
  4.     "pref, 12, pref",
  5.     // size of columns
  6.     "pref, 6, pref, 12, pref, 6, pref");
  7. panel.add(new JLabel("First Name:"), c.xy(1, 1, "anchor:line_end"));
  8. panel.add(new JLabel("Last Name:"), c.xy(5, 1));
  9. c.normalize();
  10. panel.add(new JTextField(""), c.xy(3, 1, "fill:horizontal"));
  11. panel.add(new JTextField(""), c.xy(7, 1));
  12. c.normalize();
  13. panel.add(new JScrollPane(new JTextArea()), c.xyw(1, 3, 7, "fill:both"));
  14.  

As you can see it looks almost like JGoodies FormLayout.

Learn more about EGBConstraints in the original blog entry or don't waste any more time and download it yourself.

PgsTextField

This small component will enable you to put an unlimited amount of icons within a JTextField. These icons may invoke actions, show popups or don't do anything at all.

It looks like this:

For an introduction on how to use it look at the original blog entry or download it now.

Note: This component will become part of SwingLabs soon.