72 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
73 |
import javax.swing.JTextField; |
import javax.swing.JTextField; |
74 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
75 |
|
import javax.swing.ListSelectionModel; |
76 |
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
77 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
78 |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionEvent; |
113 |
public void propertyChange(PropertyChangeEvent e) |
public void propertyChange(PropertyChangeEvent e) |
114 |
{ |
{ |
115 |
JFileChooser filechooser = getFileChooser(); |
JFileChooser filechooser = getFileChooser(); |
116 |
// FIXME: Multiple file selection waiting on JList multiple selection |
|
|
// bug. |
|
117 |
String n = e.getPropertyName(); |
String n = e.getPropertyName(); |
118 |
|
if (n.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) |
119 |
if (n.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) |
{ |
120 |
|
if (filechooser.isMultiSelectionEnabled()) |
121 |
|
fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
122 |
|
else |
123 |
|
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
124 |
|
} |
125 |
|
else if (n.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) |
126 |
{ |
{ |
127 |
File file = filechooser.getSelectedFile(); |
File file = filechooser.getSelectedFile(); |
128 |
if (file == null) |
if (file == null) |
150 |
setDirectory(currentDirectory); |
setDirectory(currentDirectory); |
151 |
boolean hasParent = (currentDirectory.getParentFile() != null); |
boolean hasParent = (currentDirectory.getParentFile() != null); |
152 |
getChangeToParentDirectoryAction().setEnabled(hasParent); |
getChangeToParentDirectoryAction().setEnabled(hasParent); |
|
//boxEntries(); |
|
153 |
} |
} |
154 |
|
|
155 |
else if (n.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) |
else if (n.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) |
379 |
setIcon(fileView.getIcon(file)); |
setIcon(fileView.getIcon(file)); |
380 |
setText(fileView.getName(file)); |
setText(fileView.getName(file)); |
381 |
|
|
|
// FIXME: we can't go creating a new border here every time... |
|
|
//setBorder(BorderFactory.createEmptyBorder(0, index * 8, 0, 0)); |
|
382 |
if (isSelected) |
if (isSelected) |
383 |
{ |
{ |
384 |
setBackground(list.getSelectionBackground()); |
setBackground(list.getSelectionBackground()); |
429 |
File f = (File) value; |
File f = (File) value; |
430 |
setText(v.getName(f)); |
setText(v.getName(f)); |
431 |
setIcon(v.getIcon(f)); |
setIcon(v.getIcon(f)); |
432 |
|
setOpaque(true); |
433 |
if (isSelected) |
if (isSelected) |
434 |
{ |
{ |
435 |
setBackground(list.getSelectionBackground()); |
setBackground(list.getSelectionBackground()); |
622 |
} |
} |
623 |
|
|
624 |
/** |
/** |
625 |
* A mouse listener for the {@link JFileChooser}. This class is not yet |
* A mouse listener for the {@link JFileChooser}. |
|
* implemented. |
|
626 |
*/ |
*/ |
627 |
protected class SingleClickListener |
protected class SingleClickListener |
628 |
extends MouseAdapter |
extends MouseAdapter |
629 |
{ |
{ |
630 |
|
|
631 |
|
/** Stores instance of the list */ |
632 |
|
JList list; |
633 |
|
|
634 |
/** |
/** |
635 |
* Creates a new listener. |
* Creates a new listener. |
636 |
* |
* |
638 |
*/ |
*/ |
639 |
public SingleClickListener(JList list) |
public SingleClickListener(JList list) |
640 |
{ |
{ |
641 |
// FIXME: implement |
this.list = list; |
642 |
} |
} |
643 |
|
|
644 |
/** |
/** |
854 |
|
|
855 |
this.cancelButtonMnemonic = 0; |
this.cancelButtonMnemonic = 0; |
856 |
this.cancelButtonText = "Cancel"; |
this.cancelButtonText = "Cancel"; |
857 |
this.cancelButtonToolTipText = "Cancel ToolTip Text"; |
this.cancelButtonToolTipText = "Abort file chooser dialog"; |
858 |
|
|
859 |
this.directoryOpenButtonMnemonic = 0; |
this.directoryOpenButtonMnemonic = 0; |
860 |
this.directoryOpenButtonText = "Open"; |
this.directoryOpenButtonText = "Open"; |
861 |
this.directoryOpenButtonToolTipText = "Open ToolTip Text"; |
this.directoryOpenButtonToolTipText = "Open selected directory"; |
862 |
|
|
863 |
this.helpButtonMnemonic = 0; |
this.helpButtonMnemonic = 0; |
864 |
this.helpButtonText = "Help"; |
this.helpButtonText = "Help"; |
865 |
this.helpButtonToolTipText = "Help"; |
this.helpButtonToolTipText = "Filechooser help"; |
866 |
|
|
867 |
this.openButtonMnemonic = 0; |
this.openButtonMnemonic = 0; |
868 |
this.openButtonText = "Open"; |
this.openButtonText = "Open"; |
869 |
this.openButtonToolTipText = "Open ToolTip Text"; |
this.openButtonToolTipText = "Open selected file"; |
870 |
|
|
871 |
this.saveButtonMnemonic = 0; |
this.saveButtonMnemonic = 0; |
872 |
this.saveButtonText = "Save"; |
this.saveButtonText = "Save"; |
873 |
this.saveButtonToolTipText = "Save ToolTip Text"; |
this.saveButtonToolTipText = "Save selected file"; |
874 |
|
|
875 |
this.updateButtonMnemonic = 0; |
this.updateButtonMnemonic = 0; |
876 |
this.updateButtonText = "Update"; |
this.updateButtonText = "Update"; |
877 |
this.updateButtonToolTipText = "Update ToolTip Text"; |
this.updateButtonToolTipText = "Update directory listing"; |
878 |
} |
} |
879 |
|
|
880 |
/** |
/** |
929 |
{ |
{ |
930 |
JPanel panel = new JPanel(new BorderLayout()); |
JPanel panel = new JPanel(new BorderLayout()); |
931 |
fileList = new JList(getModel()); |
fileList = new JList(getModel()); |
932 |
|
|
933 |
// a bug is preventing the vertical wrap from working right now, |
// a bug is preventing the vertical wrap from working right now, |
934 |
// uncomment the next line once that is fixed... |
// uncomment the next line once that is fixed... |
935 |
//fileList.setLayoutOrientation(JList.VERTICAL_WRAP); |
//fileList.setLayoutOrientation(JList.VERTICAL_WRAP); |