add a new line depending on the amount of character (or words)
how could i make it so if you split a certain string onto different lines after a certain amount of characters( but i dont want words split in half).
EG:
dont want it to look like this:
--------------------------------
| kkjhlgljhgljhghgjhgjhgljhgjbh,kghkhlkhlkjhlkjhlglhlkjhkljhlkh |
| |
| |
| |
--------------------------------
But like this:
---------------------------------
| kjjkhjlhkjhlhgvjhdkljhglkrgh |
| kjhlkukjhkjhlkjhlkjhlkjhlkjhlkj |
| jkhklhljkhljkhlkjlj |
| |
---------------------------------
(this looks wired after i posted it ) ;/
this is the code ive already come up with:
public help(int width,int height,String text) { img = new GreenfootImage(width+1, height+1); img.setColor(new Color(108,170,199,124)); img.fillRect(0,0,width,height); setImage(img); Font font = img.getFont(); font = font.deriveFont(FONT_SIZE); img.setFont(font); img.drawString(text,5,5); }