Beispiel #1
0
  /**
   * Display a boxed title message to the console
   *
   * @param title Title text
   */
  public void displayTitle(String title) {
    StringBuilder titleBar = new StringBuilder();
    for (int i = 0; i < 40; i++) {
      titleBar.append("-");
    }
    StringBuilder titleBarText = new StringBuilder();
    for (int i = 0; i < (18 - title.length() / 2); i++) {
      titleBarText.append(" ");
    }
    titleBarText.append(title);
    for (int i = titleBarText.length(); i < 38; i++) {
      titleBarText.append(" ");
    }

    spacer();
    display(titleBar.toString());
    display("|" + titleBarText.toString() + "|");
    display(titleBar.toString());
  }
Beispiel #2
0
 /**
  * Display a custom error message to the console
  *
  * @param text Error text to display
  */
 public void displayError(String text) {
   spacer();
   display("!!!  ERROR: " + text);
   spacer();
 }