Advertisement
tyridge77

Main

Feb 14th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1.     public static void main(String[] args) throws NativeHookException, InterruptedException, AWTException, FileNotFoundException {
  2.        
  3.        
  4.    
  5.  
  6.         robot = new Robot();
  7.        
  8.        
  9.        
  10.         //GlobalScreen.registerNativeHook();
  11.        
  12.         //GlobalScreen.addNativeKeyListener(new GlobalKeyListenerExample());
  13.  
  14.      
  15.        
  16.         int width = Toolkit.getDefaultToolkit().getScreenSize().width;
  17.         int height = Toolkit.getDefaultToolkit().getScreenSize().height;
  18.        
  19.         Rectangle rect = new Rectangle(width,height);
  20.         BufferedImage capture = robot.createScreenCapture(rect);
  21.        
  22.          
  23.          
  24.         JFrame window = new JFrame("Pixel Box");
  25.         window.setVisible(false);
  26.         window.setSize(width, height);
  27.         window.setLocation(0,0);
  28.      
  29.        
  30.      
  31.      
  32.        
  33.        
  34.         for(int x = 0;x<width;x++)
  35.         {
  36.          for(int y = 0;y<height;y++)
  37.          {
  38.              
  39.          
  40.           Color rgb = new Color(capture.getRGB(x,y));
  41.           window.add(new Representation(x,y,1,1,rgb,width,height));
  42.          
  43.          }
  44.         }
  45.         window.setVisible(true);
  46.        
  47.        
  48.        
  49.  
  50.      
  51.  
  52.         };
  53.    
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement