java - What is the best way to rotate several buttons in a jpanel around a central point? -


i working on project in have background image specific points of interest. each of these specific points have custom button class overlaid on when click point, i'm clicking button. however, able rotate background image , have buttons rotate image custom buttons still overlaid on specific points. tips how should go doing this?

are wanting rotate 4 different images , move them around square, keeping them upright? or rotating single image after 1 button click single image on side? if former, can done using container (a jpanel) uses borderlayout, , having 4 jpanels background images , jbuttons held in container jpanel @ 4 compass points of borderlayout: borderlayout.east, borderlayout.west, borderlayout.north, , borderlayout.south (although java gurus prefer use newer constants, i.e., borderlayout.page_start). when button pressed, remove components , re-add in rotated order.

if want latter, things bit trickier in you'll need use affinetransforms, rotate instance rotate container, , you'll need perform same transformation on point of mouse press/click/release, rotated buttons receive correct clicks. if container not square, things trickier still.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -