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

  • SEARCH
  • Home
  • 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 149641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:09:46+00:00 2026-05-11T09:09:46+00:00

I made this pacman game using an applet. When the applet finishes loading, it

  • 0

I made this pacman game using an applet. When the applet finishes loading, it is meant to display a ‘start menu’ graphic i made which says ‘Double click to start the game’, etc. The graphic would take up the whole 400×400 applet. Here’s the code:

public void paint(Graphics g) {     if (! isRunning)     {         switch (result)         {             case 0:                 showStartScreen(g);             break;              case 1:                 showWonScreen(g);             break;              case -1:                 showLostScreen(g);             break;         }         return;     }       //Code for rendering other stuff if game is here } 

showStartScreen:

public void showStartScreen(Graphics g) {     Image intro=img.getImg('pacman-intro.png');     g.drawImage(intro, 0, 0, this);  } 

This works fine when I run this locally on Eclipse, but in the web browser, when the applet is loaded I just see a blank box where the java’s loading animation previously was. Surprisingly, if I double click randomly where the applet is meant to be, the game starts and works as normal. So this makes me think that the problem is just with drawing .png files using drawImage.

The same thing occurs when you win or lose the game,it just hangs instead of drawing the graphic it needs to.

You can see this here (you can use arrow keys to control)

P.S I am using double buffering here.

Any thoughts..?

EDIT: Code for ImgHelper class which is used to load the img:

import java.awt.Image; import java.net.URL;  import javax.swing.ImageIcon;  public class ImgHelper {     public Image getImg(String file)     {             //Engine is the name of the base applet class         URL url=Engine.class.getClassLoader().getResource('assets/' + file);         return new ImageIcon(url).getImage();      }   } 
  • 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. 2026-05-11T09:09:47+00:00Added an answer on May 11, 2026 at 9:09 am

    Ah, I checked the contents of your jar file.

    Replace ‘pacman-intro.png’ with ‘pacman-intro.PNG’. It’s case-sensitive.

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

Sidebar

Related Questions

I made this bash one-liner which I use to list Weblogic instances running along
I made this simple example , which doesn't work in Chrome 16 (latest), but
I made this function to display a form, the form had to be sticky
I made this loader which actually works pretty well. I now want to make
I made this test to select a row, which I created previously, from two
I made this regex: /\<+[a-zA-Z0-9\=\\s]+\>+.+\<\/+[a-zA-Z0-9]+\>/gi which matches a full html tag like: <p>this is
I made this PHP chatbox which supports some JavaScript code. I have these 'images'
I made this query which select the date in column, now i want to
Made this nice little loop for hiding and showing div's, works as a charm
I made this function to verify a user's twitter credentials. Its running on two

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.