Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

Draw thick line without using Graphics2D

Thread view: 
SPG - 15 Feb 2005 13:46 GMT
Hi, (sorry for X-Post, didn't see this NG before previous post)

We have an applet that MUST support jvm 1.1 (MS JVM also).
I want to plot some lines, and the selected line needs to be two points
thick.

Simple to do with Graphics2D (setStroke(new BasicStroke(2)), but this is not
supported with the older JVMs.

Is there another way to do this?

Steve
Thomas Weidenfeller - 15 Feb 2005 14:45 GMT
> Is there another way to do this?

For horizontal and vertical lines only, draw a filled rectangle instead.
For lines with an arbitrary angle you will need to pick a line plotting
algorithm from some computer graphics textbook and implement it. Simply
drawing multiple neighboring lines usually doesn't work.

However, be prepared that your own line plotting can be much slower than
 AWT's line plotting, because AWT uses the platform's graphics system
and hardware for drawing, while your own algorithm will have to do all
the hard work in software.

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

Boudewijn Dijkstra - 15 Feb 2005 19:11 GMT
> Hi, (sorry for X-Post, didn't see this NG before previous post)
>
[quoted text clipped - 6 lines]
>
> Is there another way to do this?

Draw two lines.
Andrey Kuznetsov - 15 Feb 2005 22:37 GMT
> We have an applet that MUST support jvm 1.1 (MS JVM also).
> I want to plot some lines, and the selected line needs to be two points
[quoted text clipped - 5 lines]
>
> Is there another way to do this?

yes, see http://www.acme.com/java/software/Acme.Psg.html

Signature

Andrey Kuznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.