Skip to content

A Java Swing component designed to display a list of unique directory and/or file paths. Additionally, it supports drag-and-drop functionality, allowing users to drag files and directories from their file system into the list.

License

Notifications You must be signed in to change notification settings

Valkryst/JPathList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java CI with Maven CodeQL

JPathList is a Java Swing component designed to display a list of unique directory and/or file paths. Additionally, it supports drag-and-drop functionality, allowing users to drag files and directories from their file system into the list.

Table of Contents

Installation

JPathList is hosted on the JitPack package repository which supports Gradle, Maven, and sbt.

Gradle Gradle

Add JitPack to your build.gradle at the end of repositories.

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add JPathList as a dependency.

dependencies {
	implementation 'com.github.Valkryst:JPathList:2023.11.11-2'
}

Maven Maven

Add JitPack as a repository.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Add JPathList as a dependency.

<dependency>
    <groupId>com.github.Valkryst</groupId>
    <artifactId>JPathList</artifactId>
    <version>2023.11.11-2</version>
</dependency>

Scala SBT Scala SBT

Add JitPack as a resolver.

resolvers += "jitpack" at "https://jitpack.io"

Add JPathList as a dependency.

libraryDependencies += "com.github.Valkryst" % "JPathList" % "2023.11.11-2"

Example

This creates a new JPathList and displays it in a JFrame. It is configured to display all files and directories added to it, so you can immediately test the drag-and-drop functionality.

public class Driver {
    public static void main(final String[] args) {
        SwingUtilities.invokeLater(() -> {
            final var fileList = new JPathList();
            fileList.setRecursionMode(JFileChooser.FILES_AND_DIRECTORIES);

            final var frame = new JFrame("JPathList Example");
            frame.getContentPane().add(new JScrollPane(fileList));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setPreferredSize(new Dimension(500, 500));

            frame.setVisible(true);
            frame.pack();
            frame.setLocationRelativeTo(null);
        });
    }
}

The allowed recursion modes are:

  • JFileChooser.FILES_ONLY
  • JFileChooser.DIRECTORIES_ONLY
  • JFileChooser.FILES_AND_DIRECTORIES

Any other values are considered NONE and will prevent any files or directories from being added to the list.

About

A Java Swing component designed to display a list of unique directory and/or file paths. Additionally, it supports drag-and-drop functionality, allowing users to drag files and directories from their file system into the list.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages