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

  • Home
  • SEARCH
  • 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 9227493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:05:45+00:00 2026-06-18T05:05:45+00:00

Okay, I understand your need for an SSCCE, so I created (my first) one.

  • 0

Okay, I understand your need for an SSCCE, so I created (my first) one.

I managed to replicate the problem with under 200 lines of code. On my system this demo compiled and ran perfectly (only the flickering was still there of course).
I stripped everything that had nothing to do with it. So basically we have two source files now: the screen manager and the game manager.

The screen manager:
http://pastebin.com/WeKpxEXW

The game manager:
http://pastebin.com/p3C5m8UN

You can compile this code with this make file (I use a ported version of Linux’ make for Windows):
CC = javac
BASE = nl/jorikoolstra/jLevel
CLASS_FILES = classes/$(BASE)/Game/GameMain.class classes/$(BASE)/Graphics/ScreenManager.class

jLevel: $(CLASS_FILES)
    @echo Done.

classes/%.class : src/%.java
    @echo Compiling src/$*.java to $@ [command: $(CC) src/$*.java ] ...
    @$(CC) -Xlint:unchecked -d classes -classpath src src/$*.java

Where the source files are placed in the /src directory and the classes in the /classes directory.

After compilation to byte-code the game can be started using the following .bat file:

@set STARUP_CLASS=nl.jorikoolstra.jLevel.Game.GameMain
@set ARGUMENTS=1280 1024 32
@java -cp classes;resources %STARUP_CLASS% %ARGUMENTS%

Note that the ARGUMENT variable depends on your own screen settings and that you have to change it so that the game is displayed in the right resolution for your screen.

  • 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-18T05:05:46+00:00Added an answer on June 18, 2026 at 5:05 am

    I see why it is flickering —-

    BufferStrategy is doing a separate painting job from the Component’s paint() method and they seem to use different Graphics objects and they are refreshing at a different rate —

    when paint() is invoked before show(), it’s fine. But

    when paint() is invoked after show(), it will repaint the component to its initial blank look — so flashing happens.


    It’s very easy to eliminate the flickering: override paint() method of your JFrame (GameMain) as you don’t need it to do anything (BufferStrategy can give you more precise control on painting stuffs):

    @Override
    public void paint (Graphics g) {}
    

    That’s all. (I have tested it and it works fine, hope this may help :))


    ===== Update =====

    Instead of overriding paint() method, a better way is to call setIgnoreRepaint(true) for your JFrame (GameMain) — this method is just designed for such purposes! USE IT!

    private GameMain(String ... args)
    {
        setIgnoreRepaint(true);
        .....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I understand what the problem is, I sort of understand constraints in that
Okay, so I understand all of us C/C++ programmers have at one time met
Okay, the problem Im having is that I do not understand how to refer
okay i have been trying to understand this for hours i am learning VB
Okay this is definitely a n00b question but here goes. The way I understand
Okay, I have the following create action #posts_controller, nested resource under discussions def create
Okay I basically understand How MCTS works with node selection etc. What I don't
Okay so i understand the basics of MAXDOP , but i want to understand
Okay, from what I understand, an integer that is a fraction will be rounded
Okay, I understand this: mm/dd/yyyy - 02/01/2003 - strtotime() returns : 1st February 2003

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.