aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Laying out a JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Laying out a JPanel" Watch "Laying out a JPanel" New topic
Author

Laying out a JPanel

Nathe Chan
Ranch Hand

Joined: Mar 12, 2009
Posts: 33
Hi Java greenhorns!

I'm stuck again with a JAVA laying out problem.

Currently, I have trouble with laying out the GridLayout and FlowLayout. The teacher has instructed me to lay it out this way. But, my code is the wrong way.

So, I have tried it out, but ended up with the wrong solution.

Here is the image for the wrong solution.

http://img.photobucket.com/albums/v85/nategenerations/ForEmployeeUseOnlyINCORRECT.jpg

I want MY JPanel to look like this.

http://img.photobucket.com/albums/v85/nategenerations/ForEmployeeUseOnlyCORRECT.jpg

My incorrect code is here.



Can you please correct it for me please? Or, just give me an overall picture of how to fix the problem?

That would be nice of you.

Thanks,

-Nathe
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
I fixed it to the best of my ability (I'm pretty bored and I wanted to use GridLayout).



Nathe Chan
Ranch Hand

Joined: Mar 12, 2009
Posts: 33
Thanks Ryan!

You just saved my BUTT tonight. . .
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39865
    
  28
Ryan Beckett wrote:I fixed it to the best of my ability (I'm pretty bored and I wanted to use GridLayout).
Please don't. We believe that people learn better if they are given hints as to how something works, rather than simply giving an answer. That case was quite straightforward, but it would have been better to show an example with something similar in.

In some cases (eg assessed work) plagiarism software would find the solution here, and the candidate would risk a 0 overall mark for using other people's work.

This thread would sit better on the Swing forum: moving.
Nathe Chan
Ranch Hand

Joined: Mar 12, 2009
Posts: 33
I agree. I had my code there and he was fixing it. And, he pinpointed what I did wrong. Originally, it was my work, so that would not be considred plaigiarism. Using other's would.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Laying out a JPanel