I have a seperate class that extends SwingWorker, I want it to open a file in background and when done it will set the text of a component in the Main class.
Isn’t it possible to open the filechooser somehow like this? fc.showOpenDialog(Main); Because this gives me errors when building.
The argument passed to
showOpenDialogshould be the parent component for the dialog. So if your Main class extends Component, you can pass an instance of that class toshowOpenDialog. You cannot simply pass a class name.