本文整理了Java中javax.swing.JFileChooser.addPropertyChangeListener()
方法的一些代码示例,展示了JFileChooser.addPropertyChangeListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.addPropertyChangeListener()
方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:addPropertyChangeListener
暂无
代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-core
public MultiFileChooserPanel(final JFileChooser fileChooser, final IPreferences preferences) {
this.fileChooser = fileChooser;
this.preferences = preferences;
fileChooser.addPropertyChangeListener(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) {
final File[] files = (File[]) event.getNewValue();
getModel().set(files);
}
});
}
代码示例来源:origin: dcaoyuan/nbscala
/** Creates new form JarArtifactChooser */
public AntArtifactChooser( String[] artifactTypes, JFileChooser chooser ) {
this.artifactTypes = artifactTypes;
initComponents();
jListArtifacts.setModel( new DefaultListModel() );
chooser.addPropertyChangeListener( this );
}
代码示例来源:origin: org.softsmithy.lib/lib-core
/**
* Creates a new ImagePreview.
*
* @param fc a file chooser
*/
public ImagePreview(JFileChooser fc) {
setPreferredSize(new Dimension(100, 50));
fc.addPropertyChangeListener(this);
}
代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing
/**
* Creates a new ImagePreview.
*
* @param fc a file chooser
*/
public ImagePreview(JFileChooser fc) {
setPreferredSize(new Dimension(100, 50));
fc.addPropertyChangeListener(this);
}
代码示例来源:origin: com.github.haifengl/smile-plot
/**
* Constructor.
*/
public FilePreview(JFileChooser fc) {
setPreferredSize(new Dimension(160, 160));
fc.addPropertyChangeListener(this);
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
/** This class requires a file chooser to register with so this class will
* be notified when a new file is selected in the browser.
* @param JFileChooser that this preview window is used in.
*/
public ImageFileChooserPreview(JFileChooser parent)
{
setPreferredSize(new Dimension(previewWidth , previewHeight));
parent.addPropertyChangeListener(this);
}
代码示例来源:origin: asad/SMSD
/**
*
* @param fc
*/
public ImagePreView(JFileChooser fc) {
setPreferredSize(new Dimension(100, 50));
fc.addPropertyChangeListener(this);
}
代码示例来源:origin: com.l2fprod.common/l2fprod-common-shared
private static void track(JFileChooser chooser, final String key) {
// get the path for the given filechooser
String path = node().get(key, null);
if (path != null) {
File file = new File(path);
if (file.exists()) {
chooser.setCurrentDirectory(file);
}
}
PropertyChangeListener trackPath = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
/* everytime the path change, update the preferences */
if (evt.getNewValue() instanceof File) {
node().put(key, ((File)evt.getNewValue()).getAbsolutePath());
}
}
};
chooser.addPropertyChangeListener(
JFileChooser.DIRECTORY_CHANGED_PROPERTY,
trackPath);
}
代码示例来源:origin: stackoverflow.com
public void propertyChange(final PropertyChangeEvent e)
{
String prop = e.getPropertyName();
if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop))
{
JFileChooser fileChooser = (JFileChooser)e.getSource();
File currentDirectory = (File)e.getNewValue();
String directory = currentDirectory.toString();
if (directory.endsWith("Desktop")
|| directory.endsWith("My Documents"))
{
File selectedFile = fileChooser.getSelectedFile();
if (selectedFile == null || ! selectedFile.equals(currentDirectory))
{
fileChooser.removePropertyChangeListener( this );
fileChooser.setSelectedFile( currentDirectory );
fileChooser.addPropertyChangeListener( this );
}
}
}
}
代码示例来源:origin: com.harium.etyl/etyl
@Override
public void openDialog() {
if(opened) {
return;
}
chooser = new JFileChooser(path);
PreviewPane previewPane = new PreviewPane();
chooser.setAccessory(previewPane);
chooser.addPropertyChangeListener(previewPane);
chooser.setVisible(true);
opened = true;
new Thread(this).start();
}
代码示例来源:origin: com.harium/etyl
@Override
public void openDialog() {
if(opened) {
return;
}
chooser = new JFileChooser(path);
PreviewPane previewPane = new PreviewPane();
chooser.setAccessory(previewPane);
chooser.addPropertyChangeListener(previewPane);
chooser.setVisible(true);
opened = true;
new Thread(this).start();
}
代码示例来源:origin: stackoverflow.com
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
代码示例来源:origin: stackoverflow.com
fc.addPropertyChangeListener(JFileChooser.FILE_FILTER_CHANGED_PROPERTY, new PropertyChangeListener() {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
/** Creates new form JarArtifactChooser */
public MakeArtifactChooser( ArtifactType artifactType, JFileChooser chooser , FSPath baseDir) {
this.artifactType = artifactType;
this.baseDir = baseDir;
initComponents();
listArtifacts.setModel(new MyDefaultListModel(false));
chooser.addPropertyChangeListener( this );
//PathPanel pathPanel = new PathPanel();
//leftPanel.add(pathPanel);
// Accessibility
listArtifacts.getAccessibleContext().setAccessibleDescription(getString("PROJECT_LIBRARY_FILES_AD")); // NOI18N
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/** Lazily creates a JFileChooser and returns it. */
private JFileChooser getOpenChooser() {
if (openChooser == null) {
openChooser = new JFileChooser();
Drawing d = svgPanel.getDrawing();
fileFilterInputFormatMap = new HashMap<javax.swing.filechooser.FileFilter, InputFormat>();
javax.swing.filechooser.FileFilter firstFF = null;
for (InputFormat format : d.getInputFormats()) {
javax.swing.filechooser.FileFilter ff = format.getFileFilter();
if (firstFF == null) {
firstFF = ff;
}
fileFilterInputFormatMap.put(ff, format);
openChooser.addChoosableFileFilter(ff);
}
openChooser.setFileFilter(firstFF);
openChooser.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("fileFilterChanged")) {
InputFormat inputFormat = fileFilterInputFormatMap.get(evt.getNewValue());
openChooser.setAccessory((inputFormat == null) ? null : inputFormat.getInputFormatAccessory());
}
}
});
}
return openChooser;
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/** Lazily creates a JFileChooser and returns it. */
private JFileChooser getSaveChooser() {
if (saveChooser == null) {
saveChooser = new JFileChooser();
Drawing d = svgPanel.getDrawing();
fileFilterOutputFormatMap = new HashMap<javax.swing.filechooser.FileFilter, OutputFormat>();
javax.swing.filechooser.FileFilter firstFF = null;
for (OutputFormat format : d.getOutputFormats()) {
javax.swing.filechooser.FileFilter ff = format.getFileFilter();
if (firstFF == null) {
firstFF = ff;
}
fileFilterOutputFormatMap.put(ff, format);
saveChooser.addChoosableFileFilter(ff);
}
saveChooser.setFileFilter(firstFF);
saveChooser.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("fileFilterChanged")) {
OutputFormat outputFormat = fileFilterOutputFormatMap.get(evt.getNewValue());
saveChooser.setAccessory((outputFormat == null) ? null : outputFormat.getOutputFormatAccessory());
}
}
});
}
return saveChooser;
}
代码示例来源:origin: lbalazscs/Pixelitor
private static void initOpenChooser() {
assert EventQueue.isDispatchThread() : "not EDT thread";
if (openChooser == null) {
//noinspection NonThreadSafeLazyInitialization
openChooser = new JFileChooser(Dirs.getLastOpen());
openChooser.setName("open");
setDefaultOpenExtensions();
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
ProgressPanel progressPanel = new ProgressPanel();
ImagePreviewPanel preview = new ImagePreviewPanel(progressPanel);
p.add(preview, BorderLayout.CENTER);
p.add(progressPanel, BorderLayout.SOUTH);
openChooser.setAccessory(p);
openChooser.addPropertyChangeListener(preview);
}
}
代码示例来源:origin: freeplane/freeplane
public BitmapImagePreview(final JFileChooser fc) {
super();
this.fc = fc;
setBorder(new MatteBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, Color.BLACK));
final int previewSize = ResourceController.getResourceController().getIntProperty("image_preview_size", 300);
setPreferredSize(new Dimension(previewSize, previewSize));
fc.addPropertyChangeListener(this);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-ant-ui
rbVariable.addActionListener(this);
if (chooser != null) {
chooser.addPropertyChangeListener(this);
代码示例来源:origin: Mine-and-blade-admin/Battlegear2
ImagePreviewPanel preview = new ImagePreviewPanel();
fc.setAccessory(preview);
fc.addPropertyChangeListener(preview);
内容来源于网络,如有侵权,请联系作者删除!