Hi Eugene,

by default ULCTextArea does not limit the number of characters you may
enter.
This behaviour is similar to the Swing-based JTextArea component.

To limit the number of lines or the number of characters, you should write
an extension
as you already suggested. If you do this, you can rely on the Swing and
write a document
filter that performs this task.
The following URL gives an example of writing a related document filter for
Swing:
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#
filter

Greetings,

Daniel

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Eugene Coelho
Sent: Donnerstag, 18. Mai 2006 15:18
To: UlC Devleoper list
Subject: [ULC-developer] Restrict No of Lines in a Text Area


Hi
Is there a way in  which i can restrict the no of lines entered in text area
Current behaviour  seems to allow user to  enter any no of lines  i need to
restrict this to allow only 4 lines and not more that .
I tried overriding the caret update in my own extension
it started giving Attempt to mutate in notification  exception

public class UIMyTextArea extends UITextArea {

    @Override
    public void caretUpdate(CaretEvent e) {
        // TODO Auto-generated method stub
        //super.caretUpdate(e);
        String text = getValue().toString();
        StringBuffer textbuf = new StringBuffer(text);
        final int size = text.length();
        final int maxSize = 50; //  no of characters  could be anything
        System.out.println("Text Area String "+size + " Max Size"+maxSize);
        if (size > maxSize)
        {
        textbuf.delete(0, size - maxSize);
        setText(textbuf.toString());
        }
        //vBar.setValue(vBar.getMaximum());
    }
}

Tried  the samething with  filterinput  only to give me heap overflow errors

Thanks and Regards ,
Gene


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to