├── src ├── WordLengthSelectorListener.java ├── WordListPanel.java ├── Application.java ├── PictionaryView.java ├── WordLengthSelector.java └── WordInput.java ├── .gitignore └── README.md /src/WordLengthSelectorListener.java: -------------------------------------------------------------------------------- 1 | public interface WordLengthSelectorListener { 2 | void onNumberOfLettersSelected(int numberOfLettersSelected); 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE-specific files 2 | .idea 3 | *.iml 4 | 5 | # Compiled class file 6 | *.class 7 | 8 | # Log file 9 | *.log 10 | 11 | # BlueJ files 12 | *.ctxt 13 | 14 | # Mobile Tools for Java (J2ME) 15 | .mtj.tmp/ 16 | 17 | # Package Files # 18 | *.jar 19 | *.war 20 | *.ear 21 | *.zip 22 | *.tar.gz 23 | *.rar 24 | 25 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 26 | hs_err_pid* 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pictionary-cheat 2 | > GUI to cheat on online pictionary games 3 | 4 | > PURPOSE OF PROJECT: To cheat on a pictionary game. In this game, a user is drawing an image on the screen. The other users playing must guess the word represented by the picture. Everyone knows how many words there are and how many characters per word. Over time, letters will start to be revealed on the screen. This program takes all known info about the word(s) and narrows down the possibilities for the user, based on previous words from the game. This was made for a particular pictionary game in the Minecraft server Mineplex. 5 | 6 | > VERSION/DATE: 01/14/18 7 | 8 | > AUTHOR: Lauren Stephenson (@CompSciLauren) 9 | -------------------------------------------------------------------------------- /src/WordListPanel.java: -------------------------------------------------------------------------------- 1 | import javax.swing.*; 2 | import java.awt.*; 3 | 4 | public class WordListPanel extends JPanel { 5 | private String[] words; 6 | private JList wordJList; 7 | 8 | public WordListPanel() { 9 | this.setLayout(new BorderLayout()); 10 | 11 | words = new String[0]; 12 | JScrollPane scrollPane = new JScrollPane(); 13 | 14 | wordJList = new JList(); 15 | scrollPane.setViewportView(wordJList); 16 | 17 | this.add(scrollPane); 18 | } 19 | 20 | public void setWords(String[] words) { 21 | this.words = new String[words.length]; 22 | for (int x = 0; x < words.length; x++) { 23 | this.words[x] = words[x]; 24 | } 25 | 26 | wordJList.setListData(this.words); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Application.java: -------------------------------------------------------------------------------- 1 | import javax.swing.*; 2 | import java.awt.*; 3 | 4 | public class Application { 5 | public static void main(String[] args) { 6 | //Use an appropriate Look and Feel 7 | try { 8 | //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 9 | UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); 10 | } catch (Exception ex) { 11 | ex.printStackTrace(); 12 | } 13 | 14 | // Turn off metal's use of bold fonts 15 | UIManager.put("swing.boldMetal", Boolean.FALSE); 16 | 17 | //Schedule a job for the event dispatch thread: 18 | //creating and showing this application's GUI. 19 | javax.swing.SwingUtilities.invokeLater(new Runnable() { 20 | public void run() { 21 | createAndShowGUI(); 22 | } 23 | }); 24 | } 25 | 26 | /** 27 | * Create the GUI and show it. For thread safety, 28 | * this method should be invoked from the 29 | * event dispatch thread. 30 | */ 31 | private static void createAndShowGUI() { 32 | //Create and set up the window 33 | JFrame frame = new JFrame("Pictionary Cheat"); 34 | frame.setPreferredSize(new Dimension(350, 600)); 35 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 36 | 37 | Container mainContainer = frame.getContentPane(); 38 | PictionaryView view = new PictionaryView(mainContainer); 39 | 40 | //Display the window 41 | frame.pack(); 42 | frame.setVisible(true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/PictionaryView.java: -------------------------------------------------------------------------------- 1 | import javax.swing.*; 2 | import java.awt.*; 3 | import java.util.ArrayList; 4 | 5 | public class PictionaryView { 6 | private JPanel viewPanel = new JPanel(); 7 | private String[] words; 8 | 9 | public PictionaryView(Container container) { 10 | words = WordInput.words; 11 | container.add(viewPanel); 12 | viewPanel.setLayout(new BorderLayout()); 13 | 14 | addUIToViewPanel(); 15 | } 16 | 17 | private void addUIToViewPanel() { 18 | WordLengthSelector wordLengthSelector = new WordLengthSelector(); 19 | WordListPanel wordList = new WordListPanel(); 20 | wordList.setWords(words); 21 | wordLengthSelector.setListener(new WordLengthSelectorListener() { 22 | @Override 23 | public void onNumberOfLettersSelected(int numberOfLettersSelected) { 24 | if (numberOfLettersSelected == -1) { 25 | wordList.setWords(words); 26 | return; 27 | } 28 | 29 | String[] filteredWords = getWordsOfLength(numberOfLettersSelected); 30 | wordList.setWords(filteredWords); 31 | } 32 | }); 33 | 34 | viewPanel.add(wordLengthSelector, BorderLayout.PAGE_START); 35 | viewPanel.add(wordList, BorderLayout.LINE_END); 36 | } 37 | 38 | private String[] getWordsOfLength(int length) { 39 | ArrayList listOfWords = new ArrayList<>(); 40 | for(int x = 0; x < words.length; x++) { 41 | if(words[x].length() == length) { 42 | listOfWords.add(words[x]); 43 | } 44 | } 45 | String[] listOfWordsArray = listOfWords.toArray(new String[listOfWords.size()]); 46 | return listOfWordsArray; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/WordLengthSelector.java: -------------------------------------------------------------------------------- 1 | import javafx.scene.control.ComboBox; 2 | 3 | import javax.swing.*; 4 | import java.awt.*; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | 8 | public class WordLengthSelector extends JPanel { 9 | private static final int[] numberOptions = {4, 5, 6, 7, 8, 9, 10, 11}; 10 | 11 | private WordLengthSelectorListener listener; 12 | 13 | public WordLengthSelector() { 14 | this.setLayout(new BorderLayout()); 15 | this.add(getJComboBox()); 16 | } 17 | 18 | private JComboBox getJComboBox() { 19 | JComboBox comboBox = new JComboBox(getDisplayNames()); 20 | comboBox.addActionListener(new ActionListener() { 21 | @Override 22 | public void actionPerformed(ActionEvent e) { 23 | if (comboBox.getSelectedIndex() == 0) { 24 | listener.onNumberOfLettersSelected(-1); 25 | return; 26 | } 27 | 28 | int numberOfLetters = numberOptions[comboBox.getSelectedIndex() - 1]; 29 | 30 | if (listener != null) { 31 | listener.onNumberOfLettersSelected(numberOfLetters); 32 | } 33 | } 34 | }); 35 | 36 | return comboBox; 37 | } 38 | 39 | void setListener(WordLengthSelectorListener listener) { 40 | this.listener = listener; 41 | } 42 | 43 | private static String[] getDisplayNames() { 44 | String[] optionDisplayNames = new String[numberOptions.length + 1]; 45 | optionDisplayNames[0] = "--Select Number of Letters--"; 46 | 47 | for (int x = 0 ; x < numberOptions.length; x++) { 48 | optionDisplayNames[x + 1] = numberOptions[x] + " Letters"; 49 | } 50 | 51 | return optionDisplayNames; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/WordInput.java: -------------------------------------------------------------------------------- 1 | public class WordInput { 2 | public static final String[] words = { 3 | "salsa", 4 | "sushi", 5 | "booty", 6 | "snake", 7 | "rainbow", 8 | "hamster", 9 | "muffin", 10 | "paper", 11 | "winter", 12 | "stomach", 13 | "spoon", 14 | "corl", 15 | "fishing", 16 | "lizard", 17 | "hair", 18 | "snowflake", 19 | "dance", 20 | "fire", 21 | "capture", 22 | "cereal", 23 | "toilet", 24 | "elbow", 25 | "skirt", 26 | "tooth", 27 | "mushroom", 28 | "giant", 29 | "baggage", 30 | "zipper", 31 | "beard", 32 | "shout", 33 | "batman", 34 | "rose", 35 | "chestplate", 36 | "family", 37 | "chair", 38 | "stingray", 39 | "creeper", 40 | "royal", 41 | "milk", 42 | "shark", 43 | "campfire", 44 | "phone", 45 | "flag", 46 | "zombie", 47 | "tears", 48 | "crown", 49 | "bookcase", 50 | "unicorn", 51 | "spring", 52 | "summer", 53 | "drink", 54 | "slime", 55 | "pikachu", 56 | "uppercut", 57 | "hobo", 58 | "elephant", 59 | "neck", 60 | "whistle", 61 | "smiley", 62 | "disco", 63 | "burn", 64 | "football", 65 | "math", 66 | "sugar", 67 | "iceberg", 68 | "toaster", 69 | "basketball", 70 | "frisbee", 71 | "photograph", 72 | "rabbit", 73 | "palace", 74 | "bowl", 75 | "branch", 76 | "eye", 77 | "fat", 78 | "rain", 79 | "galaxy", 80 | "speedboat", 81 | "ring", 82 | "jellyfish", 83 | "flint", 84 | "pistol", 85 | "dice", 86 | "towel", 87 | "torch", 88 | "autumn", 89 | "balloons", 90 | "compass", 91 | "mansion", 92 | "america", 93 | "sloth", 94 | "cupcake", 95 | "skype", 96 | "pyramid", 97 | "sleeping", 98 | "boots", 99 | "jump", 100 | "pirate", 101 | "cork", 102 | "spray", 103 | "minecraft", 104 | "fighting", 105 | "crowd", 106 | "dragon", 107 | "peach", 108 | "domino", 109 | "sheep", 110 | "ruler", 111 | "cloud", 112 | "syrup", 113 | "flower", 114 | "book", 115 | "beans", 116 | "ski", 117 | "truck", 118 | "tomato", 119 | "drool", 120 | "nether", 121 | "acorn", 122 | "handcuffs", 123 | "shotgun", 124 | "time", 125 | "alligator", 126 | "picnic", 127 | "angel", 128 | "ocean", 129 | "clock", 130 | "igloo", 131 | "helicopter", 132 | "piano", 133 | "watch", 134 | "sponge", 135 | "bamboo", 136 | "berry", 137 | "frozen", 138 | "telphone", 139 | "mouth", 140 | "finger", 141 | "sideburns", 142 | "pregnant", 143 | "keyboard", 144 | "dress", 145 | "worm", 146 | "lion", 147 | "tetris", 148 | "moon", 149 | "bread", 150 | "plant", 151 | "cheek", 152 | "prison", 153 | "storm", 154 | "comet", 155 | "castle", 156 | "cinema", 157 | "lawnmower", 158 | "boy", 159 | "bowtie", 160 | "calculator", 161 | "kiss", 162 | "donut", 163 | "letter", 164 | "elevator", 165 | "pancake", 166 | "farm", 167 | "youtube", 168 | "charmander", 169 | "stool", 170 | "lollipop", 171 | "hammer", 172 | "earth", 173 | "car", 174 | "xbox", 175 | "wind", 176 | "volcano", 177 | "squid", 178 | "couch", 179 | "cannibal", 180 | "cheese", 181 | "diamonds", 182 | "mario", 183 | "bird", 184 | "wizard", 185 | "zoo", 186 | "bikini", 187 | "teapot", 188 | "sunglasses", 189 | "nose", 190 | "booger", 191 | "police", 192 | "speaker", 193 | "wheat", 194 | "bucket", 195 | "king", 196 | "dinosaur", 197 | "hang", 198 | "skeleton", 199 | "stamp", 200 | "alcohol", 201 | "skull", 202 | "tent", 203 | "music", 204 | "juggle", 205 | "staircase", 206 | "moose", 207 | "crying", 208 | "computer", 209 | "tiger", 210 | "plumber", 211 | "soup", 212 | "ninja", 213 | "radar", 214 | "blanket", 215 | "brush", 216 | "archer", 217 | "lamp", 218 | "queen", 219 | "mouse", 220 | "spaceship", 221 | "chest", 222 | "penguin", 223 | "roll", 224 | "lava", 225 | "tiny", 226 | "temple", 227 | "crab", 228 | "laptop", 229 | "chimney", 230 | "guard", 231 | "skinny", 232 | "pig", 233 | "pokeball", 234 | "kirby", 235 | "ankle", 236 | "present", 237 | "cold", 238 | "television", 239 | "drill", 240 | "treehouse", 241 | "astronaut", 242 | "miner", 243 | "cat", 244 | "shield", 245 | "notebook", 246 | "spaghetti", 247 | "blood", 248 | "yelling", 249 | "coconut", 250 | "river", 251 | "emeralds", 252 | "battery", 253 | "hook", 254 | "grave", 255 | "pizza", 256 | "magic", 257 | "turtle", 258 | "telescope", 259 | "quick", 260 | "screw", 261 | "popsicle", 262 | "hand", 263 | "carrot", 264 | "pants", 265 | "playstation", 266 | "twitter", 267 | "hospital", 268 | "pepsi", 269 | "pool", 270 | "barn", 271 | "school", 272 | "racecar", 273 | "punch", 274 | "trash", 275 | "grapes", 276 | "desk", 277 | "mother", 278 | "paint", 279 | "burger", 280 | "sprout", 281 | "windmill", 282 | "mineplex", 283 | "baby", 284 | "camel", 285 | "bridge", 286 | "wither", 287 | "stain", 288 | "sun", 289 | "bear", 290 | "lightning", 291 | "sock", 292 | "ghast", 293 | "llama", 294 | "pillow", 295 | "swing", 296 | "gift", 297 | "bench", 298 | "butterfly", 299 | "frog", 300 | "sunrise", 301 | "pajamas", 302 | "camera", 303 | "golem", 304 | "skunk", 305 | "boat", 306 | "squirrel", 307 | "zebra", 308 | "waist", 309 | "grass", 310 | "muscles", 311 | "melon", 312 | "yoshi", 313 | "guitar", 314 | "fall", 315 | "violin", 316 | "trumpet", 317 | "stump", 318 | "vomit", 319 | "rifle", 320 | "chicken", 321 | "erupt", 322 | "anchor", 323 | "cake", 324 | "planet", 325 | "armor", 326 | "cookie", 327 | "snowman", 328 | "poop", 329 | "beer", 330 | "money", 331 | "stable", 332 | "swimming", 333 | "robot", 334 | "snorlax", 335 | "candy", 336 | "desert", 337 | "nintendo", 338 | "piston", 339 | "pumpkin", 340 | "bumblebee", 341 | "chef", 342 | "mudkip", 343 | "thumb", 344 | "darts", 345 | "cyclops", 346 | "spider", 347 | "bank", 348 | "witch", 349 | "cigar", 350 | "superman", 351 | "wolf", 352 | "father", 353 | "pull", 354 | "cactus", 355 | "dream", 356 | "prize", 357 | "bacon", 358 | "godzilla", 359 | "letterbox", 360 | "tower", 361 | "ants", 362 | "forest", 363 | "alien", 364 | "bagel", 365 | "shorts", 366 | "light", 367 | "face", 368 | "tail", 369 | "shoe", 370 | "monkey", 371 | "axe", 372 | "explosion", 373 | "umbrella", 374 | "tornado", 375 | "party", 376 | "clown", 377 | "facebook", 378 | "photo", 379 | "pencil", 380 | "plane", 381 | "noodles", 382 | "leash", 383 | "puppy", 384 | "night", 385 | "chocolate", 386 | "motorbike", 387 | "obsidian", 388 | "yawn", 389 | "eggs", 390 | "window", 391 | "coffee", 392 | "anvil", 393 | "confused", 394 | "panda", 395 | "bow", 396 | "joker", 397 | }; 398 | } 399 | --------------------------------------------------------------------------------