Windows: update fonts (and scaling) when user changes Windows text size

This commit is contained in:
Karl Tauber
2019-10-12 20:10:37 +02:00
parent 012d86066d
commit 5e33182de3
4 changed files with 83 additions and 11 deletions

View File

@@ -79,6 +79,15 @@ class ControlBar
lafModel.setSelectedItem( lafModel.getElementAt( sel ) );
lookAndFeelComboBox.setModel( lafModel );
UIManager.addPropertyChangeListener( e -> {
if( "lookAndFeel".equals( e.getPropertyName() ) ) {
EventQueue.invokeLater( () -> {
// update info label because user scale factor may change
updateInfoLabel();
} );
}
} );
}
void initialize( JFrame frame, JTabbedPane tabbedPane ) {
@@ -173,11 +182,8 @@ class ControlBar
// change look and feel
UIManager.setLookAndFeel( newLaf.className );
// update info label because user scale factor may change
updateInfoLabel();
// update all components
SwingUtilities.updateComponentTreeUI( frame );
FlatLaf.updateUI();
// increase size of frame if necessary
int width = frame.getWidth();