SwingX: fixed missing highlighting of "today" in JXMonthView and JXDatePicker

This commit is contained in:
Karl Tauber
2022-09-12 13:29:53 +02:00
parent 9041a16b22
commit 0e523f1193
7 changed files with 17 additions and 2 deletions

View File

@@ -27,6 +27,8 @@ FlatLaf Change Log
- Fixed possible exception in `FlatUIUtils.resetRenderingHints()`. (issue #575)
- Fixed AWT components on macOS, which use Swing components internally. (issue
#583)
- SwingX: Fixed missing highlighting of "today" in `JXMonthView` and
`JXDatePicker`.
## 2.4

View File

@@ -16,9 +16,11 @@
package com.formdev.flatlaf.swingx.ui;
import java.awt.Color;
import java.awt.Insets;
import java.util.Calendar;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
@@ -52,6 +54,8 @@ public class FlatMonthViewUI
private static class FlatRenderingHandler
extends RenderingHandler
{
private final Color todayColor = UIManager.getColor( "JXMonthView.todayColor" );
@Override
public JComponent prepareRenderingComponent( JXMonthView monthView, Calendar calendar,
CalendarState dayState )
@@ -67,8 +71,12 @@ public class FlatMonthViewUI
Border b = c.getBorder();
if( b instanceof CompoundBorder && ((CompoundBorder)b).getInsideBorder() instanceof EmptyBorder )
border = new CompoundBorder( ((CompoundBorder)b).getOutsideBorder(), new FlatEmptyBorder( py * 2, 0, py * 2, 0 ) );
} else if( dayState == CalendarState.TODAY )
border = new FlatLineBorder( new Insets( py, px, py, px ), monthView.getTodayBackground() );
} else if( dayState == CalendarState.TODAY ) {
Color lineColor = monthView.getTodayBackground();
if( lineColor == null )
lineColor = todayColor;
border = new FlatLineBorder( new Insets( py, px, py, px ), lineColor );
}
if( border == null )
border = new FlatEmptyBorder( py, px, py, px );

View File

@@ -39,6 +39,7 @@ JXDatePicker.border = com.formdev.flatlaf.swingx.ui.FlatDatePickerBorder
JXMonthView.monthDownFileName = {icon}com.formdev.flatlaf.swingx.ui.FlatMonthDownIcon
JXMonthView.monthUpFileName = {icon}com.formdev.flatlaf.swingx.ui.FlatMonthUpIcon
JXMonthView.todayColor = @foreground
#---- TitledPanel ----

View File

@@ -445,6 +445,7 @@ JXMonthView.monthStringBackground #4c5052 HSL 200 4 31 javax.swing.plaf.C
JXMonthView.monthStringForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.monthUpFileName [lazy] 20,20 com.formdev.flatlaf.swingx.ui.FlatMonthUpIcon [UI]
JXMonthView.selectedBackground #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.todayColor #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.trailingDayForeground #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.unselectableDayForeground #e05555 HSL 0 69 61 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.weekOfTheYearForeground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -450,6 +450,7 @@ JXMonthView.monthStringBackground #dfdfdf HSL 0 0 87 javax.swing.plaf.C
JXMonthView.monthStringForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.monthUpFileName [lazy] 20,20 com.formdev.flatlaf.swingx.ui.FlatMonthUpIcon [UI]
JXMonthView.selectedBackground #bfdaf2 HSL 208 66 85 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.todayColor #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.trailingDayForeground #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.unselectableDayForeground #e02222 HSL 0 75 51 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.weekOfTheYearForeground #666666 HSL 0 0 40 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -466,6 +466,7 @@ JXMonthView.monthStringBackground #00ff00 HSL 120 100 50 javax.swing.plaf.C
JXMonthView.monthStringForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.monthUpFileName [lazy] 20,20 com.formdev.flatlaf.swingx.ui.FlatMonthUpIcon [UI]
JXMonthView.selectedBackground #aaffaa HSL 120 100 83 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.todayColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.trailingDayForeground #c0c0c0 HSL 0 0 75 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.unselectableDayForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]
JXMonthView.weekOfTheYearForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -368,6 +368,7 @@ JXMonthView.monthStringBackground
JXMonthView.monthStringForeground
JXMonthView.monthUpFileName
JXMonthView.selectedBackground
JXMonthView.todayColor
JXMonthView.trailingDayForeground
JXMonthView.unselectableDayForeground
JXMonthView.weekOfTheYearForeground