Guest User

Untitled

a guest
Aug 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. // Try some crazy reflection bullshit
  2. try
  3. {
  4.     // Grab the class
  5.     Class applicationClass = Class.forName("com.apple.eawt.Application");
  6.    
  7.     // Grab the methods
  8.     @SuppressWarnings("unchecked")
  9.     Method getApplicationMethod = applicationClass.getMethod("getApplication");
  10.     @SuppressWarnings("unchecked")
  11.     Method setDockIconMethod = applicationClass.getMethod("setDockIconImage", java.awt.Image.class);
  12.    
  13.     // Call getApplication()
  14.     Object macOSXApplication = getApplicationMethod.invoke(null); // Static
  15.     // Call setDockIconImage()
  16.     setDockIconMethod.invoke(macOSXApplication, iconImage);
  17. }
  18. catch(Exception e)
  19. {
  20.     // If it doesn't work, don't worry about it
  21. }
Add Comment
Please, Sign In to add comment