DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Jul 2006
    Location
    Belgium
    Posts
    6

    Image loading and showing problem

    Hi,

    I'm trying to make a little java application for my website, but I have
    to load images. The compiling of the code gives no errors, but when I
    run it, it says "Applet not initialized" . I know wich row the message
    causes, but I don't know how to solve it.
    Here's the code:

    Code:
    import java.awt.*;
    import java.applet.*;
    import java.awt.Image.*;
    
    public class App extends Applet {
            DeskTop desktop;
    
            public void init() {
                    desktop = new DeskTop( );
            }
    
            public void paint(Graphics g) {
                    desktop.paint( g );
            }
    
    }
    
    class DeskTop extends App {
            private String desktopimagename;
            private Image desktopimage;
    
            public DeskTop( ) {
                    desktopimagename = "bg_Tiger.jpg";
                    desktopimage = super.getImage(super.getDocumentBase(), "img/" +
    desktopimagename);
            }
    
            public void paint( Graphics g ) {
                    g.drawImage( desktopimage, 0, 0, super.WIDTH, super.HEIGHT, this );
            }
    }
    The code wich causes the message is the 23rd row:

    Code:
    desktopimage = super.getImage(super.getDocumentBase(), "img/" +
    desktopimagename);
    Does anybody know something that can solve this ?

    Thanks in advance...



    PS: what I also tried was:
    add a void to my App class:
    Code:
    public Image getImg( String imagename ) {
    	Image picture;
    	picture = this.getImage( this.getDocumentBase(), "img/" + imagename );
    	return picture;
    }
    and instead of using
    Code:
    desktopimage = super.getImage(super.getDocumentBase(), "img/" +
    desktopimagename);
    i used
    Code:
    desktopimage = super.getImg( desktopimagename );
    Last edited by sachavdk; 07-12-2006 at 10:18 PM. Reason: Quick addition

Similar Threads

  1. Showing something when loading data
    By THL in forum ASP.NET
    Replies: 2
    Last Post: 03-08-2006, 07:02 AM
  2. Replies: 1
    Last Post: 03-03-2002, 10:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links