support changing default font used for all components with automatic scaling UI if using larger font

This commit is contained in:
Karl Tauber
2020-03-31 12:15:51 +02:00
parent 60c6c5b37a
commit af89dd13c1
12 changed files with 400 additions and 192 deletions

View File

@@ -208,6 +208,11 @@ public class FlatTestFrame
} );
}
} );
UIScale.addPropertyChangeListener( e -> {
// update title because user scale factor may change
updateTitle();
} );
}
private void updateTitle() {
@@ -403,7 +408,7 @@ public class FlatTestFrame
}
private void updateScaleFactorComboBox() {
scaleFactorComboBox.setEnabled( !UIScale.isSystemScalingEnabled() && UIManager.getLookAndFeel() instanceof FlatLaf );
scaleFactorComboBox.setEnabled( UIManager.getLookAndFeel() instanceof FlatLaf );
}
private void sizeVariantChanged() {

View File

@@ -368,7 +368,16 @@ public class UIDefaultsDump
private void dumpActiveValue( PrintWriter out, ActiveValue value ) {
out.print( "[active] " );
dumpValue( out, value.createValue( defaults ) );
Object realValue = value.createValue( defaults );
if( realValue instanceof Font && realValue == UIManager.getFont( "defaultFont" ) ) {
// dump "$defaultFont" for the default font to make it easier to
// compare Windows/Linux dumps with macOS dumps
out.print( "$defaultFont" );
if( realValue instanceof UIResource )
out.print( " [UI]" );
} else
dumpValue( out, realValue );
}
private String dumpClass( Object value ) {