Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PJC text Trim

792859Sep 17 2010 — edited Sep 19 2010
Hello !

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)
This post has been answered by François Degrelle on Sep 18 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2010
Added on Sep 17 2010
4 comments
924 views