chooser.setSelectedFile(file);
            public void actionPerformed(ActionEvent e) {                JFileChooser chooser = new JFileChooser();                chooser.showOpenDialog(LoginPanel.this);                File selectedFile = chooser.getSelectedFile();                                if(selectedFile==null){                    JOptionPane.showMessageDialog(LoginPanel.this, "No favourites file selected", "Error", JOptionPane.ERROR_MESSAGE);                    return;                }                                if(!selectedFile.canRead()){                    JOptionPane.showMessageDialog(LoginPanel.this, "Cannot read selected file", "Error", JOptionPane.ERROR_MESSAGE);                    return;                }                                importFavourites(selectedFile);                                repaint();            }