mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
UIScale: renamed some methods (to avoid confusion)
This commit is contained in:
@@ -66,7 +66,7 @@ public class UIScale
|
|||||||
|
|
||||||
private static Boolean jreHiDPI;
|
private static Boolean jreHiDPI;
|
||||||
|
|
||||||
public static boolean isJreHiDPIEnabled() {
|
public static boolean isSystemScalingEnabled() {
|
||||||
if( jreHiDPI != null )
|
if( jreHiDPI != null )
|
||||||
return jreHiDPI;
|
return jreHiDPI;
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ public class UIScale
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double getSystemScaleFactor( Graphics2D g ) {
|
public static double getSystemScaleFactor( Graphics2D g ) {
|
||||||
return isJreHiDPIEnabled() ? g.getDeviceConfiguration().getDefaultTransform().getScaleX() : 1;
|
return isSystemScalingEnabled() ? g.getDeviceConfiguration().getDefaultTransform().getScaleX() : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getSystemScaleFactor( GraphicsConfiguration gc ) {
|
public static double getSystemScaleFactor( GraphicsConfiguration gc ) {
|
||||||
return isJreHiDPIEnabled() ? gc.getDefaultTransform().getScaleX() : 1;
|
return isSystemScalingEnabled() ? gc.getDefaultTransform().getScaleX() : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- user scaling (Java 8) ----------------------------------------------
|
//---- user scaling (Java 8) ----------------------------------------------
|
||||||
@@ -111,7 +111,7 @@ public class UIScale
|
|||||||
return;
|
return;
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
if( isEnabled() ) {
|
if( isUserScalingEnabled() ) {
|
||||||
// listener to update scale factor if LaF changed or if Label.font changed
|
// listener to update scale factor if LaF changed or if Label.font changed
|
||||||
// (e.g. option "Override default fonts" in IntelliJ IDEA)
|
// (e.g. option "Override default fonts" in IntelliJ IDEA)
|
||||||
PropertyChangeListener listener = new PropertyChangeListener() {
|
PropertyChangeListener listener = new PropertyChangeListener() {
|
||||||
@@ -135,7 +135,7 @@ public class UIScale
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void updateScaleFactor() {
|
private static void updateScaleFactor() {
|
||||||
if( !isEnabled() )
|
if( !isUserScalingEnabled() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// use font size to calculate scale factor (instead of DPI)
|
// use font size to calculate scale factor (instead of DPI)
|
||||||
@@ -165,8 +165,8 @@ public class UIScale
|
|||||||
return font.getSize() / fontSizeDivider;
|
return font.getSize() / fontSizeDivider;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isEnabled() {
|
private static boolean isUserScalingEnabled() {
|
||||||
if( isJreHiDPIEnabled() )
|
if( isSystemScalingEnabled() )
|
||||||
return false; // disable user scaling if JRE scales
|
return false; // disable user scaling if JRE scales
|
||||||
|
|
||||||
// same as in IntelliJ IDEA
|
// same as in IntelliJ IDEA
|
||||||
@@ -179,7 +179,7 @@ public class UIScale
|
|||||||
* or "sun.java2d.uiScale" to the given font.
|
* or "sun.java2d.uiScale" to the given font.
|
||||||
*/
|
*/
|
||||||
public static FontUIResource applyCustomScaleFactor( FontUIResource font ) {
|
public static FontUIResource applyCustomScaleFactor( FontUIResource font ) {
|
||||||
if( UIScale.isJreHiDPIEnabled() )
|
if( UIScale.isSystemScalingEnabled() )
|
||||||
return font;
|
return font;
|
||||||
|
|
||||||
String uiScale = System.getProperty( "flatlaf.uiScale" );
|
String uiScale = System.getProperty( "flatlaf.uiScale" );
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ public class FlatTestFrame
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateScaleFactorComboBox() {
|
private void updateScaleFactorComboBox() {
|
||||||
scaleFactorComboBox.setEnabled( !UIScale.isJreHiDPIEnabled() && UIManager.getLookAndFeel() instanceof FlatLaf );
|
scaleFactorComboBox.setEnabled( !UIScale.isSystemScalingEnabled() && UIManager.getLookAndFeel() instanceof FlatLaf );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|||||||
Reference in New Issue
Block a user