Exemplo n.º 1
0
  public void inicializar() {
    // Componentes
    jPanelFondo = new JPanel();
    jButtonBuscar = new JButton();
    jLabelNombreEstudiante = new JLabel();
    jTextFieldBuscar = new JTextField();
    jTableEstudiantes = new JTable();
    jButtonVer = new JButton();
    jButtonCancelar = new JButton();
    jButtonReporte = new JButton();
    jScrollPaneLista = new JScrollPane();

    // Color del fondo
    jPanelFondo.setBackground(new Color(255, 255, 255));
    jButtonBuscar.setBackground(new Color(255, 255, 255));
    jLabelNombreEstudiante.setBackground(new Color(255, 255, 255));
    jTextFieldBuscar.setBackground(new Color(255, 255, 255));
    jTableEstudiantes.setBackground(new Color(255, 255, 255));
    jButtonVer.setBackground(new Color(255, 255, 255));
    jButtonCancelar.setBackground(new Color(255, 255, 255));
    jScrollPaneLista.setBackground(new Color(255, 255, 255));

    setBackground(new Color(255, 255, 255));
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setTitle("Buscar Estudiante");

    jButtonBuscar.setBorder(null);
    jButtonBuscar.setBorderPainted(false);
    jButtonBuscar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/buscar.jpg")));
    jButtonBuscar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            jButtonBuscarActionPerformed(evt);
          }
        });

    jButtonVer.setBorder(null);
    jButtonVer.setBorderPainted(false);
    jButtonVer.setIcon(new ImageIcon(getClass().getResource("/Imagenes/editar1.jpg")));
    jButtonVer.setText("Elegir");
    jButtonVer.setHorizontalTextPosition(SwingConstants.CENTER);
    jButtonVer.setVerticalTextPosition(SwingConstants.BOTTOM);
    jButtonVer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            jButtonVerActionPerformed(evt);
          }
        });

    jButtonCancelar.setBorder(null);
    jButtonCancelar.setBorderPainted(false);
    jButtonCancelar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/cancelar2.jpg")));
    jButtonCancelar.setText("Cancelar");
    jButtonCancelar.setHorizontalTextPosition(SwingConstants.CENTER);
    jButtonCancelar.setVerticalTextPosition(SwingConstants.BOTTOM);
    jButtonCancelar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            jButtonCancelarActionPerformed(evt);
          }
        });

    jLabelNombreEstudiante.setFont(new Font("Harrington", 0, 24));
    jLabelNombreEstudiante.setText("Estudiante");

    jTextFieldBuscar.setFont(new Font("Tahoma", 0, 18));
    jTextFieldBuscar.addKeyListener(
        new java.awt.event.KeyAdapter() {
          /*public void keyPressed(java.awt.event.KeyEvent evt) {
              jTextFieldBuscarKeyPressed(evt);
          }*/
          public void keyTyped(java.awt.event.KeyEvent evt) {
            jTextFieldBuscarKeyTyped(evt);
          }
        });
    jPanelFondo.add(
        jTextFieldBuscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 40, 268, -1));

    jButtonReporte.setText("Reporte");
    jButtonReporte.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonReporteActionPerformed(evt);
          }
        });
    jPanelFondo.add(
        jButtonReporte, new org.netbeans.lib.awtextra.AbsoluteConstraints(650, 360, -1, -1));

    // modelo = new DefaultTableModel();
    modelo = new MiModelo();
    jTableEstudiantes = new JTable(modelo);

    jTableEstudiantes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    jScrollPaneLista.setViewportView(jTableEstudiantes);

    javax.swing.GroupLayout jPanelFondoLayout = new javax.swing.GroupLayout(jPanelFondo);
    jPanelFondo.setLayout(jPanelFondoLayout);
    jPanelFondoLayout.setHorizontalGroup(
        jPanelFondoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanelFondoLayout
                    .createSequentialGroup()
                    .addGap(79, 79, 79)
                    .addComponent(jLabelNombreEstudiante)
                    .addGap(36, 36, 36)
                    .addComponent(
                        jTextFieldBuscar,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        268,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(35, 35, 35)
                    .addComponent(
                        jButtonBuscar,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        86,
                        javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanelFondoLayout
                    .createSequentialGroup()
                    .addGap(227, 227, 227)
                    .addComponent(
                        jButtonVer,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        115,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 97, Short.MAX_VALUE)
                    .addComponent(jButtonCancelar)
                    .addGap(238, 238, 238)
                    .addComponent(jButtonReporte))
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanelFondoLayout
                    .createSequentialGroup()
                    .addContainerGap(49, Short.MAX_VALUE)
                    .addComponent(
                        jScrollPaneLista,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        723,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    jPanelFondoLayout.setVerticalGroup(
        jPanelFondoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanelFondoLayout
                    .createSequentialGroup()
                    .addGroup(
                        jPanelFondoLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                jPanelFondoLayout
                                    .createSequentialGroup()
                                    .addGap(19, 19, 19)
                                    .addComponent(
                                        jButtonBuscar,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        62,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                jPanelFondoLayout
                                    .createSequentialGroup()
                                    .addGap(35, 35, 35)
                                    .addGroup(
                                        jPanelFondoLayout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                jTextFieldBuscar,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabelNombreEstudiante))))
                    .addGap(26, 26, 26)
                    .addComponent(
                        jScrollPaneLista,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        192,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(
                        jPanelFondoLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonCancelar)
                            .addComponent(jButtonVer)
                            .addComponent(jButtonReporte))
                    .addContainerGap(68, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                jPanelFondo,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                jPanelFondo,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE));

    pack();
  }
Exemplo n.º 2
0
  @SuppressWarnings("unchecked")
  private void initComponents() { // GEN-BEGIN:initComponents

    jPanelFondo = new javax.swing.JPanel();
    jButtonVer = new javax.swing.JButton();
    jLabelNombreEstudiante = new javax.swing.JLabel();
    jScrollPaneLista = new javax.swing.JScrollPane();
    jTableEstudiantes = new javax.swing.JTable();
    jButtonCancelar = new javax.swing.JButton();
    jButtonBuscar = new javax.swing.JButton();
    jTextFieldBuscar = new javax.swing.JTextField();
    jButtonReporte = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Buscar Estudiante");

    jPanelFondo.setBackground(new java.awt.Color(255, 255, 255));
    jPanelFondo.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    jButtonVer.setBackground(new java.awt.Color(255, 255, 255));
    jButtonVer.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/Imagenes/editar1.jpg"))); // NOI18N
    jButtonVer.setText("Elegir");
    jButtonVer.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jButtonVer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jButtonVer.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonVerActionPerformed(evt);
          }
        });
    jButtonVer.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(java.awt.event.KeyEvent evt) {
            jButtonVerKeyPressed(evt);
          }
        });
    jPanelFondo.add(
        jButtonVer, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 320, 115, -1));

    jLabelNombreEstudiante.setFont(new java.awt.Font("Harrington", 0, 24));
    jLabelNombreEstudiante.setText("Estudiante");
    jPanelFondo.add(
        jLabelNombreEstudiante, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 40, -1, -1));

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

    jTableEstudiantes.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null}
            },
            new String[] {"Title 1", "Title 2", "Title 3", "Title 4"}));
    jScrollPaneLista.setViewportView(jTableEstudiantes);

    jPanelFondo.add(
        jScrollPaneLista, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 110, 723, 192));

    jButtonCancelar.setBackground(new java.awt.Color(255, 255, 255));
    jButtonCancelar.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cancelar2.jpg"))); // NOI18N
    jButtonCancelar.setText("Cancelar");
    jButtonCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jButtonCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jButtonCancelar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonCancelarActionPerformed(evt);
          }
        });
    jButtonCancelar.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(java.awt.event.KeyEvent evt) {
            jButtonCancelarKeyPressed(evt);
          }
        });
    jPanelFondo.add(
        jButtonCancelar, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 320, -1, -1));

    jButtonBuscar.setBackground(new java.awt.Color(255, 255, 255));
    jButtonBuscar.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/Imagenes/buscar.jpg"))); // NOI18N
    jButtonBuscar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonBuscarActionPerformed(evt);
          }
        });
    jButtonBuscar.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(java.awt.event.KeyEvent evt) {
            jButtonBuscarKeyPressed(evt);
          }
        });
    jPanelFondo.add(
        jButtonBuscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(610, 20, 86, 60));

    jTextFieldBuscar.setFont(new java.awt.Font("Tahoma", 0, 18));
    jTextFieldBuscar.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyTyped(java.awt.event.KeyEvent evt) {
            jTextFieldBuscarKeyTyped(evt);
          }
        });
    jPanelFondo.add(
        jTextFieldBuscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 40, 268, -1));

    jButtonReporte.setText("Reporte");
    jButtonReporte.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonReporteActionPerformed(evt);
          }
        });
    jPanelFondo.add(
        jButtonReporte, new org.netbeans.lib.awtextra.AbsoluteConstraints(650, 360, -1, -1));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelFondo, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelFondo, javax.swing.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE));

    pack();
  } // GEN-END:initComponents