Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HELP ! Scrollpanes on Panels

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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();
}
}
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic