import javax.swing.*;
import java.awt.*;
public class JRectanglesJavaExample extends JFrame
{
Container cntnr = getContentPane();
public JRectanglesJavaExample()
{
cntnr.setBackground(Color.GREEN);
cntnr.setLayout(new FlowLayout());
}
public void paint(Graphics gr)
{
super.paint(gr);
gr.setColor(Color.YELLOW);
gr.fillRect(50, 50, 130, 130);
gr.clearRect(60, 70, 60, 60);
}
public static void main(String[] ag)
{
JRectanglesJavaExample frm = new JRectanglesJavaExample();
frm.setSize(230,230);
frm.setVisible(true);
}
}
Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.
Related Articles
Basic Courses
Advance Courses