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.

Results 1 to 2 of 2

Thread: adding images to word list

  1. #1
    Member
    Join Date
    Apr 2014
    Posts
    82
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default adding images to word list

    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 06:56 PM.


  2. #2
    Member
    Join Date
    Feb 2014
    Posts
    180
    Thanks
    0
    Thanked 48 Times in 45 Posts

    Default Re: adding images to word list

    Quote Originally Posted by newtolearningjava View Post
    Word newWord = new Word("Pizza", "Food"); //how do i add a image of a pizza with this
    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:

Similar Threads

  1. Need Help For Adding image into Word document Using APache POI
    By nareshdev in forum What's Wrong With My Code?
    Replies: 0
    Last Post: June 17th, 2013, 03:44 AM
  2. Help with adding multiple images to an application
    By Jumbosize in forum Object Oriented Programming
    Replies: 9
    Last Post: February 26th, 2012, 12:52 PM
  3. adding rectangles in images
    By mserrao in forum AWT / Java Swing
    Replies: 4
    Last Post: September 1st, 2011, 07:27 AM
  4. Problem with adding to a list in a loop
    By aminmusa in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 30th, 2010, 10:13 AM
  5. removing stopwords from a word list
    By jessie in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: November 15th, 2010, 12:02 PM