How to pass parameters between the GUI components?

I have the following code to select a doc file using JFileChooser:

private void jPanel3MouseClicked(java.awt.event.MouseEvent evt) {                                     
    JFileChooser fc = new JFileChooser("user.home");
    fc.setAcceptAllFileFilterUsed(false);
    FileNameExtensionFilter filter = new FileNameExtensionFilter("Document Files", "Doc", "Docx");
    fc.setFileFilter(filter);
    int result = fc.showOpenDialog(this);
    if (result == JFileChooser.APPROVE_OPTION) {
    File selectedFile = fc.getSelectedFile();
    JOptionPane.showMessageDialog(null, "File Selected Successfully !");
     }
}     

And a JTextField to get the keyword to be searched in the above selected document:

private void strActionPerformed(java.awt.event.ActionEvent evt) {                                    

     String key = str.getText();
     JOptionPane.showMessageDialog(null, "you entered"+key);
     str.setText("");//to clear the field after entering the string
}

Now how can I search the presence of the keyword in the document using a button? I am more concerned with how the file and the keyword can be passed to the button to carry out further operations?