- Feb 17, 2002
- 5,322
- 0
- 0
I'm a decent programmer but new to java.
I'm writing an applet to play Boggle. (I figured it was the right complexity of project to learn the language.) MY BoggleBoardContainer is a JPanel. The following code compiles and runs but I don't get the rectangle I expect to get. What am I doing wrong?
void DrawDiceOutlines(JPanel BoggleBoardContainer, Color diceBorderColor)
{
BoggleBoardContainer.setBackground(Color.green); //works
Graphics2D G2 = (Graphics2D)BoggleBoardContainer.getGraphics();
G2.setStroke(new BasicStroke (2.0f));
G2.setColor(Color.black);
G2.draw(new Rectangle2D.Double(0,0,300,300)); //doesn't work
}
I'm writing an applet to play Boggle. (I figured it was the right complexity of project to learn the language.) MY BoggleBoardContainer is a JPanel. The following code compiles and runs but I don't get the rectangle I expect to get. What am I doing wrong?
void DrawDiceOutlines(JPanel BoggleBoardContainer, Color diceBorderColor)
{
BoggleBoardContainer.setBackground(Color.green); //works
Graphics2D G2 = (Graphics2D)BoggleBoardContainer.getGraphics();
G2.setStroke(new BasicStroke (2.0f));
G2.setColor(Color.black);
G2.draw(new Rectangle2D.Double(0,0,300,300)); //doesn't work
}
