• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HELP ! Scrollpanes on Panels

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all - hope you can help...
I have a JPanel & I have a JScrollPane on it.....
the panel & the components on it are seen, as are the scrollbars but it wont scroll. I know there are components hidded that it should scroll to, but it just wont scroll....
Any ideas?
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a seemingly similar problem - I have a JScrollPane with a JTable in it - the table is longer and wider than the pane, when the application is running, and although both scrollbars look good, only the vertical bar allows scrolling - the horizontal one doesn't.
Any ideas ?
Thanks, Kate
 
Dave Donohoe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kate -
I managed to fix the problem....my code was OK, the problem I was having was that the order in which I created & added the ScrollPane & the Panel I wanted on it was a bit off....its very weird....but this code (which I found elsewhere on JavaRanch) shows a correct order for the components....I dont know if it will make a difference in your app, but it did help me......
import java.awt.*;
import javax.swing.*;
public class Test extends JFrame
{
public Test()
{
JLabel bigLabel = new JLabel("Really Big Label"); bigLabel.setFont(bigLabel.getFont().deriveFont(200.0F));
JPanel panel = new JPanel();
panel.add(bigLabel);
JScrollPane scrollPane = new JScrollPane(panel); getContentPane().add(scrollPane);
setSize(new Dimension(200, 200));
setVisible(true);
}
public static void main(String[] s)
{
new Test();
}
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic