• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Components doing whatever they want

 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have really stuck at this point. I have the code below:

The output is as shown below :

HERE

You can imagine from my code that is not the result I want! So, what I'm doing wrong? Any idea?

Thank you
 
Tim Moores
Bartender
Posts: 2756
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there are separate code blocks for all values of "i" anyway, then there's no point in having the loop at all.

I can't tell what you're trying to accomplish, though; can you describe it in words?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Components are not doing “what they want”, but what they always do: what you tell them. You said to add the panel four times, and it added the panel four times.
 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes but, I'm creating new Panel each time and also has different position for each condition(North, South, Page Start, Page End). Also, I have right and left be Page Start and Page End, then why place them North and South ? :S Really weird
 
Stephan van Hulst
Bartender
Pie
Posts: 5608
55
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pan Niko wrote:You can imagine from my code that is not the result I want!


Well, no we can't really. If that's the code that's giving you the output, then how can we expect it to do anything else than what it's doing?

Why don't you tell us what you want?
 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Thanks for responses. With code above wanted to add different arrows around a board. That's why I was using North, South, Page End and Start. Figured out how to do it and are simply two things. First, use West and East instead of Page End - Start and second panel's layout to be BoxLayout(), with Y_Axis or X_Axis.

Thank you, again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic