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 8 of 8

Thread: Anyone here use JCreater

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Anyone here use JCreater

    Should be a simple question but.

    I have my programme built in eclipse and everything works fine but I need to present it in JCreater and I'm having a problem with the image paths and I am just getting a blank.

    In eclipse the path is --> ImageIcon icon= new ImageIcon("src/picture"+ i +".gif");

    But in JCreater that path won't work.

    Any help much appreciated.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Anyone here use JCreater

    See the answer posted on the other forum where you posted this question.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Anyone here use JCreater

    I did see it.

  4. #4
    Junior Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Anyone here use JCreater

    Now this path works fine but its the absolute path, and I can't really use this.

    ImageIcon icon= new ImageIcon("C:\\Documents and Settings\\Compaq_Owner\\My Documents\\JCreator LE\\MyProjects\\project_name\\src\\resources\\picture"+ i +".gif");

    Where as what I need is to know what the relative path is and how to direct to it
    Last edited by JoeBrown; April 12th, 2012 at 07:43 AM.

  5. #5
    Junior Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Anyone here use JCreater

    Solved and for anyone with the same problem

    here's the solution that I have come up with for JCreater

    Firstly put the image files into the classes's folder (not src folder!")

    then replace this line

    ImageIcon icon= new ImageIcon("src/picture"+ i +".gif");

    With this line

    ImageIcon icon= new ImageIcon(getClass().getResource("picture"+ i +".gif"));

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Anyone here use JCreater

    Please don't crosspost, or if you must, please provide links between your posts so we all know whether a question has been answered. Recommended reading: http://www.javaprogrammingforums.com...s-posting.html
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Junior Member
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Anyone here use JCreater

    Quote Originally Posted by KevinWorkman View Post
    Please don't crosspost, or if you must, please provide links between your posts so we all know whether a question has been answered. Recommended reading: http://www.javaprogrammingforums.com...s-posting.html
    I didn't cross post on this forum, if I post on a different forum it's because I'm looking for the best solution, A different forum could have 100,000 members that would never see a post here.

    I presume it's noting the rules that you can't be members of 2 different programming forums.

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Anyone here use JCreater

    Quote Originally Posted by JoeBrown View Post
    I didn't cross post on this forum, if I post on a different forum it's because I'm looking for the best solution, A different forum could have 100,000 members that would never see a post here.
    That's exactly the point. You could ask a question in 10 different places, and receive an answer in one of those places within 5 minutes. So why should everyone from the other 9 places waste time answering the question? It takes you absolutely no time to say "by the way, I also posted this here" so that we can see what else you've already been told so we don't have to repeat information you already know. Plus, people googling your problem that come will want to know what you found out.

    Quote Originally Posted by JoeBrown View Post
    I presume it's noting the rules that you can't be members of 2 different programming forums.
    Right, there's no way to make or enforce that kind of rule. It's just common politeness, which is usually a good idea to give to people who are willing to help you, for free, in their spare time.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!