-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunnyConsolePrank.java
More file actions
115 lines (97 loc) · 4.27 KB
/
Copy pathFunnyConsolePrank.java
File metadata and controls
115 lines (97 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// import java.util.Random;
// public class FunnyConsolePrank {
// public static void main(String[] args) throws InterruptedException {
// String[] colors = {
// "\u001B[31m", // Red
// "\u001B[32m", // Green
// "\u001B[33m", // Yellow
// "\u001B[34m", // Blue
// "\u001B[35m", // Purple
// "\u001B[36m", // Cyan
// "\u001B[37m" // White
// };
// String blink = "\u001B[5m"; // Blinking
// String reset = "\u001B[0m"; // Reset
// String[] funFacts = {
// "Fun Fact: A group of flamingos is called a 'flamboyance'!",
// "Fun Fact: Bananas are berries, but strawberries aren't!",
// "Fun Fact: Honey never spoils. Archaeologists have eaten 3000-year-old honey.",
// "Fun Fact: A single strand of spaghetti is called a 'spaghetto'.",
// "Fun Fact: Cows have best friends and get stressed when separated.",
// "Fun Fact: Wombat poop is cube-shaped."
// };
// Random rand = new Random();
// int fakeProgress = 0;
// int factCounter = 0;
// while (true) {
// int randomColorIndex = rand.nextInt(colors.length);
// String color = colors[randomColorIndex];
// // Blinking warning message
// System.out.print(color + blink + "WARNING: System format in progress..." + reset + "\n");
// // Fake progress bar
// System.out.print(color + "[");
// for (int i = 0; i < fakeProgress; i++) {
// System.out.print("=");
// }
// for (int i = fakeProgress; i < 50; i++) {
// System.out.print(" ");
// }
// System.out.print("] " + fakeProgress * 2 + "%" + reset + "\r");
// Thread.sleep(200); // Delay
// fakeProgress++;
// factCounter++;
// // Play a beep occasionally
// if (rand.nextInt(10) < 2) { // 20% chance
// System.out.print("\u0007"); // Terminal bell sound
// }
// // Show a fun fact every 100 iterations
// if (factCounter >= 100) {
// int randomFactIndex = rand.nextInt(funFacts.length);
// System.out.println("\n" + color + funFacts[randomFactIndex] + reset);
// factCounter = 0;
// }
// // Loop progress bar
// if (fakeProgress > 50) {
// fakeProgress = 0;
// System.out.print("\n");
// }
// }
// }
// }
import javax.swing.*;
import java.awt.*;
import java.util.Random;
public class FunnyConsolePrank {
public static void main(String[] args) {
JFrame frame = new JFrame("System Alert");
JLabel label = new JLabel("VIRUS DETECTED! Formatting C:\\ Drive...", SwingConstants.CENTER);
label.setFont(new Font("Arial", Font.BOLD, 20));
frame.add(label);
frame.setSize(400, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setAlwaysOnTop(true);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Random rand = new Random();
// Random color and position changer loop
while (true) {
// Random background color
Color randomColor = new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
frame.getContentPane().setBackground(randomColor);
// Random beep
if (rand.nextInt(5) == 0) { // 20% chance
Toolkit.getDefaultToolkit().beep();
}
// Random window position
int x = rand.nextInt(Toolkit.getDefaultToolkit().getScreenSize().width - frame.getWidth());
int y = rand.nextInt(Toolkit.getDefaultToolkit().getScreenSize().height - frame.getHeight());
frame.setLocation(x, y);
// Sleep before next change
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}