I suggest you to refer following example of 'Graphics class', which will give you something idea about the use of this class:
Code:
import java.awt.Graphics;
import javax.swing.JFrame;
public class GraphicsDemo1 extends JFrame
{
public static void main(String[] abt)
{
MainClass fB = new MainClass();
fB.setSize(300,300);
fB.setVisible(true);
}
public void paint(Graphics gB)
{
gB.drawRect(10, 10, 60, 50);
gB.fillRect(100, 10, 60, 50);
gB.drawRoundRect(190, 10, 60, 50, 15, 15);
gB.fillRoundRect(70, 90, 140, 100, 30, 40);
}
}
Bookmarks