mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
Theme Editor: added "live" preview
This commit is contained in:
@@ -35,6 +35,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@@ -66,6 +67,7 @@ import javax.swing.text.html.HTMLEditorKit;
|
|||||||
import com.formdev.flatlaf.ui.FlatNativeWindowBorder;
|
import com.formdev.flatlaf.ui.FlatNativeWindowBorder;
|
||||||
import com.formdev.flatlaf.ui.FlatPopupFactory;
|
import com.formdev.flatlaf.ui.FlatPopupFactory;
|
||||||
import com.formdev.flatlaf.ui.FlatRootPaneUI;
|
import com.formdev.flatlaf.ui.FlatRootPaneUI;
|
||||||
|
import com.formdev.flatlaf.ui.FlatUIUtils;
|
||||||
import com.formdev.flatlaf.util.GrayFilter;
|
import com.formdev.flatlaf.util.GrayFilter;
|
||||||
import com.formdev.flatlaf.util.LoggingFacade;
|
import com.formdev.flatlaf.util.LoggingFacade;
|
||||||
import com.formdev.flatlaf.util.MultiResolutionImageSupport;
|
import com.formdev.flatlaf.util.MultiResolutionImageSupport;
|
||||||
@@ -96,6 +98,7 @@ public abstract class FlatLaf
|
|||||||
private MnemonicHandler mnemonicHandler;
|
private MnemonicHandler mnemonicHandler;
|
||||||
|
|
||||||
private Consumer<UIDefaults> postInitialization;
|
private Consumer<UIDefaults> postInitialization;
|
||||||
|
private List<Function<Object, Object>> uiDefaultsGetters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the application look and feel to the given LaF
|
* Sets the application look and feel to the given LaF
|
||||||
@@ -356,7 +359,7 @@ public abstract class FlatLaf
|
|||||||
public UIDefaults getDefaults() {
|
public UIDefaults getDefaults() {
|
||||||
// use larger initial capacity to avoid resizing UI defaults hash table
|
// use larger initial capacity to avoid resizing UI defaults hash table
|
||||||
// (from 610 to 1221 to 2443 entries) and to save some memory
|
// (from 610 to 1221 to 2443 entries) and to save some memory
|
||||||
UIDefaults defaults = new UIDefaults( 1500, 0.75f );
|
UIDefaults defaults = new FlatUIDefaults( 1500, 0.75f );
|
||||||
|
|
||||||
// initialize basic defaults (see super.getDefaults())
|
// initialize basic defaults (see super.getDefaults())
|
||||||
initClassDefaults( defaults );
|
initClassDefaults( defaults );
|
||||||
@@ -921,6 +924,104 @@ public abstract class FlatLaf
|
|||||||
return super.hashCode();
|
return super.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a UI defaults getter function that is invoked before the standard getter.
|
||||||
|
* This allows using different UI defaults for special purposes
|
||||||
|
* (e.g. using multiple themes at the same time).
|
||||||
|
*
|
||||||
|
* @see #unregisterUIDefaultsGetter(Function)
|
||||||
|
* @see #runWithUIDefaultsGetter(Function, Runnable)
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public void registerUIDefaultsGetter( Function<Object, Object> uiDefaultsGetter ) {
|
||||||
|
if( uiDefaultsGetters == null )
|
||||||
|
uiDefaultsGetters = new ArrayList<>();
|
||||||
|
|
||||||
|
uiDefaultsGetters.remove( uiDefaultsGetter );
|
||||||
|
uiDefaultsGetters.add( uiDefaultsGetter );
|
||||||
|
|
||||||
|
// disable shared UIs
|
||||||
|
FlatUIUtils.setUseSharedUIs( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a UI defaults getter function that was invoked before the standard getter.
|
||||||
|
*
|
||||||
|
* @see #registerUIDefaultsGetter(Function)
|
||||||
|
* @see #runWithUIDefaultsGetter(Function, Runnable)
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public void unregisterUIDefaultsGetter( Function<Object, Object> uiDefaultsGetter ) {
|
||||||
|
if( uiDefaultsGetters == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
uiDefaultsGetters.remove( uiDefaultsGetter );
|
||||||
|
|
||||||
|
// enable shared UIs
|
||||||
|
if( uiDefaultsGetters.isEmpty() )
|
||||||
|
FlatUIUtils.setUseSharedUIs( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a UI defaults getter function that is invoked before the standard getter,
|
||||||
|
* runs the given runnable and unregisters the UI defaults getter function again.
|
||||||
|
* This allows using different UI defaults for special purposes
|
||||||
|
* (e.g. using multiple themes at the same time).
|
||||||
|
* If the current look and feel is not FlatLaf, then the getter is ignored and
|
||||||
|
* the given runnable invoked.
|
||||||
|
*
|
||||||
|
* @see #registerUIDefaultsGetter(Function)
|
||||||
|
* @see #unregisterUIDefaultsGetter(Function)
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public static void runWithUIDefaultsGetter( Function<Object, Object> uiDefaultsGetter, Runnable runnable ) {
|
||||||
|
LookAndFeel laf = UIManager.getLookAndFeel();
|
||||||
|
if( laf instanceof FlatLaf ) {
|
||||||
|
((FlatLaf)laf).registerUIDefaultsGetter( uiDefaultsGetter );
|
||||||
|
try {
|
||||||
|
runnable.run();
|
||||||
|
} finally {
|
||||||
|
((FlatLaf)laf).unregisterUIDefaultsGetter( uiDefaultsGetter );
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---- class FlatUIDefaults -----------------------------------------------
|
||||||
|
|
||||||
|
private class FlatUIDefaults
|
||||||
|
extends UIDefaults
|
||||||
|
{
|
||||||
|
FlatUIDefaults( int initialCapacity, float loadFactor ) {
|
||||||
|
super( initialCapacity, loadFactor );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get( Object key ) {
|
||||||
|
Object value = getValue( key );
|
||||||
|
return (value != null) ? value : super.get( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get( Object key, Locale l ) {
|
||||||
|
Object value = getValue( key );
|
||||||
|
return (value != null) ? value : super.get( key, l );
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object getValue( Object key ) {
|
||||||
|
if( uiDefaultsGetters == null )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
for( int i = uiDefaultsGetters.size() - 1; i >= 0; i-- ) {
|
||||||
|
Object value = uiDefaultsGetters.get( i ).apply( key );
|
||||||
|
if( value != null )
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---- class ActiveFont ---------------------------------------------------
|
//---- class ActiveFont ---------------------------------------------------
|
||||||
|
|
||||||
private static class ActiveFont
|
private static class ActiveFont
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public class FlatUIUtils
|
|||||||
{
|
{
|
||||||
public static final boolean MAC_USE_QUARTZ = Boolean.getBoolean( "apple.awt.graphics.UseQuartz" );
|
public static final boolean MAC_USE_QUARTZ = Boolean.getBoolean( "apple.awt.graphics.UseQuartz" );
|
||||||
|
|
||||||
|
private static boolean useSharedUIs = true;
|
||||||
private static WeakHashMap<LookAndFeel, IdentityHashMap<Object, ComponentUI>> sharedUIinstances = new WeakHashMap<>();
|
private static WeakHashMap<LookAndFeel, IdentityHashMap<Object, ComponentUI>> sharedUIinstances = new WeakHashMap<>();
|
||||||
|
|
||||||
public static Rectangle addInsets( Rectangle r, Insets insets ) {
|
public static Rectangle addInsets( Rectangle r, Insets insets ) {
|
||||||
@@ -825,6 +826,27 @@ debug*/
|
|||||||
return explicitlySet;
|
return explicitlySet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether shared UI delegates are used.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public static boolean isUseSharedUIs() {
|
||||||
|
return useSharedUIs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies whether shared UI delegates are used.
|
||||||
|
* This does not change already existing UI delegates.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public static boolean setUseSharedUIs( boolean useSharedUIs ) {
|
||||||
|
boolean old = FlatUIUtils.useSharedUIs;
|
||||||
|
FlatUIUtils.useSharedUIs = useSharedUIs;
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shared component UI for the given key and the current Laf.
|
* Creates a shared component UI for the given key and the current Laf.
|
||||||
* Each Laf instance has its own shared component UI instance.
|
* Each Laf instance has its own shared component UI instance.
|
||||||
@@ -833,6 +855,9 @@ debug*/
|
|||||||
* may use multiple Laf instances at the same time.
|
* may use multiple Laf instances at the same time.
|
||||||
*/
|
*/
|
||||||
public static ComponentUI createSharedUI( Object key, Supplier<ComponentUI> newInstanceSupplier ) {
|
public static ComponentUI createSharedUI( Object key, Supplier<ComponentUI> newInstanceSupplier ) {
|
||||||
|
if( !useSharedUIs )
|
||||||
|
return newInstanceSupplier.get();
|
||||||
|
|
||||||
return sharedUIinstances
|
return sharedUIinstances
|
||||||
.computeIfAbsent( UIManager.getLookAndFeel(), k -> new IdentityHashMap<>() )
|
.computeIfAbsent( UIManager.getLookAndFeel(), k -> new IdentityHashMap<>() )
|
||||||
.computeIfAbsent( key, k -> newInstanceSupplier.get() );
|
.computeIfAbsent( key, k -> newInstanceSupplier.get() );
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import javax.swing.JFrame;
|
|||||||
import javax.swing.JLayer;
|
import javax.swing.JLayer;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
@@ -67,6 +68,8 @@ class FlatThemeEditorPane
|
|||||||
private final FlatSyntaxTextArea textArea;
|
private final FlatSyntaxTextArea textArea;
|
||||||
private final ErrorStrip errorStrip;
|
private final ErrorStrip errorStrip;
|
||||||
private FlatFindReplaceBar findReplaceBar;
|
private FlatFindReplaceBar findReplaceBar;
|
||||||
|
private JScrollPane previewScrollPane;
|
||||||
|
private FlatThemePreview preview;
|
||||||
|
|
||||||
private File file;
|
private File file;
|
||||||
|
|
||||||
@@ -260,6 +263,30 @@ class FlatThemeEditorPane
|
|||||||
collapsiblePanel.showBottomComponent( findReplaceBar );
|
collapsiblePanel.showBottomComponent( findReplaceBar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showPreview( boolean show ) {
|
||||||
|
if( show ) {
|
||||||
|
if( preview != null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
preview = new FlatThemePreview( textArea );
|
||||||
|
previewScrollPane = new JScrollPane( preview );
|
||||||
|
previewScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||||
|
previewScrollPane.setBorder( null );
|
||||||
|
previewScrollPane.getVerticalScrollBar().setUnitIncrement( 20 );
|
||||||
|
previewScrollPane.getHorizontalScrollBar().setUnitIncrement( 20 );
|
||||||
|
add( previewScrollPane, BorderLayout.LINE_END );
|
||||||
|
} else {
|
||||||
|
if( preview == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
remove( previewScrollPane );
|
||||||
|
previewScrollPane = null;
|
||||||
|
preview = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
revalidate();
|
||||||
|
}
|
||||||
|
|
||||||
//---- class FlatSyntaxScheme ---------------------------------------------
|
//---- class FlatSyntaxScheme ---------------------------------------------
|
||||||
|
|
||||||
private static class FlatSyntaxScheme
|
private static class FlatSyntaxScheme
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public class FlatThemeFileEditor
|
|||||||
private static final String KEY_RECENT_DIRECTORY = "recentDirectory";
|
private static final String KEY_RECENT_DIRECTORY = "recentDirectory";
|
||||||
private static final String KEY_RECENT_FILE = "recentFile";
|
private static final String KEY_RECENT_FILE = "recentFile";
|
||||||
private static final String KEY_WINDOW_BOUNDS = "windowBounds";
|
private static final String KEY_WINDOW_BOUNDS = "windowBounds";
|
||||||
|
private static final String KEY_PREVIEW = "preview";
|
||||||
private static final String KEY_LAF = "laf";
|
private static final String KEY_LAF = "laf";
|
||||||
private static final String KEY_FONT_SIZE_INCR = "fontSizeIncr";
|
private static final String KEY_FONT_SIZE_INCR = "fontSizeIncr";
|
||||||
|
|
||||||
@@ -281,6 +282,9 @@ public class FlatThemeFileEditor
|
|||||||
tabbedPane.setTitleAt( index, titleFun.get() );
|
tabbedPane.setTitleAt( index, titleFun.get() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
if( state.getBoolean( KEY_PREVIEW, true ) )
|
||||||
|
themeEditorPane.showPreview( true );
|
||||||
|
|
||||||
tabbedPane.addTab( titleFun.get(), null, themeEditorPane, file.getAbsolutePath() );
|
tabbedPane.addTab( titleFun.get(), null, themeEditorPane, file.getAbsolutePath() );
|
||||||
|
|
||||||
if( select )
|
if( select )
|
||||||
@@ -350,6 +354,13 @@ public class FlatThemeFileEditor
|
|||||||
themeEditorPane.showFindReplaceBar();
|
themeEditorPane.showFindReplaceBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showHidePreview() {
|
||||||
|
boolean show = previewMenuItem.isSelected();
|
||||||
|
for( FlatThemeEditorPane themeEditorPane : getThemeEditorPanes() )
|
||||||
|
themeEditorPane.showPreview( show );
|
||||||
|
state.putBoolean( KEY_PREVIEW, show );
|
||||||
|
}
|
||||||
|
|
||||||
private void lightLaf() {
|
private void lightLaf() {
|
||||||
applyLookAndFeel( FlatLightLaf.class.getName() );
|
applyLookAndFeel( FlatLightLaf.class.getName() );
|
||||||
}
|
}
|
||||||
@@ -407,6 +418,8 @@ public class FlatThemeFileEditor
|
|||||||
String[] directories = getPrefsStrings( state, KEY_DIRECTORIES );
|
String[] directories = getPrefsStrings( state, KEY_DIRECTORIES );
|
||||||
SortedComboBoxModel<String> model = new SortedComboBoxModel<>( directories );
|
SortedComboBoxModel<String> model = new SortedComboBoxModel<>( directories );
|
||||||
directoryField.setModel( model );
|
directoryField.setModel( model );
|
||||||
|
|
||||||
|
previewMenuItem.setSelected( state.getBoolean( KEY_PREVIEW, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveState() {
|
private void saveState() {
|
||||||
@@ -505,6 +518,7 @@ public class FlatThemeFileEditor
|
|||||||
editMenu = new JMenu();
|
editMenu = new JMenu();
|
||||||
findMenuItem = new JMenuItem();
|
findMenuItem = new JMenuItem();
|
||||||
viewMenu = new JMenu();
|
viewMenu = new JMenu();
|
||||||
|
previewMenuItem = new JCheckBoxMenuItem();
|
||||||
lightLafMenuItem = new JRadioButtonMenuItem();
|
lightLafMenuItem = new JRadioButtonMenuItem();
|
||||||
darkLafMenuItem = new JRadioButtonMenuItem();
|
darkLafMenuItem = new JRadioButtonMenuItem();
|
||||||
incrFontSizeMenuItem = new JMenuItem();
|
incrFontSizeMenuItem = new JMenuItem();
|
||||||
@@ -589,6 +603,13 @@ public class FlatThemeFileEditor
|
|||||||
viewMenu.setText("View");
|
viewMenu.setText("View");
|
||||||
viewMenu.setMnemonic('V');
|
viewMenu.setMnemonic('V');
|
||||||
|
|
||||||
|
//---- previewMenuItem ----
|
||||||
|
previewMenuItem.setText("Preview");
|
||||||
|
previewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK));
|
||||||
|
previewMenuItem.addActionListener(e -> showHidePreview());
|
||||||
|
viewMenu.add(previewMenuItem);
|
||||||
|
viewMenu.addSeparator();
|
||||||
|
|
||||||
//---- lightLafMenuItem ----
|
//---- lightLafMenuItem ----
|
||||||
lightLafMenuItem.setText("Light Laf");
|
lightLafMenuItem.setText("Light Laf");
|
||||||
lightLafMenuItem.setMnemonic('L');
|
lightLafMenuItem.setMnemonic('L');
|
||||||
@@ -684,10 +705,10 @@ public class FlatThemeFileEditor
|
|||||||
}
|
}
|
||||||
contentPane.add(tabbedPane, BorderLayout.CENTER);
|
contentPane.add(tabbedPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
//---- buttonGroup1 ----
|
//---- lafButtonGroup ----
|
||||||
ButtonGroup buttonGroup1 = new ButtonGroup();
|
ButtonGroup lafButtonGroup = new ButtonGroup();
|
||||||
buttonGroup1.add(lightLafMenuItem);
|
lafButtonGroup.add(lightLafMenuItem);
|
||||||
buttonGroup1.add(darkLafMenuItem);
|
lafButtonGroup.add(darkLafMenuItem);
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,6 +721,7 @@ public class FlatThemeFileEditor
|
|||||||
private JMenu editMenu;
|
private JMenu editMenu;
|
||||||
private JMenuItem findMenuItem;
|
private JMenuItem findMenuItem;
|
||||||
private JMenu viewMenu;
|
private JMenu viewMenu;
|
||||||
|
private JCheckBoxMenuItem previewMenuItem;
|
||||||
private JRadioButtonMenuItem lightLafMenuItem;
|
private JRadioButtonMenuItem lightLafMenuItem;
|
||||||
private JRadioButtonMenuItem darkLafMenuItem;
|
private JRadioButtonMenuItem darkLafMenuItem;
|
||||||
private JMenuItem incrFontSizeMenuItem;
|
private JMenuItem incrFontSizeMenuItem;
|
||||||
|
|||||||
@@ -99,10 +99,19 @@ new FormModel {
|
|||||||
name: "viewMenu"
|
name: "viewMenu"
|
||||||
"text": "View"
|
"text": "View"
|
||||||
"mnemonic": 86
|
"mnemonic": 86
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||||
|
name: "previewMenuItem"
|
||||||
|
"text": "Preview"
|
||||||
|
"accelerator": static javax.swing.KeyStroke getKeyStroke( 80, 130, false )
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showHidePreview", false ) )
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
|
||||||
|
name: "separator3"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||||
name: "lightLafMenuItem"
|
name: "lightLafMenuItem"
|
||||||
"text": "Light Laf"
|
"text": "Light Laf"
|
||||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
"$buttonGroup": new FormReference( "lafButtonGroup" )
|
||||||
"mnemonic": 76
|
"mnemonic": 76
|
||||||
"selected": true
|
"selected": true
|
||||||
"accelerator": static javax.swing.KeyStroke getKeyStroke( 122, 0, false )
|
"accelerator": static javax.swing.KeyStroke getKeyStroke( 122, 0, false )
|
||||||
@@ -111,7 +120,7 @@ new FormModel {
|
|||||||
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
|
||||||
name: "darkLafMenuItem"
|
name: "darkLafMenuItem"
|
||||||
"text": "Dark Laf"
|
"text": "Dark Laf"
|
||||||
"$buttonGroup": new FormReference( "buttonGroup1" )
|
"$buttonGroup": new FormReference( "lafButtonGroup" )
|
||||||
"mnemonic": 68
|
"mnemonic": 68
|
||||||
"accelerator": static javax.swing.KeyStroke getKeyStroke( 123, 0, false )
|
"accelerator": static javax.swing.KeyStroke getKeyStroke( 123, 0, false )
|
||||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "darkLaf", false ) )
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "darkLaf", false ) )
|
||||||
@@ -163,7 +172,7 @@ new FormModel {
|
|||||||
"size": new java.awt.Dimension( 535, 300 )
|
"size": new java.awt.Dimension( 535, 300 )
|
||||||
} )
|
} )
|
||||||
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
|
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
|
||||||
name: "buttonGroup1"
|
name: "lafButtonGroup"
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 310 )
|
"location": new java.awt.Point( 0, 310 )
|
||||||
} )
|
} )
|
||||||
|
|||||||
@@ -0,0 +1,649 @@
|
|||||||
|
/*
|
||||||
|
/*
|
||||||
|
* Copyright 2021 FormDev Software GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.formdev.flatlaf.themeeditor;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.HierarchyEvent;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.UIDefaults.ActiveValue;
|
||||||
|
import javax.swing.UIDefaults.LazyValue;
|
||||||
|
import javax.swing.event.DocumentEvent;
|
||||||
|
import javax.swing.event.DocumentListener;
|
||||||
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
|
import com.formdev.flatlaf.extras.components.*;
|
||||||
|
import net.miginfocom.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karl Tauber
|
||||||
|
*/
|
||||||
|
class FlatThemePreview
|
||||||
|
extends JPanel
|
||||||
|
implements DocumentListener
|
||||||
|
{
|
||||||
|
private final FlatSyntaxTextArea textArea;
|
||||||
|
private final Timer timer;
|
||||||
|
|
||||||
|
FlatThemePreview( FlatSyntaxTextArea textArea ) {
|
||||||
|
this.textArea = textArea;
|
||||||
|
|
||||||
|
initComponents();
|
||||||
|
|
||||||
|
tabbedPane1.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT );
|
||||||
|
tabbedPane1.addTab( "Tab 1", null );
|
||||||
|
tabbedPane1.addTab( "Tab 2", null );
|
||||||
|
tabbedPane1.addTab( "Tab 3", null );
|
||||||
|
tabbedPane1.addTab( "Tab 4", null );
|
||||||
|
tabbedPane1.addTab( "Tab 5", null );
|
||||||
|
tabbedPane1.addTab( "Tab 6", null );
|
||||||
|
tabbedPane1.addTab( "Tab 7", null );
|
||||||
|
tabbedPane1.addTab( "Tab 8", null );
|
||||||
|
|
||||||
|
// timer used for delayed preview updates
|
||||||
|
timer = new Timer( 500, e -> update() );
|
||||||
|
timer.setRepeats( false );
|
||||||
|
|
||||||
|
// listen to changes in text area to automatically update preview
|
||||||
|
textArea.getDocument().addDocumentListener( this );
|
||||||
|
|
||||||
|
// update when showing preview (e.g. activating tab)
|
||||||
|
addHierarchyListener( e -> {
|
||||||
|
if( (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && isShowing() )
|
||||||
|
EventQueue.invokeLater( this::update );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertUpdate( DocumentEvent e ) {
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeUpdate( DocumentEvent e ) {
|
||||||
|
timer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changedUpdate( DocumentEvent e ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update() {
|
||||||
|
if( !isShowing() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
FlatLaf.runWithUIDefaultsGetter( this::getUIDefaultProperty, this::updateComponentTreeUI );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateComponentTreeUI() {
|
||||||
|
try {
|
||||||
|
SwingUtilities.updateComponentTreeUI( this );
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object getUIDefaultProperty( Object key ) {
|
||||||
|
if( !(key instanceof String) )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Object value = textArea.propertiesSupport.getParsedProperty( (String) key );
|
||||||
|
if( value instanceof LazyValue )
|
||||||
|
value = ((LazyValue)value).createValue( null );
|
||||||
|
else if( value instanceof ActiveValue )
|
||||||
|
value = ((ActiveValue)value).createValue( null );
|
||||||
|
|
||||||
|
// System.out.println( key + " = " + value );
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( "deprecation" )
|
||||||
|
@Override
|
||||||
|
public void layout() {
|
||||||
|
try {
|
||||||
|
super.layout();
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void validateTree() {
|
||||||
|
try {
|
||||||
|
super.validateTree();
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension getPreferredSize() {
|
||||||
|
try {
|
||||||
|
return super.getPreferredSize();
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return new Dimension( 100, 100 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension getMinimumSize() {
|
||||||
|
try {
|
||||||
|
return super.getMinimumSize();
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return new Dimension( 100, 100 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension getMaximumSize() {
|
||||||
|
try {
|
||||||
|
return super.getMaximumSize();
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return new Dimension( Short.MAX_VALUE, Short.MAX_VALUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint( Graphics g ) {
|
||||||
|
try {
|
||||||
|
super.paint( g );
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintComponent( Graphics g ) {
|
||||||
|
try {
|
||||||
|
super.paintComponent( g );
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintChildren( Graphics g ) {
|
||||||
|
try {
|
||||||
|
super.paintChildren( g );
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enabledChanged() {
|
||||||
|
FlatLaf.runWithUIDefaultsGetter( this::getUIDefaultProperty, () -> {
|
||||||
|
enableDisable( this, enabledCheckBox.isSelected() );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableDisable( Component comp, boolean enabled ) {
|
||||||
|
comp.setEnabled( enabled );
|
||||||
|
|
||||||
|
if( !(comp instanceof Container) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for( Component c : ((Container)comp).getComponents() ) {
|
||||||
|
if( c == enabledCheckBox || c == previewLabel )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( c instanceof JScrollPane )
|
||||||
|
c = ((JScrollPane)c).getViewport().getView();
|
||||||
|
|
||||||
|
enableDisable( c, enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeProgress() {
|
||||||
|
int value = slider3.getValue();
|
||||||
|
progressBar1.setValue( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
|
previewLabel = new JLabel();
|
||||||
|
enabledCheckBox = new JCheckBox();
|
||||||
|
separator2 = new JSeparator();
|
||||||
|
labelLabel = new JLabel();
|
||||||
|
label1 = new JLabel();
|
||||||
|
flatButton1 = new FlatButton();
|
||||||
|
buttonLabel = new JLabel();
|
||||||
|
button1 = new JButton();
|
||||||
|
testDefaultButton1 = new FlatThemePreview.TestDefaultButton();
|
||||||
|
helpButton = new FlatButton();
|
||||||
|
hSpacer2 = new JPanel(null);
|
||||||
|
toggleButtonLabel = new JLabel();
|
||||||
|
toggleButton1 = new JToggleButton();
|
||||||
|
toggleButton3 = new JToggleButton();
|
||||||
|
hSpacer1 = new JPanel(null);
|
||||||
|
checkBoxLabel = new JLabel();
|
||||||
|
checkBox1 = new JCheckBox();
|
||||||
|
checkBox3 = new JCheckBox();
|
||||||
|
hSpacer3 = new JPanel(null);
|
||||||
|
radioButtonLabel = new JLabel();
|
||||||
|
radioButton1 = new JRadioButton();
|
||||||
|
radioButton3 = new JRadioButton();
|
||||||
|
hSpacer4 = new JPanel(null);
|
||||||
|
comboBoxLabel = new JLabel();
|
||||||
|
comboBox1 = new FlatComboBox<>();
|
||||||
|
comboBox3 = new JComboBox<>();
|
||||||
|
spinnerLabel = new JLabel();
|
||||||
|
spinner1 = new JSpinner();
|
||||||
|
textFieldLabel = new JLabel();
|
||||||
|
textField1 = new FlatTextField();
|
||||||
|
formattedTextFieldLabel = new JLabel();
|
||||||
|
formattedTextField1 = new FlatFormattedTextField();
|
||||||
|
passwordFieldLabel = new JLabel();
|
||||||
|
passwordField1 = new FlatPasswordField();
|
||||||
|
textAreaLabel = new JLabel();
|
||||||
|
scrollPane1 = new JScrollPane();
|
||||||
|
textArea1 = new JTextArea();
|
||||||
|
editorPaneLabel = new JLabel();
|
||||||
|
scrollPane5 = new JScrollPane();
|
||||||
|
editorPane1 = new JEditorPane();
|
||||||
|
textPaneLabel = new JLabel();
|
||||||
|
scrollPane9 = new JScrollPane();
|
||||||
|
textPane1 = new JTextPane();
|
||||||
|
scrollBarLabel = new JLabel();
|
||||||
|
scrollBar1 = new JScrollBar();
|
||||||
|
scrollBar5 = new FlatScrollBar();
|
||||||
|
separatorLabel = new JLabel();
|
||||||
|
separator1 = new JSeparator();
|
||||||
|
sliderLabel = new JLabel();
|
||||||
|
slider1 = new JSlider();
|
||||||
|
slider3 = new JSlider();
|
||||||
|
progressBarLabel = new JLabel();
|
||||||
|
progressBar1 = new FlatProgressBar();
|
||||||
|
toolTipLabel = new JLabel();
|
||||||
|
toolTip1 = new JToolTip();
|
||||||
|
tabbedPaneLabel = new JLabel();
|
||||||
|
tabbedPane1 = new JTabbedPane();
|
||||||
|
|
||||||
|
//======== this ========
|
||||||
|
setLayout(new MigLayout(
|
||||||
|
"insets dialog,hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[fill]" +
|
||||||
|
"[130,fill]",
|
||||||
|
// rows
|
||||||
|
"[]0" +
|
||||||
|
"[]unrel" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[grow]"));
|
||||||
|
|
||||||
|
//---- previewLabel ----
|
||||||
|
previewLabel.setText("Preview");
|
||||||
|
previewLabel.setFont(previewLabel.getFont().deriveFont(previewLabel.getFont().getSize() + 6f));
|
||||||
|
add(previewLabel, "cell 0 0 2 1,alignx left,growx 0");
|
||||||
|
|
||||||
|
//---- enabledCheckBox ----
|
||||||
|
enabledCheckBox.setText("Enabled");
|
||||||
|
enabledCheckBox.setSelected(true);
|
||||||
|
enabledCheckBox.addActionListener(e -> enabledChanged());
|
||||||
|
add(enabledCheckBox, "cell 0 0 2 1,align right top,grow 0 0");
|
||||||
|
add(separator2, "cell 0 1 2 1");
|
||||||
|
|
||||||
|
//---- labelLabel ----
|
||||||
|
labelLabel.setText("JLabel:");
|
||||||
|
add(labelLabel, "cell 0 2");
|
||||||
|
|
||||||
|
//---- label1 ----
|
||||||
|
label1.setText("Some Text");
|
||||||
|
add(label1, "cell 1 2");
|
||||||
|
|
||||||
|
//---- flatButton1 ----
|
||||||
|
flatButton1.setText("Help");
|
||||||
|
flatButton1.setButtonType(FlatButton.ButtonType.help);
|
||||||
|
flatButton1.setVisible(false);
|
||||||
|
add(flatButton1, "cell 1 1,alignx right,growx 0");
|
||||||
|
|
||||||
|
//---- buttonLabel ----
|
||||||
|
buttonLabel.setText("JButton:");
|
||||||
|
add(buttonLabel, "cell 0 3");
|
||||||
|
|
||||||
|
//---- button1 ----
|
||||||
|
button1.setText("Apply");
|
||||||
|
button1.setToolTipText("This button is enabled.");
|
||||||
|
add(button1, "cell 1 3,alignx left,growx 0");
|
||||||
|
|
||||||
|
//---- testDefaultButton1 ----
|
||||||
|
testDefaultButton1.setText("OK");
|
||||||
|
add(testDefaultButton1, "cell 1 3");
|
||||||
|
|
||||||
|
//---- helpButton ----
|
||||||
|
helpButton.setButtonType(FlatButton.ButtonType.help);
|
||||||
|
add(helpButton, "cell 1 3");
|
||||||
|
add(hSpacer2, "cell 1 3");
|
||||||
|
|
||||||
|
//---- toggleButtonLabel ----
|
||||||
|
toggleButtonLabel.setText("JToggleButton:");
|
||||||
|
add(toggleButtonLabel, "cell 0 4");
|
||||||
|
|
||||||
|
//---- toggleButton1 ----
|
||||||
|
toggleButton1.setText("Unselected");
|
||||||
|
toggleButton1.setToolTipText("LOOOOOOOOOOOOOONG TEXT");
|
||||||
|
add(toggleButton1, "cell 1 4,alignx left,growx 0");
|
||||||
|
|
||||||
|
//---- toggleButton3 ----
|
||||||
|
toggleButton3.setText("Selected");
|
||||||
|
toggleButton3.setSelected(true);
|
||||||
|
add(toggleButton3, "cell 1 4");
|
||||||
|
add(hSpacer1, "cell 1 4");
|
||||||
|
|
||||||
|
//---- checkBoxLabel ----
|
||||||
|
checkBoxLabel.setText("JCheckBox");
|
||||||
|
add(checkBoxLabel, "cell 0 5");
|
||||||
|
|
||||||
|
//---- checkBox1 ----
|
||||||
|
checkBox1.setText("Unselected");
|
||||||
|
add(checkBox1, "cell 1 5,alignx left,growx 0");
|
||||||
|
|
||||||
|
//---- checkBox3 ----
|
||||||
|
checkBox3.setText("Selected");
|
||||||
|
checkBox3.setSelected(true);
|
||||||
|
add(checkBox3, "cell 1 5,alignx left,growx 0");
|
||||||
|
add(hSpacer3, "cell 1 5");
|
||||||
|
|
||||||
|
//---- radioButtonLabel ----
|
||||||
|
radioButtonLabel.setText("JRadioButton:");
|
||||||
|
add(radioButtonLabel, "cell 0 6");
|
||||||
|
|
||||||
|
//---- radioButton1 ----
|
||||||
|
radioButton1.setText("Unselected");
|
||||||
|
add(radioButton1, "cell 1 6,alignx left,growx 0");
|
||||||
|
|
||||||
|
//---- radioButton3 ----
|
||||||
|
radioButton3.setText("Selected");
|
||||||
|
radioButton3.setSelected(true);
|
||||||
|
add(radioButton3, "cell 1 6,alignx left,growx 0");
|
||||||
|
add(hSpacer4, "cell 1 6");
|
||||||
|
|
||||||
|
//---- comboBoxLabel ----
|
||||||
|
comboBoxLabel.setText("JComboBox:");
|
||||||
|
add(comboBoxLabel, "cell 0 7");
|
||||||
|
|
||||||
|
//---- comboBox1 ----
|
||||||
|
comboBox1.setEditable(true);
|
||||||
|
comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||||
|
"Editable",
|
||||||
|
"a",
|
||||||
|
"bb",
|
||||||
|
"ccc",
|
||||||
|
"dd",
|
||||||
|
"e",
|
||||||
|
"ff",
|
||||||
|
"ggg",
|
||||||
|
"hh",
|
||||||
|
"i",
|
||||||
|
"jj",
|
||||||
|
"kkk"
|
||||||
|
}));
|
||||||
|
comboBox1.setMaximumRowCount(6);
|
||||||
|
comboBox1.setPlaceholderText("placeholder text");
|
||||||
|
add(comboBox1, "cell 1 7");
|
||||||
|
|
||||||
|
//---- comboBox3 ----
|
||||||
|
comboBox3.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||||
|
"Not edit",
|
||||||
|
"a",
|
||||||
|
"bb",
|
||||||
|
"ccc",
|
||||||
|
"dd",
|
||||||
|
"e",
|
||||||
|
"ff",
|
||||||
|
"ggg",
|
||||||
|
"hh",
|
||||||
|
"i",
|
||||||
|
"jj",
|
||||||
|
"kkk"
|
||||||
|
}));
|
||||||
|
comboBox3.setMaximumRowCount(6);
|
||||||
|
add(comboBox3, "cell 1 7");
|
||||||
|
|
||||||
|
//---- spinnerLabel ----
|
||||||
|
spinnerLabel.setText("JSpinner:");
|
||||||
|
add(spinnerLabel, "cell 0 8");
|
||||||
|
add(spinner1, "cell 1 8");
|
||||||
|
|
||||||
|
//---- textFieldLabel ----
|
||||||
|
textFieldLabel.setText("JTextField:");
|
||||||
|
add(textFieldLabel, "cell 0 9");
|
||||||
|
|
||||||
|
//---- textField1 ----
|
||||||
|
textField1.setText("Some Text");
|
||||||
|
textField1.setPlaceholderText("placeholder text");
|
||||||
|
add(textField1, "cell 1 9");
|
||||||
|
|
||||||
|
//---- formattedTextFieldLabel ----
|
||||||
|
formattedTextFieldLabel.setText("JFormattedTextF.:");
|
||||||
|
add(formattedTextFieldLabel, "cell 0 10");
|
||||||
|
|
||||||
|
//---- formattedTextField1 ----
|
||||||
|
formattedTextField1.setText("Some Text");
|
||||||
|
formattedTextField1.setPlaceholderText("placeholder text");
|
||||||
|
add(formattedTextField1, "cell 1 10");
|
||||||
|
|
||||||
|
//---- passwordFieldLabel ----
|
||||||
|
passwordFieldLabel.setText("JPasswordField:");
|
||||||
|
add(passwordFieldLabel, "cell 0 11");
|
||||||
|
|
||||||
|
//---- passwordField1 ----
|
||||||
|
passwordField1.setText("Some Text");
|
||||||
|
passwordField1.setPlaceholderText("placeholder text");
|
||||||
|
add(passwordField1, "cell 1 11");
|
||||||
|
|
||||||
|
//---- textAreaLabel ----
|
||||||
|
textAreaLabel.setText("JTextArea:");
|
||||||
|
add(textAreaLabel, "cell 0 12");
|
||||||
|
|
||||||
|
//======== scrollPane1 ========
|
||||||
|
{
|
||||||
|
scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||||
|
scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
|
//---- textArea1 ----
|
||||||
|
textArea1.setText("Some Text");
|
||||||
|
textArea1.setRows(2);
|
||||||
|
scrollPane1.setViewportView(textArea1);
|
||||||
|
}
|
||||||
|
add(scrollPane1, "cell 1 12");
|
||||||
|
|
||||||
|
//---- editorPaneLabel ----
|
||||||
|
editorPaneLabel.setText("JEditorPane");
|
||||||
|
add(editorPaneLabel, "cell 0 13");
|
||||||
|
|
||||||
|
//======== scrollPane5 ========
|
||||||
|
{
|
||||||
|
scrollPane5.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||||
|
scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
|
//---- editorPane1 ----
|
||||||
|
editorPane1.setText("Some Text");
|
||||||
|
scrollPane5.setViewportView(editorPane1);
|
||||||
|
}
|
||||||
|
add(scrollPane5, "cell 1 13");
|
||||||
|
|
||||||
|
//---- textPaneLabel ----
|
||||||
|
textPaneLabel.setText("JTextPane:");
|
||||||
|
add(textPaneLabel, "cell 0 14");
|
||||||
|
|
||||||
|
//======== scrollPane9 ========
|
||||||
|
{
|
||||||
|
scrollPane9.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||||
|
scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
|
//---- textPane1 ----
|
||||||
|
textPane1.setText("Some Text");
|
||||||
|
scrollPane9.setViewportView(textPane1);
|
||||||
|
}
|
||||||
|
add(scrollPane9, "cell 1 14");
|
||||||
|
|
||||||
|
//---- scrollBarLabel ----
|
||||||
|
scrollBarLabel.setText("JScrollBar:");
|
||||||
|
add(scrollBarLabel, "cell 0 15");
|
||||||
|
|
||||||
|
//---- scrollBar1 ----
|
||||||
|
scrollBar1.setOrientation(Adjustable.HORIZONTAL);
|
||||||
|
add(scrollBar1, "cell 1 15");
|
||||||
|
|
||||||
|
//---- scrollBar5 ----
|
||||||
|
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
|
||||||
|
scrollBar5.setShowButtons(true);
|
||||||
|
add(scrollBar5, "cell 1 16");
|
||||||
|
|
||||||
|
//---- separatorLabel ----
|
||||||
|
separatorLabel.setText("JSeparator:");
|
||||||
|
add(separatorLabel, "cell 0 17");
|
||||||
|
add(separator1, "cell 1 17");
|
||||||
|
|
||||||
|
//---- sliderLabel ----
|
||||||
|
sliderLabel.setText("JSlider:");
|
||||||
|
add(sliderLabel, "cell 0 18");
|
||||||
|
|
||||||
|
//---- slider1 ----
|
||||||
|
slider1.setValue(30);
|
||||||
|
add(slider1, "cell 1 18");
|
||||||
|
|
||||||
|
//---- slider3 ----
|
||||||
|
slider3.setMinorTickSpacing(10);
|
||||||
|
slider3.setPaintTicks(true);
|
||||||
|
slider3.setMajorTickSpacing(50);
|
||||||
|
slider3.setPaintLabels(true);
|
||||||
|
slider3.setValue(30);
|
||||||
|
slider3.addChangeListener(e -> changeProgress());
|
||||||
|
add(slider3, "cell 1 19");
|
||||||
|
|
||||||
|
//---- progressBarLabel ----
|
||||||
|
progressBarLabel.setText("JProgressBar:");
|
||||||
|
add(progressBarLabel, "cell 0 20");
|
||||||
|
|
||||||
|
//---- progressBar1 ----
|
||||||
|
progressBar1.setValue(60);
|
||||||
|
add(progressBar1, "cell 1 20");
|
||||||
|
|
||||||
|
//---- toolTipLabel ----
|
||||||
|
toolTipLabel.setText("JToolTip:");
|
||||||
|
add(toolTipLabel, "cell 0 21");
|
||||||
|
|
||||||
|
//---- toolTip1 ----
|
||||||
|
toolTip1.setTipText("Some text in tool tip.");
|
||||||
|
add(toolTip1, "cell 1 21,alignx left,growx 0");
|
||||||
|
|
||||||
|
//---- tabbedPaneLabel ----
|
||||||
|
tabbedPaneLabel.setText("JTabbedPane:");
|
||||||
|
add(tabbedPaneLabel, "cell 0 22");
|
||||||
|
add(tabbedPane1, "cell 1 22");
|
||||||
|
|
||||||
|
//---- buttonGroup1 ----
|
||||||
|
ButtonGroup buttonGroup1 = new ButtonGroup();
|
||||||
|
buttonGroup1.add(radioButton1);
|
||||||
|
buttonGroup1.add(radioButton3);
|
||||||
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
|
}
|
||||||
|
|
||||||
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
|
private JLabel previewLabel;
|
||||||
|
private JCheckBox enabledCheckBox;
|
||||||
|
private JSeparator separator2;
|
||||||
|
private JLabel labelLabel;
|
||||||
|
private JLabel label1;
|
||||||
|
private FlatButton flatButton1;
|
||||||
|
private JLabel buttonLabel;
|
||||||
|
private JButton button1;
|
||||||
|
private FlatThemePreview.TestDefaultButton testDefaultButton1;
|
||||||
|
private FlatButton helpButton;
|
||||||
|
private JPanel hSpacer2;
|
||||||
|
private JLabel toggleButtonLabel;
|
||||||
|
private JToggleButton toggleButton1;
|
||||||
|
private JToggleButton toggleButton3;
|
||||||
|
private JPanel hSpacer1;
|
||||||
|
private JLabel checkBoxLabel;
|
||||||
|
private JCheckBox checkBox1;
|
||||||
|
private JCheckBox checkBox3;
|
||||||
|
private JPanel hSpacer3;
|
||||||
|
private JLabel radioButtonLabel;
|
||||||
|
private JRadioButton radioButton1;
|
||||||
|
private JRadioButton radioButton3;
|
||||||
|
private JPanel hSpacer4;
|
||||||
|
private JLabel comboBoxLabel;
|
||||||
|
private FlatComboBox<String> comboBox1;
|
||||||
|
private JComboBox<String> comboBox3;
|
||||||
|
private JLabel spinnerLabel;
|
||||||
|
private JSpinner spinner1;
|
||||||
|
private JLabel textFieldLabel;
|
||||||
|
private FlatTextField textField1;
|
||||||
|
private JLabel formattedTextFieldLabel;
|
||||||
|
private FlatFormattedTextField formattedTextField1;
|
||||||
|
private JLabel passwordFieldLabel;
|
||||||
|
private FlatPasswordField passwordField1;
|
||||||
|
private JLabel textAreaLabel;
|
||||||
|
private JScrollPane scrollPane1;
|
||||||
|
private JTextArea textArea1;
|
||||||
|
private JLabel editorPaneLabel;
|
||||||
|
private JScrollPane scrollPane5;
|
||||||
|
private JEditorPane editorPane1;
|
||||||
|
private JLabel textPaneLabel;
|
||||||
|
private JScrollPane scrollPane9;
|
||||||
|
private JTextPane textPane1;
|
||||||
|
private JLabel scrollBarLabel;
|
||||||
|
private JScrollBar scrollBar1;
|
||||||
|
private FlatScrollBar scrollBar5;
|
||||||
|
private JLabel separatorLabel;
|
||||||
|
private JSeparator separator1;
|
||||||
|
private JLabel sliderLabel;
|
||||||
|
private JSlider slider1;
|
||||||
|
private JSlider slider3;
|
||||||
|
private JLabel progressBarLabel;
|
||||||
|
private FlatProgressBar progressBar1;
|
||||||
|
private JLabel toolTipLabel;
|
||||||
|
private JToolTip toolTip1;
|
||||||
|
private JLabel tabbedPaneLabel;
|
||||||
|
private JTabbedPane tabbedPane1;
|
||||||
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
|
|
||||||
|
//---- class TestDefaultButton --------------------------------------------
|
||||||
|
|
||||||
|
private static class TestDefaultButton
|
||||||
|
extends JButton
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean isDefaultButton() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,422 @@
|
|||||||
|
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8"
|
||||||
|
|
||||||
|
new FormModel {
|
||||||
|
contentType: "form/swing"
|
||||||
|
root: new FormRoot {
|
||||||
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
|
"$layoutConstraints": "insets dialog,hidemode 3"
|
||||||
|
"$columnConstraints": "[fill][130,fill]"
|
||||||
|
"$rowConstraints": "[]0[]unrel[][][][][][][][][][][][][][][][][][][][][][grow]"
|
||||||
|
} ) {
|
||||||
|
name: "this"
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "previewLabel"
|
||||||
|
"text": "Preview"
|
||||||
|
"font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 6, false )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0 2 1,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "enabledCheckBox"
|
||||||
|
"text": "Enabled"
|
||||||
|
"selected": true
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "enabledChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0 2 1,align right top,grow 0 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSeparator" ) {
|
||||||
|
name: "separator2"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 1 2 1"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "labelLabel"
|
||||||
|
"text": "JLabel:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 2"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label1"
|
||||||
|
"text": "Some Text"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 2"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||||
|
name: "flatButton1"
|
||||||
|
"text": "Help"
|
||||||
|
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help
|
||||||
|
"visible": false
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 1,alignx right,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "buttonLabel"
|
||||||
|
"text": "JButton:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 3"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
|
name: "button1"
|
||||||
|
"text": "Apply"
|
||||||
|
"toolTipText": "This button is enabled."
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 3,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreview$TestDefaultButton" ) {
|
||||||
|
name: "testDefaultButton1"
|
||||||
|
"text": "OK"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 3"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||||
|
name: "helpButton"
|
||||||
|
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 3"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||||
|
name: "hSpacer2"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 3"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "toggleButtonLabel"
|
||||||
|
"text": "JToggleButton:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 4"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
|
name: "toggleButton1"
|
||||||
|
"text": "Unselected"
|
||||||
|
"toolTipText": "LOOOOOOOOOOOOOONG TEXT"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 4,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
|
name: "toggleButton3"
|
||||||
|
"text": "Selected"
|
||||||
|
"selected": true
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 4"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||||
|
name: "hSpacer1"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 4"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "checkBoxLabel"
|
||||||
|
"text": "JCheckBox"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 5"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "checkBox1"
|
||||||
|
"text": "Unselected"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 5,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "checkBox3"
|
||||||
|
"text": "Selected"
|
||||||
|
"selected": true
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 5,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||||
|
name: "hSpacer3"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 5"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "radioButtonLabel"
|
||||||
|
"text": "JRadioButton:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 6"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "radioButton1"
|
||||||
|
"text": "Unselected"
|
||||||
|
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 6,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JRadioButton" ) {
|
||||||
|
name: "radioButton3"
|
||||||
|
"text": "Selected"
|
||||||
|
"selected": true
|
||||||
|
"$buttonGroup": new FormReference( "buttonGroup1" )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 6,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||||
|
name: "hSpacer4"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 6"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "comboBoxLabel"
|
||||||
|
"text": "JComboBox:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 7"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatComboBox" ) {
|
||||||
|
name: "comboBox1"
|
||||||
|
"editable": true
|
||||||
|
"model": new javax.swing.DefaultComboBoxModel {
|
||||||
|
selectedItem: "Editable"
|
||||||
|
addElement( "Editable" )
|
||||||
|
addElement( "a" )
|
||||||
|
addElement( "bb" )
|
||||||
|
addElement( "ccc" )
|
||||||
|
addElement( "dd" )
|
||||||
|
addElement( "e" )
|
||||||
|
addElement( "ff" )
|
||||||
|
addElement( "ggg" )
|
||||||
|
addElement( "hh" )
|
||||||
|
addElement( "i" )
|
||||||
|
addElement( "jj" )
|
||||||
|
addElement( "kkk" )
|
||||||
|
}
|
||||||
|
"maximumRowCount": 6
|
||||||
|
"placeholderText": "placeholder text"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.typeParameters": "String"
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 7"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
|
name: "comboBox3"
|
||||||
|
"model": new javax.swing.DefaultComboBoxModel {
|
||||||
|
selectedItem: "Not edit"
|
||||||
|
addElement( "Not edit" )
|
||||||
|
addElement( "a" )
|
||||||
|
addElement( "bb" )
|
||||||
|
addElement( "ccc" )
|
||||||
|
addElement( "dd" )
|
||||||
|
addElement( "e" )
|
||||||
|
addElement( "ff" )
|
||||||
|
addElement( "ggg" )
|
||||||
|
addElement( "hh" )
|
||||||
|
addElement( "i" )
|
||||||
|
addElement( "jj" )
|
||||||
|
addElement( "kkk" )
|
||||||
|
}
|
||||||
|
"maximumRowCount": 6
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 7"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "spinnerLabel"
|
||||||
|
"text": "JSpinner:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 8"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||||
|
name: "spinner1"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 8"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "textFieldLabel"
|
||||||
|
"text": "JTextField:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 9"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
|
||||||
|
name: "textField1"
|
||||||
|
"text": "Some Text"
|
||||||
|
"placeholderText": "placeholder text"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 9"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "formattedTextFieldLabel"
|
||||||
|
"text": "JFormattedTextF.:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 10"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) {
|
||||||
|
name: "formattedTextField1"
|
||||||
|
"text": "Some Text"
|
||||||
|
"placeholderText": "placeholder text"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 10"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "passwordFieldLabel"
|
||||||
|
"text": "JPasswordField:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 11"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatPasswordField" ) {
|
||||||
|
name: "passwordField1"
|
||||||
|
"text": "Some Text"
|
||||||
|
"placeholderText": "placeholder text"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 11"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "textAreaLabel"
|
||||||
|
"text": "JTextArea:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 12"
|
||||||
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||||
|
name: "scrollPane1"
|
||||||
|
"verticalScrollBarPolicy": 21
|
||||||
|
"horizontalScrollBarPolicy": 31
|
||||||
|
add( new FormComponent( "javax.swing.JTextArea" ) {
|
||||||
|
name: "textArea1"
|
||||||
|
"text": "Some Text"
|
||||||
|
"rows": 2
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 12"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "editorPaneLabel"
|
||||||
|
"text": "JEditorPane"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 13"
|
||||||
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||||
|
name: "scrollPane5"
|
||||||
|
"verticalScrollBarPolicy": 21
|
||||||
|
"horizontalScrollBarPolicy": 31
|
||||||
|
add( new FormComponent( "javax.swing.JEditorPane" ) {
|
||||||
|
name: "editorPane1"
|
||||||
|
"text": "Some Text"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 13"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "textPaneLabel"
|
||||||
|
"text": "JTextPane:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 14"
|
||||||
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||||
|
name: "scrollPane9"
|
||||||
|
"verticalScrollBarPolicy": 21
|
||||||
|
"horizontalScrollBarPolicy": 31
|
||||||
|
add( new FormComponent( "javax.swing.JTextPane" ) {
|
||||||
|
name: "textPane1"
|
||||||
|
"text": "Some Text"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 14"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "scrollBarLabel"
|
||||||
|
"text": "JScrollBar:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 15"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||||
|
name: "scrollBar1"
|
||||||
|
"orientation": 0
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 15"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) {
|
||||||
|
name: "scrollBar5"
|
||||||
|
"orientation": 0
|
||||||
|
"showButtons": true
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 16"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "separatorLabel"
|
||||||
|
"text": "JSeparator:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 17"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSeparator" ) {
|
||||||
|
name: "separator1"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 17"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "sliderLabel"
|
||||||
|
"text": "JSlider:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 18"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||||
|
name: "slider1"
|
||||||
|
"value": 30
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 18"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||||
|
name: "slider3"
|
||||||
|
"minorTickSpacing": 10
|
||||||
|
"paintTicks": true
|
||||||
|
"majorTickSpacing": 50
|
||||||
|
"paintLabels": true
|
||||||
|
"value": 30
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changeProgress", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 19"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "progressBarLabel"
|
||||||
|
"text": "JProgressBar:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 20"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
|
||||||
|
name: "progressBar1"
|
||||||
|
"value": 60
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 20"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "toolTipLabel"
|
||||||
|
"text": "JToolTip:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 21"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JToolTip" ) {
|
||||||
|
name: "toolTip1"
|
||||||
|
"tipText": "Some text in tool tip."
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 21,alignx left,growx 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "tabbedPaneLabel"
|
||||||
|
"text": "JTabbedPane:"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 22"
|
||||||
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
|
||||||
|
name: "tabbedPane1"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 1 22"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( null ) {
|
||||||
|
"location": new java.awt.Point( 0, 0 )
|
||||||
|
"size": new java.awt.Dimension( 400, 785 )
|
||||||
|
} )
|
||||||
|
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
|
||||||
|
name: "buttonGroup1"
|
||||||
|
}, new FormLayoutConstraints( null ) {
|
||||||
|
"location": new java.awt.Point( 0, 955 )
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@ class FlatThemePropertiesSupport
|
|||||||
// caches
|
// caches
|
||||||
private Properties propertiesCache;
|
private Properties propertiesCache;
|
||||||
private final Map<Integer, Object> parsedValueCache = new HashMap<>();
|
private final Map<Integer, Object> parsedValueCache = new HashMap<>();
|
||||||
|
private final Map<String, Object> parsedValueCache2 = new HashMap<>();
|
||||||
private Set<String> allKeysCache;
|
private Set<String> allKeysCache;
|
||||||
private String baseTheme;
|
private String baseTheme;
|
||||||
|
|
||||||
@@ -123,6 +124,28 @@ class FlatThemePropertiesSupport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object getParsedProperty( String key ) {
|
||||||
|
Object parsedValue = parsedValueCache2.get( key );
|
||||||
|
if( parsedValue != null )
|
||||||
|
return !(parsedValue instanceof Exception) ? parsedValue : null;
|
||||||
|
|
||||||
|
String str = getPropertyOrWildcard( key );
|
||||||
|
if( str == null )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Object[] resultValueType = new Object[1];
|
||||||
|
String value = resolveValue( str );
|
||||||
|
parsedValue = UIDefaultsLoaderAccessor.parseValue( key, value, resultValueType, resolver );
|
||||||
|
parsedValueCache2.put( key, parsedValue );
|
||||||
|
return parsedValue;
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
System.out.println( textArea.getFileName() + ": " + ex.getMessage() ); //TODO
|
||||||
|
parsedValueCache2.put( key, ex );
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String getPropertyOrWildcard( String key ) {
|
private String getPropertyOrWildcard( String key ) {
|
||||||
String value = getProperty( key );
|
String value = getProperty( key );
|
||||||
if( value != null )
|
if( value != null )
|
||||||
@@ -192,6 +215,7 @@ class FlatThemePropertiesSupport
|
|||||||
private void clearCache() {
|
private void clearCache() {
|
||||||
propertiesCache = null;
|
propertiesCache = null;
|
||||||
parsedValueCache.clear();
|
parsedValueCache.clear();
|
||||||
|
parsedValueCache2.clear();
|
||||||
allKeysCache = null;
|
allKeysCache = null;
|
||||||
baseTheme = null;
|
baseTheme = null;
|
||||||
|
|
||||||
@@ -208,6 +232,7 @@ class FlatThemePropertiesSupport
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
parsedValueCache.clear();
|
parsedValueCache.clear();
|
||||||
|
parsedValueCache2.clear();
|
||||||
allKeysCache = null;
|
allKeysCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#---- TabbedPane ----
|
#---- TabbedPane ----
|
||||||
|
|
||||||
TabbedPane.selectedBackground = darken($TabbedPane.background,5%)
|
#TabbedPane.selectedBackground = darken($TabbedPane.background,5%)
|
||||||
|
|
||||||
|
|
||||||
#---- FlatThemeEditorPane ----
|
#---- FlatThemeEditorPane ----
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#---- TabbedPane ----
|
#---- TabbedPane ----
|
||||||
|
|
||||||
TabbedPane.selectedBackground = lighten($TabbedPane.background,5%)
|
#TabbedPane.selectedBackground = lighten($TabbedPane.background,5%)
|
||||||
|
|
||||||
|
|
||||||
#---- FlatThemeEditorPane ----
|
#---- FlatThemeEditorPane ----
|
||||||
|
|||||||
Reference in New Issue
Block a user