Re: how to make a scroll pane in a JApplet
thewhoracle schrieb:
I am using gridbaglayout and have a 800x600 Japplet. i want it to stay
800x600 but be able to scroll down because i have too many fields to
fit on 600. I tried using the examples java.sun has it won't work.
can someone point to me a very simple example of scrollpane or
scrollbar usage in a JApplet or tell me an easy way to do this?
Try the following in your JApplet:
public void init()
{
JComponent yourLargeComponent = ....;
JScrollPane scrollPane = new JScrollPane();
scrollPane.getViewport().add(largeComponent);
this.getContentPane().add(scrollPane);
}
Note that you must not add directly to the
JScrollPane/JApplet but to their viewport/contentpane.
--
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
.