Originally posted by Mike Lipay:
Where I am currently stuck is in spacing the lines, I need to get them close together than the app is currently doing. The lines in question are in the banner section; I need to cut the spacing by half, while leaving the font sizes as they are.
I'm not sure exactly what your code is doing when it uses the same
layoutTF instance in multiple containers but tries to
setVgap() differently for each. I don't think that has anything to do with your spacing problem, though.
One problem is that your
row1 and
row2 panels default to having a 5-pixel border. You can get rid of this by replacing
new JPanel() with
new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0).
Another problem is just that JLabels return a preferred size that is larger than you want. You can easily set a preferred size that is shorter. Here's some code demonstrating way to do this. The shorter preferred size is set in the
squish() method. (This code doesn't use
row1/
row2, so their 5-pixel borders don't come into play.)
This code also changes your
setHorizontalAlignment(0) calls to
setHorizontalAlignment(JLabel.CENTER). It works out the same but makes it easier to understand what it is doing.
[edit: Mention that code doesn't use row1/row2.]
[ September 12, 2007: Message edited by: Brian Cole ]