I'm trying to create Frame with 2 JButtons and 1 JList.
Buttons are Add and Remove. After clicking Add button JFileChooser creates and user choses a file.
The file then must to be added to the JList.

public class GmFrame extends JFrame {

	private JButton bAdd;
	private JButton bRemove;
	public JList jl;
	public Vector<File> vf = new Vector<File>();
	public GmFrame() {
		super("GM & OBP");
		Container c = this.getContentPane();
		c.setLayout(new FlowLayout(FlowLayout.LEFT, 10,10));
		JPanel p = new JPanel();
		p.setLayout(new BorderLayout(10,0));
		bAdd = new JButton("Add");
		bRemove = new JButton("Remove");
		jl = new JList(vf);
		jl.setPreferredSize(new Dimension(500,100));
		vf.add(new File("C://"));
		vf.add(new File("D://"));
		p.add(bAdd, BorderLayout.WEST);
		p.add(bRemove, BorderLayout.EAST);
		p.add(jl, BorderLayout.CENTER);
	private void addActionListeners() {
		bAdd.addActionListener(new AddListener(this));
				new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						System.out.println(jl.getSelectedValue().getClass().getName() );
						int i = jl.getSelectedIndex();

class AddListener implements ActionListener {
	GmFrame gf;
	AddListener(GmFrame gf) {
		this.gf = gf;
		public void actionPerformed(ActionEvent arg0) {
			JFileChooser fileChooser = new JFileChooser(new File("C:/Program Files/"));
			int ret = fileChooser.showDialog(null, "Open file");
			if (ret == JFileChooser.APPROVE_OPTION) {
		      File file = fileChooser.getSelectedFile();

My problem is that chosen file doesn't shown on the frame. But the file is added to the Vector that linked with JList.
What have I do to "refresh" the frame?
Could someone please show me my mistake?

Thanks in advance

Because you add it only to vector and not the JList:


You added it successfully to the Vector but where is the code that adds it to list?

Thank you, javaAddict.

Just I thought JList use Observer/Observable interface. So if Vector changes, the JList changes too. Apparently my understanding is wrong.

javaAddict, could you please tell me how can I add element to JList?
Should I create new JList?