hi
i hve following code prgram working good
but component not visible which are scrolled
how can i scroll them help
import java.awt.*;
import javax.swing.*;
import java.net.*;
import java.awt.event.*;
class SDemo2
{
static JScrollBar sv;
static JPanel p;
static JViewport jvp;
public static void main(
String a[])
{
JScrollPane j ;
jvp=new JViewport();
sv =new JScrollBar(JScrollBar.VERTICAL,0,0,0,600);
p=new JPanel();
p.setLayout(null);
JFrame f=new JFrame();
JButton b[]=new JButton[100];
//JTextField b[]=new JTextField[90];
int y=10;
for(int i=0; i<15; i++)
{
b[i]=new JButton("High");
b[i].setBounds(10,y,100,50);
y=y+40;
p.add(b[i]);
}
jvp.add(p);
f.getContentPane().add(jvp,BorderLayout.CENTER);
f.getContentPane().add(sv,BorderLayout.EAST);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
f.setSize(500,500);
sv.addAdjustmentListener(new AdjustmentListener()
{
public void adjustmentValueChanged( AdjustmentEvent e)
{
JScrollBar h=(JScrollBar)e.getSource();
Point pt=jvp.getViewPosition();
pt.y=e.getValue();
jvp.setViewPosition(pt);
}});
}
}