Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

tell me this!!

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps you would get a better response if you used a more appropriate subject!
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use this code
txtArea.scrollRectToVisible(new Rectangle (0,txtArea.getHeight()-2,1,1));
-regards
prasanna
 
asheet anand
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thankx prasanna but this method works with swings only.i have a canvas here as my textarea and that too in awt..
asheet
 
Saloon Keeper
Posts: 25608
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic