File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Line2D vs. Line2D.Float vs... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Line2D vs. Line2D.Float vs..." Watch "Line2D vs. Line2D.Float vs..." New topic
Author

Line2D vs. Line2D.Float vs...

Steven YaegerII
Ranch Hand

Joined: May 31, 2000
Posts: 182
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

Joined: May 31, 2000
Posts: 182
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

Joined: May 31, 2000
Posts: 182
Never mind about the dotted/dashed lines. Any comments on the precision of lines vs. pixels still welcome though.
Thanx
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Line2D vs. Line2D.Float vs...
 
Similar Threads
draw pixel at position that is float
drawRect( ) with non integers arguments
windows vs mac
drawing lines