File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Scroll ........i need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Scroll ........i need help" Watch "Scroll ........i need help" New topic
Author

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

Kajol Shroff
Ranch Hand

Joined: Dec 04, 2000
Posts: 160
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

Joined: Feb 22, 2001
Posts: 156
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

Joined: Dec 04, 2000
Posts: 160
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

Joined: Dec 09, 2000
Posts: 55
// 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

Joined: Jun 14, 2000
Posts: 347
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

Joined: Dec 04, 2000
Posts: 160
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

Joined: Feb 22, 2001
Posts: 156
Why don't you post the code you are using? I tested the following and it works just fine:
Kajol Shroff
Ranch Hand

Joined: Dec 04, 2000
Posts: 160
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scroll ........i need help
 
Similar Threads
what's the possible reason?
How to scroll with the mouse horizontally
Problem with JTable when no. of records are more than the size of frame!!!
positioning scrollbar
JScrollPane