Page 230 - CTS - CSA TP - Volume 2
P. 230
COMPUTER SOFTWARE APPLICATION - CITS
for (Shape line : lines) {
g2d.draw(line);
}
}
private void createLine(int startX, int startY, int endX, int endY) {
currentLine = new Line2D.Double(startX, startY, endX, endY);
lines.add(currentLine);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
LineDrawingGUI gui = new LineDrawingGUI();
gui.setVisible(true);
});
}
}
Output:
215
CITS : IT & ITES - Computer Software Application - Exercise 119