trackeditor: use showOpenDialog and disable directory creation when selecting files
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8221 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 20548bd598e68231a5a19c9e11d60842ab88d137 Former-commit-id: 260e9d1502d3774556a2233a3b2f089514e3dd5f
This commit is contained in:
parent
b71890c48f
commit
f8353de288
8 changed files with 51 additions and 15 deletions
|
@ -45,6 +45,7 @@ import java.io.FileOutputStream;
|
|||
import java.util.Vector;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
|
@ -223,6 +224,8 @@ public class EditorFrame extends JFrame
|
|||
String tmp = "";
|
||||
String filename = Editor.getProperties().getPath() +sep+"project.xml";
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -234,7 +237,7 @@ public class EditorFrame extends JFrame
|
|||
filter.addValid(".prj.xml");
|
||||
filter.setDescription("*.prj.xml");
|
||||
fc.setFileFilter(filter);
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
tmp = fc.getSelectedFile().toString();
|
||||
|
@ -1303,6 +1306,8 @@ public class EditorFrame extends JFrame
|
|||
String tmp = "";
|
||||
// String filename = Editor.getProperties().getPath();
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -1310,7 +1315,7 @@ public class EditorFrame extends JFrame
|
|||
fc.setDialogTitle("Background image selection");
|
||||
fc.setVisible(true);
|
||||
fc.setCurrentDirectory(new File(System.getProperty("user.dir") + "/tracks"));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
tmp = fc.getSelectedFile().toString();
|
||||
|
|
|
@ -23,6 +23,7 @@ package gui.properties;
|
|||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
|
@ -206,6 +207,8 @@ public class EnvMapProperties extends PropertyPanel
|
|||
protected void envMapFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -213,10 +216,10 @@ public class EnvMapProperties extends PropertyPanel
|
|||
fc.setDialogTitle("Environment Mapping image file selection");
|
||||
fc.setVisible(true);
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("PNG images", "png");
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
|
|
@ -22,6 +22,7 @@ package gui.properties;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
|
@ -205,6 +206,8 @@ public class GraphicProperties extends PropertyPanel
|
|||
protected void backgroundImageFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -215,7 +218,7 @@ public class GraphicProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
|
|
@ -22,11 +22,13 @@ package gui.properties;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.EtchedBorder;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import gui.EditorFrame;
|
||||
import utils.Editor;
|
||||
|
@ -104,6 +106,8 @@ public class ImageProperties extends PropertyPanel
|
|||
String tmp = "";
|
||||
String filename = Editor.getProperties().getImage();
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -120,7 +124,10 @@ public class ImageProperties extends PropertyPanel
|
|||
File file = new File(tmpFile);
|
||||
fc.setCurrentDirectory(file);
|
||||
}
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
pathTextField.setText(fc.getSelectedFile().toString());
|
||||
|
|
|
@ -23,6 +23,7 @@ package gui.properties;
|
|||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
|
@ -347,6 +348,8 @@ public class SurfaceProperties extends PropertyPanel
|
|||
protected void textureNameFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -357,7 +360,7 @@ public class SurfaceProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
@ -395,6 +398,8 @@ public class SurfaceProperties extends PropertyPanel
|
|||
protected void racelineNameFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -405,7 +410,7 @@ public class SurfaceProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
|
@ -271,6 +272,8 @@ public class TerrainProperties extends PropertyPanel
|
|||
protected void elevationMapFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -281,7 +284,7 @@ public class TerrainProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
@ -296,6 +299,8 @@ public class TerrainProperties extends PropertyPanel
|
|||
protected void reliefFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -306,7 +311,7 @@ public class TerrainProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
@ -518,6 +523,8 @@ public class TerrainProperties extends PropertyPanel
|
|||
protected void objectMapFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -525,10 +532,10 @@ public class TerrainProperties extends PropertyPanel
|
|||
fc.setDialogTitle("Object Map image file selection");
|
||||
fc.setVisible(true);
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("PNG images", "png");
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
|
|
@ -23,6 +23,7 @@ package gui.properties;
|
|||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
|
@ -297,7 +298,7 @@ public class TrackLightProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
@ -312,6 +313,8 @@ public class TrackLightProperties extends PropertyPanel
|
|||
protected void textureOffFile()
|
||||
{
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -322,7 +325,7 @@ public class TrackLightProperties extends PropertyPanel
|
|||
FileNameExtensionFilter filter = new FileNameExtensionFilter("RGB and PNG images", "rgb", "png");
|
||||
fc.addChoosableFileFilter(filter);
|
||||
fc.setCurrentDirectory(new File(Editor.getProperties().getPath()));
|
||||
int result = fc.showDialog(this, "Ok");
|
||||
int result = fc.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
String fileName = fc.getSelectedFile().toString();
|
||||
|
|
|
@ -25,6 +25,7 @@ import gui.EditorFrame;
|
|||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JMenuItem;
|
||||
|
@ -64,6 +65,8 @@ public class TorcsPlugin implements Plugin
|
|||
{
|
||||
String tmp = "";
|
||||
JFileChooser fc = new JFileChooser();
|
||||
Action folder = fc.getActionMap().get("New Folder");
|
||||
folder.setEnabled(false);
|
||||
fc.setSelectedFiles(null);
|
||||
fc.setSelectedFile(null);
|
||||
fc.rescanCurrentDirectory();
|
||||
|
@ -78,7 +81,7 @@ public class TorcsPlugin implements Plugin
|
|||
filter.addInvalid(".prj.xml");
|
||||
filter.setDescription("*.xml");
|
||||
fc.setFileFilter(filter);
|
||||
int result = fc.showDialog(editor, "Ok");
|
||||
int result = fc.showOpenDialog(editor);
|
||||
if (result == JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
tmp = fc.getSelectedFile().toString();
|
||||
|
|
Loading…
Reference in a new issue