Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

How to print?



Hi,
im pretty new to java. Im attending a programming class at a college in norway. I have only been programing for 3 months.

My question is, how can i for example print all items or a selected item from the games archive(so i get it in a new window with the info requested when choosing print)?
I have tried some codes with println, but only got to print the key/id that the object has in the archive.
I hope anyone here can help me and show me how the print code should look like.
I have for your information as you maybe can see, created classes for the objects and the archives before i created the main class RentalArchive.

kind regards
Alexander

/**
* Write a description of class RentalArchive here.
*
* @author AH
* @version 0.1
*/
public class RentalArchive
{

private MovieArchive movies;
private GameArchive games;
private MusicArchive musics;
private CustomerArchive customers;
private DistributorArchive distributors;

public RentalArchive()
{
movies = new MovieArchive();
games = new GameArchive();
musics = new MusicArchive();
customers = new CustomerArchive();
distributors = new DistributorArchive();

}

/**
* newGame()
* Add a new Game to the archive
*
* @param int ga_productNo
* @param String ga_title
* @param int ga_released
* @param String ga_gameDeveloper
* @param String ga_description
* @param String ga_genre
* @param String ga_platform
* @param String ga_distributor
* @param int ga_di_distNo
* @param int ga_price
* @param int ga_inStock
* @return none
*/

public void newGame(int ga_productNo, String ga_title, int ga_released, String ga_gameDeveloper, String ga_description, String ga_genre, String ga_platform, String ga_distributor, int ga_di_distNo, int ga_price, int ga_inStock)
{

games.newGame(ga_productNo, ga_title, ga_released, ga_gameDeveloper, ga_description, ga_genre, ga_platform, ga_distributor, ga_di_distNo, ga_price, ga_inStock);

}

/**
* newMusic()
* Add a new Music to archive
*
* @param int mu_productNo
* @param String mu_artist
* @param String mu_title
* @param int mu_released
* @param String mu_recordlabel
* @param String mu_description
* @param String mu_genre
* @param String mu_distributor
* @param itn mu_di_distNo
* @param int mu_price
* @param int mu_inStock
* @return none
*/

public void newMusic(int mu_productNo, String mu_artist, String mu_title, int mu_released, String mu_recordlabel, String mu_description, String mu_genre, String mu_distributor, int mu_di_distNo, int mu_price, int mu_inStock)
{
musics.newMusic(mu_productNo, mu_artist, mu_title, mu_released, mu_recordlabel, mu_description, mu_genre, mu_distributor, mu_di_distNo, mu_price, mu_inStock);

}

/**
* newMovie()
* Add a new Movie to the archive
*
* @param int mo_productNo
* @param String mo_title
* @param String mo_actor
* @param int mo_released
* @param String mo_filmstudio
* @param String mo_description
* @param String mo_genre
* @param String mo_format
* @param String mo_distributor
* @param int mo_di_distNo
* @param int mo_price
* @param int mo_inStock
* @return none
*/

public void newMovie(int mo_productNo, String mo_title, String mo_actor, int mo_released, String mo_filmstudio, String mo_description, String mo_genre, String mo_format, String mo_distributor, int mo_di_distNo, int mo_price, int mo_inStock)
{
movies.newMovie(mo_productNo, mo_title, mo_actor, mo_released, mo_filmstudio, mo_description, mo_genre, mo_format, mo_distributor, mo_di_distNo, mo_price, mo_inStock);

}

/**
* newCustomer()
* Add a new Customer to archive
*
* @param int cu_customerNo
* @param String cu_surename
* @param String cu_lastname
* @param String cu_adress
* @param int cu_zipCode
* @param String cu_city
* @param int cu_phone
* @return none
*/

public void newCustomer(int cu_customerNo, String cu_surename, String cu_lastname, String cu_adress, int cu_zipCode, String cu_city, int cu_phone)
{
customers.newCustomer(cu_customerNo, cu_surename, cu_lastname, cu_adress, cu_zipCode, cu_city, cu_phone);

}

/**
* newDistributor()
* Add a new Distributor to archive
*
* @param int di_distNo
* @param String di_companyName
* @param String di_adress
* @param int di_zipCode
* @param String di_city
* @param int di_phone
* @param String di_attentionName
* @param int di_attentionPhone
* @return none
*/

public void newDistributor(int di_distNo, String di_companyName, String di_adress, int di_zipCode, String di_city, int di_phone, String di_attentionName, int di_attentionPhone)
{
distributors.newDistributor(di_distNo, di_companyName, di_adress, di_zipCode, di_city, di_phone, di_attentionName, di_attentionPhone);

}

}