import java.applet.Applet; import java.awt.*; /** Places a Panel holding 100 buttons in a ScrollPane that is * too small to hold it. * */ public class ScrollPaneTest extends Applet { public void init() { setLayout(new BorderLayout()); ScrollPane pane = new ScrollPane(); Panel bigPanel = new Panel(); bigPanel.setLayout(new GridLayout(10, 10)); for(int i=0; i<100; i++) { bigPanel.add(new Button("Button " + i)); } pane.add(bigPanel); add(pane, BorderLayout.CENTER); } }
Places a Panel holding 100 buttons in a ScrollPane
Permanent link to this article: http://bangla.sitestree.com/places-a-panel-holding-100-buttons-in-a-scrollpane/