making an input BOLD

So I wrote this exercise from my book (Do-It-Yourself Java Games),  and added the 'toUpperCase' as an experiment.

I was thinking when I got through this one, I would make a little Mad Libs program.
I was also thinking I could make the user input   "input()"  print out Bold, or Italics when the completed story ran.....

I did a lot of searching, and it seems that there is no simple way to tell the program to print out the specific string that comes into the input() bold or anything else.

You can make a JLabel and format that,  it's easy to google.  But the Label needs the specific text and can't accept an input().

So I looked in the book to see if she had loaded any font changers into the JAR provided, but the only real reference to changing something the way I needed it was the name.toUpperCase();

Here's my code.  I just spent 2 hours trying to find a way to change the way the user input is printed out,  but it looks like it's something I will have to try to figure out on my own when I know more.

package Nellie.Tobey.sillystory;
import com.godtsoft.diyjava.DIYWindow;

public class SillyStory extends DIYWindow {
 public SillyStory() {

  print("Enter your name:");
  String name = input().toUpperCase();
  print("Enter an animal:");
  String animal = input();
  print("Enter an animal part:");
  String animalPart = input();
  print("  ");
  print(name + " had a little " + animal + ",");
  print("It's " + animalPart + " was white as snow,");
  print("and everywhere that " + name + " went,");
  print("the " + animal + " was sure to go.");
 public static void main(String[] args) {
  new SillyStory();

*Maybe my first real go at a program should be something that can convert User Input into a String, that functions can treat and run as a string.... I tried googling it, but came up with Nadda.


Popular posts from this blog

Statistics, Python, Making a Stem Plot

Pandas Python and a little probability

JavaScript Ascii animation with while loops and console.log