I know the piece of code below is far from perfect but it does what I want it to do. My problem is that I can’t understand what object is the “this” keyword pointing at.
public class Browser extends JFileChooser{
public File browser_creation(){
int r;
JFileChooser browser1 = new JFileChooser();
r = browser1.showOpenDialog(this);
if (r == Browser.APPROVE_OPTION) {
return browser1.getSelectedFile();
}
else {
return null;
}
}
}
thispoints to the current instance of Browser. In other words, it is referring to the object that it is being executed in.Here is some more information from the Java tutorials: http://download.oracle.com/javase/tutorial/java/javaOO/thiskey.html