LaCaraDeLaVerga

menu

Sep 8th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.97 KB | None | 0 0
  1. package presentacion;
  2.  
  3. import java.awt.EventQueue;
  4.  
  5. import javax.swing.JFrame;
  6. import javax.swing.JButton;
  7. import javax.swing.JLabel;
  8. import javax.swing.JTextField;
  9. import java.awt.Color;
  10. import javax.swing.JMenu;
  11. import javax.swing.JCheckBoxMenuItem;
  12. import javax.print.DocFlavor.URL;
  13. import javax.sound.sampled.AudioInputStream;
  14. import javax.sound.sampled.AudioSystem;
  15. import javax.sound.sampled.Clip;
  16. import javax.sound.sampled.LineUnavailableException;
  17. import javax.sound.sampled.UnsupportedAudioFileException;
  18. import javax.swing.AbstractAction;
  19. import java.awt.event.ActionEvent;
  20. import javax.swing.Action;
  21. import java.awt.SystemColor;
  22. import java.awt.Font;
  23. import javax.swing.JPanel;
  24. import javax.swing.border.SoftBevelBorder;
  25. import javax.swing.border.BevelBorder;
  26. import javax.swing.JProgressBar;
  27. import javax.swing.UIManager;
  28. import javax.swing.JEditorPane;
  29. import java.awt.event.ActionListener;
  30. import java.awt.event.MouseAdapter;
  31. import java.awt.event.MouseEvent;
  32. import java.io.IOException;
  33. import java.awt.CardLayout;
  34. import javax.swing.JSpinner;
  35. import javax.swing.SpinnerNumberModel;
  36. import javax.swing.JToggleButton;
  37. import javax.swing.JCheckBox;
  38. import javax.swing.JList;
  39. import javax.swing.JSlider;
  40.  
  41. public class multiTab {
  42.  
  43.     private JFrame frame;
  44.    
  45.    
  46.     /**
  47.      * Launch the application.
  48.      */
  49.     public static void main(String[] args) {
  50.         EventQueue.invokeLater(new Runnable() {
  51.             public void run() {
  52.                 try {
  53.                     multiTab window = new multiTab();
  54.                     window.frame.setVisible(true);
  55.                 } catch (Exception e) {
  56.                     e.printStackTrace();
  57.                 }
  58.             }
  59.         });
  60.     }
  61.  
  62.     /**
  63.      * Create the application.
  64.      */
  65.     public multiTab() {
  66.         initialize();
  67.     }
  68.  
  69.     /**
  70.      * Initialize the contents of the frame.
  71.      */
  72.     private void initialize() {
  73.  
  74. //      VARIABLES
  75.         int alto = 600 ;
  76.         int ancho =600 ;
  77.        
  78.        
  79.         frame = new JFrame();
  80.         frame.getContentPane().setForeground(new Color(0, 0, 0));
  81.         frame.getContentPane().setFont(new Font("Arial Narrow", Font.BOLD, 14));
  82.         frame.setBackground(SystemColor.inactiveCaption);
  83.         frame.getContentPane().setBackground(new Color(222, 184, 135));
  84.         frame.getContentPane().setLayout(new CardLayout(0, 0));
  85.         frame.setSize(alto, ancho);
  86.         frame.setResizable(false);
  87.        
  88.        
  89.     //JPANELS++
  90.         final JPanel panelMenu = new JPanel();
  91.         panelMenu.setBackground(new Color(100, 149, 237));
  92.         frame.getContentPane().add(panelMenu, "name_20725192591211");
  93.         panelMenu.setLayout(null);
  94.        
  95.         final JPanel panelGame = new JPanel();
  96.         frame.getContentPane().add(panelGame, "name_20728442959615");
  97.        
  98.         final JPanel panelOpc = new JPanel();
  99.        
  100.         panelOpc.setBackground(new Color(100, 149, 237));
  101.         frame.getContentPane().add(panelOpc, "name_20731659673905");
  102.         panelOpc.setLayout(null);
  103.        
  104.        
  105.        
  106.        
  107.         //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  108.        
  109.     //ELEMENTOS DEL PANEL MENU **
  110.        
  111.         JButton button = new JButton("2048");
  112.         button.setForeground(new Color(0, 0, 0));
  113.         button.setFont(new Font("Tahoma", Font.PLAIN, 50));
  114.         button.setBackground(new Color(100, 149, 237));
  115.         button.setBounds(200, 75, 200, 100);
  116.         panelMenu.add(button);
  117.        
  118.         JButton btnJuegoNuevo = new JButton("modo cl\u00E1sico");
  119.         btnJuegoNuevo.addActionListener(new ActionListener() {
  120.             public void actionPerformed(ActionEvent arg0) {
  121.  
  122.  
  123.             }
  124.         });
  125.         btnJuegoNuevo.setForeground(new Color(0, 0, 0));
  126.         btnJuegoNuevo.setFont(new Font("Tahoma", Font.PLAIN, 25));
  127.         btnJuegoNuevo.setBackground(new Color(100, 149, 237));
  128.         btnJuegoNuevo.setBounds(200, 200, 200, 100);
  129.         panelMenu.add(btnJuegoNuevo);
  130.        
  131.         JButton btnOpciones = new JButton("Desafio ");
  132.         btnOpciones.addActionListener(new ActionListener() {
  133.             public void actionPerformed(ActionEvent e) {
  134.             panelMenu.setVisible(false);
  135.             panelOpc.setVisible(true);
  136.            
  137.             }
  138.         });
  139.         btnOpciones.setForeground(new Color(0, 0, 0));
  140.         btnOpciones.setFont(new Font("Tahoma", Font.PLAIN, 40));
  141.         btnOpciones.setBackground(new Color(100, 149, 237));
  142.         btnOpciones.setBounds(200, 315, 200, 100);
  143.         panelMenu.add(btnOpciones);
  144.        
  145.         JLabel lblUniversidadNacionalGeneral = new JLabel("Universidad Nacional General Sarmiento ");
  146.         lblUniversidadNacionalGeneral.setBounds(180, 472, 295, 34);
  147.         panelMenu.add(lblUniversidadNacionalGeneral);
  148.        
  149.         JLabel lblTrabajoPracticoN = new JLabel("Programaci\u00F3n III - Trabajo Pr\u00E1ctico n\u00B01");
  150.         lblTrabajoPracticoN.setBounds(185, 511, 228, 14);
  151.         panelMenu.add(lblTrabajoPracticoN);
  152.        
  153.         JLabel lblJorgeRearteCarvalho = new JLabel("Jorge Rearte Carvalho - Jeremias Medrano");
  154.         lblJorgeRearteCarvalho.setBounds(176, 537, 301, 14);
  155.         panelMenu.add(lblJorgeRearteCarvalho);
  156.        
  157.         JCheckBox chckbxSonidos = new JCheckBox("MUTE");
  158.         chckbxSonidos.setBackground(new Color(100, 149, 237));
  159.         chckbxSonidos.setBounds(6, 7, 97, 23);
  160.         panelMenu.add(chckbxSonidos);
  161.        
  162. //      ******************************************************************
  163.        
  164.        
  165.         //ELEMENTOS DE OPCIONES
  166.         JButton btnNewButton = new JButton("Tama\u00F1o del Tablero");
  167.         btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 35));
  168.         btnNewButton.setBackground(new Color(100, 149, 237));
  169.         btnNewButton.setBounds(100, 27, 400, 110);
  170.         panelOpc.add(btnNewButton);
  171.        
  172.         JButton btnx = new JButton("3X3");
  173.         btnx.setBackground(new Color(100, 149, 237));
  174.         btnx.setFont(new Font("Tahoma", Font.PLAIN, 25));
  175.         btnx.setBounds(110, 148, 100, 50);
  176.         panelOpc.add(btnx);
  177.        
  178.         JButton btnx_1 = new JButton("4X4");
  179.         btnx_1.setBackground(new Color(100, 149, 237));
  180.         btnx_1.setFont(new Font("Tahoma", Font.PLAIN, 25));
  181.         btnx_1.setBounds(250, 148, 100, 50);
  182.         panelOpc.add(btnx_1);
  183.        
  184.         JButton btnx_2 = new JButton("5X5");
  185.         btnx_2.setFont(new Font("Tahoma", Font.PLAIN, 25));
  186.         btnx_2.setBackground(new Color(100, 149, 237));
  187.         btnx_2.setBounds(382, 148, 100, 50);
  188.         panelOpc.add(btnx_2);
  189.        
  190.         JButton btnx_3 = new JButton("6X6");
  191.         btnx_3.setFont(new Font("Tahoma", Font.PLAIN, 25));
  192.         btnx_3.setBackground(new Color(100, 149, 237));
  193.         btnx_3.setBounds(110, 240, 100, 50);
  194.         panelOpc.add(btnx_3);
  195.        
  196.         JButton btnx_4 = new JButton("7X7");
  197.         btnx_4.setFont(new Font("Tahoma", Font.PLAIN, 25));
  198.         btnx_4.setBackground(new Color(100, 149, 237));
  199.         btnx_4.setBounds(250, 240, 100, 50);
  200.         panelOpc.add(btnx_4);
  201.        
  202.         JButton btnx_5 = new JButton("8X8");
  203.         btnx_5.setFont(new Font("Tahoma", Font.PLAIN, 25));
  204.         btnx_5.setBackground(new Color(100, 149, 237));
  205.         btnx_5.addActionListener(new ActionListener() {
  206.             public void actionPerformed(ActionEvent arg0) {
  207.             }
  208.         });
  209.         btnx_5.setBounds(382, 240, 100, 50);
  210.         panelOpc.add(btnx_5);
  211.        
  212.         JButton btnx_6 = new JButton("9X9");
  213.         btnx_6.setBackground(new Color(100, 149, 237));
  214.         btnx_6.setFont(new Font("Tahoma", Font.PLAIN, 25));
  215.         btnx_6.setBounds(170, 320, 100, 50);
  216.         panelOpc.add(btnx_6);
  217.        
  218.         JButton btnx_7 = new JButton("10X10");
  219.         btnx_7.setFont(new Font("Tahoma", Font.PLAIN, 20));
  220.         btnx_7.setBackground(new Color(100, 149, 237));
  221.         btnx_7.setBounds(329, 322, 100, 50);
  222.         panelOpc.add(btnx_7);
  223.        
  224.         JLabel lblTeDesafiamosA = new JLabel("Te desafiamos a que ganes en los distintos tableros , si lo haces seras redirigido a un video porno espectacular");
  225.         lblTeDesafiamosA.setBounds(20, 383, 564, 67);
  226.         panelOpc.add(lblTeDesafiamosA);
  227.        
  228.  
  229.     }
  230.    
  231.    
  232.     public static void musicaFondo(Object menuInicial) throws UnsupportedAudioFileException, IOException, LineUnavailableException
  233.     {
  234.         java.net.URL url = menuInicial.getClass().getResource("/sonidos/cancionjuego.mp3");
  235.         AudioInputStream sound = AudioSystem.getAudioInputStream(url);
  236.         Clip clip = AudioSystem.getClip();
  237.         clip.open(sound);
  238.         clip.start();
  239.         clip.loop(Clip.LOOP_CONTINUOUSLY);
  240.     }
  241.     public static void musicaClick(JFrame i) throws UnsupportedAudioFileException, IOException, LineUnavailableException
  242.     {
  243.         java.net.URL url = i.getClass().getResource("/sonidos/click.wav");
  244.         AudioInputStream sound = AudioSystem.getAudioInputStream(url);
  245.         Clip clip = AudioSystem.getClip();
  246.         clip.open(sound);
  247.         clip.start();
  248.     }  
  249.    
  250.    
  251.    
  252.    
  253. }
Add Comment
Please, Sign In to add comment