diff options
| author | pants <niklasjo2004@gmail.com> | 2026-09-21 14:16:34 -0700 |
|---|---|---|
| committer | pants <niklasjo2004@gmail.com> | 2026-09-21 14:16:34 -0700 |
| commit | 81ba9eb66f8284d8760012973f84cdbe617ceb94 (patch) | |
| tree | 466432644e9e3fd66ee183ec53a1f10abb1b7faa /c2/mondrian/Client.java | |
Diffstat (limited to 'c2/mondrian/Client.java')
| -rw-r--r-- | c2/mondrian/Client.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/c2/mondrian/Client.java b/c2/mondrian/Client.java new file mode 100644 index 0000000..7b288af --- /dev/null +++ b/c2/mondrian/Client.java @@ -0,0 +1,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!"); + } +} + |
