ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Suma en javan jFrame


Enviado por   •  3 de Diciembre de 2019  •  Tarea  •  2.317 Palabras (10 Páginas)  •  186 Visitas

Página 1 de 10

Suma en Java Jframe

public class SUMA extends javax.swing.JFrame {

    public SUMA() {

        initComponents();

    }

    @SuppressWarnings("unchecked")

    //                          

    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();

        jLabel1 = new javax.swing.JLabel();

        jLabel2 = new javax.swing.JLabel();

        jLabel3 = new javax.swing.JLabel();

        jButton1 = new javax.swing.JButton();

        CajaNum1 = new javax.swing.JTextField();

        CajaNum2 = new javax.swing.JTextField();

        CajaTotal = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(51, 153, 255));

        jLabel1.setFont(new java.awt.Font("Arial Black", 0, 18)); // NOI18N

        jLabel1.setForeground(new java.awt.Color(0, 0, 0));

        jLabel1.setText("Suma de dos numeros");

        jLabel2.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N

        jLabel2.setForeground(new java.awt.Color(0, 0, 0));

        jLabel2.setText("Capturar Segundo numero");

        jLabel3.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N

        jLabel3.setForeground(new java.awt.Color(0, 0, 0));

        jLabel3.setText("Capturar Primer numero");

        jButton1.setBackground(new java.awt.Color(204, 204, 204));

        jButton1.setFont(new java.awt.Font("Arial Black", 0, 20)); // NOI18N

        jButton1.setForeground(new java.awt.Color(0, 0, 0));

        jButton1.setText("TOTAL");

        jButton1.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                jButton1ActionPerformed(evt);

            }

        });

        CajaNum1.setBackground(new java.awt.Color(255, 255, 255));

        CajaNum1.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N

        CajaNum2.setBackground(new java.awt.Color(255, 255, 255));

        CajaNum2.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N

        CajaTotal.setEditable(false);

        CajaTotal.setBackground(new java.awt.Color(255, 255, 255));

        CajaTotal.setFont(new java.awt.Font("Arial Black", 0, 14)); // NOI18N

        CajaTotal.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                CajaTotalActionPerformed(evt);

            }

        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

        jPanel1.setLayout(jPanel1Layout);

        jPanel1Layout.setHorizontalGroup(

            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(jPanel1Layout.createSequentialGroup()

                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addGroup(jPanel1Layout.createSequentialGroup()

                        .addGap(10, 10, 10)

                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addGap(10, 10, 10)

                        .addComponent(CajaNum1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))

                    .addGroup(jPanel1Layout.createSequentialGroup()

                        .addGap(10, 10, 10)

                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addGap(0, 0, 0)

                        .addComponent(CajaNum2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))

                    .addGroup(jPanel1Layout.createSequentialGroup()

                        .addGap(30, 30, 30)

                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addGap(40, 40, 40)

                        .addComponent(CajaTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))

                    .addGroup(jPanel1Layout.createSequentialGroup()

                        .addGap(80, 80, 80)

                        .addComponent(jLabel1)))

                .addContainerGap(133, Short.MAX_VALUE))

        );

        jPanel1Layout.setVerticalGroup(

            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(jPanel1Layout.createSequentialGroup()

                .addGap(30, 30, 30)

                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)

                .addGap(50, 50, 50)

                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addComponent(jLabel3)

...

Descargar como (para miembros actualizados) txt (9 Kb) pdf (45 Kb) docx (9 Kb)
Leer 9 páginas más »
Disponible sólo en Clubensayos.com