Hello All,
I have a form with a JPanel and a JScrollPane. The panel has a row of components like JTextField, Combo box, check box etc. A button will generate another row of the same components mentioned above. I would like to add scrolling to the JPanel as the number of rows increase so that I can scroll up and down. I am using JDeveloper and my problem is that the scrolling functionality is not added when the number of rows increase. Can any one help how to solve this problem. Any code snippets/explanation will be highly appreciated. I have to urgently implement it.
Thanks in advance.
Kind regards and best wishes.
Hasnain.

Here is my code sample.

// Declarations
private JButton jButton1 = new JButton();
private XYLayout xYLayout1 = new XYLayout();
private ScrollPane scrollPane1 = new ScrollPane();
private Panel panel1 = new Panel();
private JTextField jTextField2 = new JTextField();

// Initialization and setup
this.getContentPane().setLayout( null );
this.setSize(new Dimension(842, 586));
jButton1.setText("jButton1");
jButton1.setBounds(new Rectangle(10, 260, 75, 25));
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
scrollPane1.setBounds(new Rectangle(90, 65, 335, 170));
panel1.setLayout(null);
jTextField2.setBounds(new Rectangle(5, 5, 85, 20));
jTextField2.setText("First TextField");
panel1.add(jTextField2, null);
scrollPane1.add(panel1, null);
this.getContentPane().add(scrollPane1, null);
this.getContentPane().add(jButton1, null);


// action listener method for the button
int x = jTextField2.getBounds().x;
int y = jTextField2.getBounds().y;
JTextField f = new JTextField();
f.setText("Second TextField");
f.setBounds(x,y+20,jTextField2.getWidth(),jTextField2.getHeight());
panel1.add(f,null);
panel1.repaint();
jTextField2 = f;