Results 1 to 2 of 2
  1. #1
    sidkdbl07 is offline Member
    Join Date
    Jan 2008
    Posts
    2
    Rep Power
    0

    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!!

  2. #2
    sidkdbl07 is offline Member
    Join Date
    Jan 2008
    Posts
    2
    Rep Power
    0

    Default

    This is what I came up with in the end... I thought I would share.

    Java 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;
    	}

Similar Threads

  1. Help with Move Shape
    By romina in forum AWT / Swing
    Replies: 2
    Last Post: 12-09-2010, 04:25 AM
  2. Implementing an interface
    By bugger in forum Advanced Java
    Replies: 1
    Last Post: 01-09-2008, 02:35 PM
  3. weird looking shape JButton is it possible?
    By unhurt in forum AWT / Swing
    Replies: 8
    Last Post: 11-03-2007, 10:10 AM
  4. tool to create shape frame
    By boy22 in forum AWT / Swing
    Replies: 1
    Last Post: 08-05-2007, 05:10 AM
  5. How to change shape of JButton
    By FaRuK in forum AWT / Swing
    Replies: 1
    Last Post: 05-19-2007, 01:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •