how to refresh a Jlist in a JSscrollPane
Hi,
first , sorry for my poor english
i have a JScrollPane with a Jlist inside .
After pushing a button , i recreate the Jlist
and i would like to REFRESH the JScrollPane with my new Jlist.
How can i do that ??
many thanks
code:
.....
private javax.swing.JScrollPane jScrollPane = null;
private JList jList1 = null;
......
private void initialize() {
this.setSize(630, 500);
this.setTitle("Filtre CAO");
this.setName("frmFCAO");
this.setContentPane([u]getJContentPane</u>());
}
private javax.swing.JPanel [u]getJContentPane</u>() {
if (jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
...
JButton b1 = new JButton("chercher");
b1.addActionListener (new ActionListener() {
public void actionPerformed(ActionEvent e) {
...... processing ......
jList1 = new JList(....);
here , HOW TO REFRESH ????
});
.....
jContentPane.add(getJScrollPane(), null);
}
return jContentPane;
........
private javax.swing.JScrollPane getJScrollPane() {
if(jScrollPane == null) {
jScrollPane = new javax.swing.JScrollPane();
jList1 = new JList(........);
jScrollPane.setViewportView(jList1);
jScrollPane.setBounds(25, 34, 299, 129);
jScrollPane.setSize(269, 134);
jScrollPane.setLocation(17, 49);
}
return jScrollPane;
}
|