Hello,
I'm writting a Popup class, which as the name suggests, will display various popup messages for the user.
So far I've got this constructor working, but it's just a standard rectangle with sharp edges.
I'm trying to figure out how to round the edges so I end up with a rounded rectangle.
Could someone show me how to do that in Greenfoot?
I'm also open to the idea of using 2D classes such as RoundRectangle2D etc., although I'm unfamiliar with it and don't know if Greenfoot will support it.
Thanks a lot!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public Popup(String text) { int fontSize = 35 ; Color fontColor = new Color( 32 , 51 , 76 ); Color fontBgColor = new Color( 0 , 0 , 0 , 0 ); Color bgColor = new Color( 255 , 255 , 255 , 100 ); GreenfootImage txtImg = new GreenfootImage(text, fontSize, fontColor, fontBgColor); GreenfootImage img = new GreenfootImage(txtImg.getWidth()+ 40 , txtImg.getHeight()+ 40 ); img.setColor(bgColor); img.fill(); img.drawImage(txtImg, (img.getWidth() - txtImg.getWidth())/ 2 , (img.getHeight() - txtImg.getHeight())/ 2 ); setImage(img); } |