Advertisement
Charmander

pokemon

Jan 13th, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. import java.net.MalformedURLException;
  2. import java.net.URL;
  3. import java.util.Random;
  4. import javax.swing.JFrame;
  5. import javax.swing.ImageIcon;
  6. import javax.swing.JLabel;
  7.  
  8. class test {
  9.  
  10. public static final String[] list = {"Bulbasaur", "Ivysaur", "Venusaur", "Charmander", "Charmeleon", "Charizard", "Squirtle", "Wartortle", "Blastoise", "Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidgeotto", "Pidgeot", "Rattata", "Raticate", "Spearow", "Fearow", "Ekans", "Arbok", "Pikachu", "Raichu", "Sandshrew", "Sandslash", "Nidoran (f)", "Nidorina", "Nidoqueen", "Nidoran (m)", "Nidorino", "Nidoking", "Clefairy", "Clefable", "Vulpix", "Ninetales", "Jigglypuff", "Wigglytuff", "Zubat", "Golbat", "Oddish", "Gloom", "Vileplume", "Paras", "Parasect", "Venonat", "Venomoth", "Diglett", "Dugtrio", "Meowth", "Persian", "Psyduck", "Golduck", "Mankey", "Primeape", "Growlithe", "Arcanine", "Poliwag", "Poliwhirl", "Poliwrath", "Abra", "Kadabra", "Alakazam", "Machop", "Machoke", "Machamp", "Bellsprout", "Weepinbell", "Victreebel", "Tentacool", "Tentacruel", "Geodude", "Graveler", "Golem", "Ponyta", "Rapidash", "Slowpoke", "Slowbro", "Magnemite", "Magneton", "Farfetch'd", "Doduo", "Dodrio", "Seel", "Dewgong", "Grimer", "Muk", "Shellder", "Cloyster", "Gastly", "Haunter", "Gengar", "Onix", "Drowzee", "Hypno", "Krabby", "Kingler", "Voltorb", "Electrode", "Exeggcute", "Exeggutor", "Cubone", "Marowak", "Hitmonlee", "Hitmonchan", "Lickitung", "Koffing", "Weezing", "Rhyhorn", "Rhydon", "Chansey", "Tangela", "Kangaskhan", "Horsea", "Seadra", "Goldeen", "Seaking", "Staryu", "Starmie", "Mr. Mime", "Scyther", "Jynx", "Electabuzz", "Magmar", "Pinsir", "Tauros", "Magikarp", "Gyarados", "Lapras", "Ditto", "Eevee", "Vaporeon", "Jolteon", "Flareon", "Porygon", "Omanyte", "Omastar", "Kabuto", "Kabutops", "Aerodactyl", "Snorlax", "Articuno", "Zapdos", "Moltres", "Dratini", "Dragonair", "Dragonite", "Mewtwo", "Mew"};
  11.  
  12. public static void main(String args[]) throws MalformedURLException {
  13. Random rand = new Random();
  14. String num = "" + (rand.nextInt(151) + 1);
  15. while (num.length() < 3) {
  16. num = "0" + num;
  17. }
  18. JFrame frame = new JFrame();
  19. ImageIcon icon = new ImageIcon(new URL("http://serebii.net/sunmoon/pokemon/" + num + ".png"));
  20. JLabel label = new JLabel(icon);
  21. String n = " ";
  22. if ("AEIOU".indexOf(list[Integer.parseInt(num) - 1].substring(0, 1)) >= 0) {
  23. n = "n ";
  24. }
  25. label.setText("Congratulations, you caught a" + n + list[Integer.parseInt(num) - 1] + "! ");
  26. frame.add(label);
  27. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28. frame.pack();
  29. frame.setVisible(true);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement