public static void setFrameIcons ( Frame frame , List < ? extends Image > icons ) { try { Method m = frame . getClass ( ) . getMethod ( "setIconImages" , List . class ) ; m . invoke ( frame , icons ) ; return ; } catch ( SecurityException e ) { // Fine, fine, no reflection for us } catch ( NoSuchMethodException e ) { // This is fine, we must be on a pre-1.6 JVM } catch ( Exception e ) { // Something else went awry? Log it log . warning ( "Error setting frame icons" , "frame" , frame , "icons" , icons , "e" , e ) ; } // We couldn't find it, couldn't reflect, or something. // Just use whichever's at the top of the list frame . setIconImage ( icons . get ( 0 ) ) ; }
Sets the frame s icons . Unfortunately the ability to pass multiple icons so the OS can choose the most size - appropriate one was added in 1 . 6 ; before that you can only set one icon .