| Thomas Fritsch 2005-08-31, 6:59 pm |
| "Unknown" <unknownerror404@comcast.net> schrieb im Newsbeitrag
news:UIGdnZ2dnZ3xDRXLnZ2dnXGDiN6dnZ2dRVn
-yZ2dnZ0@comcast.com...
> Hi all! I'm writting an implementation for a mastermind game. I have a
> class that represents all the holes in which the user can click on to
> guess the appropriate sequence of pegs. When I add an object(extends
> JPanel and overrides the paintcomponent to display images as the holes) to
> another JPanel in the BorderLayout.CENTER, it still positions the Panel
> far to the left in the center of the root panel. If you have any
> suggestions, thanks ahead of time!
OK, you did something like
panel1.add(panel2, BorderLayout.CENTER);
May be you missed
panel1.setLayout(new BorderLayout());
at the beginning. Then panel1 still would have its default layout, which
happens to be FlowLayout.
--
"TFritsch$t-online:de".replace(':','.').replace('$','@')
|