Results 1 to 3 of 3
  1. #1
    antnas is offline Member
    Join Date
    Oct 2012
    Posts
    15
    Rep Power
    0

    Default Album Class Adding the pictures

    I need to create an album class for my project.
    Java Code:
    public class Album
    {
      private int nPictsInAlbum;
      private Picture pictArray[];
      private int capacity;
      
      //////////constructors//////////
      public Album(int capacityParam )
      {
        capacity = capacityParam;
        pictArray = new Picture[capacity];
        nPictsInAlbum = 0;
      }
      
      //////////methods//////////
      public boolean addPicture( Picture p )
      {
        System.out.println("addPicture( p ) called.  The Picture object param. printed as a String is");
        System.out.println( p );
        return true;
      } 
      public boolean addPicture( Picture p, int where )
      {
        System.out.println("addPicture( p , " + where + " ) called.  The Picture object param. printed as a String is");
        System.out.println( p );
        return true;
      }
      
      public void explore()
      {
        Picture p = new Picture();
        p.show();
      }
    This is the code I have so far. When running the tester for the album I can choose the location of the pictures, add as many pictures as the capacity lets me, but when I choose "show" It only comes up with a blank frame and no pictures in it as is written in my explore method. I have to add something to that method so that it adds up all the widths of the pictures I add for the width of the frame and then takes the tallest pictures height and sets that as the height of the frame. I am super lost on how to go about this. the copyPictureInto method was a suggestion from my TA to use.

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: Album Class Adding the pictures

    Both of your addPicture() methods doesn't do anything except printing some logs information and return a boolean true. Don't you have to store the picture argument in the pictArray? In the explore method maybe you need to iterate the pictArray and show each picture stored there.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Creating an album class
    By antnas in forum New To Java
    Replies: 5
    Last Post: 12-02-2012, 10:12 PM
  2. Replies: 22
    Last Post: 07-25-2012, 09:51 PM
  3. Replies: 1
    Last Post: 05-20-2011, 01:59 PM
  4. java photo album api
    By karq in forum Advanced Java
    Replies: 3
    Last Post: 11-06-2010, 05:03 PM
  5. Java Image Album 1.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-04-2007, 07:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •