Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Images don't painting

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
This is my first post, and I need your help!
I'm trying to display five images, but I can't. I don't have any error message, any warning!
I have two classes:

Class 1:



Class 2:


I see the background, and the Strings, but no images :-(

Any help will be great!

Thank you in advance!

Daniel Lima
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
# public void loadImages() {
# bgImage = loadImage("/images/background.jpg");
# opaqueImage = loadImage("/images/opaque.png");
# transparentImage = loadImage("/images/transparent.png");
# translucentImage = loadImage("/images/translucent.png");
# antiAliasedImage = loadImage("/images/antialiased.png");
# imagesLoaded = true;
# // signal to AWT to repaint this window
# repaint();
# }

Try using now. Hope this will help you
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Vijay Kakade !
Tnx for your reply!

This don't work. I've tryed...

I don't know what's happening.... I looked the code thousands of times!

Please try test this code in your computer...

Tnx in advance!
 
Sharad Jadhav
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are all images in classpath? Put that in classpath It should display the images.
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Vijay Kakade, tnx!

I'm newbe on J2SE...and I'm using eclipse ide.... how can I put this images in classpath?
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add information:

I've edited the .classpath file, no success.
I've edited the run configurations, no succes.
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
More information!

if i do this:



It works!
But I think that I can't put the absolute path im my aplication...
 
Daniel Lima
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Resolved with:

 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic