blob: 7b288af11aa32e9022d02de9ff57eda5281d344f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import java.awt.*;
import java.util.*;
public class Client {
public static void main(String[] args) throws Exception {
Scanner console = new Scanner(System.in);
System.out.println("Welcome to the CSE 123 Mondrian Art Generator!");
int choice = 0;
while (choice != 1 && choice != 2) {
System.out.print("Enter 1 for a basic Mondrian or 2 for a complex Mondrian: ");
choice = console.nextInt();
}
System.out.print("Enter image width (>= 300px): ");
int width = console.nextInt();
System.out.print("Enter image height (>= 300px): ");
int height = console.nextInt();
Mondrian mond = new Mondrian();
Picture pic = new Picture(width, height);
Color[][] pixels = pic.getPixels();
if (choice == 1) {
mond.paintBasicMondrian(pixels);
} else { // choice == 2
mond.paintComplexMondrian(pixels);
}
pic.setPixels(pixels);
pic.save(choice == 1 ? "basic.png" : "extension.png");
pic.show();
System.out.println("Enjoy your artwork!");
}
}
|