Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
Ron McLeod
Junilu Lacar
Liutauras Vilda
Sheriffs:
Paul Clapham
Jeanne Boyarsky
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Piet Souris
Carey Brown
Bartenders:
Jesse Duncan
Frits Walraven
Mikalai Zaikin
Forum:
Swing / AWT / SWT
Mirror View
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all
I have the java.awt.Shape i want to transform this shape to mirror view how can i do that
Thanks in advance
-Chiru
Craig Wood
Ranch Hand
Posts: 1535
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Use a scale value of "-1" to reflect about an axis.
protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = getWidth(); int h = getHeight(); Arc2D.Double arc = new Arc2D.Double(0, h/6, w/3, h*2/3, 45, -85, Arc2D.OPEN); g2.setPaint(Color.blue); g2.draw(arc); AffineTransform at = AffineTransform.getTranslateInstance(w,0); at.scale(-1, 1); g2.setPaint(Color.red); g2.draw(at.createTransformedShape(arc)); }
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
The big Four-Oh (-Oh-Oh)
What's the meaning of Meaningless...
Intrepid Ibex
How does a true mirror work?
The MExican-Brad Pitt
More...