Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alignment Issue

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please have a look at the following code

Form.java




Main.java




In here, I add items using the "add" button. Then, the names of the items, locations of the items and the size of the items will be displayed in the Boxes called "nameBox", "locationBox" and "sizeBox". "nameBox" contains JCheckBoxes and other two contains JLabels.

Now, the problem is, when I add items, the "nameBox" goes down, while other boxes are in their correct position. When I add more items, it goes more down. I am attaching two images explaining the normal look and with my Box Down problem. Please help me..>>
Align Issue.png
Align Issue
[Thumbnail for Align Issue.png]
normal look.png
Normal Look
[Thumbnail for normal look.png]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Please have a look at the following code

467 lines of uncompilable code? you must be joking.

in that state, if you want it fixed, you'd have to pay someone.

if you really want us to help, strip out everything unrelated
(e.g. are the images part of the problem, if not why are they there)

just use a frame with 2 or 3 components to reproduce your alignment problem,
then post that code here (should be 30 lines max), and make sure we can
copy/paste/compile/run and observe the problem.



 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. Anyway, the code I have posted before is less than half of my original code. However, I edited it and reduced the code as much as I can. There is no way I can reduce it to 30 lines, because it will never address my original issue. Please help.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it seems your problem is:

1) the differing heights of the checkbox and those of the labels.
2) the addition of a JPanel to both locationBox and sizeBox in addItems()

add the 2 indicated lines in AddAction()



also, don't call updateUI() directly, change updateInterface() to this
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow!! That was amazing!!! Now my code looks exactly how it should look!! Thanks a lot for your help!! I really appreciate it!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic