Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.32 KB | None | 0 0
  1. package ayudantia;
  2. import java.awt.Graphics;
  3. import java.awt.Image;
  4.  
  5.  
  6.  
  7.  
  8.  
  9. import javax.swing.ImageIcon;
  10. import javax.swing.JPanel;
  11.  
  12. import java.awt.EventQueue;
  13.  
  14. import javax.swing.JFrame;
  15. import javax.swing.JButton;
  16. import javax.swing.JLabel;
  17.  
  18. import java.awt.event.ActionListener;
  19. import java.awt.event.ActionEvent;
  20. import java.awt.Color;
  21. import java.awt.Toolkit;
  22.  
  23. public class adivina_quien {
  24.  
  25. private JFrame frame;
  26.  
  27. /**
  28. * Launch the application.
  29. */
  30. public static void main(String[] args) {
  31. EventQueue.invokeLater(new Runnable() {
  32. public void run() {
  33. try {
  34. adivina_quien window = new adivina_quien();
  35. window.frame.setVisible(true);
  36. } catch (Exception e) {
  37. e.printStackTrace();
  38. }
  39. }
  40. });
  41. }
  42.  
  43. /**
  44. * Create the application.
  45. */
  46. public adivina_quien() {
  47. initialize();
  48. }
  49.  
  50. /**
  51. * Initialize the contents of the frame.
  52. */
  53. private void initialize() {
  54. frame = new JFrame();
  55. frame.setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\JPRG\\Downloads\\simpsons\\The-Simpsons-Hit-Run-2-icon.png"));
  56. frame.getContentPane().setBackground(new Color(255, 255, 0));
  57. frame.setBounds(100, 100, 1280, 750);
  58. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  59. frame.getContentPane().setLayout(null);
  60.  
  61.  
  62.  
  63.  
  64.  
  65. final JLabel label = new JLabel("");
  66. label.setBounds(588, 0, 152, 210);
  67. label.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\bart-simpson.png"));
  68. frame.getContentPane().add(label);
  69.  
  70. final JLabel label_1 = new JLabel("");
  71. label_1.setBounds(165, 67, 46, 14);
  72. frame.getContentPane().add(label_1);
  73. final personaje p1 = new personaje("moe", true,false,false,false,false,false,true,label_1);
  74.  
  75. final JLabel label_2 = new JLabel("");
  76. label_2.setBounds(252, 67, 46, 14);
  77. frame.getContentPane().add(label_2);
  78.  
  79. final JLabel Label = new JLabel("New label");
  80. Label.setBounds(750, 0, 119, 210);
  81. Label.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\abraham-simpson.png"));
  82. frame.getContentPane().add(Label);
  83.  
  84. final JLabel lblNewLabel_1 = new JLabel("New label");
  85. lblNewLabel_1.setBounds(137, 463, 138, 210);
  86. lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\apu-nahasapeemapetilon.png"));
  87. frame.getContentPane().add(lblNewLabel_1);
  88.  
  89. final JLabel label_3 = new JLabel("");
  90. label_3.setBounds(10, 477, 130, 209);
  91. label_3.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\carl-carlson.png"));
  92. frame.getContentPane().add(label_3);
  93.  
  94. final JLabel lblNewLabel_2 = new JLabel("New label");
  95. lblNewLabel_2.setBounds(307, 463, 119, 210);
  96. lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\castulo-smithers.png"));
  97. frame.getContentPane().add(lblNewLabel_2);
  98.  
  99. final JLabel lblNewLabel_3 = new JLabel("New label");
  100. lblNewLabel_3.setBounds(480, 464, 73, 209);
  101. lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\cletus-del-roy.png"));
  102. frame.getContentPane().add(lblNewLabel_3);
  103.  
  104. final JLabel lblNewLabel_4 = new JLabel("New label");
  105. lblNewLabel_4.setBounds(587, 463, 138, 204);
  106. lblNewLabel_4.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\dr-julius-hilbbert.png"));
  107. frame.getContentPane().add(lblNewLabel_4);
  108.  
  109. final JLabel lblNewLabel_5 = new JLabel("New label");
  110. lblNewLabel_5.setBounds(735, 463, 138, 205);
  111. lblNewLabel_5.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\jefe-gorgory.png"));
  112. frame.getContentPane().add(lblNewLabel_5);
  113.  
  114. final JLabel lblNewLabel_7 = new JLabel("New label");
  115. lblNewLabel_7.setBounds(971, 467, 119, 196);
  116. lblNewLabel_7.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\lisa-simpson.png"));
  117. frame.getContentPane().add(lblNewLabel_7);
  118.  
  119. final JLabel lblNewLabel_8 = new JLabel("New label");
  120. lblNewLabel_8.setBounds(1061, 479, 165, 172);
  121. lblNewLabel_8.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\maggie-simpson.png"));
  122. frame.getContentPane().add(lblNewLabel_8);
  123.  
  124. final JLabel lblNewLabel_9 = new JLabel("New label");
  125. lblNewLabel_9.setBounds(750, 243, 138, 188);
  126. lblNewLabel_9.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\marge-simpson.png"));
  127. frame.getContentPane().add(lblNewLabel_9);
  128.  
  129. final JLabel lblNewLabel_10 = new JLabel("New label");
  130. lblNewLabel_10.setBounds(866, 243, 130, 188);
  131. lblNewLabel_10.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\milhouse-van-houten.png"));
  132. frame.getContentPane().add(lblNewLabel_10);
  133.  
  134. final JLabel lblNewLabel_13 = new JLabel("New label");
  135. lblNewLabel_13.setBounds(853, 0, 143, 210);
  136. lblNewLabel_13.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\patty-bouvier.png"));
  137. frame.getContentPane().add(lblNewLabel_13);
  138.  
  139. final JLabel lblNewLabel_14 = new JLabel("New label");
  140. lblNewLabel_14.setBounds(975, -17, 152, 245);
  141. lblNewLabel_14.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\reverendo-alegria.png"));
  142. frame.getContentPane().add(lblNewLabel_14);
  143.  
  144. final JLabel lblNewLabel_15 = new JLabel("New label");
  145. lblNewLabel_15.setBounds(1115, 0, 130, 210);
  146. lblNewLabel_15.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\selma-bouvier.png"));
  147. frame.getContentPane().add(lblNewLabel_15);
  148.  
  149. final JLabel lblNewLabel_16 = new JLabel("New label");
  150. lblNewLabel_16.setBounds(602, 243, 138, 196);
  151. lblNewLabel_16.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\troy-mcclure.png"));
  152. frame.getContentPane().add(lblNewLabel_16);
  153.  
  154. JButton btnNewButton_13 = new JButton("Millhouse");
  155. btnNewButton_13.setBounds(894, 448, 89, 23);
  156. btnNewButton_13.addActionListener(new ActionListener() {
  157. public void actionPerformed(ActionEvent e) {
  158. if (lblNewLabel_10.isVisible()){
  159. lblNewLabel_10.setVisible(false);
  160.  
  161. }else {
  162. lblNewLabel_10.setVisible(true);
  163. }
  164. }
  165. });
  166. frame.getContentPane().add(btnNewButton_13);
  167. JButton btnNewButton = new JButton("troy McClure");
  168. btnNewButton.setBounds(633, 448, 107, 23);
  169. btnNewButton.addActionListener(new ActionListener() {
  170. public void actionPerformed(ActionEvent arg0) {
  171. if (lblNewLabel_16.isVisible()){
  172. lblNewLabel_16.setVisible(false);
  173.  
  174. }else {
  175. lblNewLabel_16.setVisible(true);
  176. }
  177. }
  178. });
  179. frame.getContentPane().add(btnNewButton);
  180.  
  181. JButton btnNewButton_1 = new JButton("abraham");
  182. btnNewButton_1.setBounds(760, 222, 89, 23);
  183. btnNewButton_1.addActionListener(new ActionListener() {
  184. public void actionPerformed(ActionEvent arg0) {
  185. if (Label.isVisible()){
  186. Label.setVisible(false);
  187.  
  188. }else {
  189. Label.setVisible(true);
  190. }
  191. }
  192. });
  193. frame.getContentPane().add(btnNewButton_1);
  194.  
  195. JButton btnNewButton_2 = new JButton("Bart");
  196. btnNewButton_2.setBounds(633, 222, 89, 23);
  197. btnNewButton_2.addActionListener(new ActionListener() {
  198. public void actionPerformed(ActionEvent arg0) {
  199. if (label.isVisible()){
  200. label.setVisible(false);
  201.  
  202. }else {
  203. label.setVisible(true);
  204. }
  205. }
  206. });
  207. frame.getContentPane().add(btnNewButton_2);
  208.  
  209. JButton btnNewButton_3 = new JButton("Marge");
  210. btnNewButton_3.setBounds(772, 448, 89, 23);
  211. btnNewButton_3.addActionListener(new ActionListener() {
  212. public void actionPerformed(ActionEvent arg0) {
  213. if (lblNewLabel_9.isVisible()){
  214. lblNewLabel_9.setVisible(false);
  215.  
  216. }else {
  217. lblNewLabel_9.setVisible(true);
  218. }
  219. }
  220. });
  221. frame.getContentPane().add(btnNewButton_3);
  222.  
  223. JButton btnNewButton_4 = new JButton("Apu");
  224. btnNewButton_4.setBounds(165, 684, 89, 23);
  225. btnNewButton_4.addActionListener(new ActionListener() {
  226. public void actionPerformed(ActionEvent e) {
  227. if (lblNewLabel_1.isVisible()){
  228. lblNewLabel_1.setVisible(false);
  229.  
  230. }else {
  231. lblNewLabel_1.setVisible(true);
  232. }
  233. }
  234. });
  235. frame.getContentPane().add(btnNewButton_4);
  236.  
  237. JButton btnNewButton_5 = new JButton("Carl");
  238. btnNewButton_5.setBounds(32, 684, 89, 23);
  239. btnNewButton_5.addActionListener(new ActionListener() {
  240. public void actionPerformed(ActionEvent e) {
  241. if (label_3.isVisible()){
  242. label_3.setVisible(false);
  243.  
  244. }else {
  245. label_3.setVisible(true);
  246. }
  247. }
  248. });
  249. frame.getContentPane().add(btnNewButton_5);
  250.  
  251. JButton btnNewButton_6 = new JButton("Smitters");
  252. btnNewButton_6.setBounds(317, 684, 89, 23);
  253. btnNewButton_6.addActionListener(new ActionListener() {
  254. public void actionPerformed(ActionEvent e) {
  255. if (lblNewLabel_2.isVisible()){
  256. lblNewLabel_2.setVisible(false);
  257.  
  258. }else {
  259. lblNewLabel_2.setVisible(true);
  260. }
  261. }
  262. });
  263. frame.getContentPane().add(btnNewButton_6);
  264.  
  265. JButton btnNewButton_7 = new JButton("Cletus");
  266. btnNewButton_7.setBounds(480, 684, 89, 23);
  267. btnNewButton_7.addActionListener(new ActionListener() {
  268. public void actionPerformed(ActionEvent e) {
  269. if (lblNewLabel_3.isVisible()){
  270. lblNewLabel_3.setVisible(false);
  271.  
  272. }else {
  273. lblNewLabel_3.setVisible(true);
  274. }
  275. }
  276. });
  277. frame.getContentPane().add(btnNewButton_7);
  278.  
  279. JButton btnNewButton_8 = new JButton("Hibbert");
  280. btnNewButton_8.setBounds(617, 678, 89, 23);
  281. btnNewButton_8.addActionListener(new ActionListener() {
  282. public void actionPerformed(ActionEvent e) {
  283. if (lblNewLabel_4.isVisible()){
  284. lblNewLabel_4.setVisible(false);
  285.  
  286. }else {
  287. lblNewLabel_4.setVisible(true);
  288. }
  289. }
  290. });
  291. frame.getContentPane().add(btnNewButton_8);
  292.  
  293. JButton btnNewButton_9 = new JButton("GorGorY");
  294. btnNewButton_9.setBounds(745, 677, 89, 23);
  295. btnNewButton_9.addActionListener(new ActionListener() {
  296. public void actionPerformed(ActionEvent e) {
  297. if (lblNewLabel_5.isVisible()){
  298. lblNewLabel_5.setVisible(false);
  299.  
  300. }else {
  301. lblNewLabel_5.setVisible(true);
  302. }
  303. }
  304. });
  305.  
  306. final JLabel lblNewLabel_6 = new JLabel("New label");
  307. lblNewLabel_6.setBounds(856, 474, 105, 210);
  308. lblNewLabel_6.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\lenny-leonard.png"));
  309. frame.getContentPane().add(lblNewLabel_6);
  310. frame.getContentPane().add(btnNewButton_9);
  311.  
  312. JButton btnNewButton_10 = new JButton("Lenny");
  313. btnNewButton_10.setBounds(866, 678, 89, 23);
  314. btnNewButton_10.addActionListener(new ActionListener() {
  315. public void actionPerformed(ActionEvent e) {
  316. if (lblNewLabel_6.isVisible()){
  317. lblNewLabel_6.setVisible(false);
  318.  
  319. }else {
  320. lblNewLabel_6.setVisible(true);
  321. }
  322. }
  323. });
  324. frame.getContentPane().add(btnNewButton_10);
  325.  
  326. JButton btnNewButton_11 = new JButton("Lisa");
  327. btnNewButton_11.setBounds(1001, 677, 89, 23);
  328. btnNewButton_11.addActionListener(new ActionListener() {
  329. public void actionPerformed(ActionEvent e) {
  330. if (lblNewLabel_7.isVisible()){
  331. lblNewLabel_7.setVisible(false);
  332.  
  333. }else {
  334. lblNewLabel_7.setVisible(true);
  335. }
  336. }
  337. });
  338. frame.getContentPane().add(btnNewButton_11);
  339.  
  340. JButton btnNewButton_12 = new JButton("Maggie");
  341. btnNewButton_12.setBounds(1115, 677, 89, 23);
  342. btnNewButton_12.addActionListener(new ActionListener() {
  343. public void actionPerformed(ActionEvent e) {
  344. if (lblNewLabel_8.isVisible()){
  345. lblNewLabel_8.setVisible(false);
  346.  
  347. }else {
  348. lblNewLabel_8.setVisible(true);
  349. }
  350. }
  351. });
  352. frame.getContentPane().add(btnNewButton_12);
  353.  
  354. JButton btnNewButton_14 = new JButton("reverendo alegria");
  355. btnNewButton_14.setBounds(988, 222, 119, 23);
  356. btnNewButton_14.addActionListener(new ActionListener() {
  357. public void actionPerformed(ActionEvent e) {
  358. if (lblNewLabel_14.isVisible()){
  359. lblNewLabel_14.setVisible(false);
  360.  
  361. }else {
  362. lblNewLabel_14.setVisible(true);
  363. }
  364. }
  365. });
  366. frame.getContentPane().add(btnNewButton_14);
  367. final JLabel lblNewLabel_12 = new JLabel("New label");
  368. lblNewLabel_12.setBounds(1107, 235, 119, 210);
  369. lblNewLabel_12.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\montgomery-burns.png"));
  370. frame.getContentPane().add(lblNewLabel_12);
  371.  
  372.  
  373. JButton btnNewButton_15 = new JButton("SR. Burns");
  374. btnNewButton_15.setBounds(1137, 445, 89, 23);
  375. btnNewButton_15.addActionListener(new ActionListener() {
  376. public void actionPerformed(ActionEvent e) {
  377. if (lblNewLabel_12.isVisible()){
  378. lblNewLabel_12.setVisible(false);
  379.  
  380. }else {
  381. lblNewLabel_12.setVisible(true);
  382. }
  383. }
  384. });
  385. frame.getContentPane().add(btnNewButton_15);
  386.  
  387. final JLabel lblNewLabel_11 = new JLabel("New label");
  388. lblNewLabel_11.setBounds(1008, 242, 119, 210);
  389. lblNewLabel_11.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\moe-szyslak.png"));
  390. frame.getContentPane().add(lblNewLabel_11);
  391.  
  392. JButton btnNewButton_16 = new JButton("Moe");
  393. btnNewButton_16.setBounds(1018, 448, 89, 23);
  394. btnNewButton_16.addActionListener(new ActionListener() {
  395. public void actionPerformed(ActionEvent e) {
  396. if (lblNewLabel_11.isVisible()){
  397. lblNewLabel_11.setVisible(false);
  398.  
  399. }else {
  400. lblNewLabel_11.setVisible(true);
  401. }
  402. }
  403. });
  404. frame.getContentPane().add(btnNewButton_16);
  405.  
  406. JButton btnNewButton_17 = new JButton("paty");
  407. btnNewButton_17.setBounds(876, 221, 89, 23);
  408. btnNewButton_17.addActionListener(new ActionListener() {
  409. public void actionPerformed(ActionEvent e) {
  410. if (lblNewLabel_13.isVisible()){
  411. lblNewLabel_13.setVisible(false);
  412.  
  413. }else {
  414. lblNewLabel_13.setVisible(true);
  415. }
  416.  
  417. }
  418. });
  419. frame.getContentPane().add(btnNewButton_17);
  420.  
  421. JButton btnNewButton_18 = new JButton("selma");
  422. btnNewButton_18.setBounds(1137, 221, 89, 23);
  423. btnNewButton_18.addActionListener(new ActionListener() {
  424. public void actionPerformed(ActionEvent e) {
  425. if (lblNewLabel_15.isVisible()){
  426. lblNewLabel_15.setVisible(false);
  427.  
  428. }else {
  429. lblNewLabel_15.setVisible(true);
  430. }
  431. }
  432. });
  433. frame.getContentPane().add(btnNewButton_18);
  434.  
  435. JButton btnHombre = new JButton("hombre");
  436. btnHombre.setForeground(Color.BLACK);
  437. btnHombre.addActionListener(new ActionListener() {
  438. @SuppressWarnings("deprecation")
  439. public void actionPerformed(ActionEvent arg0) {
  440. lblNewLabel_14.hide();
  441. lblNewLabel_16.hide();
  442. lblNewLabel_10.hide();
  443. lblNewLabel_11.hide();
  444. lblNewLabel_12.hide();
  445. lblNewLabel_6.hide();
  446. lblNewLabel_5.hide();
  447. lblNewLabel_4.hide();
  448. lblNewLabel_3.hide();
  449. lblNewLabel_2.hide();
  450. lblNewLabel_1.hide();
  451. label.hide();
  452. Label.hide();
  453. label_3.hide();
  454.  
  455.  
  456. }
  457. });
  458. btnHombre.setBounds(59, 361, 104, 36);
  459. frame.getContentPane().add(btnHombre);
  460.  
  461. JButton btnMujer = new JButton("mujer");
  462. btnMujer.addActionListener(new ActionListener() {
  463. @SuppressWarnings("deprecation")
  464. public void actionPerformed(ActionEvent e) {
  465. lblNewLabel_7.hide();
  466. lblNewLabel_8.hide();
  467. lblNewLabel_9.hide();
  468. lblNewLabel_13.hide();
  469. lblNewLabel_15.hide();
  470.  
  471. }
  472. });
  473. btnMujer.setBounds(191, 362, 107, 34);
  474. frame.getContentPane().add(btnMujer);
  475.  
  476. JButton btnNewButton_19 = new JButton("reiniciar");
  477. btnNewButton_19.addActionListener(new ActionListener() {
  478. @SuppressWarnings("deprecation")
  479. public void actionPerformed(ActionEvent e) {
  480. lblNewLabel_7.show();
  481. lblNewLabel_8.show();
  482. lblNewLabel_9.show();
  483. lblNewLabel_13.show();
  484. lblNewLabel_15.show();
  485. lblNewLabel_14.show();
  486. lblNewLabel_16.show();
  487. lblNewLabel_10.show();
  488. lblNewLabel_11.show();
  489. lblNewLabel_12.show();
  490. lblNewLabel_6.show();
  491. lblNewLabel_5.show();
  492. lblNewLabel_4.show();
  493. lblNewLabel_3.show();
  494. lblNewLabel_2.show();
  495. lblNewLabel_1.show();
  496. label.show();
  497. Label.show();
  498. label_3.show();
  499. }
  500. });
  501. btnNewButton_19.setBounds(331, 361, 97, 36);
  502. frame.getContentPane().add(btnNewButton_19);
  503.  
  504. JLabel lblNewLabel = new JLabel("New label");
  505. lblNewLabel.setBounds(10, 1, 521, 390);
  506. lblNewLabel.setIcon(new ImageIcon("C:\\Users\\JPRG\\Downloads\\simpsons\\clearart-145.png"));
  507. frame.getContentPane().add(lblNewLabel);
  508. }
  509. public Image getFrameIconImage() {
  510. return frame.getIconImage();
  511. }
  512. public void setFrameIconImage(Image iconImage) {
  513. frame.setIconImage(iconImage);
  514. }
  515.  
  516. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement