Results 1 to 8 of 8
  1. #1
    gaj7 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Exclamation Java applet back buffering problem

    In order to prevent flickering in my applet i decided to try back buffering. I had a problem with the following code in Eclipse though:

    backBuffer = createImage(640, 640);
    g = backBuffer.getGraphics();

    Eclipse put a red line under createImage. It says that createImage(int, int) is undefined by the class, but i have seen this done in examples. I imported both java.awt.* and java.applet.*. Why doesn't it recognise createImage()?
    Last edited by gaj7; 01-10-2012 at 01:45 AM. Reason: mispelling

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,891
    Rep Power
    25

    Default Re: Java applet back buffering problem

    createImage(int, int) is undefined by the class
    Did you look in the API doc for the class to see how to use the createImage method?
    If not, you need to look.
    Java Platform SE 6
    Last edited by Norm; 01-10-2012 at 02:57 AM.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Java applet back buffering problem

    Extend JApplet instead, and convert your other components to the equivalent Swing components. Swing components are double buffered by default.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    gaj7 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Java applet back buffering problem

    Is swing better than awt and how easy is it to convert?

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,891
    Rep Power
    25

    Default Re: Java applet back buffering problem

    Yes. Most of the changes are to the classnames by adding a leading J
    Also read the API doc for the class to find the syntax and the methods to use.

  6. #6
    gaj7 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Java applet back buffering problem

    And no double buffering is needed in swing?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,891
    Rep Power
    25

    Default Re: Java applet back buffering problem

    Swing does double buffering. See also post#3

  8. #8
    gaj7 is offline Member
    Join Date
    Jan 2012
    Posts
    7
    Rep Power
    0

    Default Re: Java applet back buffering problem

    Thanks it is working better than ever

Similar Threads

  1. Double buffering graphics problem
    By Guy in forum Java 2D
    Replies: 13
    Last Post: 08-30-2011, 10:22 PM
  2. Double buffering problem
    By Perakp in forum New To Java
    Replies: 1
    Last Post: 08-11-2011, 09:18 PM
  3. Scriptlet Not Running on JSP after coming back from back button of browser
    By jason.3dmagic in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 06-23-2011, 08:44 AM
  4. problem with back button of the browser.
    By shivakumari in forum Java Servlet
    Replies: 2
    Last Post: 03-25-2009, 08:41 AM
  5. Double Buffering problem
    By aprenz in forum Java Applets
    Replies: 0
    Last Post: 05-28-2008, 05:26 AM

Tags for this Thread

Posting Permissions

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