i acheived this with a program i wrote called "rotating" availible for referance at Nathan's Computer Knowledge
how i acheived this was to attach a line to the top of my image (the x, y coordinate) to the center of the image using the getWidth() getHeight() methods. that way when i rotated the image which was a space ship, the line would point in the dirrection of the front of the space ship, which could later be used to tell which dirrection to fire the missiles, so the animation will display a space ship firing missiles.
you also need to rotate your image and make your ship or whatever front of the image whatever your image is the front needs to be pointing to the top right of the or i mean the top of top left.
this teqnique as far as i know only works with images rotating that are not moving , it may work with space ships but your ship might be deformed haha but i think it would look fine.
the next thing you need to do is get the slope of the lines, and figure out which dirrection it is facing.
i achieved something similar to this at point a to point page
how now that i think about it, i might be trying to answer the wrong question. but if you ever need to get a image or an object from anywhere on the screen to anywhere on the screen i would really reccomend that point a to point b page listed above. it is difficult to explain the answer but i have acheived this myself for a program that didnt have user input, in other words a "stationary" object rotating and shooting in a 360' dirrection , displaying animation as a cannon shooting cannon ball s , that was the first or the second link i listed the first one, which may be somewhat helpful to your question.
to clarify, you need to (as described above) rotate your image in a paint program (disclaimer: your image will show as rotated to the left 50%), add a line line2d.double(yourimage.getx(), yourimage.gety(),yourimage.getwidth() / 2, yourimage.getheight() / 2);, from the top left (x, y) to the center (as described above), then you need to get the slope of the line, figure out which dirrection your line is facing in an 8 quadrent circle, which i have done (the last two steps) i have done at the page listed above, the first page "Nathan's computer knowledge" you may use my program "rotating" as a reference to achieve the last two steps which are long and complicated, but if you look at my program you should be able to see how i did it, and the page has a runnable jar zip folder attached working on windows for download demonstration visual and the source and the source and images are included.
i think that is it, you could have rotation code set up to a key listener as well.
good luck to you, if you have any questions or comments or would like to contact me, please reply via email that is listed on the about me page or should be listed.
one of the links i was trying to post it looks like it got the wrong url acctually i think i might have fixed it its called "rotating" on the nathanscomputerknowledge website it should be listed in the navigation onthe left side of the screen. acctually it is called "rotating cannons shooting cannon balls in a runnable jar"
also: when you get the slope of the line and the quadrent number, you have to increments the x or the y value depending on which quadrent you are in, and the y and the x value by the slope of the line. keeping looking at "rotating" if you get lost and watch the program in your ide to see what it does, then you will know how to do what it's doing by looking at the code, which may solver your problem or similar problems.
take note: this teqnique works in a 360' radius not just a 8 quadrent vector (circle)