wood burning stoves 2.0*
The moose likes Applets and the fly likes tell me this!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "tell me this!!" Watch "tell me this!!" New topic
Author

tell me this!!

asheet anand
Ranch Hand

Joined: Nov 15, 2000
Posts: 83
hi everybody,
a have a simple ??
i'm working on a chat application. my message displaying area is a canvas.i have added scroll-bars to it using scroll-pane
"sp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);"
now what i want is the scrollbars should adjust automatically to display the last message and also i should be able to adjust them
manually so that i can view the previous messages.
i have tried setScrollposition() it works well also but then i'm not able to adjust scrollbars manually.
this interface is in AWT.
please tell me a solution.its a bit urgent.
thankx and regards
asheet
asheet anand
Ranch Hand

Joined: Nov 15, 2000
Posts: 83
hi everyone,
no seems to be able to answer my ?? which is a bit stunning .i'll like to request Mr.Manfred Leonhardt
to please help me out..
thankx
asheet
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Asheet,
I can not help you with the problem. I have never attempted it so I have no clue as to how to do it.
Sorry,
Manfred
Scott Palmer
Ranch Hand

Joined: Jul 11, 2001
Posts: 31
Perhaps you would get a better response if you used a more appropriate subject!
Prasanna KumarBP
Greenhorn

Joined: Jul 25, 2001
Posts: 21
use this code
txtArea.scrollRectToVisible(new Rectangle (0,txtArea.getHeight()-2,1,1));
-regards
prasanna
asheet anand
Ranch Hand

Joined: Nov 15, 2000
Posts: 83
thankx prasanna but this method works with swings only.i have a canvas here as my textarea and that too in awt..
asheet
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

You use a low-level component, you'll need a low-level solution.
In other words, when the scrollbar moves, you'll have to redraw the affected parts of the canvas.
For smooth scrolling, you'll need to bit-blit. It's simpler to scroll line-by-line by rerendering the strings, but that makes for jerkier operation.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: tell me this!!
 
Similar Threads
JScrollPane & JPanel dynamic changes
regarding JTable scrollabrs
Handling scrollpanes
Help with JScrollPane
scrollbar platform differences using version 1.1