I am trying to add images to go with my wordlist but unsure of how to do this.
public class WordRepository {
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I am trying to add images to go with my wordlist but unsure of how to do this.
public class WordRepository {
Last edited by newtolearningjava; April 26th, 2014 at 05:56 PM.
Adding an image in Java really means adding an image object, e.g., a BufferedImage. Assuming you have a pizzaImg variable that refers to an image object of a pizza, then you can add it to Word using
Word newWord = new Word("Pizza", "Food", pizzaImg);
This obviously implies that you'll also need to change the Word constructor so that it accepts an image object as a parameter.
Some useful links on creating image objects: