Results 1 to 6 of 6
- 10-14-2011, 04:23 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
- 10-14-2011, 06:56 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,638
- Rep Power
- 13
Re: How to enable smooth rendering of objects(ex. line, circle) in applet
Set the antialias rendering hint on the Graphics2D object:
Java Code:public void paintComponent(Graphics g){ Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Last edited by doWhile; 10-14-2011 at 10:12 PM. Reason: Fixed code
- 10-14-2011, 07:56 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Re: How to enable smooth rendering of objects(ex. line, circle) in applet
Hey, I am getting a compilation error.
Cannot find symbol
Symbol: method setRenderingHint(java.awt.RenderingHints.Key, java.lang.Object)
I am working in applet. I have public void paint(Graphics screen){} instead of paintComponent(Graphics g). Is this the reason of the error? what to do now?
- 10-14-2011, 08:45 PM #4
Member
- Join Date
- Oct 2011
- Location
- Kraków Poland
- Posts
- 3
- Rep Power
- 0
Re: How to enable smooth rendering of objects(ex. line, circle) in applet
Java Code:Graphics2D g2d = (Graphics2D) g;
Last edited by anura; 10-14-2011 at 08:54 PM.
- 10-14-2011, 10:11 PM #5
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,638
- Rep Power
- 13
Re: How to enable smooth rendering of objects(ex. line, circle) in applet
My telepathy skills lack practice, so I can't see your code to comment on why you are receiving the error (in other words, please post the appropriate code). Quick note however, I did edit my code above as the cast was supposed to be to a Graphics2D object (my bad)...which - my rusty telepathy skills tells me - might be the problem.
Last edited by doWhile; 10-14-2011 at 10:13 PM.
- 10-15-2011, 12:16 AM #6
Member
- Join Date
- Oct 2011
- Location
- Kraków Poland
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
draw smooth dash-ed line
By sarveshwar in forum Java 2DReplies: 3Last Post: 03-01-2011, 08:23 AM -
Xml Rendering BASE64 break line problem
By justinazz in forum XMLReplies: 0Last Post: 01-05-2011, 05:46 PM -
How can swing objects be painted when using active rendering?
By kiregad in forum New To JavaReplies: 9Last Post: 06-26-2010, 04:16 PM -
How to draw both line to smooth joining in png
By luoluo in forum Java 2DReplies: 7Last Post: 04-18-2010, 08:09 AM -
Circle and line
By c_walker in forum New To JavaReplies: 1Last Post: 01-27-2010, 04:56 AM
Bookmarks