public SkymapTextureLoader(RenderManager renderMan) {
this.renderMan = renderMan;
}
@Override
public void actionPerformed(ActionEvent e) {
CenteredFileDialog fileDialog =
new CenteredFileDialog(null, "Open Skymap", FileDialog.LOAD);
String directory;
synchronized (SkyboxTextureLoader.class) {
directory = defaultDirectory;
}
fileDialog.setDirectory(directory);
fileDialog.setFilenameFilter(
new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".png")
|| name.toLowerCase().endsWith(".jpg")
|| name.toLowerCase().endsWith(".hdr")
|| name.toLowerCase().endsWith(".pfm");
}
});
fileDialog.setVisible(true);
File selectedFile = fileDialog.getSelectedFile();
if (selectedFile != null) {
synchronized (SkyboxTextureLoader.class) {
File parent = selectedFile.getParentFile();
if (parent != null) {
defaultDirectory = parent.getAbsolutePath();