Page 226 - CTS - CSA TP - Volume 2
P. 226

COMPUTER SOFTWARE APPLICATION - CITS




               public static void main(String[] args) {
                   SwingUtilities.invokeLater(() -> {

                       PlaneShapesGUI gui = new PlaneShapesGUI();
                       gui.setVisible(true);
                   });
              }

           }


           Output:




































           TASK 2:  Drawing Circles
           import javax.swing.*;
           import java.awt.*;
           import java.awt.event.MouseAdapter;
           import java.awt.event.MouseEvent;

           import java.util.ArrayList;
           import java.awt.geom.Ellipse2D;
           public class CircleDrawingGUI extends JFrame {



               private ArrayList<Shape> circles = new ArrayList<>();
               private Shape currentCircle;
               private int centerX, centerY;
              public CircleDrawingGUI() {





                                                           211

                              CITS : IT & ITES - Computer Software Application - Exercise 119
   221   222   223   224   225   226   227   228   229   230   231