Class SwingTreeInitConfig
SwingTree
library,
which can be configured using a functional SwingTreeConfigurator
lambda
passed to SwingTree.initialiseUsing(SwingTreeConfigurator)
.
It allows for the configuration of the default
font, font installation, scaling, event processing and
application wide StyleSheet
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
Defines how the scaling factor for the UI should be determined. -
Method Summary
Modifier and TypeMethodDescriptiondefaultAnimationInterval
(long newDefaultAnimationInterval) Used to configure the default animation interval in milliseconds, which is a property that determines the delay between two consecutive animation steps.defaultFont
(Font newDefaultFont) Used to configure the default font, which may be used by theSwingTree
to derive the UI scaling factor and or to install the font in theUIManager
depending on theSwingTreeInitConfig.FontInstallation
mode (seedefaultFont(Font, FontInstallation)
).defaultFont
(Font newDefaultFont, SwingTreeInitConfig.FontInstallation newFontInstallation) Used to configure both the defaultFont
and theSwingTreeInitConfig.FontInstallation
mode.eventProcessor
(EventProcessor newEventProcessor) Used to configure theEventProcessor
, which is used to process both UI and application events.isUiScaleDownAllowed
(boolean newUiScaleAllowScaleDown) Used to configure whether values smaller than 100% are allowed for the user scale factor as is specified by the system propertyswingtree.uiScale.allowScaleDown
.isUiScaleFactorEnabled
(boolean newUiScaleEnabled) Used to configure whether the UI scaling mode is enabled as is specified by the system propertyswingtree.uiScale.enabled
.static SwingTreeInitConfig
standard()
styleSheet
(StyleSheet newStyleSheet) Used to configure a globalStyleSheet
serving as a base for allStyleSheet
s used inside your application (seeUIFactoryMethods.use(swingtree.style.StyleSheet, Supplier)
).uiScaleFactor
(float newUiScale) Use this to configure the UI scaling factor.
-
Method Details
-
standard
-
defaultFont
Used to configure the default font, which may be used by theSwingTree
to derive the UI scaling factor and or to install the font in theUIManager
depending on theSwingTreeInitConfig.FontInstallation
mode (seedefaultFont(Font, FontInstallation)
).- Parameters:
newDefaultFont
- The new default font, ornull
to unset the default font.- Returns:
- A new
SwingTreeInitConfig
instance with the new default font.
-
defaultFont
public SwingTreeInitConfig defaultFont(Font newDefaultFont, SwingTreeInitConfig.FontInstallation newFontInstallation) Used to configure both the defaultFont
and theSwingTreeInitConfig.FontInstallation
mode.The
SwingTreeInitConfig.FontInstallation
mode determines how theFont
is installed in theUIManager
(seeSwingTreeInitConfig.FontInstallation
).If the
SwingTreeInitConfig.FontInstallation
mode isSwingTreeInitConfig.FontInstallation.SOFT
, then theFont
will only be installed as the "defaultFont" property in theUIManager
. If on the other hand theSwingTreeInitConfig.FontInstallation
mode isSwingTreeInitConfig.FontInstallation.HARD
, then theFont
will be installed by replacing allFont
s in theUIManager
.- Parameters:
newDefaultFont
- The new default font, ornull
to unset the default font.newFontInstallation
- The newSwingTreeInitConfig.FontInstallation
mode.- Returns:
- A new
SwingTreeInitConfig
instance with the new default font andSwingTreeInitConfig.FontInstallation
mode.
-
eventProcessor
Used to configure theEventProcessor
, which is used to process both UI and application events. You may create your ownEventProcessor
implementation or use one of the predefined ones likeEventProcessor.COUPLED_STRICT
,EventProcessor.COUPLED
orEventProcessor.DECOUPLED
.- Parameters:
newEventProcessor
- The newEventProcessor
.- Returns:
- A new
SwingTreeInitConfig
instance with the newEventProcessor
.
-
styleSheet
Used to configure a globalStyleSheet
serving as a base for allStyleSheet
s used inside your application (seeUIFactoryMethods.use(swingtree.style.StyleSheet, Supplier)
).- Parameters:
newStyleSheet
- The newStyleSheet
, ornull
to unset theStyleSheet
.- Returns:
- A new
SwingTreeInitConfig
instance with the newStyleSheet
.
-
uiScaleFactor
Use this to configure the UI scaling factor. The default factor determined by the system property"swingtree.uiScale"
.If Java runtime scales (Java 9 or later), this scale factor is applied on top of the Java system scale factor. Java 8 does not scale and this scale factor replaces the user scale factor that SwingTree computes based on the font. To replace the Java 9+ system scale factor, use system property "sun.java2d.uiScale", which has the same syntax as this one.
Allowed Values e.g.
1.5
,1.5x
,150%
or144dpi
(96dpi is 100%)- Parameters:
newUiScale
- The new UI scaling factor.- Returns:
- A new
SwingTreeInitConfig
instance with the new UI scaling factor.
-
isUiScaleFactorEnabled
Used to configure whether the UI scaling mode is enabled as is specified by the system propertyswingtree.uiScale.enabled
.Allowed Values
false
andtrue
Defaulttrue
- Parameters:
newUiScaleEnabled
- The new UI scaling mode.- Returns:
- A new
SwingTreeInitConfig
instance with the new UI scaling mode.
-
isUiScaleDownAllowed
Used to configure whether values smaller than 100% are allowed for the user scale factor as is specified by the system propertyswingtree.uiScale.allowScaleDown
.Allowed Values
false
andtrue
Defaultfalse
- Parameters:
newUiScaleAllowScaleDown
- The new UI scaling mode.- Returns:
- A new
SwingTreeInitConfig
instance with the new UI scaling mode.
-
defaultAnimationInterval
Used to configure the default animation interval in milliseconds, which is a property that determines the delay between two consecutive animation steps. You can think of it as the time between the heartbeats of the animation. The smaller the interval, the higher the refresh rate and the smoother the animation will look. However, the smaller the interval, the more CPU time will be used. The default interval is 16 ms which corresponds to 60 fps. Seestandard()
, returning an instance of this config with the default value.
This property is used as default value by theLifeTime
object which is used to define the duration of anAnimation
.- Parameters:
newDefaultAnimationInterval
- The new default animation interval.- Returns:
- A new
SwingTreeInitConfig
instance with the new default animation interval.
-