From d9075528fbd792a5e1bb55506bd44b3bc060f353 Mon Sep 17 00:00:00 2001 From: LiuZihan <1353843969@qq.com> Date: Sun, 24 May 2026 17:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'project/View'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/View/ConsoleView.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 project/View/ConsoleView.java diff --git a/project/View/ConsoleView.java b/project/View/ConsoleView.java new file mode 100644 index 0000000..a3e9aad --- /dev/null +++ b/project/View/ConsoleView.java @@ -0,0 +1,29 @@ +package com.example.moviecli.view; + +import java.util.Scanner; + +public class ConsoleView { + private static final String ANSI_RESET = "\u001B[0m"; + private static final String ANSI_GREEN = "\u001B[32m"; + private static final String ANSI_RED = "\u001B[31m"; + private static final String ANSI_BLUE = "\u001B[34m"; + + private final Scanner scanner = new Scanner(System.in); + + public String readLine() { + System.out.print("> "); + return scanner.nextLine(); + } + + public void printSuccess(String msg) { + System.out.println(ANSI_GREEN + msg + ANSI_RESET); + } + + public void printError(String msg) { + System.out.println(ANSI_RED + msg + ANSI_RESET); + } + + public void printInfo(String msg) { + System.out.println(ANSI_BLUE + msg + ANSI_RESET); + } +} \ No newline at end of file