Note, I do use general path and drawshape: private void drawCircleBar(Graphics g, int pullToTheLeftPixels, int angleToStartOn, int angleToEndOn, int colour) { GeneralPath pathStatic = new GeneralPath();//these should not be made each time but had repaint issues when I did, see https://groups.google.com/forum/embed/?place=forum/codenameone-discussions&showsearch=true&showpopout=true&hl=en&parenturl=http%3A%2F%2Fwww.codenameone.com%2Fdiscussion-forum.html#!topic/codenameone-discussions/Qb2uJtU82BY GeneralPath pathDynamic = new GeneralPath(); strokeWidth= myWidth/17; g.setColor(0xffffff); if (stroke == null) { stroke = new Stroke(strokeWidth, Stroke.CAP_BUTT, Stroke.JOIN_ROUND, 1f); } //for testing /* if (progress++>=100) { progress=0; }*/ //debug: //g.drawRect(getX(),getY(), myWidth, myHeight); //draw in centre so we can see where it is //g.drawRect( getX()+(myWidth/2)-5,getY()+(myHeight/2)-5, 10, 10); g.setFont(f); g.setAntiAliased(true); int pixelsToMoveTextAndImageDown = getHeight()/14; //draw full arc int sideAngle = 50; //the amount of degrees less than a semi circle (180) double startAngle = Math.toRadians(angleToStartOn+sideAngle);//180 for perfect semi circle, but it isnt, so 220 double angleComplete = Math.toRadians(angleToEndOn-sideAngle); int circleW = myHeight; if (circleW>myWidth) { circleW=myWidth; } /////no need circleW-=strokeWidth*2; circleW+=strokeWidth*3; int circleH = circleW; int xPos = getX()+((myWidth/2)-(circleW/2))-pullToTheLeftPixels; int yPos = getY()+(myHeight/4);//getY()+myHeight/2;//getY()+strokeWidth;
pathStatic.arc(xPos, yPos, circleW, circleH , startAngle, angleComplete); g.drawShape(pathStatic, stroke); //_("progress:"+progress+" which is "+(progress*3.6)); String percentageStr = ""+progress+"%"; int stringWidth = f.stringWidth("XXX"); Image thumbImage = thumbsUp; Image thumbImageSelected = thumbsUpSelected; switch (myPos) { case PROGRESS_BAR_LEFT: break; case PROGRESS_BAR_RIGHT: pullToTheLeftPixels = -(int)(stringWidth/1.1f);//so it sits a bit more right thumbImage = thumbsDown; thumbImageSelected = thumbsDownSelected; pixelsToMoveTextAndImageDown = thumbsUp.getHeight()/3; break; } //tweaks for different rews, int yForThumb = f.getHeight()/3+yPos+thumbsUp.getHeight()/2;//(((getY()+myHeight/2)-f.getHeight()*2))-thumbsUp.getHeight()/2;//-thumbsUp.getHeight()/3)+pixelsToMoveTextAndImageDown; //thumbsUp or down g.drawImage(thumbImage, (((getX()+myWidth/2)-thumbsUp.getWidth()/2)-pullToTheLeftPixels)+stringWidth/3, yForThumb ); if (isSelected) //draw the pressed version if we know we have pressed it. { g.drawImage(thumbImageSelected, (((getX()+myWidth/2)-thumbsUp.getWidth()/2)-pullToTheLeftPixels)+stringWidth/3, yForThumb ); } switch (myPos) { case PROGRESS_BAR_LEFT: pixelsToMoveTextAndImageDown = thumbsDown.getHeight();//-thumbsDown.getHeight()/8; break; case PROGRESS_BAR_RIGHT: pullToTheLeftPixels = -(int)(stringWidth/1.1f);//so it sits a bit more right pixelsToMoveTextAndImageDown = -((thumbsDown.getHeight()/3)+f.getHeight()/4);//*2; // the text is above the thumb break; } //add +stringWidth/3 here to nudge it to the right a touch, same with thumbs up image (since the circle is pulled left and we dont want //this stuff to loook too close to edge g.setColor(0xffffff); g.drawString(percentageStr, (((getX()+myWidth/2)-stringWidth/2)-pullToTheLeftPixels)+stringWidth/3, yForThumb+pixelsToMoveTextAndImageDown);//(getY()+myHeight/2)+pixelsToMoveTextAndImageDown); //blue progress bit float progressAngle = (float)((progress*1.3f)); angleComplete = Math.toRadians(progressAngle); g.setColor(colour); pathDynamic.arc(xPos, yPos, circleW, circleH , startAngle, angleComplete); //draw actual progress arc g.drawShape(pathDynamic, stroke); } On Monday, October 24, 2016 at 5:14:17 PM UTC+8, Gareth Murfin wrote: > > Ive come back to an app I have not touched in around 2 months. Suddenly it > is freezing and it is very hard to pin point. I just updated the libs to > see if it had been fixed, after that it does give me an exception, can > anyone explain whats going wrong here? > > An exception occurred during transition paint this might be valid in case > of a resize in the middle of a transition > java.lang.StackOverflowError > at > com.codename1.ui.geom.GeneralPath$Ellipse._addToPath(GeneralPath.java:971) > at > com.codename1.ui.geom.GeneralPath$Ellipse._addToPath(GeneralPath.java:968) > at > com.codename1.ui.geom.GeneralPath$Ellipse._addToPath(GeneralPath.java:969) > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/9df216d2-f182-401d-bb9e-b3d879cfe714%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.