Skip to content

Commit

Permalink
Updated POM and added LICENSE and README files
Browse files Browse the repository at this point in the history
  • Loading branch information
steffen678 committed Mar 12, 2017
1 parent eb536f2 commit bf7d38c
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 2 deletions.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2017, Steffen Flor
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# NativeJFileChooser

This is a drop-in replacement for Swing's file chooser. Instead of displaying
the Swing file chooser, it makes use of the JavaFX file chooser if available.
It still uses Swing's file chooser as a fallback.

## Usage

NativeJFileChooser is available via Maven:

<dependency>
<groupId>li.flor</groupId>
<artifactId>native-j-file-chooser</artifactId>
<version>1.6.3</version>
</dependency>

Simply replace

JFileChooser fileChooser = new JFileChooser();

with

JFileChooser fileChooser = new NativeJFileChooser();

## Example

EventQueue.invokeLater(() -> {
JFrame frame = new JFrame("Test");
JButton button = new JButton("Click me!");
JFileChooser fileChooser = new NativeJFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter("JPG", "*.jpg"));
button.addActionListener((ActionEvent e) -> {
fileChooser.showDialog(frame, "Open");
});
frame.add(button);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
});
85 changes: 83 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>li.flor</groupId>
<artifactId>NativeJFileChooser</artifactId>
<artifactId>native-j-file-chooser</artifactId>
<version>1.6.3</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<name>${project.groupId}:${project.artifactId}</name>
<description>Native file chooser for Swing.</description>
<url>https://github.com/veluria/NativeJFileChooser</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyname>${gpg.keyname}</keyname>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<licenses>
<license>
<name>The 2-Clause BSD License</name>
<url>https://opensource.org/licenses/BSD-2-Clause</url>
</license>
</licenses>
<developers>
<developer>
<name>${cred.name}</name>
<email>${cred.email}</email>
<organization>${cred.org}</organization>
<organizationUrl>${cred.orgurl}</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/veluria/NativeJFileChooser.git</connection>
<developerConnection>scm:git:ssh://github.com/veluria/NativeJFileChooser.git</developerConnection>
<url>https://github.com/veluria/NativeJFileChooser</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>

0 comments on commit bf7d38c

Please sign in to comment.