title: Thicker line prevent transformatio
body: <p>I created an implementation of the interface java.awt.geom.Shape. This contains a sequence of paths in terms of PathIterator to draw the shape of an AND gate.
  Now I want to move this shape when i move the mouse pointer. This works excellent but when i want to increase the thickness of lines this stops working. If i dont change the thickness of pen this works well.
  When i set the width of pen to 1 it works. But when i set it to 10 just a part of gate apears seemingly drawn from the point (0,0) thus translate does not affected.
  Here is the Gate source:</p>
  
  <pre><code>package pashe;
  import java.awt.Rectangle;
  import java.awt.Shape;
  import java.awt.geom.AffineTransform;
  import java.awt.geom.PathIterator;
  import java.awt.geom.Point2D;
  
  import java.awt.geom.Rectangle2D;
  
  public class Gate implements Shape {
  
      GPathIterator pathIterator;
      public Gate(){
  
          pathIterator = new GPathIterator();
      }
      @Override
      public boolean contains(Point2D arg0) {
          // TODO Auto-generated method stub
          return false;
      }
  
      @Override
      public boolean contains(Rectangle2D arg0) {
          // TODO Auto-generated method stub
          return false;
      }
  
      @Override
      public boolean contains(double arg0, double arg1) {
          // TODO Auto-generated method stub
          return false;
      }
  
      @Override
      public boolean contains(double arg0, double arg1, double arg2, double arg3) {
          // TODO Auto-generated method stub
          return false;
      }
  
      @Override
      public Rectangle getBounds() {
          // TODO Auto-generated method stub
          return new Rectangle(0,0,50,30);
      }
  
      @Override
      public Rectangle2D getBounds2D() {
          // TODO Auto-generated method stub
          return (new Rectangle(0,0,50,30));
      }
  
      @Override
      public PathIterator getPathIterator(AffineTransform arg0) {
      return pathIterator;
  
      }
  
      @Override
      public PathIterator getPathIterator(AffineTransform arg0, double arg1) {
          // TODO Auto-generated method stub
          return pathIterator;
      }
  
      @Override
      public boolean intersects(Rectangle2D arg0) {
          // TODO Auto-generated method stub
          return false;
      }
  
      @Override
      public boolean intersects(double arg0, double arg1, double arg2, double arg3) {
          // TODO Auto-generated method stub
          return false;
      }
  
  
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>package pashe;
  
  import java.awt.geom.PathIterator;
  
  public class GPathIterator implements PathIterator {
  
      int current = 0;
      @Override
      public int currentSegment(float[] points) {
          switch (current){
          case 0:{
              points[0] = 0;
              points[1] = 0;
              return PathIterator.SEG_MOVETO;
          }
          case 1:
          {
              points[0] = 15;
              points[1] = 0;
              return PathIterator.SEG_LINETO;
          }
          case 2:
          {
              points[0] = 40;
              points[1] = 0;
              points[2] = 40;
              points[3] = 15;
              return PathIterator.SEG_QUADTO;
          }
          case 3:
          {
              points[0] = 40;
              points[1] = 30;
              points[2] = 15;
              points[3] = 30;
              return PathIterator.SEG_QUADTO;
          }
          case 4:
          {
              points[0] = 0;
              points[1] = 30;
              return PathIterator.SEG_LINETO;
          }
          case 5:
          {
              return PathIterator.SEG_CLOSE;
          }
  
  
          default:
              return -1;
          }
  
      }
  
      @Override
      public int currentSegment(double[] arg0) {
          // TODO Auto-generated method stub
          return current;
      }
  
      @Override
      public int getWindingRule() {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public boolean isDone() {
          // TODO Auto-generated method stub
          if (current &lt; 6)
          return false;
          return true;
      }
  
      @Override
      public void next() {
          // TODO Auto-generated method stub
          current++;
      }
  
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>package pashe;
  
  import java.awt.BasicStroke;
  import java.awt.BorderLayout;
  import java.awt.EventQueue;
  import java.awt.Graphics;
  import java.awt.Graphics2D;
  import java.awt.Rectangle;
  import java.awt.Shape;
  import java.awt.Stroke;
  import java.awt.geom.AffineTransform;
  import java.awt.geom.GeneralPath;
  import java.awt.geom.Point2D;
  import java.awt.geom.QuadCurve2D;
  
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.border.EmptyBorder;
  import java.awt.event.MouseAdapter;
  import java.awt.event.MouseEvent;
  import java.awt.event.MouseMotionAdapter;
  import java.awt.geom.Ellipse2D;
  
  public class Prob extends JFrame {
  
      private JPanel contentPane;
      Adap adap;
      BasicStroke stroke;
      /**
       * Launch the application.
       */
      public static void main(String[] args) {
          EventQueue.invokeLater(new Runnable() {
              public void run() {
                  try {
                      Prob frame = new Prob();
                      frame.setVisible(true);
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          });
      }
  
      /**
       * Create the frame.
       */
      public Prob() {
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setBounds(100, 100, 450, 300);
          contentPane = new JPanel();
          contentPane.addMouseMotionListener(new MouseMotionAdapter() {
              @Override
              public void mouseMoved(MouseEvent e) {
                  adap.mouseMoved(e);
              }
          });
  
          //System.out.println(stroke.getLineWidth());
          adap = new Adap(this);
          contentPane.addMouseListener(adap);
          contentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
          setContentPane(contentPane);
      }
      public void paint(Graphics g){
          Graphics2D g2d = (Graphics2D)g;
          /*super.paint(g);
          if (adap.evt != null){
          int x = adap.evt.getX();
          int y = adap.evt.getY();
          Graphics2D g2d = (Graphics2D)g;
          g2d.setStroke(new BasicStroke(5));
          GeneralPath gp = new GeneralPath();
          gp.moveTo(x, y);
          gp.lineTo(x + 15 , y);
          gp.quadTo(x + 40, y , x + 40, y + 15);
          gp.quadTo(x + 40, y + 30, x + 15, y + 30);
          gp.lineTo(x, y+30);
          gp.closePath();
          g2d.draw(gp);
          gp.moveTo(x - 8, y + 5);
          gp.lineTo(x, y + 5);
          gp.moveTo(x - 8, y + 25);
          gp.lineTo(x, y + 25);
          g2d.draw(gp);
          gp.moveTo(x + 40, y + 15);
          gp.lineTo(x + 48, y + 15);
          g2d.draw(gp);
          }*/
          //g2d.setStroke(new BasicStroke(3));
          BasicStroke old = (BasicStroke)g2d.getStroke();
                 stroke = new BasicStroke(10f,old.getEndCap(),old.getLineJoin(),old.getMiterLimit(),old.get    DashArray(),old.getDashPhase());
  
                  if (adap.evt == null)
          {
  
              return;
          }
          super.paint(g);
          int x = adap.evt.getX();
          int y = adap.evt.getY();
                    System.out.println("x=" + x + " y=" + y);
          Shape shape = new Gate();
          AffineTransform trans =  AffineTransform.getTranslateInstance(x,y);
  
          //Shape shape = trans.createTransformedShape(gate);
          //shape = stroke.createStrokedShape(shape);
                  //g2d.fill(shape);
          //Shape shape = trans.createTransformedShape(gate);
          //g2d.setTransform(trans);
                  //shape = new Ellipse2D.Double(0,0,18,18);
          g2d.setStroke(stroke);
          g2d.transform(trans);
                  //shape = trans.createTransformedShape(shape);
          g2d.draw(shape);
                  g2d.setStroke(old);
      }
  
      class Adap extends MouseAdapter {
          Prob prob;
          MouseEvent evt;
          public Adap(Prob p){
              prob = p;
          }
          @Override
          public void mouseEntered(MouseEvent ev) {
              evt = ev;
              prob.repaint();
          }
          public void mouseMoved(MouseEvent ev) {
              evt = ev;
              prob.repaint();
          }
  
  
      }
      }
  </code></pre>