Results 1 to 4 of 4
  1. #1
    sarveshwar is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default draw smooth dash-ed line

    hi !!

    i am working on a project that displays graph, a graph can be drawn as simple plain line , dash-ed line , dotted line or dash -dotted line. i don't have any problem with drawing all these of lines , but the problem is lines are not so smooth and if i zoom my graph they become very rough.

    please suggest some dash-type for BasicStroke object such that line would be smoother(if possible please explain mechanism for drawing smooth line)


    setStroke(new BasicStroke(nPathWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, fDashType, //<-- i want this value for dash-ed line , dotted line or dash -dotted line 0f));

    Thanks,
    Sarveshwar Singh.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    I presume you are working with Java2D and are drawing to a Graphics...have you tried to set the antialiasing to on? See Enabling Antialiasing | Example Depot

  3. #3
    sarveshwar is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    thanks it works !!!

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

Similar Threads

  1. How to draw line with animation
    By hnchnc in forum Java 2D
    Replies: 1
    Last Post: 11-18-2010, 10:49 PM
  2. Replies: 7
    Last Post: 04-18-2010, 07:09 AM
  3. Draw line
    By janes in forum Java 2D
    Replies: 6
    Last Post: 03-25-2010, 10:48 PM
  4. How to draw a Smooth Curve using jfreechart
    By Manfizy in forum New To Java
    Replies: 1
    Last Post: 07-07-2009, 09:01 AM
  5. How to Draw line in Java
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •