You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
package com.danmaku.view;
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class View {
|
|
private final Scanner scanner;
|
|
|
|
public View() {
|
|
this.scanner = new Scanner(System.in);
|
|
}
|
|
|
|
public void displayMessage(String message) {
|
|
System.out.println(message);
|
|
}
|
|
|
|
public void displayError(String error) {
|
|
System.err.println("[错误] " + error);
|
|
}
|
|
|
|
public void displayWelcome() {
|
|
System.out.println("╔════════════════════════════════════════╗");
|
|
System.out.println("║ 弹幕爬虫系统 v2.0 ║");
|
|
System.out.println("║ 支持多平台弹幕爬取 ║");
|
|
System.out.println("╚════════════════════════════════════════╝");
|
|
System.out.println();
|
|
}
|
|
|
|
public void displayPrompt() {
|
|
System.out.print("\n> ");
|
|
}
|
|
|
|
public String getInput() {
|
|
return scanner.nextLine().trim();
|
|
}
|
|
|
|
public String getInput(String prompt) {
|
|
System.out.print(prompt);
|
|
return scanner.nextLine().trim();
|
|
}
|
|
|
|
public void close() {
|
|
if (scanner != null) {
|
|
scanner.close();
|
|
}
|
|
}
|
|
}
|
|
|