Results 1 to 4 of 4
  1. #1
    Bbob is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

    Default How to Add an Image into an Array?

    Hi

    How do I store an image (48x48) in an array? What data type should I use?


    Would also like to ask on how to add an element in an existing array.

    For example: I made an array with the a size of 3. I want to add elements in the 3 empty space.
    Last edited by Bbob; 06-09-2010 at 01:55 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    Arrays can be defined to hold a specific data type.
    If you want to store an object of a specific type in an array, create an array of that type.
    Or you could use an array of Objects: EG Object[] anArray = new Object[6];

    To add an element to an existing array, anArray[ix] = object; // save object at element ix

    If the image is in an object, the size of the image doesn't matter.
    How are you getting the image into the program?

  3. #3
    Bbob is offline Member
    Join Date
    Jun 2010
    Posts
    11
    Rep Power
    0

    Default

    Thanks for the reply


    I plan on using the .getImage command

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    The word describing getImage() is method. Most classes have methods to do work with.
    Sometimes more than one class can have a method with the same name, so its important to give the name of the class also.

Similar Threads

  1. Array to image
    By oxxxis in forum Java 2D
    Replies: 2
    Last Post: 01-20-2010, 01:45 AM
  2. Converting Image to byte array[] ?
    By afflictedd2 in forum CLDC and MIDP
    Replies: 0
    Last Post: 04-11-2009, 11:33 PM
  3. get image file from array of pixels
    By mester in forum Advanced Java
    Replies: 1
    Last Post: 12-28-2008, 10:38 AM
  4. 2d array to image
    By Nina* in forum New To Java
    Replies: 1
    Last Post: 10-01-2008, 04:08 PM
  5. 2D Array to image
    By fred in forum Java 2D
    Replies: 1
    Last Post: 07-24-2007, 01:52 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
  •