本文整理汇总了Java中javax.swing.JFileChooser.addPropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java JFileChooser.addPropertyChangeListener方法的具体用法?Java JFileChooser.addPropertyChangeListener怎么用?Java JFileChooser.addPropertyChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.addPropertyChangeListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ProjectChooserAccessory
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/** Creates new form ProjectChooserAccessory */
public ProjectChooserAccessory(JFileChooser chooser, boolean isOpenSubprojects) {
initComponents();
modelUpdater = new ModelUpdater();
//#98080
RP = new RequestProcessor(ModelUpdater.class.getName(), 1);
RP2 = new RequestProcessor(ModelUpdater.class.getName(), 1);
updateSubprojectsTask = RP.create(modelUpdater);
updateSubprojectsTask.setPriority( Thread.MIN_PRIORITY );
// Listen on the subproject checkbox to change the option accordingly
jCheckBoxSubprojects.setSelected( isOpenSubprojects );
jCheckBoxSubprojects.addActionListener( this );
// Listen on the chooser to update the Accessory
chooser.addPropertyChangeListener( this );
// Set default list model for the subprojects list
jListSubprojects.setModel( new DefaultListModel() );
// Disable the Accessory. JFileChooser does not select a file
// by default
setAccessoryEnablement( false, 0 );
}
示例2: doLoadCalibration
import javax.swing.JFileChooser; //导入方法依赖的package包/类
synchronized public void doLoadCalibration() {
final JFileChooser j = new JFileChooser();
j.setCurrentDirectory(new File(dirPath));
j.setApproveButtonText("Select folder");
j.setDialogTitle("Select a folder that has XML files storing calibration");
j.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // let user specify a base filename
j.setApproveButtonText("Select folder");
j.setApproveButtonToolTipText("Only enabled for a folder that has cameraMatrix.xml and distortionCoefs.xml");
setButtonState(j, j.getApproveButtonText(), calibrationExists(j.getCurrentDirectory().getPath()));
j.addPropertyChangeListener(JFileChooser.DIRECTORY_CHANGED_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent pce) {
setButtonState(j, j.getApproveButtonText(), calibrationExists(j.getCurrentDirectory().getPath()));
}
});
int ret = j.showOpenDialog(null);
if (ret != JFileChooser.APPROVE_OPTION) {
return;
}
dirPath = j.getSelectedFile().getPath();
putString("dirPath", dirPath);
loadCalibration();
}
示例3: doLoadCalibration
import javax.swing.JFileChooser; //导入方法依赖的package包/类
synchronized public void doLoadCalibration() {
final JFileChooser j = new JFileChooser();
j.setCurrentDirectory(new File(dirPath));
j.setApproveButtonText("Select folder");
j.setDialogTitle("Select a folder that has XML files storing calibration");
j.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // let user specify a base filename
j.setApproveButtonText("Select folder");
j.setApproveButtonToolTipText("Only enabled for a folder that has cameraMatrix.xml and distortionCoefs.xml");
setButtonState(j, j.getApproveButtonText(), calibrationExists(j.getCurrentDirectory().getPath()));
j.addPropertyChangeListener(JFileChooser.DIRECTORY_CHANGED_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent pce) {
setButtonState(j, j.getApproveButtonText(), calibrationExists(j.getCurrentDirectory().getPath()));
}
});
int ret = j.showOpenDialog(null);
if (ret != JFileChooser.APPROVE_OPTION) {
return;
}
dirPath = j.getSelectedFile().getPath();
putString("dirPath", dirPath);
loadCalibration();
}
示例4: AntArtifactChooser
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/** Creates new form JarArtifactChooser */
public AntArtifactChooser( String[] artifactTypes, JFileChooser chooser ) {
this.artifactTypes = artifactTypes;
initComponents();
jListArtifacts.setModel( new DefaultListModel() );
chooser.addPropertyChangeListener( this );
}
示例5: FileDeleter
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/** adds a keyreleased listener on the JFileChooser FilePane inner classes so that user can use Delete key to delete the file
* that is presently being shown in the preview window
* @param chooser the chooser
* @param preview the data file preview
*/
public FileDeleter(JFileChooser chooser, ChipDataFilePreview preview) {
this.chooser = chooser;
this.preview = preview;
chooser.addPropertyChangeListener(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY, this);
Component comp = addDeleteListener(chooser);
}
示例6: ImagePreview
import javax.swing.JFileChooser; //导入方法依赖的package包/类
public ImagePreview(JFileChooser fc) {
setPreferredSize(new Dimension(100, 50));
setBorder(new TitledBorder(BorderFactory.createEtchedBorder(),
Local.getString("Preview"), TitledBorder.CENTER, TitledBorder.ABOVE_TOP));
fc.addPropertyChangeListener(this);
}
示例7: FilePreview
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* Constructor.
*/
public FilePreview(JFileChooser fc) {
setPreferredSize(new Dimension(160, 160));
fc.addPropertyChangeListener(this);
}
示例8: sequenceMenuItemActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void sequenceMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sequenceMenuItemActionPerformed
if (evt.getActionCommand().equals("start")) {
float oldScale = chipCanvas.getScale();
AESequencerInterface aemonseq = (AESequencerInterface) chip.getHardwareInterface();
try {
if ((aemonseq != null) && (aemonseq instanceof AEMonitorSequencerInterface)) {
((AEMonitorSequencerInterface) aemonseq).stopMonitoringSequencing();
}
} catch (HardwareInterfaceException e) {
e.printStackTrace();
}
JFileChooser fileChooser = new JFileChooser();
ChipDataFilePreview preview = new ChipDataFilePreview(fileChooser, chip); // from book swing hacks
fileChooser.addPropertyChangeListener(preview);
fileChooser.setAccessory(preview);
String lastFilePath = prefs.get("AEViewer.lastFile", ""); // getString the last folder
lastFile = new File(lastFilePath);
DATFileFilter datFileFilter = new DATFileFilter();
fileChooser.addChoosableFileFilter(datFileFilter);
fileChooser.setCurrentDirectory(lastFile); // sets the working directory of the chooser
// boolean wasPaused=isPaused();
// setPaused(true);
int retValue = fileChooser.showOpenDialog(this);
if (retValue == JFileChooser.APPROVE_OPTION) {
lastFile = fileChooser.getSelectedFile();
if (lastFile != null) {
recentFiles.addFile(lastFile);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
sequenceFile(lastFile);
}
});
}
fileChooser = null;
// setPaused(false);
// chipCanvas.setScale(oldScale);
} else if (evt.getActionCommand().equals("stop")) {
setPlayMode(PlayMode.LIVE);
stopSequencing();
}
}
示例9: openAEInputFileDialog
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* Called when user asks to open data file file dialog.
*/
@Override
public void openAEInputFileDialog() {
// try{Thread.currentThread().sleep(200);}catch(InterruptedException e){}
float oldScale = viewer.chipCanvas.getScale();
fileChooser = new JFileChooser();
// new TypeAheadSelector(fileChooser);
//com.sun.java.plaf.windows.WindowsFileChooserUI;
// fileChooser.addKeyListener(new KeyAdapter() {
// public void keyTyped(KeyEvent e){
// System.out.println("keycode="+e.getKeyCode());
// }
// });
// System.out.println("fileChooser.getUIClassID()="+fileChooser.getUIClassID());
// KeyListener[] keyListeners=fileChooser.getKeyListeners();
ChipDataFilePreview preview = new ChipDataFilePreview(fileChooser, viewer.getChip());
// from book swing hacks
new FileDeleter(fileChooser, preview);
fileChooser.addPropertyChangeListener(preview);
fileChooser.setAccessory(preview);
String lastFilePath = AEViewer.prefs.get("AEViewer.lastFile", "");
// get the last folder
viewer.lastFile = new File(lastFilePath);
// fileChooser.setFileFilter(datFileFilter);
IndexFileFilter indexFileFilter = new IndexFileFilter();
fileChooser.addChoosableFileFilter(indexFileFilter);
DATFileFilter datFileFilter = new DATFileFilter();
fileChooser.addChoosableFileFilter(datFileFilter);
if (lastFilter == null) {
fileChooser.setFileFilter(datFileFilter);
} else {
fileChooser.setFileFilter(lastFilter);
}
fileChooser.setCurrentDirectory(viewer.lastFile);
// sets the working directory of the chooser
// boolean wasPaused=isPaused();
setPaused(true);
try {
int retValue = fileChooser.showOpenDialog(viewer);
if (retValue == JFileChooser.APPROVE_OPTION) {
lastFilter = fileChooser.getFileFilter();
try {
viewer.lastFile = fileChooser.getSelectedFile();
if (viewer.lastFile != null) {
viewer.recentFiles.addFile(viewer.lastFile);
}
startPlayback(viewer.lastFile);
} catch (IOException fnf) {
log.warning(fnf.toString());
}
} else {
preview.showFile(null);
}
} catch (GLException e) {
log.warning(e.toString());
preview.showFile(null);
}
fileChooser = null;
// viewer.chipCanvas.setScale(oldScale);
// restore persistent scale so that we don't get tiny size on next startup
setPaused(false);
}
示例10: FilePreviewer
import javax.swing.JFileChooser; //导入方法依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
public FilePreviewer(JFileChooser fc) {
setPreferredSize(new Dimension(100, 50));
fc.addPropertyChangeListener(this);
}
示例11: FileDeleter
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* adds a key-released listener on the JFileChooser FilePane inner
* classes so that user can use Delete key to delete the file that is
* presently being shown in the preview window
*
* @param chooser the chooser
* @param preview the data file preview
*/
public FileDeleter(JFileChooser chooser, ChipDataFilePreview preview) {
super();
this.chooser = chooser;
this.preview = preview;
chooser.addPropertyChangeListener(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY, this);
Component comp = addDeleteListener(chooser);
}