Maven dependency: (via Github Packages)
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/Degubi/jframe-titlebar</url>
</repository>
<dependency>
<groupId>degubi</groupId>
<artifactId>jframe-titlebar</artifactId>
<version>1.0.0</version>
</dependency>
Jar file:
Jar file downloads are available under 'Packages'
All functions are found in a single class: JFrameTitlebar
var frame = new JFrame("Hi");
frame.setSize(800, 600);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// This next line is important, because the functions found in JFrameTitlebar only work if the frame is already visible
frame.setVisible(true);
JFrameTitlebar.setDarkMode(frame); // Sets the titlebar theme to dark
JFrameTitlebar.setLightMode(frame); // Sets the titlebar theme to light
public final class Main {
public static void main(String[] args) {
var frame = new JFrame("Hi");
var toggleButton = new JButton("Toggle");
toggleButton.addActionListener(e -> JFrameTitlebar.setMode(frame, !JFrameTitlebar.isDarkMode(frame)));
frame.setContentPane(toggleButton);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800, 600);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
Feedback, bug reports and enhancements are always welcome.