Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:15:48+00:00 2026-06-03T11:15:48+00:00

/** * This is the entry point method. */ public void onModuleLoad() { Canvas

  • 0
/**
 * This is the entry point method.
 */
public void onModuleLoad() {
    Canvas canvas = Canvas.createIfSupported();
    final Context2d context2d = canvas.getContext2d();

    RootPanel.get("canvas").add(canvas);
    Image img = new Image("face.png");
    final ImageElement face = ImageElement.as(img.getElement());
    img.addLoadHandler(new LoadHandler() {

        @Override
        public void onLoad(LoadEvent event) {
            context2d.drawImage(face, 0, 0);
        }
    });
    //RootPanel.get("canvas").add(img);
}

This is my code. I want to draw the image onto the canvas.
This works if the last line:

RootPanel.get(“canvas”).add(img);

is NOT commented out.

But with the line commented it seems that the image wont be loaded or so. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:15:58+00:00Added an answer on June 3, 2026 at 11:15 am

    Have you placed the image within the WEB-INF folder? That’s where GWT loads the images from. Normally it’s recommend to create an “images” folder so you can load it with “images/face.png”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a router like this, as main entry point: window.AppRouter = Backbone.Router.extend({ routes:
This only clears items in the user cache: public static void ClearCache() { foreach
In a typical winform program.cs contains the entry point: static void Main(string[] args) {
This entry appears to be about 80% of what I want to do but
Should I implement named parameters in Java using Hash tables? I saw this entry:
This question is in regards to this blog entry. https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/ All the way at
On this Wikipedia entry I found out that ITU Telecommunication Standardization Sector (ITU-T) is
I've got this code: Entry.h #import <Foundation/Foundation.h> @interface Entry : NSObject { id object;
This is a piece of code I write for this question: Entry text on
According to this Wikipedia entry on the PNG format , a PNG image file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.