src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java

Print this page




 891 
 892     private static String getScaledImageName(String path) {
 893         if (!isValidPath(path)) {
 894             return null;
 895         }
 896 
 897         int slash = path.lastIndexOf('/');
 898         String name = (slash < 0) ? path : path.substring(slash + 1);
 899 
 900         if (name.contains("@2x")) {
 901             return null;
 902         }
 903 
 904         int dot = name.lastIndexOf('.');
 905         String name2x = (dot < 0) ? name + "@2x"
 906                 : name.substring(0, dot) + "@2x" + name.substring(dot);
 907         return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x;
 908     }
 909 
 910     private static boolean isValidPath(String path) {
 911         return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".");



 912     }
 913 }


 891 
 892     private static String getScaledImageName(String path) {
 893         if (!isValidPath(path)) {
 894             return null;
 895         }
 896 
 897         int slash = path.lastIndexOf('/');
 898         String name = (slash < 0) ? path : path.substring(slash + 1);
 899 
 900         if (name.contains("@2x")) {
 901             return null;
 902         }
 903 
 904         int dot = name.lastIndexOf('.');
 905         String name2x = (dot < 0) ? name + "@2x"
 906                 : name.substring(0, dot) + "@2x" + name.substring(dot);
 907         return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x;
 908     }
 909 
 910     private static boolean isValidPath(String path) {
 911         return path != null &&
 912                 !path.isEmpty() &&
 913                 !path.endsWith("/") &&
 914                 !path.endsWith(".");
 915     }
 916 }