Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes Java Components doing whatever they want Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java Components doing whatever they want" Watch "Java Components doing whatever they want" New topic
Author

Java Components doing whatever they want

Pan Niko
Ranch Hand

Joined: Mar 19, 2011
Posts: 86

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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Oct 13, 2005
Posts: 38087
    
  22
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

Joined: Mar 19, 2011
Posts: 86

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

Joined: Sep 20, 2010
Posts: 3605
    
  14

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

Joined: Mar 19, 2011
Posts: 86

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Components doing whatever they want
 
Similar Threads
Swap
Help with two buttons on applet
KeyListener not working for JLabel.
JButtons fail to change
Converting an Application into JApplet