JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.42k stars 272 forks source link

FlatLaf: endless recursion in font #456

Closed tsjung75 closed 2 years ago

tsjung75 commented 2 years ago

After upgrading from 1.6.x to 2.0-rc1, I've encountered following errors.

[2021.12.23 01:16:47] : java.lang.IllegalStateException
  + FlatLaf: endless recursion in font
  * Caught From : com.psia.control.job.AbstractJob.handleRun()
  ================== [Start stack race] =================
    at com.formdev.flatlaf.FlatLaf$ActiveFont.createValue(FlatLaf.java:1282)
    at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
    at javax.swing.UIDefaults.get(Unknown Source)
    at com.formdev.flatlaf.FlatLaf$FlatUIDefaults.get(FlatLaf.java:1216)
    at javax.swing.MultiUIDefaults.get(Unknown Source)
    at javax.swing.UIDefaults.getFont(Unknown Source)
    at javax.swing.UIManager.getFont(Unknown Source)
    at javax.swing.LookAndFeel.installColorsAndFont(Unknown Source)
    at javax.swing.plaf.basic.BasicPanelUI.installDefaults(Unknown Source)
    at javax.swing.plaf.basic.BasicPanelUI.installUI(Unknown Source)
    at com.formdev.flatlaf.ui.FlatPanelUI.installUI(FlatPanelUI.java:68)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JPanel.setUI(Unknown Source)
    at javax.swing.JPanel.updateUI(Unknown Source)
    at javax.swing.JPanel.<init>(Unknown Source)
    at javax.swing.JPanel.<init>(Unknown Source)
    at javax.swing.JPanel.<init>(Unknown Source)

What is the cause of this error?

I am using custom .properties file and it's contents like below.

#---- variables ----

@background=#f2f2f2
@foreground=#000000
@selectionBackground=#00a8cc
@selectionForeground=#ffffff
@selectionInactiveBackground=#d4d4d4
@selectionInactiveForeground=@foreground
@disabledForeground=#8C8C8C
@componentBackground=#ffffff
@menuBackground=#fff
@menuHoverBackground=darken(@menuBackground,10%,derived)
@menuCheckBackground=darken(@menuBackground,10%,derived)
@menuCheckHoverBackground=darken(@menuBackground,20%,derived)
@cellFocusColor=#000000
@icon=#afafaf

# Drop (use lazy colors for IntelliJ platform themes, which usually do not specify these colors)
@dropCellBackground=lighten(List.selectionBackground,10%,lazy)
@dropCellForeground=lazy(List.selectionForeground)
@dropLineColor=lighten(List.selectionBackground,20%,lazy)
@dropLineShortColor=darken(List.selectionBackground,20%,lazy)

#---- globals ----

*.background=@background
*.foreground=@foreground
*.textBackground=#cccccc
*.textForeground=@foreground
*.caretForeground=@foreground
*.inactiveBackground=@background
*.inactiveForeground=@disabledForeground
*.selectionBackground=@selectionBackground
*.selectionForeground=@selectionForeground
*.disabledBackground=@background
*.disabledForeground=@disabledForeground
*.disabledText=@disabledForeground
*.acceleratorForeground=lighten(@foreground,30%)
*.acceleratorSelectionForeground=@selectionForeground

#---- system colors ----

activeCaption=#99b4d1
inactiveCaption=#bfcddb
controlHighlight=#e3e3e3
controlLtHighlight=#fff
controlDkShadow=darken($controlShadow,15%)

#---- Button ----

Button.background=#ffffff
Button.focusedBackground=#e3f1fa
Button.hoverBackground=darken($Button.background,3%,derived)
Button.pressedBackground=darken($Button.background,10%,derived)

Button.borderColor=$Component.borderColor
Button.disabledBorderColor=$Component.disabledBorderColor
Button.focusedBorderColor=$Component.focusedBorderColor
Button.hoverBorderColor=$Button.focusedBorderColor

Button.default.background=$Button.background
Button.default.foreground=@foreground
Button.default.focusedBackground=$Button.focusedBackground
Button.default.hoverBackground=$Button.hoverBackground
Button.default.pressedBackground=$Button.pressedBackground
Button.default.borderColor=#4F9EE3
Button.default.hoverBorderColor=$Button.hoverBorderColor
Button.default.focusedBorderColor=$Button.focusedBorderColor
Button.default.focusColor=$Component.focusColor
Button.default.borderWidth=2

Button.toolbar.hoverBackground=darken($Button.background,12%,derived)
Button.toolbar.pressedBackground=darken($Button.background,15%,derived)

#---- CheckBox ----

# enabled
CheckBox.icon.borderColor=#b0b0b0
CheckBox.icon.background=#FFFFFF
CheckBox.icon.selectedBorderColor=$CheckBox.icon.borderColor
CheckBox.icon.selectedBackground=$CheckBox.icon.background
CheckBox.icon.checkmarkColor=#4F9EE3

# disabled
CheckBox.icon.disabledBorderColor=#BDBDBD
CheckBox.icon.disabledBackground=@background
CheckBox.icon.disabledCheckmarkColor=#ABABAB

# focused
CheckBox.icon.focusedBorderColor=#7B9FC7
CheckBox.icon.focusedBackground=$Button.focusedBackground

# hover
CheckBox.icon.hoverBorderColor=$CheckBox.icon.focusedBorderColor
CheckBox.icon.hoverBackground=$Button.hoverBackground

# pressed
CheckBox.icon.pressedBackground=$Button.pressedBackground

# used if CheckBox.icon.style=filled
# enabled
CheckBox.icon[filled].selectedBorderColor=#4B97D9
CheckBox.icon[filled].selectedBackground=#4F9EE3
CheckBox.icon[filled].checkmarkColor=#FFFFFF
# focused
CheckBox.icon[filled].selectedFocusedBorderColor=#ACCFF7
CheckBox.icon[filled].selectedFocusedBackground=$CheckBox.icon[filled].selectedBackground
CheckBox.icon[filled].selectedFocusedCheckmarkColor=$CheckBox.icon.focusedBackground
# hover
CheckBox.icon[filled].selectedHoverBackground=#5E94CE
# pressed
CheckBox.icon[filled].selectedPressedBackground=#72A1D4

#---- ComboBox ----

ComboBox.background=@componentBackground
ComboBox.buttonBackground=@componentBackground
ComboBox.buttonEditableBackground=#fafafa
ComboBox.buttonArrowColor=#666666
ComboBox.buttonDisabledArrowColor=#ABABAB
ComboBox.buttonHoverArrowColor=#999999

#---- Component ----

Component.borderColor=#c4c4c4
Component.disabledBorderColor=#cfcfcf
Component.focusedBorderColor=#87afda
Component.focusColor=#97c3f3
Component.linkColor=#2470B3
Component.grayFilter=25,-25,100

Component.error.borderColor=lighten(desaturate($Component.error.focusedBorderColor,20%),25%)
Component.error.focusedBorderColor=#e53e4d
Component.warning.borderColor=lighten(saturate($Component.warning.focusedBorderColor,25%),20%)
Component.warning.focusedBorderColor=#e2a53a
Component.custom.borderColor=lighten(desaturate(#f00,20%,derived noAutoInverse),25%,derived noAutoInverse)

#---- Desktop ----

Desktop.background=#E6EBF0

#---- DesktopIcon ----

DesktopIcon.background=darken($Desktop.background,10%)

#---- HelpButton ----

HelpButton.questionMarkColor=#4F9EE3

#---- InternalFrame ----

InternalFrame.activeTitleBackground=#fff
InternalFrame.activeTitleForeground=@foreground
InternalFrame.inactiveTitleBackground=#fafafa
InternalFrame.inactiveTitleForeground=@disabledForeground

InternalFrame.activeBorderColor=darken($Component.borderColor,20%)
InternalFrame.inactiveBorderColor=$Component.borderColor

InternalFrame.buttonHoverBackground=darken($InternalFrame.activeTitleBackground,10%,derived)
InternalFrame.buttonPressedBackground=darken($InternalFrame.activeTitleBackground,20%,derived)
InternalFrame.closeHoverBackground=lazy(Actions.Red)
InternalFrame.closePressedBackground=darken(Actions.Red,10%,lazy)
InternalFrame.closeHoverForeground=#fff
InternalFrame.closePressedForeground=#fff

InternalFrame.activeDropShadowOpacity=0.25
InternalFrame.inactiveDropShadowOpacity=0.5

#---- List ----

List.background=@componentBackground

#---- Menu ----

Menu.icon.arrowColor=#666666
Menu.icon.disabledArrowColor=#ABABAB

#---- MenuBar ----

MenuBar.borderColor=#cdcdcd
MenuBar.hoverBackground=@menuHoverBackground

#---- MenuItemCheckBox ----

CheckBoxMenuItem.icon.checkmarkColor=#4F9EE3
CheckBoxMenuItem.icon.disabledCheckmarkColor=#ABABAB

#---- PasswordField ----

PasswordField.capsLockIconColor=#00000064

#---- Popup ----

Popup.dropShadowColor=#000
Popup.dropShadowOpacity=0.15

#---- PopupMenu ----

PopupMenu.borderColor=#adadad

#---- ProgressBar ----

ProgressBar.background=#D1D1D1
ProgressBar.foreground=#1E82E6
ProgressBar.selectionForeground=@componentBackground
ProgressBar.selectionBackground=@foreground

#---- RadioButton ----

RadioButton.icon[filled].centerDiameter=5

#---- ScrollBar ----

ScrollBar.track=lighten(@background,1%,derived noAutoInverse)
ScrollBar.thumb=darken($ScrollBar.track,10%,derived noAutoInverse)
ScrollBar.hoverTrackColor=darken($ScrollBar.track,3%,derived noAutoInverse)
ScrollBar.hoverThumbColor=darken($ScrollBar.thumb,10%,derived noAutoInverse)
ScrollBar.pressedThumbColor=darken($ScrollBar.thumb,20%,derived noAutoInverse)
ScrollBar.hoverButtonBackground=darken(@background,5%,derived noAutoInverse)
ScrollBar.pressedButtonBackground=darken(@background,10%,derived noAutoInverse)

#---- Separator ----

Separator.foreground=#d1d1d1

#---- Slider ----

Slider.trackColor=#c4c4c4
Slider.thumbColor=#6e6e6e
Slider.tickColor=#888888
Slider.hoverColor=lighten($Slider.thumbColor,15%,derived)
Slider.disabledForeground=#c0c0c0

#---- SplitPane ----

SplitPaneDivider.draggingColor=#c4c4c4
SplitPaneDivider.oneTouchHoverArrowColor=#333333

#---- TabbedPane ----

TabbedPane.disabledForeground=@disabledForeground
TabbedPane.underlineColor=#4083C9
TabbedPane.disabledUnderlineColor=#ababab
TabbedPane.hoverColor=#d9d9d9
TabbedPane.focusColor=#dae4ed
TabbedPane.contentAreaColor=#bfbfbf

#---- Table ----

Table.background=@componentBackground
Table.gridColor=darken($Table.background,3%)

#---- TableHeader ----

TableHeader.background=@componentBackground
TableHeader.separatorColor=darken($TableHeader.background,10%)
TableHeader.bottomSeparatorColor=$TableHeader.separatorColor

#---- TitlePane ----

TitlePane.embeddedForeground=lighten($TitlePane.foreground,35%)
TitlePane.buttonHoverBackground=darken($TitlePane.background,10%,derived)
TitlePane.buttonPressedBackground=darken($TitlePane.background,20%,derived)

#---- ToggleButton ----

ToggleButton.selectedBackground=darken($ToggleButton.background,20%,derived)
ToggleButton.selectedForeground=@foreground
ToggleButton.disabledSelectedBackground=darken($ToggleButton.background,13%,derived)

ToggleButton.toolbar.selectedBackground=$ToggleButton.selectedBackground

#---- ToolTip ----

ToolTip.border=4,6,4,6,$InternalFrame.activeBorderColor
ToolTip.background=#fafafa

#---- Tree ----

Tree.background=@componentBackground
Tree.hash=#E6E6E6
DevCharly commented 2 years ago

Caught From : com.psia.control.job.AbstractJob.handleRun()

Is this exception from a background thread?

DevCharly commented 2 years ago

Maybe fixed in latest 2.0 snapshot: https://github.com/JFormDesigner/FlatLaf#snapshots

tsjung75 commented 2 years ago

I tested with the latest 2.0 snapshot and found that this issue is fixed. Thank you very much!