Javafree
Página Inicial do Fórum > Frameworks, APIs e IDE's

aplicativo em java



Criar novo tópico   Responder tópico


  1. adoniel22
    Posts:1


    Comment Arrow

    Publicado em: 23/03/2015 16:16:34

    Boa tarde pessoal estou com um problema estou criando um aplicativo em java, e estou com alguns problemas a parte visual ja criei toda agora falta a programaçao em se estou comerçando agora gostaria de uama ajuda se possivel.

    a minha tela de logiem gostaria de compara a senhas e acessa-la se a senah nao estiver correta ele aparece uma frase .
    se a senha correta ele abre a procipa janela que se chama "principal";

    vou postar o codgos
    package reuniao;

    /**
    *
    * @author t1071045
    */
    public class SalaLogin extends javax.swing.JFrame {

    /**
    * Creates new form SalaLogin
    */
    public SalaLogin() {
    initComponents();
    }

    /**
    * 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">
    private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    senha = new javax.swing.JPasswordField();
    login = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    entrar = new javax.swing.JButton();
    cancelar = new javax.swing.JButton();
    jLabel6 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Principal";
    setResizable(false);

    jLabel2.setText("password:";

    login.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    loginActionPerformed(evt);
    }
    });

    jLabel3.setIcon(new javax.swing.ImageIcon("C:\\Users\\t1071045\\Documents\\NetBeansProjects\\Reuniao\\Icones\\Reuniao.png"); // NOI18N

    jLabel5.setIcon(new javax.swing.ImageIcon("C:\\Users\\t1071045\\Documents\\NetBeansProjects\\Reuniao\\Icones\\dddddd.gif"); // NOI18N

    entrar.setIcon(new javax.swing.ImageIcon("C:\\Users\\t1071045\\Documents\\NetBeansProjects\\Reuniao\\Icones\\yes.png"); // NOI18N
    entrar.setText("Entrar";
    entrar.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    entrarActionPerformed(evt);
    }
    });

    cancelar.setIcon(new javax.swing.ImageIcon("C:\\Users\\t1071045\\Documents\\NetBeansProjects\\Reuniao\\Icones\\no.png"); // NOI18N
    cancelar.setText("Cancelar";
    cancelar.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    cancelarActionPerformed(evt);
    }
    });

    jLabel6.setText("Login:";

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(154, 154, 154)
    .addComponent(jLabel4)
    .addGap(0, 0, Short.MAX_VALUE))
    .addGroup(layout.createSequentialGroup()
    .addGap(104, 104, 104)
    .addComponent(jLabel1)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(26, 26, 26)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel2)
    .addComponent(jLabel6))
    .addGap(27, 27, 27)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addGroup(layout.createSequentialGroup()
    .addComponent(entrar)
    .addGap(43, 43, 43)
    .addComponent(cancelar))
    .addComponent(senha)
    .addComponent(login, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addContainerGap(78, Short.MAX_VALUE))
    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jLabel3)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jLabel4)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
    .addComponent(jLabel1)
    .addGap(152, 152, 152))
    .addGroup(layout.createSequentialGroup()
    .addGap(18, 18, 1
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createSequentialGroup()
    .addGap(22, 22, 22)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(login, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel6))
    .addGap(18, 18, 1
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(senha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(18, 18, 1
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(entrar)
    .addComponent(cancelar))))
    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
    );

    pack();
    }// </editor-fold>

    private void loginActionPerformed(java.awt.event.ActionEvent evt) {




    // TODO add your handling code here:
    }






    private void entrarActionPerformed(java.awt.event.ActionEvent evt) {


    }

    private void cancelarActionPerformed(java.awt.event.ActionEvent evt) {

    System.exit(0);
    // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
    * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
    */
    try {
    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
    javax.swing.UIManager.setLookAndFeel(info.getClassName());
    break;
    }
    }
    } catch (ClassNotFoundException ex) {
    java.util.logging.Logger.getLogger(SalaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
    java.util.logging.Logger.getLogger(SalaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
    java.util.logging.Logger.getLogger(SalaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    java.util.logging.Logger.getLogger(SalaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new SalaLogin().setVisible(true);
    }
    });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton cancelar;
    private javax.swing.JButton entrar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JTextField login;
    private javax.swing.JPasswordField senha;
    // End of variables declaration
    }



  1. Relacionados