mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 15:07:11 -06:00
Theme Editor: fixed preview when switching Laf
This commit is contained in:
@@ -154,6 +154,9 @@ class FlatThemeEditorPane
|
||||
|
||||
// error strip
|
||||
errorStrip.setCaretMarkerColor( UIManager.getColor( "FlatThemeEditorPane.errorstrip.caretMarkerColor" ) );
|
||||
|
||||
if( preview != null )
|
||||
preview.updateLater();
|
||||
}
|
||||
|
||||
void updateFontSize( int sizeIncr ) {
|
||||
@@ -271,7 +274,7 @@ class FlatThemeEditorPane
|
||||
preview = new FlatThemePreview( textArea );
|
||||
previewScrollPane = new JScrollPane( preview );
|
||||
previewScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
||||
previewScrollPane.setBorder( null );
|
||||
previewScrollPane.setBorder( BorderFactory.createEmptyBorder() );
|
||||
previewScrollPane.getVerticalScrollBar().setUnitIncrement( 20 );
|
||||
previewScrollPane.getHorizontalScrollBar().setUnitIncrement( 20 );
|
||||
add( previewScrollPane, BorderLayout.LINE_END );
|
||||
|
||||
@@ -67,7 +67,7 @@ class FlatThemePreview
|
||||
// update when showing preview (e.g. activating tab)
|
||||
addHierarchyListener( e -> {
|
||||
if( (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && isShowing() )
|
||||
EventQueue.invokeLater( this::update );
|
||||
updateLater();
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -85,6 +85,10 @@ class FlatThemePreview
|
||||
public void changedUpdate( DocumentEvent e ) {
|
||||
}
|
||||
|
||||
void updateLater() {
|
||||
EventQueue.invokeLater( this::update );
|
||||
}
|
||||
|
||||
private void update() {
|
||||
if( !isShowing() )
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user