From df6394de9a0c6f007b3ca7bc53cf3b4171d1ca3c Mon Sep 17 00:00:00 2001 From: Ayeong Kwon Date: Thu, 11 Dec 2025 20:34:45 +0900 Subject: [PATCH 1/2] UI: Implement Enter key input handling and boolean return --- .LCKIntroScreen.java~ | 1 + IntroScreen.java | 12 ++- src/main/java/com/unitime/UI/IntroScreen.java | 96 +++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 .LCKIntroScreen.java~ diff --git a/.LCKIntroScreen.java~ b/.LCKIntroScreen.java~ new file mode 100644 index 0000000..b6f86aa --- /dev/null +++ b/.LCKIntroScreen.java~ @@ -0,0 +1 @@ +C:\Users\82102\Documents\oss\TeamProject2\UniTime-Solver\IntroScreen.java \ No newline at end of file diff --git a/IntroScreen.java b/IntroScreen.java index 7b8165a..45db2d7 100644 --- a/IntroScreen.java +++ b/IntroScreen.java @@ -1,3 +1,5 @@ +import java.util.Scanner; + public class IntroScreen { private static final String ANSI_RESET = "\u001b[0m"; private static final String ANSI_BOLD = "\u001b[1m"; @@ -14,12 +16,20 @@ public class IntroScreen { private static final int NUM_COLORS = ANSI_COLORS.length; private static final int WIDTH = 80; - public static void main(String[] args) { + public static boolean start() { printBorderedBox(); System.out.println("=".repeat(WIDTH + 4)); System.out.println(ANSI_YELLOW + " Press [ENTER] to Start UniTime_Solver." + ANSI_RESET); System.out.println("=".repeat(WIDTH + 4)); + + //waiting user's enter + try (Scanner scanner = new Scanner(System.in)) { + scanner.nextLine(); + return true; //if user's enter succeed + }catch (exception e) { + return false; //else + } } private static void printBorderedBox() { diff --git a/src/main/java/com/unitime/UI/IntroScreen.java b/src/main/java/com/unitime/UI/IntroScreen.java index e69de29..ced7fb8 100644 --- a/src/main/java/com/unitime/UI/IntroScreen.java +++ b/src/main/java/com/unitime/UI/IntroScreen.java @@ -0,0 +1,96 @@ +import java.util.Scanner; + +public class IntroScreen { + private static final String ANSI_RESET = "\u001b[0m"; + private static final String ANSI_BOLD = "\u001b[1m"; + private static final String ANSI_GREEN = "\u001b[38;5;46m"; + private static final String ANSI_YELLOW = "\u001b[38;5;226m"; + private static final String[] ANSI_COLORS = { + "\u001b[38;5;196m", + "\u001b[38;5;208m", + "\u001b[38;5;220m", + "\u001b[38;5;46m", + "\u001b[38;5;51m", + "\u001b[38;5;93m" + }; + private static final int NUM_COLORS = ANSI_COLORS.length; + private static final int WIDTH = 80; + + public static void start() { + printBorderedBox(); + + System.out.println("=".repeat(WIDTH + 4)); + System.out.println(ANSI_YELLOW + " Press [ENTER] to Start UniTime_Solver." + ANSI_RESET); + System.out.println("=".repeat(WIDTH + 4)); + + // 사용자 입력 대기 로직 (이전에 구현하신 부분) + try (Scanner scanner = new Scanner(System.in)) { + scanner.nextLine(); + } + + System.out.println("\n🎉 UniTime-Solver가 시작됩니다..."); + // 다음 단계(메인 메뉴)로 넘어가는 코드가 여기에 추가됩니다. + } + + private static void printBorderedBox() { + String h_border = "+-" + "-".repeat(WIDTH) + "-+"; + String emptyLine = "| " + " ".repeat(WIDTH) + " |"; + + System.out.println(h_border); + + String title = " ♬ UniTime-Solver"; + int currentLength = title.length(); + int padding = WIDTH - currentLength; + + System.out.println("| " + ANSI_BOLD + title + ANSI_RESET + " ".repeat(padding) + " |"); + System.out.println(h_border); + + String status = " Status: [ *READY to START* ]"; + int statusPadding = WIDTH - status.length(); + + + System.out.println("| " + ANSI_GREEN + status + ANSI_RESET + " ".repeat(statusPadding) + " |"); + System.out.println(h_border); + + String[] logo = { + " _ _ _ _____ _ ____ _ ", + + " | | | |_ __ (_)_ _ (_)_ __ ___ ___ / ___| ___ | |_ ______ __ ", + + " | | | | '_ \\| | | | | | '_ ` _ \\ / _ \\____\\___ \\ / _ \\| \\ \\ / /_ \\ '__|", + + " | |_| | | | | | | | | | | | | | | __/_____|__) | (_) | |\\ V / __/ | ", + + " \\____/|_| |_|_| |_| |_|_| |_| |_|\\___| |____/ \\___/|_| \\_/\\___|_| " + }; + + final int MAX_LOGO_WIDTH = 72; + + System.out.println(emptyLine); + + for (int i = 0; i < logo.length; i++) { + String line = logo[i]; + + int leftPadding = (WIDTH - MAX_LOGO_WIDTH) / 2; + + System.out.print("| " + " ".repeat(leftPadding)); + + int printableWidth = Math.min(line.length(), MAX_LOGO_WIDTH); + + for (int j = 0; j < printableWidth; j++) { + char c = line.charAt(j); + + int colorIndex = (i + j) % NUM_COLORS; + + + System.out.print(ANSI_COLORS[colorIndex] + c + ANSI_RESET); + } + + int rightPadding = WIDTH - leftPadding - printableWidth; + System.out.println(" ".repeat(rightPadding) + " |"); + } + + System.out.println(emptyLine); + System.out.println(h_border); + } +} \ No newline at end of file From 35ea8f7cfe838e21c532ed9f8677771664dc9ae0 Mon Sep 17 00:00:00 2001 From: Ayeong Kwon Date: Thu, 11 Dec 2025 20:52:50 +0900 Subject: [PATCH 2/2] UI: Fix file structure and change into English. --- .LCKIntroScreen.java~ | 1 - IntroScreen.java | 96 ------------------- src/main/java/com/unitime/UI/IntroScreen.java | 11 ++- 3 files changed, 6 insertions(+), 102 deletions(-) delete mode 100644 .LCKIntroScreen.java~ delete mode 100644 IntroScreen.java diff --git a/.LCKIntroScreen.java~ b/.LCKIntroScreen.java~ deleted file mode 100644 index b6f86aa..0000000 --- a/.LCKIntroScreen.java~ +++ /dev/null @@ -1 +0,0 @@ -C:\Users\82102\Documents\oss\TeamProject2\UniTime-Solver\IntroScreen.java \ No newline at end of file diff --git a/IntroScreen.java b/IntroScreen.java deleted file mode 100644 index 45db2d7..0000000 --- a/IntroScreen.java +++ /dev/null @@ -1,96 +0,0 @@ -import java.util.Scanner; - -public class IntroScreen { - private static final String ANSI_RESET = "\u001b[0m"; - private static final String ANSI_BOLD = "\u001b[1m"; - private static final String ANSI_GREEN = "\u001b[38;5;46m"; - private static final String ANSI_YELLOW = "\u001b[38;5;226m"; - private static final String[] ANSI_COLORS = { - "\u001b[38;5;196m", - "\u001b[38;5;208m", - "\u001b[38;5;220m", - "\u001b[38;5;46m", - "\u001b[38;5;51m", - "\u001b[38;5;93m" - }; - private static final int NUM_COLORS = ANSI_COLORS.length; - private static final int WIDTH = 80; - - public static boolean start() { - printBorderedBox(); - - System.out.println("=".repeat(WIDTH + 4)); - System.out.println(ANSI_YELLOW + " Press [ENTER] to Start UniTime_Solver." + ANSI_RESET); - System.out.println("=".repeat(WIDTH + 4)); - - //waiting user's enter - try (Scanner scanner = new Scanner(System.in)) { - scanner.nextLine(); - return true; //if user's enter succeed - }catch (exception e) { - return false; //else - } - } - - private static void printBorderedBox() { - String h_border = "+-" + "-".repeat(WIDTH) + "-+"; - String emptyLine = "| " + " ".repeat(WIDTH) + " |"; - - System.out.println(h_border); - - String title = " ♬ UniTime-Solver"; - int currentLength = title.length(); - int padding = WIDTH - currentLength; - - System.out.println("| " + ANSI_BOLD + title + ANSI_RESET + " ".repeat(padding) + " |"); - System.out.println(h_border); - - String status = " Status: [ *READY to START* ]"; - int statusPadding = WIDTH - status.length(); - - - System.out.println("| " + ANSI_GREEN + status + ANSI_RESET + " ".repeat(statusPadding) + " |"); - System.out.println(h_border); - - String[] logo = { - " _ _ _ _____ _ ____ _ ", - - " | | | |_ __ (_)_ _ (_)_ __ ___ ___ / ___| ___ | |_ ______ __ ", - - " | | | | '_ \\| | | | | | '_ ` _ \\ / _ \\____\\___ \\ / _ \\| \\ \\ / /_ \\ '__|", - - " | |_| | | | | | | | | | | | | | | __/_____|__) | (_) | |\\ V / __/ | ", - - " \\____/|_| |_|_| |_| |_|_| |_| |_|\\___| |____/ \\___/|_| \\_/\\___|_| " - }; - - final int MAX_LOGO_WIDTH = 72; - - System.out.println(emptyLine); - - for (int i = 0; i < logo.length; i++) { - String line = logo[i]; - - int leftPadding = (WIDTH - MAX_LOGO_WIDTH) / 2; - - System.out.print("| " + " ".repeat(leftPadding)); - - int printableWidth = Math.min(line.length(), MAX_LOGO_WIDTH); - - for (int j = 0; j < printableWidth; j++) { - char c = line.charAt(j); - - int colorIndex = (i + j) % NUM_COLORS; - - - System.out.print(ANSI_COLORS[colorIndex] + c + ANSI_RESET); - } - - int rightPadding = WIDTH - leftPadding - printableWidth; - System.out.println(" ".repeat(rightPadding) + " |"); - } - - System.out.println(emptyLine); - System.out.println(h_border); - } -} \ No newline at end of file diff --git a/src/main/java/com/unitime/UI/IntroScreen.java b/src/main/java/com/unitime/UI/IntroScreen.java index ced7fb8..d6f4dc8 100644 --- a/src/main/java/com/unitime/UI/IntroScreen.java +++ b/src/main/java/com/unitime/UI/IntroScreen.java @@ -1,6 +1,7 @@ import java.util.Scanner; public class IntroScreen { + //set color for introscreen private static final String ANSI_RESET = "\u001b[0m"; private static final String ANSI_BOLD = "\u001b[1m"; private static final String ANSI_GREEN = "\u001b[38;5;46m"; @@ -16,20 +17,20 @@ public class IntroScreen { private static final int NUM_COLORS = ANSI_COLORS.length; private static final int WIDTH = 80; - public static void start() { + public static boolean start() { printBorderedBox(); System.out.println("=".repeat(WIDTH + 4)); System.out.println(ANSI_YELLOW + " Press [ENTER] to Start UniTime_Solver." + ANSI_RESET); System.out.println("=".repeat(WIDTH + 4)); - // 사용자 입력 대기 로직 (이전에 구현하신 부분) + //waiting user's enter try (Scanner scanner = new Scanner(System.in)) { scanner.nextLine(); + return true; //if user's enter succeed + }catch (Exception e) { + return false; //else } - - System.out.println("\n🎉 UniTime-Solver가 시작됩니다..."); - // 다음 단계(메인 메뉴)로 넘어가는 코드가 여기에 추가됩니다. } private static void printBorderedBox() {