PJC text Trim
792859Sep 17 2010 — edited Sep 19 2010Hello !
I am trying to create a PJC for a text item to automatically trim leading or trailing blank spaces. I thaught it was simple but when i try to enter the text "java" with a white space at the beginning each time I press the space bar I have an error message in the java console, the applet is dead .
here is my PJC code
import java.awt.Component;
import oracle.forms.handler.IHandler;
import oracle.forms.ui.VTextField;
public class TextTrim extends VTextField {
static IHandler mHandler;
public TextTrim() {
super();
}
public void init(IHandler handler)
{
super.init(handler);
mHandler = handler;
// put your initialisation instructions here
}
public String getText() {
return super.getText().trim();
}
}
I have this error
Exception in thread "AWT-EventQueue-2" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.substring(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextField.scrollSelectionIntoView(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextComponent.replaceRangeDamage(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWCommonText.processKeyEvent(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextField.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextField.processEventImpl(Unknown Source)