tblackwe
asked on
Using JScrollPanes
Check out the code below and see if you can tell me why my windows don't show the ScrollPane the way it's supposed to:
Border compound = BorderFactory.createEmptyB order(0,10 ,10,10);
ev = new EventView(jDateTree, top, thisDateHash); // returns a JPanel
jEvent Panel = new JPanel();
jEventPanel.setBounds(0,0, 780,getHei ght());
jEventPanel.setLayout(null );
ev.setLayout(null);
ev.setBounds(170,30,500,ge tHeight()- 30);
ev.setBorder(compound);
JScrollPane evScrollPane = new JScrollPane(ev);
JEventPanel.setPrefferredS ize(new Dimension(getWidth() - 170, getHeight() - 30));
evScrollPane.setBounds(170 ,30,1000,g etHeight() -30);
jEventPanel.add(evScrollPa ne);
JEventPanel.setBorder(comp ound);
My applet compiles and runs fine. It shows what it is supposed to, but there is only one scrollbar at the bottom of the applet. This should be a simple task, yet I don't know why it's not working. Could someone please help!!!????The element that is supposed to be scrolled is a JPanel, and I know it's legal to have a JPanel inside a scroll pane right?
Border compound = BorderFactory.createEmptyB
ev = new EventView(jDateTree, top, thisDateHash); // returns a JPanel
jEvent Panel = new JPanel();
jEventPanel.setBounds(0,0,
jEventPanel.setLayout(null
ev.setLayout(null);
ev.setBounds(170,30,500,ge
ev.setBorder(compound);
JScrollPane evScrollPane = new JScrollPane(ev);
JEventPanel.setPrefferredS
evScrollPane.setBounds(170
jEventPanel.add(evScrollPa
JEventPanel.setBorder(comp
My applet compiles and runs fine. It shows what it is supposed to, but there is only one scrollbar at the bottom of the applet. This should be a simple task, yet I don't know why it's not working. Could someone please help!!!????The element that is supposed to be scrolled is a JPanel, and I know it's legal to have a JPanel inside a scroll pane right?
hi,
try this
evScrollPane.getViewport() .add(param eter, null);
parameter = e.g., list,table
mb...
try this
evScrollPane.getViewport()
parameter = e.g., list,table
mb...
Stalefish has it, you have to explicit them if you want to view them...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
JScrollpane.setVerticalScr
and
JScrollPane.setHorizontalS
Dustin