/* JScrollPane */
import javax.swing.*;
import java.awt.*;
public class JScrollPanedemo extends JApplet
{
public void init()
{
try
{
SwingUtilities.invokeAndWait(new Runnable(){
public void run()
{
makeGUI();
}
});
}
catch(Exception e)
{
System.out.println("Cant create because"+e);
}
}
private void makeGUI()
{
JPanel jp=new JPanel();
jp.setLayout(new GridLayout(5,5));
int b=0;
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
jp.add(new JButton("Button"+b));
b++;
}
}
JScrollPane jsp=new JScrollPane(jp);
add(jsp);
}
}
********************************************************************
<html>
<body>
<applet code="JScrollPanedemo.class" width=200 height=300>
</applet>
</body>
</html>
*****************************************************************
No comments:
Post a Comment