streaming.gui.GenreJDialogLayout.java Source code

Java tutorial

Introduction

Here is the source code for streaming.gui.GenreJDialogLayout.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package streaming.gui;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import streaming.entity.Genre;

import streaming.service.GenreService;

/**
 *
 * @author ajc
 */
@Component
public class GenreJDialogLayout extends javax.swing.JDialog {

    /**
     * Creates new form JDialogFilm
     */

    private GenreJPanelList jpListeGenre = null;

    @Autowired
    private GenreService genreService;

    public GenreJDialogLayout() {
        this.setModal(true);
        initComponents();
    }

    public GenreJPanelList getJpListeGenre() {
        return jpListeGenre;
    }

    public void setJpListeGenre(GenreJPanelList jpListeGenre) {
        this.jpListeGenre = jpListeGenre;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jPanel9 = new javax.swing.JPanel();
        jTGenre = new javax.swing.JTextField();
        jPanel10 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Nouveau genre");
        getContentPane().setLayout(new java.awt.GridLayout(2, 3));

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Nom");
        getContentPane().add(jLabel1);

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(jPanel9Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 176, Short.MAX_VALUE));
        jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 189, Short.MAX_VALUE));

        getContentPane().add(jPanel9);

        jTGenre.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTGenre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTGenreActionPerformed(evt);
            }
        });
        getContentPane().add(jTGenre);

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(jPanel10Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 176, Short.MAX_VALUE));
        jPanel10Layout.setVerticalGroup(jPanel10Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 189, Short.MAX_VALUE));

        getContentPane().add(jPanel10);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(jPanel7Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 176, Short.MAX_VALUE));
        jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 189, Short.MAX_VALUE));

        getContentPane().add(jPanel7);

        jButton1.setText("OK");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout
                .setHorizontalGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel11Layout.createSequentialGroup().addGap(24, 24, 24)
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 129,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(23, Short.MAX_VALUE)));
        jPanel11Layout
                .setVerticalGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel11Layout.createSequentialGroup().addGap(70, 70, 70).addComponent(jButton1)
                                .addContainerGap(96, Short.MAX_VALUE)));

        getContentPane().add(jPanel11);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        Genre g = new Genre(jTGenre.getText());
        genreService.ajouter(g);
        jpListeGenre.rafraichirJTable();
        this.setVisible(false);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jTGenreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTGenreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTGenreActionPerformed

    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JTextField jTGenre;
    // End of variables declaration//GEN-END:variables
}