|
|
@ -1,10 +1,32 @@ |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* MIT License |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Copyright (c) 2021 Jannis Weis |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and |
|
|
|
|
|
|
|
* associated documentation files (the "Software"), to deal in the Software without restriction, |
|
|
|
|
|
|
|
* including without limitation the rights to use, copy, modify, merge, publish, distribute, |
|
|
|
|
|
|
|
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
|
|
|
|
|
|
|
* furnished to do so, subject to the following conditions: |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* The above copyright notice and this permission notice shall be included in all copies or |
|
|
|
|
|
|
|
* substantial portions of the Software. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT |
|
|
|
|
|
|
|
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
|
|
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
|
|
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
|
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
package com.github.weisj.darklaf.ui.demo; |
|
|
|
package com.github.weisj.darklaf.ui.demo; |
|
|
|
|
|
|
|
|
|
|
|
import com.github.weisj.darklaf.LafManager; |
|
|
|
import java.awt.Dialog; |
|
|
|
import com.github.weisj.darklaf.properties.icons.IconLoader; |
|
|
|
import java.awt.Dimension; |
|
|
|
import com.github.weisj.darklaf.theme.Theme; |
|
|
|
import java.awt.Toolkit; |
|
|
|
import com.github.weisj.darklaf.theme.info.PreferredThemeStyle; |
|
|
|
import java.awt.Window; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
|
|
import java.util.logging.Level; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.JDialog; |
|
|
|
import javax.swing.JDialog; |
|
|
@ -13,19 +35,20 @@ import javax.swing.JMenuBar; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.UIManager; |
|
|
|
import javax.swing.UIManager; |
|
|
|
import javax.swing.UnsupportedLookAndFeelException; |
|
|
|
import javax.swing.UnsupportedLookAndFeelException; |
|
|
|
import java.awt.Dialog; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import java.awt.Toolkit; |
|
|
|
|
|
|
|
import java.awt.Window; |
|
|
|
import com.github.weisj.darklaf.LafManager; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import com.github.weisj.darklaf.properties.icons.IconLoader; |
|
|
|
import java.util.logging.Level; |
|
|
|
import com.github.weisj.darklaf.theme.Theme; |
|
|
|
|
|
|
|
import com.github.weisj.darklaf.theme.info.PreferredThemeStyle; |
|
|
|
|
|
|
|
|
|
|
|
public final class DemoExecutor { |
|
|
|
public final class DemoExecutor { |
|
|
|
|
|
|
|
|
|
|
|
public static Theme getPreferredTheme() { |
|
|
|
public static Theme getPreferredTheme() { |
|
|
|
PreferredThemeStyle themeStyle = LafManager.getPreferredThemeStyle(); |
|
|
|
PreferredThemeStyle themeStyle = LafManager.getPreferredThemeStyle(); |
|
|
|
return LafManager.themeForPreferredStyle( |
|
|
|
return LafManager.themeForPreferredStyle( |
|
|
|
new PreferredThemeStyle(themeStyle.getContrastRule(), themeStyle.getColorToneRule())); |
|
|
|
new PreferredThemeStyle(themeStyle.getContrastRule(), themeStyle.getColorToneRule())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void showDemo(final ComponentDemo demo) { |
|
|
|
public static void showDemo(final ComponentDemo demo) { |
|
|
@ -41,7 +64,6 @@ public final class DemoExecutor { |
|
|
|
public static AtomicReference<Window> showDemo(final ComponentDemo demo, final boolean asDialog) { |
|
|
|
public static AtomicReference<Window> showDemo(final ComponentDemo demo, final boolean asDialog) { |
|
|
|
LafManager.enabledPreferenceChangeReporting(false); |
|
|
|
LafManager.enabledPreferenceChangeReporting(false); |
|
|
|
LafManager.addThemePreferenceChangeListener(LafManager::installTheme); |
|
|
|
LafManager.addThemePreferenceChangeListener(LafManager::installTheme); |
|
|
|
LafManager.setDecorationsEnabled(true); |
|
|
|
|
|
|
|
AtomicReference<Window> windowRef = new AtomicReference<>(); |
|
|
|
AtomicReference<Window> windowRef = new AtomicReference<>(); |
|
|
|
DemoExecutionSpec executionSpec = demo.getExecutionSpec(); |
|
|
|
DemoExecutionSpec executionSpec = demo.getExecutionSpec(); |
|
|
|
|
|
|
|
|
|
|
|