Skip to content

Commit 73731db

Browse files
committed
Modernize Swing UI with FlatLaf light theme and release 1.3.0
- Add FlatLaf 3.7.1 dependency and ModernLookAndFeel installer with rounded controls, slim scrollbars, and graceful fallback to the platform theme - Install the theme before building the Swing UI in Main - Widen the default window to 800x420 so all library actions stay visible - Cover theme installation with a UI regression test - Bump version to 1.3.0 and update the changelog Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SQLcadZ3v1J2pGcD8DbUdZ
1 parent ab0a6e1 commit 73731db

6 files changed

Lines changed: 83 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Unreleased
44

5+
## 1.3.0 - 2026-07-02
6+
### Added
7+
- FlatLaf 3.7.1 dependency and a `ModernLookAndFeel` installer with UI regression coverage.
8+
9+
### Changed
10+
- Swing UI now starts with the modern FlatLaf light look and feel: flat controls, rounded buttons,
11+
inputs, progress bars, and slim scrollbars instead of the legacy Metal theme.
12+
- Main window default size grew to 800x420 so all library actions stay visible with the new theme.
13+
514
## 1.2.1 - 2026-06-19
615
### Changed
716
- Hardened CI, release, Docker, and Scorecard workflows after repository audit.

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.krotname</groupId>
99
<artifactId>javasoundrecorder</artifactId>
10-
<version>1.2.1</version>
10+
<version>1.3.0</version>
1111
<name>JavaSoundRecorder</name>
1212
<description>Microphone recorder with optional Dropbox upload.</description>
1313
<url>https://github.com/krotname/JavaSoundRecorder</url>
@@ -28,6 +28,7 @@
2828
<jacoco.version>0.8.15</jacoco.version>
2929
<slf4j.version>2.0.18</slf4j.version>
3030
<dropbox.version>8.0.0</dropbox.version>
31+
<flatlaf.version>3.7.1</flatlaf.version>
3132
<jackson-core.version>2.22.0</jackson-core.version>
3233
<java-flac-encoder.version>0.3.8</java-flac-encoder.version>
3334
<junit.version>6.1.1</junit.version>
@@ -71,6 +72,11 @@
7172
<artifactId>java-flac-encoder</artifactId>
7273
<version>${java-flac-encoder.version}</version>
7374
</dependency>
75+
<dependency>
76+
<groupId>com.formdev</groupId>
77+
<artifactId>flatlaf</artifactId>
78+
<version>${flatlaf.version}</version>
79+
</dependency>
7480

7581
<dependency>
7682
<groupId>org.junit.jupiter</groupId>

src/main/java/com/krotname/javasoundrecorder/Main.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.krotname.javasoundrecorder.storage.DropboxUploadService;
1919
import com.krotname.javasoundrecorder.storage.NoopUploadService;
2020
import com.krotname.javasoundrecorder.storage.UploadService;
21+
import com.krotname.javasoundrecorder.ui.ModernLookAndFeel;
2122
import com.krotname.javasoundrecorder.ui.RecorderPanel;
2223
import com.krotname.javasoundrecorder.ui.RecorderSettings;
2324
import com.krotname.javasoundrecorder.ui.SettingsDialog;
@@ -118,6 +119,7 @@ private static void runCli(RecordingCoordinator coordinator) {
118119
* This avoids hidden background work after manual close in demonstration runs.
119120
*/
120121
private static void launchUi(AppRuntime runtime) {
122+
ModernLookAndFeel.install();
121123
// Keep Swing construction on the EDT and capture panel reference early to avoid
122124
// accidental nulls when wiring callbacks.
123125
EventQueue.invokeLater(() -> {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.krotname.javasoundrecorder.ui;
2+
3+
import com.formdev.flatlaf.FlatLightLaf;
4+
import javax.swing.UIManager;
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
7+
8+
/**
9+
* Installs the FlatLaf light look and feel so the Swing UI matches modern desktop applications.
10+
* Keeps the platform default look and feel when installation fails so the UI stays usable.
11+
*/
12+
public final class ModernLookAndFeel {
13+
private static final Logger logger = LoggerFactory.getLogger(ModernLookAndFeel.class);
14+
private static final int CORNER_ARC = 12;
15+
private static final int FOCUS_WIDTH = 1;
16+
private static final int SCROLLBAR_WIDTH = 12;
17+
18+
private ModernLookAndFeel() {
19+
}
20+
21+
/**
22+
* Applies the modern light theme with rounded buttons, inputs, and progress bars.
23+
*
24+
* @return true when FlatLaf became the active look and feel
25+
*/
26+
public static boolean install() {
27+
UIManager.put("Component.arc", CORNER_ARC);
28+
UIManager.put("Button.arc", CORNER_ARC);
29+
UIManager.put("ProgressBar.arc", CORNER_ARC);
30+
UIManager.put("TextComponent.arc", CORNER_ARC);
31+
UIManager.put("Component.focusWidth", FOCUS_WIDTH);
32+
UIManager.put("ScrollBar.thumbArc", CORNER_ARC);
33+
UIManager.put("ScrollBar.width", SCROLLBAR_WIDTH);
34+
if (FlatLightLaf.setup()) {
35+
return true;
36+
}
37+
logger.warn("FlatLaf was not installed; keeping the platform default look and feel.");
38+
return false;
39+
}
40+
}

src/main/java/com/krotname/javasoundrecorder/ui/RecorderPanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
public class RecorderPanel extends JPanel {
2929
private static final int VERTICAL_GAP = 10;
3030
private static final int HORIZONTAL_GAP = 10;
31-
private static final int PREF_WIDTH = 620;
32-
private static final int PREF_HEIGHT = 360;
31+
private static final int PREF_WIDTH = 800;
32+
private static final int PREF_HEIGHT = 420;
3333
private static final int BORDER_GAP = 12;
3434
private static final int DETAILS_ROWS = 4;
3535
private static final int PERCENT_MAX = 100;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.krotname.javasoundrecorder.ui;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
6+
import com.formdev.flatlaf.FlatLightLaf;
7+
import javax.swing.LookAndFeel;
8+
import javax.swing.UIManager;
9+
import org.junit.jupiter.api.Test;
10+
11+
class ModernLookAndFeelUiTest {
12+
@Test
13+
void installsFlatLafLightThemeWithRoundedControls() throws Exception {
14+
LookAndFeel previous = UIManager.getLookAndFeel();
15+
try {
16+
assertTrue(ModernLookAndFeel.install());
17+
assertEquals(FlatLightLaf.class.getName(), UIManager.getLookAndFeel().getClass().getName());
18+
assertEquals(12, UIManager.get("Button.arc"));
19+
} finally {
20+
UIManager.setLookAndFeel(previous);
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)