Theme Editor:

- update preview after 300ms (was 500ms)
- added separator between editor and preview
This commit is contained in:
Karl Tauber
2021-08-22 14:26:18 +02:00
parent 357823a027
commit a5575894ab
2 changed files with 15 additions and 5 deletions

View File

@@ -58,7 +58,7 @@ class FlatThemePreview
tabbedPane1.addTab( "Tab 8", null );
// timer used for delayed preview updates
timer = new Timer( 500, e -> update() );
timer = new Timer( 300, e -> update() );
timer.setRepeats( false );
// listen to changes in text area to automatically update preview
@@ -201,15 +201,13 @@ class FlatThemePreview
}
private void enableDisable( Component comp, boolean enabled ) {
if( comp != previewLabel && comp != enabledCheckBox )
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();
@@ -224,6 +222,7 @@ class FlatThemePreview
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
previewSeparator = new JSeparator();
previewLabel = new JLabel();
enabledCheckBox = new JCheckBox();
separator2 = new JSeparator();
@@ -332,6 +331,10 @@ class FlatThemePreview
"[]" +
"[grow]"));
//---- previewSeparator ----
previewSeparator.setOrientation(SwingConstants.VERTICAL);
add(previewSeparator, "west");
//---- previewLabel ----
previewLabel.setText("Preview");
previewLabel.setFont(previewLabel.getFont().deriveFont(previewLabel.getFont().getSize() + 6f));
@@ -690,6 +693,7 @@ class FlatThemePreview
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JSeparator previewSeparator;
private JLabel previewLabel;
private JCheckBox enabledCheckBox;
private JSeparator separator2;

View File

@@ -9,6 +9,12 @@ new FormModel {
"$rowConstraints": "[]0[]unrel[][][][][][][][][][][][][][][][][][][][][][][grow]"
} ) {
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" ) {
name: "previewLabel"
"text": "Preview"