Home > Archive > Java Help > August 2005 > Help: adding a JPanel to a JPanel in the center layout
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Help: adding a JPanel to a JPanel in the center layout
|
|
| Unknown 2005-08-31, 3:58 am |
| 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!
B
| |
| Andrew Thompson 2005-08-31, 3:58 am |
| On Tue, 30 Aug 2005 15:44:14 -0700, Unknown wrote:
> 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)
Why not use a GridLayout?
>..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, ..
Tell us exactly what you're doing, in code..
<http://www.physci.org/codes/sscce.jsp>
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Give me a whiskey, don't think twice.."
The Angels 'Marseille'
| |
| Roedy Green 2005-08-31, 7:56 am |
| On Tue, 30 Aug 2005 15:44:14 -0700, "Unknown"
<unknownerror404@comcast.net> wrote or quoted :
>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!
You could try a GridBagLayout which has insets for controlling the
fine positioning. see http://mindprod.com/jgloss/gridbaglayout.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
|
|
|
|