• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Attaching Scrollbars to Containers

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can ScrollBar be Attached to Containers like Applet, frame etc.
I have a big user registration Applet and I want to make it small size and attach the scroll bar so that users can scroll and fill up the data. Please help me,How can I acieve this?
- Dev Prakash
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can get better help here.
Ajith
[This message has been edited by Ajith Kallambella (edited October 18, 2000).]
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dev Prakash,

/* Declares JScrollPane reference scroller and initializes with a
new JScrollPane object. */
JScrollPane scroller = new JScrollPane (outputArea);
scroller.setBackground(Color.pink);
scroller.setForeground(Color.magenta);
/* Get the applet's GUI component display area and attaches the
scroller to the Container c. */
Container c = getContentPane();
c.add(scroller);
 
prasanth Tata
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi dev prakash,
Sorry previous message was incomplete.
You can use JScrollPane class to solve your problem.
Follow this code :-
JTextArea outputArea = new JTextArea(10,20);
/* Declares JScrollPane reference scroller and initializes with a
new JScrollPane object. */
JScrollPane scroller = new JScrollPane (outputArea);
scroller.setBackground(Color.pink);
scroller.setForeground(Color.magenta);
/* Get the applet's GUI component display area and attaches the
scroller to the Container c. */
Container c = getContentPane();
c.add(scroller);
May be it helps you !
Take care
Prasanth Tata
 
Dev Prakash
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Prasanth Tata,
This solutions works, but I wanted to just work with AWT Components and not Swing.
I can attach a panel to applet and scrollpane to panel and all other components to scrollpane. And it works fine, BUT I wanna know if we can directly attach scroll bar to applet.
-Dev Prakash
reply
    Bookmark Topic Watch Topic
  • New Topic