filechooser-abstraction

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Лицензия

Лицензия

Группа

Группа

org.wiztools
Идентификатор

Идентификатор

filechooser-abstraction
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

filechooser-abstraction
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Ссылка на сайт

Ссылка на сайт

https://github.com/wiztools/filechooser-abstraction
Система контроля версий

Система контроля версий

https://github.com/wiztools/filechooser-abstraction

Скачать filechooser-abstraction

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.wiztools/filechooser-abstraction/ -->
<dependency>
    <groupId>org.wiztools</groupId>
    <artifactId>filechooser-abstraction</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.wiztools/filechooser-abstraction/
implementation 'org.wiztools:filechooser-abstraction:0.1.0'
// https://jarcasting.com/artifacts/org.wiztools/filechooser-abstraction/
implementation ("org.wiztools:filechooser-abstraction:0.1.0")
'org.wiztools:filechooser-abstraction:jar:0.1.0'
<dependency org="org.wiztools" name="filechooser-abstraction" rev="0.1.0">
  <artifact name="filechooser-abstraction" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.wiztools', module='filechooser-abstraction', version='0.1.0')
)
libraryDependencies += "org.wiztools" % "filechooser-abstraction" % "0.1.0"
[org.wiztools/filechooser-abstraction "0.1.0"]

Зависимости

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

WizTools.org FileChooser Abstraction Library

An abstraction library (adapter pattern) to easily switch between JFileChooser and FileDialog.

Usage

Typical usage:

import org.wiztools.filechooser.*;

...

FileChooser fc = new JFCFileChooser(); // To use JFileChooser
FileChooser fc = new FDFileChooser();  // To use FileDialog

...

fc.setDialogTitle("JFileChooser");
FileChooserResponse res = fc.showOpenDialog(this); // `this' could be Frame / Dialog
if(res == FileChooserResponse.APPROVE_OPTION) {
	File f = fc.getSelectedFile();
	// your code
}
else if(res == FileChooserResponse.CANCEL_OPTION) {
	// your code
}

Using FileFilter:

import org.wiztools.filechooser.*;

...

// 1. Define FileChooser:
FileChooser fc = ...;


// 2. Define FileFilter:
FileFilter ff = new FileFilter() {
	public boolean accept(File file) {
		if(file.getName().endsWith(".xml")) {
			return true;
		}
		return false;
	}

	public String getDescription() {
		return "XML";
	}
};

// 3. Assign the FileFilter to the FileChooser:
fc.setFileFilter(ff);

Why?

JFileChooser is the preferred way of doing things in Java. But, if you want to comply to Apple Sandbox requirements when on-boarding your app to Mac App Store, you must use FileDialog instead of JFileChooser (FileDialog uses NSOpenDialog and NSSaveDialog internally).

This library may be used to:

  1. Modify your app to use FileDialog with minimal code change.
  2. Support FileDialog in Mac platform, and JFileChooser in other platforms, with very less code specific to each platform.
org.wiztools

WizTools.org

Passion meets programming.

Версии библиотеки

Версия
0.1.0