Adding Scrollbar to JPanel...
843806Mar 6 2008 — edited Mar 13 2008Hi i need to add scrollbar to JPanel. I added a JPanel to JScrollpane. Then i added the JScrollpane to JFrame but only the JScrollPane gets displayed and not the JPanel.
final BarChartDisp bcd = new BarChartDisp(ptcor1,ptcor2,max, "Event Specication - "+eventsCount+":"+event);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
bcd.getContentPane().setLayout(new BorderLayout());
JScrollPane js = new JScrollPane();
js.setLayout(new ScrollPaneLayout());
JPanel p = bcd.fillItems();
js.add(p);
js.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
bcd.getContentPane().add(js);
bcd.setVisible(true);
}
here BarChartDisp extends JFrame. bcd.fillItems() returns an object of class BarChart which extends JPanel. Pl help..
Thanks!