i’m looking for this effect, but PulpCore doen’t works with swing. Do you know what library use, or how to make a TileMap? Also, I’d like to move forever in it.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
I’m guessing you don’t want to use an actual world-map implementation like JXMapViewer…
The basic functionality appears to be: click on some coordinates, and that point becomes centered in the viewport. One fairly simple way to do this is to have the component(s) that you want to view all contained within a
JPaneland have that panel inside aJScrollPanewith its scrollbars turned off (setHorizontalScrollbarPolicy(HORIZONTAL_SCROLLBAR_NEVER)and so on). Then, set up a click or action listener for your elements that calculates the new center point, what the new viewport rectangle coordinates will be, and usescrollRectToVisibleon the panel to shift the view. For animation, you can use a SwingTimerto set up a series of incremental scrolls in the required direction until you reach the target.