Hi,
I had create a rectangle in Canvas like the textfield and now I can print my input in that rectangle, I want that how can I write the input when it's size is bigger than the rectangle! I want that when it's size is bigger than the rectangle the remain of my input must be shown and the input which I wrote earlier must be shifted! actualy I want to scroll my input in the rctangle, How can I do it? Could anyone show me sample code for it please?
to scrolling the input in the rectangle I worte some code like below but when i scroll the input with Canvas.Right the String which I inserted after scrolling will be seprated to characters! Could you help me to solve it please?How could I shift the String when I click on Canvas.Right?
public void copyStr(){ tchar=this.text.toCharArray(); copy=text.length()-1; textchar[cp]=tchar[copy]; t[p]=textchar[cp]; cp++; p++; if(text.length()>=9){ shiftRight(); } } public void shiftRight(){ int m=0; String temp; char []te; for (int i=10;i<this.text.length()-1;i++){ t[i-1]=t[i]; } for(int i=10;i<this.text.length()-1;i++){ textchar[m]=t[i]; m++; } text=new String(textchar); } protected void keyPressed(int keyCode) { if(keyCode==-4){ shiftRight(); } long currentTime = System.currentTimeMillis(); int pressedKeyNum = getNum(keyCode); if( pressedKeyNum >= 0 && pressedKeyNum <= 9 ) { if(keyCode == this.lastKeyStroke && currentTime - this.lastKeyStrokeTime < MIN_STROKE_TIME) { cursorplace++; cursor[cursorplace]='_'; this.text = this.text.substring(0, this.text.length() - 1); this.text += KEY_MAP[pressedKeyNum][this.lastKeyStrokeIndex]; this.lastKeyStrokeIndex++; copyStr(); } else { this.text += KEY_MAP[pressedKeyNum][0]; this.lastKeyStrokeIndex = 1; copyStr(); } if(this.lastKeyStrokeIndex >= KEY_MAP[pressedKeyNum].length) { this.lastKeyStrokeIndex = 0; } else { if( pressedKeyNum == 10 ) { this.remove(); } } this.lastKeyStroke = keyCode; this.lastKeyStrokeTime = System.currentTimeMillis(); } }