Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Java Components doing whatever they want

 
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 7625
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 79637
380
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 15705
367
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic