public void paint(Graphics g){ //Downcast the Graphics object to a // Graphics2D object Graphics2D g2 = (Graphics2D)g; //Scale device space to produce inches on // the screen based on actual screen // resolution. g2.scale((double)res/72,(double)res/72); //Translate origin to center of Frame g2.translate((hSize/2)*ds,(vSize/2)*ds); //Draw x-axis g2.draw(new Line2D.Double( -1.5*ds,0.0,1.5*ds,0.0)); //Draw y-axis g2.draw(new Line2D.Double( 0.0,-1.5*ds,0.0,1.5*ds)); //Upper left quadrant, Solid red fill Ellipse2D.Double circle1 = new Ellipse2D.Double( -2.0*ds,-2.0*ds,2.0*ds,2.0*ds); g2.setPaint(new Color(255,0,0));//red g2.fill(circle1); g2.draw(circle1); Figure 1 |