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

Ask A Question

Stats

  • Questions 80k
  • Answers 80k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Seems OK as a logical pattern. But, as always. the… May 11, 2026 at 4:24 pm
  • Editorial Team
    Editorial Team added an answer I wouldn't try doing anything automated - the name is… May 11, 2026 at 4:24 pm
  • Editorial Team
    Editorial Team added an answer I'd do ADO.NET first along with SQL. If you don't… May 11, 2026 at 4:24 pm

Related Questions

Leading on from my previous questions I am going to try and clarify one
I'm building a pacman game. Basically, I want to have a map representation of
I'm trying to show the famous mouth opening/closing animation of the pacman character in
For my university assignment I have to make a networkable version of pacman. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.