• Post Reply Bookmark Topic Watch Topic
  • New Topic

Line2D vs. Line2D.Float vs...  RSS feed

 
Steven YaegerII
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was browsing Line2D, Line2D.Float, & Line2D.Double. Is it possible for a line (float or double) to extend 5.32 pixels long?? I would think that it is, otherwise PSP wouldn't be able to draw shapes as vectors. It sure would make things a little easier.
Let's say There's a vertical line, 400 pixels high, and I put labels beside the line, from $0.00 to $1,500.00. Using those dimensions, $1 is equal to 0.26... pixels. Ultimately, I would like to be able to draw a 1 pixel dot anywhere on the vertical line & have it appear accurately, relative to it's $ value per the labels. I'm not sure how to go about it, or if I should just assign a pixel to a certain $ range (1pix = $1.374). The first idea is more efficient, but, is it possible?
Appreciatively,
Steve
 
Steven YaegerII
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stroke solid = screen2D.getStroke();
float[] a1 = { 3, 3, 3, 3, 3, };
BasicStroke dashed = new BasicStroke( 1, 0, 0, 0, a1, 2 );
float[] a2 = { 1, 1, 1, 1, 1, };
BasicStroke dotted = new BasicStroke( 1, 0, 0, 0, a2, 1 );
Does the above code make a dashed and dotted Stroke correctly ? I'm not sure that I'm putting in the proper arguments. I have the docs and have been searching, but haven't found any code yet. Any code for a dotted and dashed line would help greatly ?
SteveII
[This message has been edited by Steven YaegerII (edited March 18, 2001).]
 
Steven YaegerII
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind about the dotted/dashed lines. Any comments on the precision of lines vs. pixels still welcome though.
Thanx
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!