Re: Problems with JPanel
Thank you for all your answer.
Finally, I've created a JLabel with a transparent image with this code
private JLabel getLblTransparent() {
if (lblTransparent== null) {
lblTransparent = new JLabel();
lblTransparent.setIcon(new ImageIcon("transparent.gif"));
}
return lblTransparent;
}
Caller code:
jPanel0.add(getLblTransparent(), new Constraints(new Leading(0, 14, 14),
new Leading(0, 14, 14)));
[..omissis..]
// Array of x*y cells
And next I have the code to show dynamically the 'moving pieces' constructed
to lblTransparent:
lblTransparent.add(lblPiece[i]);
lblPiece[i].setBounds(
character.get(i).getPedina().getX()*this.xIcona+((xIcona-icona.getIconWidth())/2)
,
character.get(i).getPedina().getY()*this.yIcona+((yIcona-icona.getIconHeight())/2)
, icona.getIconWidth()
, icona.getIconHeight());
Thanks to all and see you soon!
Netlopa
"Netlopa" <netlopaNO@SPAM.it> ha scritto nel messaggio
news:gvpnje$giq$1@aioe.org...
Hello,
I'm creating a project for the university and I have currently a problem.
I created a JPanel that contains within it an array of (x * y) JLabel
(which by the method setIcon are just pictures and have nothing to text).
Now I want to create pieces, which are expected to move around the board,
but I find myself with a problem of "top".
In practice, the pieces are hidden from the board itself (JLabel array)
and then you can not see.
Then, I could not find any method that allows to switch JPanel (or just
the array of JLabel) into the background so as not to hide the pieces
(which should be set as in the first stage).
Someone can enlighten me;)
Thank you,
netlopa