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 7010123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:57:02+00:00 2026-05-27T21:57:02+00:00

Normally an applet will call different methods that will have a Graphics2D-object that ends

  • 0

Normally an applet will call different methods that will have a Graphics2D-object that ends on the screen.

In the process the methods will manipulate and draw things on this object.

But my problem is, that I have some very static images that needs to be calculated and drawn for each frame.

How can I build an Graphics-object that I can cache, and re-apply the moving objects? For an example I have this static background drawer, the Graphics2D-object is the one from the Applet.

private Graphics2D drawbackground(Graphics2D g2d) {
    // Debug grid layer
    int x = 0;
    int y = 0;

    for (int i = 0; i < 9; i++) {
    if (x == 0 && y == 0 || y % 82 == 0) {
        x = 0;
        for (int t = 0; t <= 5; t++) {
        g2d.setColor(Color.WHITE);
        g2d.drawLine(x, y + 41, x + 41, y);
        g2d.drawLine(x + 41, y, x + 82, y + 41);
        g2d.drawLine(x, y + 41, x + 41, y + 82);
        g2d.drawLine(x + 82, y + 41, x + 41, y + 82);
        x += 82;
        }
        y += 41;
    } else if (y % 41 == 0) {
        x = 41;
        for (int t = 0; t <= 5; t++) {
        g2d.setColor(Color.WHITE);
        g2d.drawLine(x, y + 41, x + 41, y);
        g2d.drawLine(x + 41, y, x + 82, y + 41);
        g2d.drawLine(x, y + 41, x + 41, y + 82);
        g2d.drawLine(x + 82, y + 41, x + 41, y + 82);
        x += 82;
        }
        y += 41;
    }
    }
}

Is it possible to generate these drawings, and re-use them in a cached copy, so my Applet doesn’t need to use time to run through these drawLines for each draw?

  • 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-05-27T21:57:03+00:00Added an answer on May 27, 2026 at 9:57 pm

    I agree with Raveline, BufferedImage is where I would go for this solution. However Double buffering is the concept that you need to get your head around before you go too deep into this.

    http://docs.oracle.com/javase/tutorial/extra/fullscreen/doublebuf.html

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

Sidebar

Related Questions

I have a JOptionPane popup in my applet normally, a-la: Object[] options = {Grade,
I have a applet in a webpage that I use and I would like
I'm using firefox3 to run a Java Applet (on Linux). normally, when the JVM
Normally, the method of passing workflow parameters to the workflow happens in the call
Normally I create web application projects and use code-behind, but I have a requirement
Normally when you update an object in linq2sql you get the object from a
I have an applet for uploading file, and when browse file, it showed all
We have a Java Applet built using AWT. This applet lets you select pictures
I have the following page: mysite.com/news/index.php?tag=tag&name=name&id=id I want to rewrite this so that it
I have created a JApplet using the JUNG library in Netbeans that compiles and

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.