mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
Theme Editor:
- update preview after 300ms (was 500ms) - added separator between editor and preview
This commit is contained in:
@@ -58,7 +58,7 @@ class FlatThemePreview
|
|||||||
tabbedPane1.addTab( "Tab 8", null );
|
tabbedPane1.addTab( "Tab 8", null );
|
||||||
|
|
||||||
// timer used for delayed preview updates
|
// timer used for delayed preview updates
|
||||||
timer = new Timer( 500, e -> update() );
|
timer = new Timer( 300, e -> update() );
|
||||||
timer.setRepeats( false );
|
timer.setRepeats( false );
|
||||||
|
|
||||||
// listen to changes in text area to automatically update preview
|
// listen to changes in text area to automatically update preview
|
||||||
@@ -201,15 +201,13 @@ class FlatThemePreview
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enableDisable( Component comp, boolean enabled ) {
|
private void enableDisable( Component comp, boolean enabled ) {
|
||||||
comp.setEnabled( enabled );
|
if( comp != previewLabel && comp != enabledCheckBox )
|
||||||
|
comp.setEnabled( enabled );
|
||||||
|
|
||||||
if( !(comp instanceof Container) )
|
if( !(comp instanceof Container) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( Component c : ((Container)comp).getComponents() ) {
|
for( Component c : ((Container)comp).getComponents() ) {
|
||||||
if( c == enabledCheckBox || c == previewLabel )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( c instanceof JScrollPane )
|
if( c instanceof JScrollPane )
|
||||||
c = ((JScrollPane)c).getViewport().getView();
|
c = ((JScrollPane)c).getViewport().getView();
|
||||||
|
|
||||||
@@ -224,6 +222,7 @@ class FlatThemePreview
|
|||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
|
previewSeparator = new JSeparator();
|
||||||
previewLabel = new JLabel();
|
previewLabel = new JLabel();
|
||||||
enabledCheckBox = new JCheckBox();
|
enabledCheckBox = new JCheckBox();
|
||||||
separator2 = new JSeparator();
|
separator2 = new JSeparator();
|
||||||
@@ -332,6 +331,10 @@ class FlatThemePreview
|
|||||||
"[]" +
|
"[]" +
|
||||||
"[grow]"));
|
"[grow]"));
|
||||||
|
|
||||||
|
//---- previewSeparator ----
|
||||||
|
previewSeparator.setOrientation(SwingConstants.VERTICAL);
|
||||||
|
add(previewSeparator, "west");
|
||||||
|
|
||||||
//---- previewLabel ----
|
//---- previewLabel ----
|
||||||
previewLabel.setText("Preview");
|
previewLabel.setText("Preview");
|
||||||
previewLabel.setFont(previewLabel.getFont().deriveFont(previewLabel.getFont().getSize() + 6f));
|
previewLabel.setFont(previewLabel.getFont().deriveFont(previewLabel.getFont().getSize() + 6f));
|
||||||
@@ -690,6 +693,7 @@ class FlatThemePreview
|
|||||||
}
|
}
|
||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
|
private JSeparator previewSeparator;
|
||||||
private JLabel previewLabel;
|
private JLabel previewLabel;
|
||||||
private JCheckBox enabledCheckBox;
|
private JCheckBox enabledCheckBox;
|
||||||
private JSeparator separator2;
|
private JSeparator separator2;
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ new FormModel {
|
|||||||
"$rowConstraints": "[]0[]unrel[][][][][][][][][][][][][][][][][][][][][][][grow]"
|
"$rowConstraints": "[]0[]unrel[][][][][][][][][][][][][][][][][][][][][][][grow]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "this"
|
name: "this"
|
||||||
|
add( new FormComponent( "javax.swing.JSeparator" ) {
|
||||||
|
name: "previewSeparator"
|
||||||
|
"orientation": 1
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "west"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "previewLabel"
|
name: "previewLabel"
|
||||||
"text": "Preview"
|
"text": "Preview"
|
||||||
|
|||||||
Reference in New Issue
Block a user