How do I specify both a minimum and a maximum cell size with JGoodies FormLayout?

2.1k views Asked by At

I want to specify that the size is 200dlu < preferred component size < 600dlu

It's a basic three-column layout, where the middle column will be empty sometimes, but other times may have a very long string in it (file paths etc.).

I'm using this currently as my column spec: "pref, max(200dlu;pref):grow, pref"

But that doesn't work really well when the content of a textfield in the middle column is very large - it can grow past the size of the screen. Even if it doesn't outgrow the screen, it just looks silly and awkward if it goes really big on large screens. I don't want to use a scrollbar - I just want a nice sensible default size for the column and the user (me, actually) can deal with the awkward textfield content scrolling mechanics if absolutely necessary.

To paraphrase: - if the text field wants to be really small, then I want the column to be 200dlu - if the text field wants to be really big, then I want the colum to be 600dlu - otherwise, just let the column be the preferred size of the text field

The doco of the JFormsDesigner product seems to imply that you can do this when it's using JGoodies FormLayout as the layout manager (but I don't like graphical layout manager tools, I just want to use the formlayout language).

1

There are 1 answers

1
Shorn On BEST ANSWER

So the answer to this is to use a column spec like: "pref, [200dlu,pref,600dlu]:grow, pref"

My problem was that the environment I was using (IntelliJ IDEA plugin devkit) has a very old version of JGoodies included. All I had to do was package my own copy of the latest version of the lib and the above spec works like a charm.