All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fernice.reflare.light.helper.kt Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package fernice.reflare.light

import fernice.reflare.FlareLookAndFeel
import javax.swing.JComponent
import javax.swing.UIManager
import javax.swing.plaf.ComponentUI

internal inline fun integrationDependent(component: JComponent, block: () -> ComponentUI): ComponentUI {
    FlareLookAndFeel.installIntegration()

    return if (UIManager.getLookAndFeel() is FlareLookAndFeel) {
        UIManager.getUI(component)
    } else {
        block()
    }
}

internal inline fun computeIntegrationDependent(block: () -> Unit) {
    if (UIManager.getLookAndFeel() !is FlareLookAndFeel) {
        block()
    }
}

object IntegrationHelper {

    @JvmStatic
    fun getIntegrationDependentUI(component: JComponent, block: () -> ComponentUI): ComponentUI {
        return integrationDependent(component, block)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy