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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:10:33+00:00 2026-05-26T23:10:33+00:00

I am trying to do a isometric map for a game on Java, but

  • 0

I am trying to do a isometric map for a game on Java, but I can’t find a way to do this. I need to add a JLabel for each polygon of the isometric map, so I can use paint() for each position. How can I add a JLabel for each polygon I draw? I can’t get it. I already have my algorithm to draw each position of my isometric map, something like this:

//L is the width of the map (that will be the framw width)
//N will be the number of COLUMN, like N*N will be the total number of positions.

//The first position (a,b) that will be

 a=L / (2*N+1)
 b=a . tan(30º

for (int y = 0; y < N; y++) {
     if (y % 2 == 0) { // Se y é PAR
        for (int x = 0; x < N; x++) {
           Polygon p = new Polygon();
           p.addPoint(x * a * 2 + a, y * b);
           p.addPoint(x * a * 2 + 2 * a, y * b + b);
           p.addPoint(x * a * 2 + a, y * b + 2 * b);
           p.addPoint(x * a * 2, y * b + b);
           g.drawPolygon(p);
        }
   } else { // if Y is odd
    for (int x = 0; x < N; x++) {
       Polygon p = new Polygon();
       p.addPoint(x * a * 2 + 2 * a, y * b);
       p.addPoint(x * a * 2 + 3 * a, y * b + b);
       p.addPoint(x * a * 2 + 2 * a, y * b + 2 * b);
       p.addPoint(x * a * 2 + a, y * b + b);
       g.drawPolygon(p);
    }
  }
}

Thanks alot in advance guys

  • 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-26T23:10:33+00:00Added an answer on May 26, 2026 at 11:10 pm

    Layout and drawing are really quite different. Layout isn’t about exact positioning. You may as well just use drawChars on the Graphics object in the position you want, or cast it into a Graphics2D object and use drawString.

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

Sidebar

Related Questions

Trying to find some information on this but am unable to get any results
Trying to make a make generic select control that I can dynamically add elements
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
Trying to do this, but is it wrong? Below is my style and script
I'm trying to extend an isometric Flash game based on as3isolib. The game does
HI I am trying to concatenate the string but i got error at this
I'm currently working on a XNA game prototype. I'm trying to achieve a isometric
I'm trying to find the row, column in a 2d isometric grid of a
I'm trying to create a web app/game that uses a side-on 'isometric' view and
Trying to figure out how to do this. I have the style but I'd

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.