Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ScrollPane in JApplet  RSS feed

 
shalini gnana
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to add a scrollpane to a Panel in an applet.But the scrollPane is not displaying..Can anyone able give a solution...
This is my coding,

private javax.swing.JScrollPane scrollpane;
private javax.swing.JPanel pane;
Container cont = getContentPane();
scrollpane = new JscrollPane(panel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
container.add(scrollpane);
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
container.add(scrollpane); (where, presumably, 'container' is Container cont = getContentPane() ;)

here the scrollpane will occupy the frame (almost), so, for the scrollpane to work,
the panel needs to be a bigger size than that of the frame/scrollpane

e.g.
if the frame's size is (400,300), include this line and see what happens
panel.setPreferredSize(new Dimension(600,400));

if, by some chance, you are using a null layout, you have a lot of work ahead of you.
[edit] disable smileys
[ September 27, 2007: Message edited by: Michael Dunn ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!