This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scroll ........i need help

 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
Again i have some problem ... tell me how do i use Scrollbar or ScrollPane.......i mean i need to display in a panel and since the data is too long so i need to use ScrollPane or Scrollbar...
Please help me.......
Can anybody please explain me with an example....
Kajol
 
Angela Lamb
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's very straightforward. Just add the panel to the ScrollPane the same as you would with any other container. Here's a link to the API:
http://java.sun.com/j2se/1.3/docs/api/java/awt/ScrollPane.html


ScrollPane pane = new JScrollPane();
Panel panel = new Panel();
pane.add(panel);
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,
I havent got any more replies.......
Angela I tried ur suggestions but failed ...
Can u or anybody else expalin and elaborte the ScrollPane with an example.......
Waiting for reply...
 
Stanley George
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// to enable scrolling
JScrollPane decryptPane = new JScrollPane();
// add the text area(or anything) to the scroll pane
decryptPane.getViewport().add(textArea);

hope this helps
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kajol,
Here is one way to do what you are asking:

This code displays labels in a scrolling panel.
Hope this helps.
Stephanie
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stanley,
I dont want to use Swing ...just a plane applet....
and Stephanie Grasson i have been trying to implemet it in applet ... let me try....well till the mean time can u give me an example using applet...........
Kajol

 
Angela Lamb
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you post the code you are using? I tested the following and it works just fine:
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Angela
Even I tried and it worked........
Sorry for the inconvinience.........I am a fresher...so a bit slow..but let me tell u u all guys re really prompt in your responses.
Cheers
Kajol
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic