Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package PRESENTACION;
- import java.awt.Color;
- import java.awt.EventQueue;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- public class MenuGrafico {
- private JFrame frame;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- MenuGrafico window = new MenuGrafico();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public MenuGrafico() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.getContentPane().setBackground(Color.BLACK);
- frame.setBounds(100, 100, 423, 601);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- frame.setTitle("Calculadora ");
- frame.setResizable(false);
- frame.setLocationRelativeTo(null);
- JPanel panel = new JPanel();
- panel.setBounds(0, 0, 434, 10);
- frame.getContentPane().add(panel);
- IniciarTecladoNumerico();
- generarTeclasDeOperaciones();
- iniciarPantallaUsuario();
- }
- private void iniciarPantallaUsuario(){
- JPanel PantallaUsuario = new JPanel();
- PantallaUsuario.setBounds(30, 21, 350, 213);
- frame.getContentPane().add(PantallaUsuario);
- }
- private void generarTeclasDeOperaciones() {
- JButton btnNewButton_10 = new JButton("+");
- btnNewButton_10.setBounds(273, 266, 120, 38);
- frame.getContentPane().add(btnNewButton_10);
- JButton btnNewButton_11 = new JButton("-");
- btnNewButton_11.setBounds(273, 315, 120, 38);
- frame.getContentPane().add(btnNewButton_11);
- JButton btnNewButton_12 = new JButton("/");
- btnNewButton_12.setBounds(273, 364, 120, 38);
- frame.getContentPane().add(btnNewButton_12);
- JButton btnNewButton_13 = new JButton("x");
- btnNewButton_13.setBounds(273, 420, 120, 38);
- frame.getContentPane().add(btnNewButton_13);
- }
- private void IniciarTecladoNumerico() {
- JButton btnNewButton = new JButton("0");
- btnNewButton.setBounds(101, 470, 67, 56);
- frame.getContentPane().add(btnNewButton);
- JButton btnNewButton_1 = new JButton("1");
- btnNewButton_1.setBounds(30, 266, 64, 56);
- frame.getContentPane().add(btnNewButton_1);
- JButton btnNewButton_2 = new JButton("2");
- btnNewButton_2.setBounds(104, 266, 64, 56);
- frame.getContentPane().add(btnNewButton_2);
- JButton btnNewButton_3 = new JButton("5");
- btnNewButton_3.setBounds(104, 333, 64, 56);
- frame.getContentPane().add(btnNewButton_3);
- JButton btnNewButton_4 = new JButton("4");
- btnNewButton_4.setBounds(30, 333, 64, 56);
- frame.getContentPane().add(btnNewButton_4);
- JButton btnNewButton_5 = new JButton("3");
- btnNewButton_5.setBounds(178, 266, 64, 56);
- frame.getContentPane().add(btnNewButton_5);
- JButton btnNewButton_6 = new JButton("6");
- btnNewButton_6.setBounds(175, 333, 67, 56);
- frame.getContentPane().add(btnNewButton_6);
- JButton btnNewButton_7 = new JButton("7");
- btnNewButton_7.setBounds(30, 403, 64, 56);
- frame.getContentPane().add(btnNewButton_7);
- JButton btnNewButton_8 = new JButton("8");
- btnNewButton_8.setBounds(104, 403, 64, 56);
- frame.getContentPane().add(btnNewButton_8);
- JButton btnNewButton_9 = new JButton("9");
- btnNewButton_9.setBounds(178, 403, 64, 56);
- frame.getContentPane().add(btnNewButton_9);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement