keyboard.zip
This is the part of the code i've been having trouble with... It prints a string but it runs off the left side when it becomes larger. I don't know where I'm going wrong with this. The cursor can stay between two strings 's' and 's2' which are divided up in an Arraylist full of characters typed.
- if(update){
- if(!textField.isEmpty()){
- for(int i=0; i<cur;i++){
- s+=Character.toString(textField.get(i));
- }
- for(int i = cur; i<textField.size();i++){
- s2+=Character.toString(textField.get(i));
- }
- sw = textWidth(s);
- }
- }
- if(!textField.isEmpty()){text(s,10,50);}
- line(10+sw,0,10+sw,100);
- if(cur!=textField.size()){text(s2,11+sw,50);}
- s="";
- s2="";
2