by Dinesh Thakur Category: Swing


import javax.swing.*;

import java.awt.*;
public class JRectanglesJavaExample extends JFrame
       Container cntnr = getContentPane();
       public JRectanglesJavaExample()
              cntnr.setLayout(new FlowLayout());
              public void paint(Graphics gr)
                           gr.fillRect(50, 50, 130, 130);
                           gr.clearRect(60, 70, 60, 60);
                          public static void main(String[] ag)
                                JRectanglesJavaExample frm = new JRectanglesJavaExample();

Draw Rectangles in Java Swing Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular 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