JFileLinkLabel
is a Java Swing component designed to display a usable link to a File,
Path, or URI.
JFileLinkLabel is hosted on the JitPack package repository which supports Gradle, Maven, and sbt.
Add JitPack to your build.gradle
at the end of repositories.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add JFileLinkLabel as a dependency.
dependencies {
implementation 'com.github.Valkryst:JFileLinkLabel:2025.5.26'
}
Add JitPack as a repository.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add JFileLinkLabel as a dependency.
<dependency>
<groupId>com.github.Valkryst</groupId>
<artifactId>JFileLinkLabel</artifactId>
<version>2025.5.26</version>
</dependency>
Add JitPack as a resolver.
resolvers += "jitpack" at "https://jitpack.io"
Add JFileLinkLabel as a dependency.
libraryDependencies += "com.github.Valkryst" % "JFileLinkLabel" % "2025.5.26"
This creates a new JFileLinkLabel
and displays it in a JFrame
.
public class Driver {
public static void main(final String[] args) {
SwingUtilities.invokeLater(() -> {
final JFileLinkLabel link = new JFileLinkLabel(
"Link to Home Directory",
Paths.get(System.getProperty("user.home"))
);
link.setForeground(Color.BLUE);
final JFrame frame = new JFrame("JFileLinkLabel Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(400, 100));
final Container contentPane = frame.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(link, BorderLayout.CENTER);
frame.setVisible(true);
frame.pack();
frame.setLocationRelativeTo(null);
});
}
}