Hi,
i want to draw arrow from source to destination(Point). Souce and destination is Node, node are movable using mouse drag. Already i connected these two node with line usiing drawLine. Now i want replace the line to arrow. I am having two points(point,point1).and i also tried with arrow image.here i am pasted my coding
public void a(Edge edge)
{
Graphics2D g2d = (Graphics2D) _fldchar;
BasicStroke stroke = new BasicStroke(3);
Polygon Poly=new Polygon();
g2d.setStroke(stroke);
Color color = _mthdo(edge);
Point point = new Point(edge.a()._mthif());
point.translate(_fldbyte, _fldtry);
Point point1 = new Point(edge._mthif()._mthif());
point1.translate(_fldbyte, _fldtry);
_fldchar.setColor(Color.red);
Protein protein1 = new Protein(edge._mthif()._mthint(), 0);
Protein protein = new Protein(edge.a()._mthint(), 0);
String type=_types(app,protein,protein1);
int xstart1=point1.x;
int xstop=xstart1+0;
if(type=="first")
{
g2d.setColor(Color.red);
g2d.drawLine(point.x, point.y, point1.x, point1.y);
}
else
{
g2d.setColor(Color.blue);
g2d.drawLine(point.x, point.y, point1.x, point1.y);
g2d.drawImage(origImageblue,point.x,point.y,(point1.x-point.x),(point1.y-point.y),this);
}
//_fldchar.drawLine(point.x, point.y, point1.x, point1.y);
//x1Points=(point.x+2,point.x-2,point.x);
/*
g2d.drawLine(point.x, point.y, point1.x, point1.y);
g2d.drawLine(xstop-4,point.y-4,xstop,point.y);
g2d.drawLine(xstop-4,point.y+4,xstop,point.y);
*/
BasicStroke stroke1 = new BasicStroke(1);
g2d.setStroke(stroke1);
}
Any body can help me, Thanks in Adv
Raja.laxman
i want to draw arrow from source to destination(Point). Souce and destination is Node, node are movable using mouse drag. Already i connected these two node with line usiing drawLine. Now i want replace the line to arrow. I am having two points(point,point1).and i also tried with arrow image.here i am pasted my coding
public void a(Edge edge)
{
Graphics2D g2d = (Graphics2D) _fldchar;
BasicStroke stroke = new BasicStroke(3);
Polygon Poly=new Polygon();
g2d.setStroke(stroke);
Color color = _mthdo(edge);
Point point = new Point(edge.a()._mthif());
point.translate(_fldbyte, _fldtry);
Point point1 = new Point(edge._mthif()._mthif());
point1.translate(_fldbyte, _fldtry);
_fldchar.setColor(Color.red);
Protein protein1 = new Protein(edge._mthif()._mthint(), 0);
Protein protein = new Protein(edge.a()._mthint(), 0);
String type=_types(app,protein,protein1);
int xstart1=point1.x;
int xstop=xstart1+0;
if(type=="first")
{
g2d.setColor(Color.red);
g2d.drawLine(point.x, point.y, point1.x, point1.y);
}
else
{
g2d.setColor(Color.blue);
g2d.drawLine(point.x, point.y, point1.x, point1.y);
g2d.drawImage(origImageblue,point.x,point.y,(point1.x-point.x),(point1.y-point.y),this);
}
//_fldchar.drawLine(point.x, point.y, point1.x, point1.y);
//x1Points=(point.x+2,point.x-2,point.x);
/*
g2d.drawLine(point.x, point.y, point1.x, point1.y);
g2d.drawLine(xstop-4,point.y-4,xstop,point.y);
g2d.drawLine(xstop-4,point.y+4,xstop,point.y);
*/
BasicStroke stroke1 = new BasicStroke(1);
g2d.setStroke(stroke1);
}
Any body can help me, Thanks in Adv
Raja.laxman