Name: dbT83986 Date: 03/21/99
The below code will produce the discrepency between the standard oval in the Graphics package and the Ellipse2D in the
Graphics2D package - the Ellipse2D object doesn't "look" quite right, and certianly not as good as the standard oval object.
The documenation seems to indicate the 2D objects will only look right when anti-aliasing is on unless some "rule" is applied
for selecting pixels during the rasterization process, but it doesn't say what this rule is or how to use it. If anti-aliasing is turned
on, one can't tell the difference between the oval and the Ellipse2D, but with it off, the Ellipse2D doesn't look as intended at all.
public class inc55846 extends Frame
public static void main(String args)
class OvalCanvas extends Canvas
public void paint(Graphics g)
Graphics2D g2 = (Graphics2D)g;
g.drawOval(45, 10, 30, 30);
// Notice the difference between an Ellipse2D.Float and a simple Oval:
Ellipse2D.Float ellipse1 = new Ellipse2D.Float(10.0f, 10.0f, 30.0f, 30.0f);
(Review ID: 55846)