|
|
Aligning label in front of JTextArea
Hi,
I think this should be a very common problem:
(Take a look at the JLabel in front of the JTextArea)
alignTextArea.png
I use the following code:
Code: final SwingBindingFactory bindingFactory = ( SwingBindingFactory ) getBindingFactory(); TableFormBuilder formBuilder = new TableFormBuilder( bindingFactory ); formBuilder.addSeparator( quot;generalquot; ); formBuilder.row(); formBuilder.add( Article.PROPERTY_HEADLINE ); formBuilder.row(); formBuilder.add( Article.PROPERTY_AUTHOR ); formBuilder.row(); formBuilder.addSeparator( quot;contentquot; ); formBuilder.row(); formBuilder.addTextArea( Article.PROPERTY_HEADLINE );
But I think it should look like this:
jgoodies.pngJust one remark: I know this is just a small problem. And many technician don't care about it.
But those issues are very, very important for all those guys that pay the money for the work we do . They don't understand the great architecture - and they don't care. But they *see* the application.
So I think the great work on the UI (I love the TitledApplicationDialog) should be continued.
you can define default attributes for the labels:Code:
formBuilder.setLabelAttributes(quot;colGrId=label colSpec=right:refquot;);
every field you add after that call will be aligned to the right side.
You can use any colSpec or rowSpec definition from JGoodies' Formlayout.Arghl, sorry for my mistakable posting.
I mean the *vertical* alignment. The baseline of the label quot;Headline:quot; does not fit to the baseline of the first line of the JTextArea.
thats definitly a jgoodies issue. I don't know if this is handled by formlayout or jgoodies looks.
Yes, this definitly is related to JGoodies forms.
But the baselines are aligned when the JGoodies builder is used (see the attached image of the JGoodiesDemo).
So I think there must be some sort of shortcoming within the TableFormBuilder.
And I think (nearly) everybody will run into the same troubles as soon as he uses a JTextArea... |
|