FileDocCategorySizeDatePackage
scroll.javaAPI DocExample1375Mon Mar 24 01:57:50 GMT 1997None

scroll

public class scroll extends Applet implements ActionListener, ContainerListener

Fields Summary
ScrollPane
sp
Constructors Summary
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

        Dimension d = sp.getViewportSize();
        sp.setScrollPosition ((int)(Math.random()*d.width), 
            (int)(Math.random()*d.height));
    
public voidcomponentAdded(java.awt.event.ContainerEvent e)

        if (e.getID() == ContainerEvent.COMPONENT_ADDED) {
            if (e.getChild() instanceof Button) {
                Button b = (Button)e.getChild();
                b.addActionListener(this);
            }
        }
    
public voidcomponentRemoved(java.awt.event.ContainerEvent e)

    
public voidinit()

        
        setLayout (new BorderLayout ());
        Panel p = new Panel(new GridLayout (7, 8));
        p.addContainerListener (this);
        for (int j=0;j<50;j++)
            p.add (new Button ("Button-" + j));
        sp.add (p);
        add (sp, "Center");