From 4241a3a8e1a466620cffee2477c07164f2c0ab53 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:37:14 +0200 Subject: [PATCH] Allow locally customizing the color of progress bar --- .idea/icon.svg | 54 +++++++++++++++++++ CHANGELOG.md | 4 ++ .../PedroProgressBarUI.java | 6 ++- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 .idea/icon.svg diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100644 index 0000000..0e4ae36 --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1838999..f2140ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +### Added + +- Allow locally customizing the color of progress bar + ## [0.0.4] - 2024-07-31 ### Added diff --git a/src/main/java/com/github/strangelookingnerd/PedroProgressBarUI.java b/src/main/java/com/github/strangelookingnerd/PedroProgressBarUI.java index 236c7e6..fe7544b 100644 --- a/src/main/java/com/github/strangelookingnerd/PedroProgressBarUI.java +++ b/src/main/java/com/github/strangelookingnerd/PedroProgressBarUI.java @@ -129,8 +129,10 @@ protected void paintIndeterminate(Graphics graphics, JComponent component) { startColor = WARNING_COLOR; endColor = WARNING_END_COLOR; } else { - startColor = INDETERMINATE_START_COLOR; - endColor = INDETERMINATE_END_COLOR; + startColor = progressBar.getClientProperty("ProgressBar.indeterminateStartColor") instanceof Color color ? + color : INDETERMINATE_START_COLOR; + endColor = progressBar.getClientProperty("ProgressBar.indeterminateEndColor") instanceof Color color ? + color : INDETERMINATE_END_COLOR; } Shape shape;