Skip to main content

animate text scroll?

16 replies [Last post]
zhane
Offline
Joined: 2008-09-27

can we let a chunk of text scroll inside a text area by itself?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zhane
Offline
Joined: 2008-09-27

the PreferredH() doesnt seem to change when the length of my text increases.

it seems to be stuck at 34 no matter the length of text

I've tried setting setShouldCalcPreferredSize(true), but doesnt seem to help

Message was edited by: zhane

another thing... it animates even without f.registerAnimated(TA) and it continues to animate even after f.deregisterAnimated(TA)

Message was edited by: zhane

Chen Fishbein

Hi,
The preferred sizes are used to give a hint to the layouts manager,
TextArea uses the rows and columns to calculate it's preferred size not
the text.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> the PreferredH() doesnt seem to change when the length of my text increases.
>
> it seems to be stuck at 34 no matter the length of text
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323953
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

zhane
Offline
Joined: 2008-09-27

hmm then how should I make it scroll to the last sentence of text
den start again from the first?

Chen Fishbein

There isn't a simple way to do this, we are rethinking the scrolling
architecture.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> hmm then how should I make it scroll to the last sentence of text
> den start again from the first?
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323970
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

zhane
Offline
Joined: 2008-09-27

http://www.sendspace.com/file/t20rrv

I override the animate function in aniTextArea... and used searchClass to create a component of that

zhane
Offline
Joined: 2008-09-27

hmm

then how about...

setting TextField as not editable, setEditable(false)

and adding an actionlistener to it?

when i do this, the actionlistener doesnt seem to be responding.
and when setEditable(true), i will open the TextField first, press okay, before the actionlistener comes in

zhane
Offline
Joined: 2008-09-27

nvm solved

Message was edited by: zhane

zhane
Offline
Joined: 2008-09-27

I declared my TextArea, did a form.registerAnimated(textareaobj) and override animate as follows.. but nothing seem to be happening >.<

must I do something about paint too?

public boolean animate() {
setScrollY(currentheight);
currentheight++;
return true;
}

Shai Almog

This should work (although it should cause the text to disappear once
the scroll passes the height) , if you can produce complete code
which I can compile and test I will take a look.

> I declared my TextArea, did a form.registerAnimated(textareaobj)
> and override animate as follows.. but nothing seem to be happening >.<
>
> must I do something about paint too?
>
> public boolean animate() {
> setScrollY(currentheight);
> currentheight++;
> return true;
> }
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323637
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

zhane
Offline
Joined: 2008-09-27

http://www.sendspace.com/file/t20rrv

I override the animate function in aniTextArea... and used searchClass to create a component of that

Shai Almog

Please don't send attachments like this in the future only via the
issue tracker.
Also please try to use ZIP and not the 7zip extensions since some
people use a different type of application/OS.

I don't think this will scroll since the text area fits exactly,
scrolling in text area is not cyclic and wouldn't behave as you
expect. Try setting a very large amount of text into the area and
verify that "isScrollableY()" returns true.

> http://www.sendspace.com/file/t20rrv
>
> I override the animate function in aniTextArea... and used
> searchClass to create a component of that
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323783
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

zhane
Offline
Joined: 2008-09-27

sorry about this.

how should I add attachments here?

I changed my aniTextArea to row1, column 1...and increased the length of text.
Y is true when i do TA.isScrollableY(), but nothing seems to be happening on my textarea. although my animate() function is being executed

Shai Almog

This works for me:
Form f = new Form();
TextArea t = new TextArea(2, 10) {
public boolean animate() {
int s = getScrollY();
s++;
if(s >= getPreferredH()) {
s = 0;
}
setScrollY(s);
return true;
}
};
t.setGrowByContent(false);
t.setText("Lots of text going on and on\nand on\nAnd
on\nand on\ntill this...");
f.registerAnimated(t);
f.addComponent(t);
f.show();

> sorry about this.
>
> how should I add attachments here?
>
>
>
> I changed my aniTextArea to row1, column 1...and increased the
> length of text.
> Y is true when i do TA.isScrollableY(), but nothing seems to be
> happening on my textarea. although my animate() function is being
> executed
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323890
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

zhane
Offline
Joined: 2008-09-27

thanks

I set my original to 2 row, 10 columns and it moved as well
but anyway decided to use urs.. since it's cleaner

but I find it strange... when I tested I set it to 1 row X column, with the 1 row setting, no matter how many columns there are, it doesnt move

and another one is that when I set X row with 1 column, it will result in java.lang.OutOfMemoryError

Chen Fishbein

Thanks, it's a bug.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> thanks
>
> I set my original to 2 row, 10 columns and it moved as well
> but anyway decided to use urs.. since it's cleaner
>
>
> but I find it strange... when I tested I set it to 1 row X column, with the 1 row setting, no matter how many columns there are, it doesnt move
>
> and another one is that when I set X row with 1 column, it will result in java.lang.OutOfMemoryError
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323952
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

This is not supported by default but you can derive text area and
override animate() to produce the desired effect (with the help of
setScrollY()).

> can we let a chunk of text scroll inside a text area by itself?
> [Message sent by forum member 'zhane' (zhane)]
>
> http://forums.java.net/jive/thread.jspa?messageID=323575
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]