# [Solved] ? About making bold text in java



## ustacp (Aug 14, 2004)

Ok I am makeing a very simple program that the user will enter their name, address, city, state, zip code, and phone number. It will then print it to a txt file that I desgnate. It will print it for multiple users. Well, when it saves 2 or more users entrys it does not skip a line to seperate them. Now I know you can have it skip a line but I do not want it to because I am going to be adding a search into it later on and skipping a line will mess it up. I was wondering if there is a way to make the users name print out in bold letters into the text document so that I can see where each users info starts and so that it doesnt look all combinded together? Just wondering if there is any code I can include? If so can you tell me where to put it at and how to to it? Thanks. 
Program is attached below:


```
import java.io.*;

public class address
{
	public static void main(String[] args)
	{

		String name, address, city, state, phonenumber;
		int zipcode;
		char answer;


		  System.out.println("Welcome to my program! ");
		  System.out.println();

		  PrintWriter addressoutfile = null;

            try
		    {
		        addressoutfile = new PrintWriter(new FileOutputStream("allimput.txt", true));
			}

		    catch(Exception e)
		    {
				System.out.println("Error opening the file \'allimput.txt\'");
			}

            do
		    {
				System.out.println("Please enter your name. ");
		        name = SavitchIn.readLine();
		        System.out.println();
		        System.out.println("Please enter your address. ");
		        address = SavitchIn.readLine();
		        System.out.println();
		        System.out.println("Please enter your city. ");
		        city = SavitchIn.readLine();
		        System.out.println();
		        System.out.println("Please enter your state. ");
		        state = SavitchIn.readLine();
		        System.out.println();
		        System.out.println("Please enter your zip code. ");
		        zipcode = SavitchIn.readLineInt();
		        System.out.println();
		        System.out.println("Please enter your phone number. ");
		        phonenumber = SavitchIn.readLine();
		        System.out.println();

                System.out.print("Is all of your information correct? ");
			    answer = SavitchIn.readLineNonwhiteChar();
			    System.out.println();

            }while(answer == 'n');




                System.out.println();
                System.out.println("Here is what was save on the file: \n" + name + "\n" + address + "\n" + city + "\n" + state +  "\n" + zipcode +  "\n" + phonenumber);


                addressoutfile.println(name);
                addressoutfile.println(address);
                addressoutfile.println(city);
                addressoutfile.println(state);
                addressoutfile.println(zipcode);
                addressoutfile.println(phonenumber);


                addressoutfile.close();

	}

}
```


----------



## Chicon (Jul 29, 2004)

Hi ustacp,

Just use a string of characters that will never be entered in a name, address, etc... as a separator :
something like this :

String header = "$*$";

and you add 
addressoutfile.println(header);

before the addressoutfile.println(name);


----------



## dilip_maurya (Aug 28, 2004)

You can change the font style to bold by creating a new font (import awt.font.*).
But for this font to work u should have a graphics object, which is not there in ur 
case.

So instead of making the font bold, u can insert some special symbol or code
(like *** or &#8992; )before every users name. This special code will help u to distinguish
between users.Thus a statement begining with special code, is a different user.
Eg.
***XYZ USER 1
23434576
Bombay
***ABC USER 2
68970860
Delhi
***PQR USER 3
87567957
uuuuuuuuu


----------



## ustacp (Aug 14, 2004)

Thanks for the replies. The simplest things can be the hardest lol. I used 
String header = "___________________"; which basically boxes the info in. Thanks


----------

