Results 1 to 2 of 2
  1. #1
    MrPremium is offline Member
    Join Date
    Apr 2011
    Rep Power

    Default Unable to set image as background

    Hi, I am making a java game for school which require myself to have a background image. I keep on getting the same error no matter what I try or change. It keeps saying Identifier Expected.

    Here are snippets of my code:

    static Image = bgImage1;

    Graphics2D g = (Graphics2D) strategy.getDrawGraphics();

    Toolkit tk = Toolkit.getDefaultToolkit();
    bgImage1 = tk.getImage("sprites/background.jpg");

    The error comes from the "static Image = bgImage1;" saying an Identifier is Expected. If you think you know the problem but need more information, I'd be glad to throw more details.


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

Similar Threads

  1. [Help] W/ background image
    By gundum584 in forum New To Java
    Replies: 9
    Last Post: 01-10-2011, 06:48 AM
  2. unable to change the TextArea.background !
    By Y. Progammer in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 05:55 PM
  3. Background image
    By leiferouis in forum New To Java
    Replies: 9
    Last Post: 03-08-2009, 06:49 PM
  4. Image as background
    By Java.child in forum AWT / Swing
    Replies: 2
    Last Post: 10-03-2008, 12:37 AM
  5. Why this image background is black ?
    By samson in forum Java 2D
    Replies: 1
    Last Post: 07-17-2007, 05:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts