Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search Coderanch
Advance search
Google search
Register / Login
Alexandr Racheev
Greenhorn
+ Follow
2
Posts
0
Threads
0
Cows
since Oct 14, 2008
Merit badge:
grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
Ranch Hand Scavenger Hunt
Number Posts (2/100)
Number Threads Started (0/100)
Number Cows Received (0/5)
Number Likes Received (0/10)
Number Likes Granted (0/20)
Set bumper stickers in profile (0/3)
Report a post to the moderators (0/1)
Edit a wiki page (0/1)
Create a post with an image (0/2)
Greenhorn Scavenger Hunt
First Post
Number Posts (2/10)
Number Threads Started (0/10)
Number Likes Received (0/3)
Number Likes Granted (0/3)
Set bumper stickers in profile (0/1)
Set signature in profile
Search for a post/thread (0/3)
Set a watch on a thread
Save thread as a bookmark
Create a post with an image (0/1)
Recent posts by Alexandr Racheev
* Welcome Federico Kereki
Hello, Federico.
[Question removed. Keep your questions out of this welcome thread]
show more
13 years ago
GWT
Rotating Squares in java
maybe this example will help you
public class RotateTest extends JPanel { private AffineTransform transform = AffineTransform.getRotateInstance(Math.PI / 10, 70, 70); private Shape rectangle = new Rectangle2D.Double(20, 20, 50, 50); private Rotater rotater = new Rotater(); public Rotater getRotater() { return rotater; } public RotateTest() { Thread rotateThread = new Thread(new Rotater()); rotateThread.setDaemon(true); rotateThread.start(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); synchronized (rectangle) { ((Graphics2D) g).draw(rectangle); } } public static void main(String[] args) { final JFrame f = new JFrame("Rotate test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setBounds(100, 100, 500, 500); f.setContentPane(new RotateTest()); f.setVisible(true); f.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { ((RotateTest) f.getContentPane()).getRotater().setStopIt(true); } }); } public class Rotater implements Runnable { private boolean stopIt = false; public synchronized boolean isStopIt() { return stopIt; } public synchronized void setStopIt(boolean stopIt) { this.stopIt = stopIt; } public void run() { while (!isStopIt()) { synchronized (rectangle) { rectangle = transform.createTransformedShape(rectangle); } SwingUtilities.invokeLater(new Runnable() { public void run() { RotateTest.this.repaint(); } }); try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(RotateTest.class.getName()).log(Level.SEVERE, null, ex); } } } } }
[ October 14, 2008: Message edited by: Alexandr Racheev ]
show more
15 years ago
Swing / AWT / SWT