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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:22:33+00:00 2026-06-06T06:22:33+00:00

I’m experienced in Java and I’ve done a little with Swing (form type apps),

  • 0

I’m experienced in Java and I’ve done a little with Swing (form type apps), but I’ve never needed more power than that so I don’t know much about what’s going on under the hood GUI-wise. Here is what I’ve gleaned from the little bit of reading I’ve been doing. I’m sure it’s off.

In writing a space invaders type game, two approaches I thought of would be:

  1. Create one big component and code for all the incremental painting and layering.
  2. Create a bunch of nested absolutely positioned JPanels in a JLayeredPane that contains text and images, then call repaint() on just the ones that might need to be redrawn. Then override paintComponent() (not sure if previous content is cleared automatically or not). From what I read, this would handle the layering and redrawing of components without having to redraw the whole screen.

Is this correct? If so, which method is better suited for the project?

  • 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-06-06T06:22:34+00:00Added an answer on June 6, 2026 at 6:22 am

    One thing to really consider when it comes down to game programming in Java is to switch to Active Rendering.

    as we know, Swing takes care of rendering in another thread, called Event Dispatch Thread. This is known as passive rendering, because you don’t really render your own visual components, but you define how your app will look like and Swing actually draws it when he wants.

    Games usually work in Full Screen mode and often require more control over the “when”, “how” and “what” will be drawn. This is called active rendering. In this case, you have to disable the Even Dispatch Thread and do the rendering on your own.

    It all makes sense, because games often work inside a big loop. One example of a game loop is:

    1. Get input data (keyboard, joystick, etc)
    2. Network communication (in case of a client-server game)
    3. Process logic according to input data. (Eventually, this will lead to the game exiting, when the user tells it to).
    4. Update the state machine of the game.
    5. Redraw the scene according to the new state
    6. Restart the loop.

    There are many sources, but I can suggest this first reading to clarify on that: Passive vs Active Rendering

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I

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.