mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
SystemInfo:
- renamed public fields from upper-case to mixed-case - added public fields for osVersion and javaVersion - fixed Mac -> MacOS - added orLater to Mojave
This commit is contained in:
@@ -585,7 +585,7 @@ public class FlatDisabledIconsTest
|
||||
private static ImageIcon loadIcon( String iconName ) {
|
||||
ImageIcon icon = new ImageIcon( LightOrDarkIcon.class.getResource( iconName ) );
|
||||
|
||||
if( SystemInfo.IS_MAC || !MultiResolutionImageSupport.isAvailable() || !iconName.endsWith( ".png" ) )
|
||||
if( SystemInfo.isMacOS || !MultiResolutionImageSupport.isAvailable() || !iconName.endsWith( ".png" ) )
|
||||
return icon;
|
||||
|
||||
String iconName2x = iconName.replace( ".png", "@2x.png" );
|
||||
|
||||
@@ -62,7 +62,7 @@ public class FlatPaintingStringTest
|
||||
add( new JLabel( "flatlaf" ) );
|
||||
add( new JLabel( "0.25*scale" ) );
|
||||
add( new JLabel( "0.5*scale" ) );
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
add( new JLabel( "0.25" ) );
|
||||
add( new JLabel( "0.5" ) );
|
||||
add( new JLabel( "0.625" ) );
|
||||
@@ -76,7 +76,7 @@ public class FlatPaintingStringTest
|
||||
|
||||
YCorrectionFunction none = (g, scaleFactor) -> 0;
|
||||
YCorrectionFunction flatlaf = (g, scaleFactor) -> {
|
||||
return SystemInfo.IS_JAVA_9_OR_LATER
|
||||
return SystemInfo.isJava_9_orLater
|
||||
? HiDPIUtils.computeTextYCorrection( g )
|
||||
: (scaleFactor > 1 ? -(0.625f * scaleFactor) : 0);
|
||||
};
|
||||
@@ -100,7 +100,7 @@ public class FlatPaintingStringTest
|
||||
add( scaleFactor, flatlaf );
|
||||
add( scaleFactor, oneQSysScale );
|
||||
add( scaleFactor, halfSysScale );
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
add( scaleFactor, oneQ );
|
||||
add( scaleFactor, half );
|
||||
add( scaleFactor, fiveEights );
|
||||
@@ -115,7 +115,7 @@ public class FlatPaintingStringTest
|
||||
}
|
||||
|
||||
private void add( float scaleFactor, YCorrectionFunction correctionFunction ) {
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
add( new Painter( scaleFactor, correctionFunction, 0 ), "split 4, gapx 0 0" );
|
||||
add( new Painter( scaleFactor, correctionFunction, 0.25f ), "gapx 0 0" );
|
||||
add( new Painter( scaleFactor, correctionFunction, 0.5f ), "gapx 0 0" );
|
||||
@@ -161,7 +161,7 @@ public class FlatPaintingStringTest
|
||||
this.yOffset = yOffset;
|
||||
setBorder( new EmptyBorder( 2, 0, 2, 0 ) );
|
||||
|
||||
if( !SystemInfo.IS_JAVA_9_OR_LATER ) {
|
||||
if( !SystemInfo.isJava_9_orLater ) {
|
||||
Font font = getFont();
|
||||
setFont( font.deriveFont( (float) Math.round( font.getSize() * scaleFactor ) ) );
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class FlatPaintingStringTest
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
// simulate component y position at a fraction
|
||||
if( scaleFactor > 1 && SystemInfo.IS_JAVA_9_OR_LATER )
|
||||
if( scaleFactor > 1 && SystemInfo.isJava_9_orLater )
|
||||
g2.translate( 0, yOffset );
|
||||
|
||||
int width = getWidth();
|
||||
@@ -199,7 +199,7 @@ public class FlatPaintingStringTest
|
||||
// g.drawLine( 0, height2 - 1, width2, height2 - 1 );
|
||||
|
||||
int baseline = (int) Math.round( (insets.top + fm.getAscent()) * scaleFactor2
|
||||
* (SystemInfo.IS_JAVA_9_OR_LATER ? scaleFactor : 1f) ) - 1;
|
||||
* (SystemInfo.isJava_9_orLater ? scaleFactor : 1f) ) - 1;
|
||||
int topline = height2 - baseline - 1;
|
||||
|
||||
g.setColor( Color.red );
|
||||
@@ -211,7 +211,7 @@ public class FlatPaintingStringTest
|
||||
g.translate( insets.left, 0 );
|
||||
|
||||
// scale
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER )
|
||||
if( SystemInfo.isJava_9_orLater )
|
||||
((Graphics2D)g).scale( scaleFactor, scaleFactor );
|
||||
|
||||
// compute Y correction
|
||||
@@ -244,7 +244,7 @@ public class FlatPaintingStringTest
|
||||
}
|
||||
|
||||
private int scale( int value ) {
|
||||
return SystemInfo.IS_JAVA_9_OR_LATER ? Math.round( value * scaleFactor ) : value;
|
||||
return SystemInfo.isJava_9_orLater ? Math.round( value * scaleFactor ) : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ public class FlatTestFrame
|
||||
className.equals( "com.sun.java.swing.plaf.motif.MotifLookAndFeel" ) )
|
||||
continue;
|
||||
|
||||
if( (SystemInfo.IS_WINDOWS && className.equals( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" )) ||
|
||||
(SystemInfo.IS_MAC && className.equals( "com.apple.laf.AquaLookAndFeel" )) ||
|
||||
(SystemInfo.IS_LINUX && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" )) )
|
||||
if( (SystemInfo.isWindows && className.equals( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" )) ||
|
||||
(SystemInfo.isMacOS && className.equals( "com.apple.laf.AquaLookAndFeel" )) ||
|
||||
(SystemInfo.isLinux && className.equals( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" )) )
|
||||
name += " (F9)";
|
||||
else if( className.equals( MetalLookAndFeel.class.getName() ) )
|
||||
name += " (F12)";
|
||||
@@ -117,13 +117,13 @@ public class FlatTestFrame
|
||||
}
|
||||
|
||||
String substanceLightClassName = "org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel";
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER && isClassAvailable( substanceLightClassName ) ) {
|
||||
if( SystemInfo.isJava_9_orLater && isClassAvailable( substanceLightClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "Substance Business (F5)", substanceLightClassName ) );
|
||||
registerSwitchToLookAndFeel( "F5", substanceLightClassName );
|
||||
}
|
||||
|
||||
String substanceDarkClassName = "org.pushingpixels.substance.api.skin.SubstanceGraphiteAquaLookAndFeel";
|
||||
if( SystemInfo.IS_JAVA_9_OR_LATER && isClassAvailable( substanceDarkClassName ) ) {
|
||||
if( SystemInfo.isJava_9_orLater && isClassAvailable( substanceDarkClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "Substance Graphite Aqua (Ctrl+F5)", substanceDarkClassName ) );
|
||||
registerSwitchToLookAndFeel( "ctrl F5", substanceDarkClassName );
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class FlatTestFrame
|
||||
}
|
||||
|
||||
String looksWindowsClassName = "com.jgoodies.looks.windows.WindowsLookAndFeel";
|
||||
if( SystemInfo.IS_WINDOWS && isClassAvailable( looksWindowsClassName ) ) {
|
||||
if( SystemInfo.isWindows && isClassAvailable( looksWindowsClassName ) ) {
|
||||
lafModel.addElement( new LookAndFeelInfo( "JGoodies Looks Windows (F7)", looksWindowsClassName ) );
|
||||
registerSwitchToLookAndFeel( "F7", looksWindowsClassName );
|
||||
}
|
||||
@@ -164,11 +164,11 @@ public class FlatTestFrame
|
||||
|
||||
registerSwitchToLookAndFeel( "F8", FlatTestLaf.class.getName() );
|
||||
|
||||
if( SystemInfo.IS_WINDOWS )
|
||||
if( SystemInfo.isWindows )
|
||||
registerSwitchToLookAndFeel( "F9", "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
|
||||
else if( SystemInfo.IS_MAC )
|
||||
else if( SystemInfo.isMacOS )
|
||||
registerSwitchToLookAndFeel( "F9", "com.apple.laf.AquaLookAndFeel" );
|
||||
else if( SystemInfo.IS_LINUX )
|
||||
else if( SystemInfo.isLinux )
|
||||
registerSwitchToLookAndFeel( "F9", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" );
|
||||
registerSwitchToLookAndFeel( "F12", MetalLookAndFeel.class.getName() );
|
||||
registerSwitchToLookAndFeel( "F11", NimbusLookAndFeel.class.getName() );
|
||||
|
||||
@@ -91,7 +91,7 @@ public class UIDefaultsDump
|
||||
dump( FlatLightLaf.class.getName(), dir );
|
||||
dump( FlatDarkLaf.class.getName(), dir );
|
||||
|
||||
if( SystemInfo.IS_WINDOWS ) {
|
||||
if( SystemInfo.isWindows ) {
|
||||
dump( FlatIntelliJLaf.class.getName(), dir );
|
||||
dump( FlatDarculaLaf.class.getName(), dir );
|
||||
}
|
||||
@@ -100,11 +100,11 @@ public class UIDefaultsDump
|
||||
// dump( MetalLookAndFeel.class.getName(), dir );
|
||||
// dump( NimbusLookAndFeel.class.getName(), dir );
|
||||
//
|
||||
// if( SystemInfo.IS_WINDOWS )
|
||||
// if( SystemInfo.isWindows )
|
||||
// dump( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel", dir );
|
||||
// else if( SystemInfo.IS_MAC )
|
||||
// else if( SystemInfo.isMacOS )
|
||||
// dump( "com.apple.laf.AquaLookAndFeel", dir );
|
||||
// else if( SystemInfo.IS_LINUX )
|
||||
// else if( SystemInfo.isLinux )
|
||||
// dump( "com.sun.java.swing.plaf.gtk.GTKLookAndFeel", dir );
|
||||
//
|
||||
// dump( "com.jgoodies.looks.plastic.PlasticLookAndFeel", dir );
|
||||
@@ -172,9 +172,9 @@ public class UIDefaultsDump
|
||||
? BasicLookAndFeel.class.getSimpleName()
|
||||
: lookAndFeel.getClass().getSimpleName();
|
||||
}
|
||||
String osSuffix = (SystemInfo.IS_MAC && lookAndFeel instanceof FlatLaf)
|
||||
String osSuffix = (SystemInfo.isMacOS && lookAndFeel instanceof FlatLaf)
|
||||
? "-mac"
|
||||
: ((SystemInfo.IS_LINUX && lookAndFeel instanceof FlatLaf)
|
||||
: ((SystemInfo.isLinux && lookAndFeel instanceof FlatLaf)
|
||||
? "-linux"
|
||||
: "");
|
||||
String javaVersion = System.getProperty( "java.version" );
|
||||
@@ -186,9 +186,9 @@ public class UIDefaultsDump
|
||||
File origFile = null;
|
||||
if( !osSuffix.isEmpty() && nameSuffix.isEmpty() )
|
||||
origFile = new File( dir, name + nameSuffix + "_" + javaVersion + ".txt" );
|
||||
else if( lookAndFeel instanceof FlatIntelliJLaf && SystemInfo.IS_WINDOWS )
|
||||
else if( lookAndFeel instanceof FlatIntelliJLaf && SystemInfo.isWindows )
|
||||
origFile = new File( dir, "FlatLightLaf_" + javaVersion + ".txt" );
|
||||
else if( lookAndFeel instanceof FlatDarculaLaf && SystemInfo.IS_WINDOWS )
|
||||
else if( lookAndFeel instanceof FlatDarculaLaf && SystemInfo.isWindows )
|
||||
origFile = new File( dir, "FlatDarkLaf_" + javaVersion + ".txt" );
|
||||
if( origFile != null ) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user