Page 228 - CTS - CSA TP - Volume 2
P. 228
COMPUTER SOFTWARE APPLICATION - CITS
currentCircle = new Ellipse2D.Double(centerX - radius, centerY - radius, 2 * radius, 2 * radius);
circles.add(currentCircle);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
CircleDrawingGUI gui = new CircleDrawingGUI();
gui.setVisible(true);
});
}
}
Output:
TASK 3: Drawing Lines
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.awt.geom.Line2D;
class LineDrawingGUI extends JFrame {
213
CITS : IT & ITES - Computer Software Application - Exercise 119