Dimension d = sp.getViewportSize(); sp.setScrollPosition ((int)(Math.random()*d.width), (int)(Math.random()*d.height));
if (e.getID() == ContainerEvent.COMPONENT_ADDED) { if (e.getChild() instanceof Button) { Button b = (Button)e.getChild(); b.addActionListener(this); } }
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");