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