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
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumDefines 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 theSwingTreeto derive the UI scaling factor and or to install the font in theUIManagerdepending on theSwingTreeInitConfig.FontInstallationmode (seedefaultFont(Font, FontInstallation)).defaultFont(Font newDefaultFont, SwingTreeInitConfig.FontInstallation newFontInstallation) Used to configure both the defaultFontand theSwingTreeInitConfig.FontInstallationmode.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.logMarker(org.slf4j.Marker newLogMarker) Allows you to configure the loggingMarkerused by SwingTree for all its logging.static SwingTreeInitConfigstandard()styleSheet(StyleSheet newStyleSheet) Used to configure a globalStyleSheetserving as a base for allStyleSheets 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 theSwingTreeto derive the UI scaling factor and or to install the font in theUIManagerdepending on theSwingTreeInitConfig.FontInstallationmode (seedefaultFont(Font, FontInstallation)).- Parameters:
newDefaultFont- The new default font, ornullto unset the default font.- Returns:
- A new
SwingTreeInitConfiginstance with the new default font.
-
defaultFont
public SwingTreeInitConfig defaultFont(Font newDefaultFont, SwingTreeInitConfig.FontInstallation newFontInstallation) Used to configure both the defaultFontand theSwingTreeInitConfig.FontInstallationmode.The
SwingTreeInitConfig.FontInstallationmode determines how theFontis installed in theUIManager(seeSwingTreeInitConfig.FontInstallation).If the
SwingTreeInitConfig.FontInstallationmode isSwingTreeInitConfig.FontInstallation.SOFT, then theFontwill only be installed as the "defaultFont" property in theUIManager. If on the other hand theSwingTreeInitConfig.FontInstallationmode isSwingTreeInitConfig.FontInstallation.HARD, then theFontwill be installed by replacing allFonts in theUIManager.- Parameters:
newDefaultFont- The new default font, ornullto unset the default font.newFontInstallation- The newSwingTreeInitConfig.FontInstallationmode.- Returns:
- A new
SwingTreeInitConfiginstance with the new default font andSwingTreeInitConfig.FontInstallationmode.
-
eventProcessor
Used to configure theEventProcessor, which is used to process both UI and application events. You may create your ownEventProcessorimplementation or use one of the predefined ones likeEventProcessor.COUPLED_STRICT,EventProcessor.COUPLEDorEventProcessor.DECOUPLED.- Parameters:
newEventProcessor- The newEventProcessor.- Returns:
- A new
SwingTreeInitConfiginstance with the newEventProcessor.
-
styleSheet
Used to configure a globalStyleSheetserving as a base for allStyleSheets used inside your application (seeUIFactoryMethods.use(swingtree.style.StyleSheet, Supplier)).- Parameters:
newStyleSheet- The newStyleSheet, ornullto unset theStyleSheet.- Returns:
- A new
SwingTreeInitConfiginstance 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
SwingTreeInitConfiginstance 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
falseandtrue
Defaulttrue- Parameters:
newUiScaleEnabled- The new UI scaling mode.- Returns:
- A new
SwingTreeInitConfiginstance 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
falseandtrue
Defaultfalse- Parameters:
newUiScaleAllowScaleDown- The new UI scaling mode.- Returns:
- A new
SwingTreeInitConfiginstance 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 theLifeTimeobject which is used to define the duration of anAnimation.- Parameters:
newDefaultAnimationInterval- The new default animation interval.- Returns:
- A new
SwingTreeInitConfiginstance with the new default animation interval.
-
logMarker
Allows you to configure the loggingMarkerused by SwingTree for all its logging. This is typically passed to methods likelogger.debug(Marker, String),logger.info(Marker, String)and so on.
You may use this marker to channel SwingTree logs to a separate log file or to filter them in any other way you like.- Parameters:
newLogMarker- The new loggingMarkerwhich is passed to methods of the SLF4J logger.- Returns:
- A new
SwingTreeInitConfiginstance with the new loggingMarker.
-