Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-11-2008, 06:24 AM
Member
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
sidkdbl07 is on a distinguished road
Default implementing shape
I want to create a SatelliteShape class that makes a shape that looks like


Are there any good tutorials on how to write the public PathIterator getPathIterator(AffineTransform pAt) method or any of the other methods?

Any hints would be great!!
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 01-12-2008, 07:42 PM
Member
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
sidkdbl07 is on a distinguished road
Default
This is what I came up with in the end... I thought I would share.

Code:
	public static GeneralPath getSatelliteShape() {
		GeneralPath wingLeft = new GeneralPath();
		wingLeft.moveTo(-22.5f,0f);
		wingLeft.lineTo(-22.5f,7.5f);
		wingLeft.lineTo(-6.6f, 7.5f);
		wingLeft.curveTo(-6.6f, 7.5f, -15f, 0f, -6.6f, -7.5f);
		wingLeft.lineTo(-22.5f, -7.5f);
		wingLeft.closePath();
		
		GeneralPath crossLeft = new GeneralPath();
		crossLeft.moveTo(-22.5f,0f);
		crossLeft.lineTo(-10f,0f);
		crossLeft.moveTo(-15f,7.5f);
		crossLeft.lineTo(-15f,-7.5f);
		
		GeneralPath circle = new GeneralPath(new Ellipse2D.Float(-10f,-10f,20f,20f));
		
		GeneralPath wingRight = new GeneralPath();
		wingRight.moveTo(22.5f,7.5f);
		wingRight.lineTo(22.5f,-7.5f);
		wingRight.lineTo(6.6f,-7.5f);
		wingRight.curveTo(6.6f, -7.5f, 15f, 0f, 6.6f, 7.5f);
		wingRight.closePath();
		
		GeneralPath crossRight = new GeneralPath();
		crossRight.moveTo(10f, 0f);
		crossRight.lineTo(22.5f, 0f);
		crossRight.moveTo(15f, 7.5f);
		crossRight.lineTo(15f, -7.5f);
		
		GeneralPath satellite = new GeneralPath();
		satellite.append(wingLeft, false);
		satellite.append(crossLeft, false);
		satellite.append(circle, false);
		satellite.append(wingRight, false);
		satellite.append(crossRight, false);
		
		return satellite;
	}
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Implementing an interface bugger Advanced Java 1 01-09-2008 02:35 PM
weird looking shape JButton is it possible? unhurt AWT / Swing 8 11-03-2007 10:10 AM
Help with Move Shape romina AWT / Swing 1 08-07-2007 06:27 AM
tool to create shape frame boy22 AWT / Swing 1 08-05-2007 05:10 AM
How to change shape of JButton FaRuK AWT / Swing 1 05-19-2007 01:56 PM


All times are GMT +2. The time now is 06:28 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org