Search Results

Search found 1 results on 1 pages for 'user134812'.

Page 1/1 | 1 

  • using NetBeans for rotate a figure in a label [migrated]

    - by user134812
    I was reading this post: http://forums.netbeans.org/post-8864.html and what I have done so far is to make a jFrame in NetBeans, on it I have drawn a jPanel and inisde the panel I have drawn a jLabel on it and use the icon property to put an image on it; until now all is so far so good. I would like to make a program that everytime I click on the figure it rotates it to the right. Actually I have found the following code: public class RotateImage extends JPanel{ // Declare an Image object for us to use. Image image; // Create a constructor method public RotateImage(){ super(); // Load an image to play with. image = Toolkit.getDefaultToolkit().getImage("Duke_Blocks.gif"); } public void paintComponent(Graphics g){ Graphics2D g2d=(Graphics2D)g; // Create a Java2D version of g. g2d.translate(170, 0); // Translate the center of our coordinates. g2d.rotate(1); // Rotate the image by 1 radian. g2d.drawImage(image, 0, 0, 200, 200, this); } but for what I see this code is for making the panel and other components from scratch, for my purposes it is not so good because I need to put several figures on my jFrame. Could somebody can give me a hint how to do this?

    Read the article

1