Example 2 Drawing and Filling Oval

suggest change
import javax.swing.*;    
import java.awt.*;    

public class MyPanel extends JPanel {
    @Override
    public void paintComponent(Graphics g){    
        // clear the previous painting
        super.paintComponent(g);    
        Graphics2D g2 = (Graphics2D)g;    
        g2.setColor(Color.blue);    
        g2.drawOval(0, 0, 20,20);  
        g2.fillOval(50,50,20,20);    
    }
}

g2.drawOval(int x,int y,int height, int width);

This method will draw an oval at specified x and y position with given height and width. 

g2.fillOval(int x,int y,int height, int width); This method will fill an oval at specified x and y position with given height and width.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


2D graphics:
* Example 2 Drawing and Filling Oval

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
98 Process
106 Modules
114 Applets
122 JNDI
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
164 2D graphics
167 Enum Map
175 Hashtable
177 SortedMap