Advertisement
LaCaraDeLaVerga

MenuGrafico

Dec 9th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.53 KB | None | 0 0
  1. package PRESENTACION;
  2.  
  3. import java.awt.Color;
  4. import java.awt.EventQueue;
  5. import javax.swing.JButton;
  6. import javax.swing.JFrame;
  7. import javax.swing.JPanel;
  8.  
  9. public class MenuGrafico {
  10.  
  11.     private JFrame frame;
  12.  
  13.     /**
  14.      * Launch the application.
  15.      */
  16.     public static void main(String[] args) {
  17.         EventQueue.invokeLater(new Runnable() {
  18.             public void run() {
  19.                 try {
  20.                     MenuGrafico window = new MenuGrafico();
  21.                     window.frame.setVisible(true);
  22.                 } catch (Exception e) {
  23.                     e.printStackTrace();
  24.                 }
  25.             }
  26.         });
  27.     }
  28.  
  29.     /**
  30.      * Create the application.
  31.      */
  32.     public MenuGrafico() {
  33.         initialize();
  34.     }
  35.  
  36.     /**
  37.      * Initialize the contents of the frame.
  38.      */
  39.     private void initialize() {
  40.         frame = new JFrame();
  41.         frame.getContentPane().setBackground(Color.BLACK);
  42.         frame.setBounds(100, 100, 423, 601);
  43.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  44.         frame.getContentPane().setLayout(null);
  45.         frame.setTitle("Calculadora ");
  46.         frame.setResizable(false);
  47.         frame.setLocationRelativeTo(null);
  48.         JPanel panel = new JPanel();
  49.         panel.setBounds(0, 0, 434, 10);
  50.         frame.getContentPane().add(panel);
  51.        
  52.         IniciarTecladoNumerico();
  53.         generarTeclasDeOperaciones();
  54.         iniciarPantallaUsuario();
  55.        
  56.         }
  57.  
  58.     private void iniciarPantallaUsuario(){
  59.         JPanel PantallaUsuario = new JPanel();
  60.         PantallaUsuario.setBounds(30, 21, 350, 213);
  61.         frame.getContentPane().add(PantallaUsuario);
  62.         }
  63.    
  64.     private void generarTeclasDeOperaciones() {
  65.             JButton btnNewButton_10 = new JButton("+");
  66.             btnNewButton_10.setBounds(273, 266, 120, 38);
  67.             frame.getContentPane().add(btnNewButton_10);
  68.            
  69.             JButton btnNewButton_11 = new JButton("-");
  70.             btnNewButton_11.setBounds(273, 315, 120, 38);
  71.             frame.getContentPane().add(btnNewButton_11);
  72.            
  73.             JButton btnNewButton_12 = new JButton("/");
  74.             btnNewButton_12.setBounds(273, 364, 120, 38);
  75.             frame.getContentPane().add(btnNewButton_12);
  76.            
  77.             JButton btnNewButton_13 = new JButton("x");
  78.             btnNewButton_13.setBounds(273, 420, 120, 38);
  79.             frame.getContentPane().add(btnNewButton_13);
  80.         }
  81.  
  82.     private void IniciarTecladoNumerico() {
  83.             JButton btnNewButton = new JButton("0");
  84.             btnNewButton.setBounds(101, 470, 67, 56);
  85.             frame.getContentPane().add(btnNewButton);
  86.            
  87.             JButton btnNewButton_1 = new JButton("1");
  88.             btnNewButton_1.setBounds(30, 266, 64, 56);
  89.             frame.getContentPane().add(btnNewButton_1);
  90.            
  91.             JButton btnNewButton_2 = new JButton("2");
  92.             btnNewButton_2.setBounds(104, 266, 64, 56);
  93.             frame.getContentPane().add(btnNewButton_2);
  94.            
  95.             JButton btnNewButton_3 = new JButton("5");
  96.             btnNewButton_3.setBounds(104, 333, 64, 56);
  97.             frame.getContentPane().add(btnNewButton_3);
  98.            
  99.             JButton btnNewButton_4 = new JButton("4");
  100.             btnNewButton_4.setBounds(30, 333, 64, 56);
  101.             frame.getContentPane().add(btnNewButton_4);
  102.            
  103.             JButton btnNewButton_5 = new JButton("3");
  104.             btnNewButton_5.setBounds(178, 266, 64, 56);
  105.             frame.getContentPane().add(btnNewButton_5);
  106.            
  107.             JButton btnNewButton_6 = new JButton("6");
  108.             btnNewButton_6.setBounds(175, 333, 67, 56);
  109.             frame.getContentPane().add(btnNewButton_6);
  110.            
  111.             JButton btnNewButton_7 = new JButton("7");
  112.             btnNewButton_7.setBounds(30, 403, 64, 56);
  113.             frame.getContentPane().add(btnNewButton_7);
  114.            
  115.             JButton btnNewButton_8 = new JButton("8");
  116.             btnNewButton_8.setBounds(104, 403, 64, 56);
  117.             frame.getContentPane().add(btnNewButton_8);
  118.            
  119.             JButton btnNewButton_9 = new JButton("9");
  120.             btnNewButton_9.setBounds(178, 403, 64, 56);
  121.             frame.getContentPane().add(btnNewButton_9);
  122.         }
  123.    
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement