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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:45:24+00:00 2026-05-13T19:45:24+00:00

In a small java swing 2D game, what is the best solution for creating

  • 0

In a small java swing 2D game, what is the best solution for creating the board view?

  1. Use a component for the board and custom paint it and each square of the checker at once?
  2. Use a component for the board and create another component modelizing the square with its own paint component doing the job for the square only. Use a layout to place each Square instance in the board?

I know this is subjective and I don’t want a fight about it. I just need some clues to figure myself which way I should go. I’ve begun a side project and I’ve using 1), with the feeling that there is something wrong.

  • 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-13T19:45:24+00:00Added an answer on May 13, 2026 at 7:45 pm

    Just go with one drawing panel/container for everything.

    Consider a tile based game. Using your second solution each tile would be an object, memory would skyrocket and the game would slow to a crawl.

    Using the first option you are flexiable. You draw what you want, you have the panel coordinates so everything is relative to this. Using the tile based example you’d know the height and width of the panel, draw your square and increment in the X and Y coordinates as appropriate.

    GUI frameworks such as Swing or .NET’s Winforms are expensive as they have a whole lot of other stuff that a game won’t need. So to answer your question, go with option one, rather than say using a panel for every checker on your board.

    One nice solution to using the second method, in combination with the first method is the Flyweight Design Pattern. You still get to use OO objects, but you’ll have a fraction of the amount you normally would. Check it out.

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

Sidebar

Related Questions

I am writing a game using Java Swing. I want to paint each time
I am creating a java swing app which makes use of the JProgressBar control.
I have a small Java Swing application that I want to rewrite in WPF
I am developing a small project using Java Swing. I am using jdk 7
I'm learning Java by making a small game in a JApplet. I got a
I have a small Java desktop app that uses Swing. There is a data
When I run my swing GUI applications under Java 6, they automatically use my
I have a small java application with a swing gui. I have set a
I have implemented Conway's Game of Life problem in Java swing. Everything is working
I've build a small GUI game in java and at some point I'm using

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.