I'm trying to write a simple paint applet with Java, but I'm having trouble with BasicStroke
. Initially, my plan was to try to somehow draw a line with a width, but the API apparently doesn't support that.
I tried using BasicStroke
, but the result is just a fuzzy mess. How can I fix this fuzz problem?
private void mousedrag_hook(Point point)
{
if(start == null)
start = point;
end = point;
Graphics2D g2d = (Graphics2D)applInstance.buffer_g;
g2d.setStroke(new BasicStroke(7));
//g2d.fillOval(point.x - 5, point.y - 5, 10, 10);
g2d.drawLine(start.x, start.y, end.x, end.y);
applInstance.repaint();
start = end;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…