How can I set each word of the inputted string onto a new line and place the output within an ASCII box?

I have the following code:

```
import java.util.Scanner;

public class labSix {
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    System.out.print("Enter a line of text: ");
    String line = in.nextLine();

    printBox(line);

}

// Returns the length of the longest token in the line. 
private static int getMaxLength(String... strings) {
    int len = Integer.MIN_VALUE;
    for (String str : strings) {
        len = Math.max(str.length(), len);
    }
    return len;
}

// Pad the strings with spaces.
private static String padString(String str, int len) {
    StringBuilder sb = new StringBuilder(str);
    return sb.append(fill(' ', len - str.length())).toString();
}

// Fill the string to the amount determined in padString.
private static String fill(char ch, int len) {
    StringBuilder sb = new StringBuilder(len);
    for (int i = 0; i < len; i++) {
        sb.append(ch);
    }
    return sb.toString();
}

// Print the box
public static void printBox(String... strings) {
    int maxBoxWidth = getMaxLength(strings);
    String line = "+" + fill('-', maxBoxWidth + 2) + "+";
    System.out.println(line);
    for (String str : strings) {
        System.out.printf("| %s |%n", padString(str, maxBoxWidth));
    }
    System.out.println(line);
}

}

```

If I try to split the string and replace " " with "\n" then there is only a "|" added to the first and last lines. 

Any suggestions on how to accomplish this?