Skip to content
Advertisement

Tag: rotation

How can I rotate multiple graphics shapes together in java without changing their position on the frame or their position relative to eachother?

I have used several java.awt.Rectangle, java.awt.Polygon, and java.awt.geom.Ellipse2D shapes together and I want to rotate them with eachother and I also want to have them keep their location on the JFrame. When I use g2D.rotate(Math.toRadians(rotation)), the shapes move on the JFrame and they are no longer close together. How can I make it so that all of the shapes keep

Java – generate and rotate matrix

recently I’m trying to learn Java a bit and currently, I’m working on a simple program that should generate a matrix and then rotate it. I’m stuck at the first part. What exactly is the problem? The logic of my code seems to be fine, but anyway program is returning not what I would expect. The code: Output: Please, enter

Java Rotating Icon in JLabel

Hi I’m having a problem trying to rotate an image inside a JLabel. I got this code from StackOverflow, and I’m trying to change it a little bit so that instead of the image rotating in a Tab, it is rotating within a JLabel. This is working, the image is rotating. However when i change it to this. This stopped

Java – Asteroids – acceleration in two dimensions

I am currently writing Asteroids for extra credit in my computer science class, following a very loose guide that provided some starter code. I have a ship and I can use key presses to change its position. The starter code provided a method of drawing the ship based on a Point position. I was then given this How am I

Java: Rotating Images

I need to be able to rotate images individually(in java). The only thing I have found so far is g2d.drawImage(image, affinetransform, ImageObserver ). Unfortunately, I need to draw the image at a specific point, and there is no method with an argument that 1.rotates the image separately and 2. allows me to set the x and y. any help is

Advertisement