D
Dan Rifkin
I've programmed other languages, now I'm learning Java. I have a simple
applet based on a sample from Sun's jdk 6.0.11. I'm trying to add a scroll
bar.
public class DrawTest extends Applet{
DrawPanel panel;
DrawControls controls;
Scrollbar scrollbar;
public void init()
{
setLayout(new BorderLayout());
panel = new DrawPanel();
controls = new DrawControls(panel);
scrollbar = new Scrollbar(Scrollbar.HORIZONTAL);
add("Center", panel);
add("North", controls);
add(scrollbar);
scrollbar.move(50, 50);
scrollbar.resize(80, 20);
}
<snip>
If I add the scroll bar with add ("South", scrollbar); it's
placed at the south end of the applet, extending from
right to left.
If I add it as above, it takes up the entire app window
except for the component on the north side, as if it's
ignoring the move() and resize() methods. What I want
to do is have two scroll bars on the applet window that
I can place next to each other, or otherwise arbitrarily
size and place.
If I comment out the setLayout(), the scrollbar appears
in a different place, but still seems to ignore move()
and size().
Thanks for any help!
applet based on a sample from Sun's jdk 6.0.11. I'm trying to add a scroll
bar.
public class DrawTest extends Applet{
DrawPanel panel;
DrawControls controls;
Scrollbar scrollbar;
public void init()
{
setLayout(new BorderLayout());
panel = new DrawPanel();
controls = new DrawControls(panel);
scrollbar = new Scrollbar(Scrollbar.HORIZONTAL);
add("Center", panel);
add("North", controls);
add(scrollbar);
scrollbar.move(50, 50);
scrollbar.resize(80, 20);
}
<snip>
If I add the scroll bar with add ("South", scrollbar); it's
placed at the south end of the applet, extending from
right to left.
If I add it as above, it takes up the entire app window
except for the component on the north side, as if it's
ignoring the move() and resize() methods. What I want
to do is have two scroll bars on the applet window that
I can place next to each other, or otherwise arbitrarily
size and place.
If I comment out the setLayout(), the scrollbar appears
in a different place, but still seems to ignore move()
and size().
Thanks for any help!