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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:14:42+00:00 2026-05-27T07:14:42+00:00

I am making a 2d platformer and am producing the map maker. So far,

  • 0

I am making a 2d platformer and am producing the map maker. So far, I have my java project splitting an image of tiles into 100 seperate images, and putting them in buttons (tile[]). When one of these buttons is clicked, it fires the MouseListener:

public void mousePressed(MouseEvent e) {
    for(int i = 0; i <= 99; i++) {
            tile[i].setBackground(null);
    }
    ((JComponent) e.getSource()).setBackground(Color.black);
}

Now, I need to know if there is a JComponent that can make this easy for me, I want to be able to click in a canvas or something, and start drawing the map (24×24 pixel grids). How would I go about doing this? If you need more code or me to explain better please ask.

  • 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-27T07:14:43+00:00Added an answer on May 27, 2026 at 7:14 am

    Use a JToggleButton as shown in Swing JToolbarButton pressing.

    Obviously this will require 2 images for each map ’tile’ location. The first is the map tile for that part of the map, the second is a black image that can be reused for every tile.

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

Sidebar

Related Questions

I am making a 2d platformer in Swing java, and I am wondering how
I am making a free cross platform mock up designer in Java. I have
I am making a 2d Platformer in Java, and for some reason, when the
I am making a basic platform game for the iPhone and I have encountered
I am attempting to integrate an existing payment platform into my webshop. After making
I have a conceptual question... I am making an Intranet application (Web platform) for
Making my first steps with NHibernate, I'm trying to have it creating my Tables
In a cross-platform (Windows, FreeBSD) C++ project I'm working on, I am making use
I am making a 2D game in Android with Cocos2D, written in Java. Here
I've been modifying/editing parts of the Android platform, but have run into a problem

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.