1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2009 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
32 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
33 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
34 |
|
|
35 |
|
import java.io.File; |
36 |
|
|
37 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
38 |
import javax.swing.Box; |
import javax.swing.Box; |
39 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
40 |
import javax.swing.Icon; |
import javax.swing.Icon; |
41 |
import javax.swing.JButton; |
import javax.swing.JButton; |
|
import javax.swing.JFileChooser; |
|
42 |
import javax.swing.JLabel; |
import javax.swing.JLabel; |
43 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
44 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
128 |
getHandler() { return eventHandler; } |
getHandler() { return eventHandler; } |
129 |
|
|
130 |
private class EventHandler implements ListSelectionListener, ChangeListener { |
private class EventHandler implements ListSelectionListener, ChangeListener { |
131 |
|
@Override |
132 |
public void |
public void |
133 |
valueChanged(ListSelectionEvent e) { |
valueChanged(ListSelectionEvent e) { |
134 |
if(e.getValueIsAdjusting()) return; |
if(e.getValueIsAdjusting()) return; |
137 |
btnRename.setEnabled(!lsm.isSelectionEmpty()); |
btnRename.setEnabled(!lsm.isSelectionEmpty()); |
138 |
} |
} |
139 |
|
|
140 |
|
@Override |
141 |
public void |
public void |
142 |
stateChanged(ChangeEvent e) { |
stateChanged(ChangeEvent e) { |
143 |
boolean b = CC.getLostFilesModel().getLostFileCount() != 0; |
boolean b = CC.getLostFilesModel().getLostFileCount() != 0; |
327 |
|
|
328 |
private String |
private String |
329 |
browse() { |
browse() { |
330 |
JFileChooser fc = new JFileChooser(); |
File f = StdUtils.showOpenDirectoryChooser(this, null); |
331 |
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
if(f == null) return null; |
|
int result = fc.showOpenDialog(this); |
|
|
if(result != JFileChooser.APPROVE_OPTION) return null; |
|
332 |
|
|
333 |
String path = fc.getSelectedFile().getAbsolutePath(); |
String path = f.getAbsolutePath(); |
334 |
if(path.length() < 2) return path; |
if(path.length() < 2) return path; |
335 |
|
|
336 |
char sep = java.io.File.separatorChar; |
char sep = java.io.File.separatorChar; |
346 |
|
|
347 |
private class EventHandler implements DocumentListener { |
private class EventHandler implements DocumentListener { |
348 |
// DocumentListener |
// DocumentListener |
349 |
|
@Override |
350 |
public void |
public void |
351 |
insertUpdate(DocumentEvent e) { updateState(); } |
insertUpdate(DocumentEvent e) { updateState(); } |
352 |
|
|
353 |
|
@Override |
354 |
public void |
public void |
355 |
removeUpdate(DocumentEvent e) { updateState(); } |
removeUpdate(DocumentEvent e) { updateState(); } |
356 |
|
|
357 |
|
@Override |
358 |
public void |
public void |
359 |
changedUpdate(DocumentEvent e) { updateState(); } |
changedUpdate(DocumentEvent e) { updateState(); } |
360 |
} |
} |