Problem with setStroke
Hi,
I am facing a problem regarding Stroke method.
I am drawing a dotted square on a frame using BasicStroke, it is working fine but when I try to draw a simple square on same frame , it is drawing dotted square only.
I have different class for Dotted Square and Plain Square.
Kindly tell me what I am doing wrong...
Here is the sample code.
For Dotted Square
public void drawFrame(Graphics g1) {
Rectangle r = displayBox();
Graphics2D g2d1=(Graphics2D)g1;
g2d1.setStroke (new BasicStroke(1f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_ROUND, 1f, new float[] {2f},0f));
g1.drawRect(r.x, r.y, r.width-1, r.width-1);
if(DrawingTool.bs!=null)
g2d1.setStroke(DrawingTool.bs);
}
For Plain Square
public void drawFrame(Graphics g) {
Rectangle r = displayBox();
g.drawRect(r.x, r.y, r.width-1, r.width-1);
//DrawingTool.bs=(BasicStroke)((Graphics2D)g).getStroke();
}
Looking forward for your co-operation.
Thanks

