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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:54:52+00:00 2026-05-31T17:54:52+00:00

I am writing a mapping application in Java, using Swing for the UI (I’ve

  • 0

I am writing a mapping application in Java, using Swing for the UI (I’ve included a prototype drawing at the end of this post). The map is implemented using a custom MapPanel class that extends JPanel. The map is fetched from the server as a series of 300×300 images (tiles) that are painted on the MapPanel whenever its paintMap() method is called. Due to the length and complexity (multiple classes, etc.) of the code I can’t include all of it here but the paintMap() method basically works like this:

// Loop for each map tile (image, xPos, yPos)
getGraphics().drawImage(image, xPos, yPos, 300, 300, null);

I would like to have another JPanel (containing a JSlider for zoom control) overlayed on top of the map panel, but I’m having difficulties getting this to work. Whenever I paint the map, the overlayed JPanel disappears. If I repaint the overlayed JPanel in the paintMap() method, it flickers badly when the map is being dragged (and thus repainted continuously).

Any suggestions for how I could implement my UI without flickering?

UI prototype

  • 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-31T17:54:54+00:00Added an answer on May 31, 2026 at 5:54 pm
    getGraphics().drawImage(image, xPos, yPos, 300, 300, null); // WRONG!!
    
    1. Don’t call getGraphics() – instead override the paintComponent(Graphics) of a JPanel or JComponent and paint when requested to do so.
    2. Use this as the ImageObserver
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a mapping application on iOS, making use of OpenStreetMap tiles. Map tile images
I'm writing a mapping application that I am writing in python and I need
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a
I'm writing a file generic block for my application and started with using Lambda
I am writing an AR application on iOS and am using CATransform3D transforms on
I writing a Linux system call map for the radare2 debugger. This means providing
I am currently writing an web application where you need to log in, using
I am writing a Java code generator. I have an immutable Map that contains
I'm writing a new Windows Forms 2.0 application. This application is going to have
Assuming that writing nhibernate mapping files is not a big issue....or polluting your domain

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.