/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ProgressBar;
import javax.swing.JOptionPane;
/**
*
* @author abb
*/
public class Login extends javax.swing.JFrame {
/**
* Creates new form MeuForm
*/
public Login() {
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() {
jButtonEntrar = new javax.swing.JButton();
jButtonSair = new javax.swing.JButton();
jCheckBoxLembrarsenha = new javax.swing.JCheckBox();
user = new javax.swing.JTextField();
pass = new javax.swing.JPasswordField();
jLabelNomeUsuario = new javax.swing.JLabel();
jLabelSenha = new javax.swing.JLabel();
jLabelNaoconsigoacessar = new javax.swing.JLabel();
jButtonEsqueciMeulogin = new javax.swing.JButton();
jLabelJatemcadastro = new javax.swing.JLabel();
jButtonCadastrese = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(0, 0, 0));
setIconImages(null);
jButtonEntrar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jButtonEntrar.setText("ENTRAR");
jButtonEntrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonEntrarActionPerformed(evt);
}
});
jButtonSair.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jButtonSair.setText("SAIR");
jButtonSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonSairActionPerformed(evt);
}
});
jCheckBoxLembrarsenha.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jCheckBoxLembrarsenha.setText("Lembrar senha");
jLabelNomeUsuario.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabelNomeUsuario.setText("Nome do usuário:");
jLabelSenha.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabelSenha.setText("Senha:");
jLabelNaoconsigoacessar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabelNaoconsigoacessar.setText("Não consigo acessar minha conta, e agora?");
jButtonEsqueciMeulogin.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jButtonEsqueciMeulogin.setText("ESQUECI MEU LOGIN / SENHA");
jButtonEsqueciMeulogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonEsqueciMeuloginActionPerformed(evt);
}
});
jLabelJatemcadastro.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabelJatemcadastro.setText("Já tem cadastro na Close Friend? ");
jButtonCadastrese.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jButtonCadastrese.setText("CADASTRAR-SE");
jButtonCadastrese.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCadastreseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelJatemcadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(54, 54, 54)
.addComponent(jButtonCadastrese, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelNaoconsigoacessar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonEsqueciMeulogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(14, 14, 14))
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButtonEntrar, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addComponent(jButtonSair, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(64, 64, 64))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelNomeUsuario)
.addComponent(jLabelSenha))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jCheckBoxLembrarsenha)
.addComponent(user, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
.addComponent(pass))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(user, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelNomeUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabelSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBoxLembrarsenha)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButtonSair)
.addComponent(jButtonEntrar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonEsqueciMeulogin)
.addComponent(jLabelNaoconsigoacessar))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonCadastrese)
.addComponent(jLabelJatemcadastro))
.addGap(45, 45, 45))
);
setSize(new java.awt.Dimension(550, 339));
setLocationRelativeTo(null);
}// </editor-fold>
private void jButtonEsqueciMeuloginActionPerformed(java.awt.event.ActionEvent evt) {
EsqueceuSenha tela = new EsqueceuSenha();
tela.setVisible(true);
dispose();
}
private void jButtonSairActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void jButtonEntrarActionPerformed(java.awt.event.ActionEvent evt) {
if(user.getText().equals("Admin")&&pass.getText().equals("1234")){
TelaPrincipal tela = new TelaPrincipal();
tela.setVisible(true);
dispose();
}else{
JOptionPane.showMessageDialog(rootPane, "Senha ou Usuário Inválidos ! Digite Novamente.");
}
}
private void jButtonCadastreseActionPerformed(java.awt.event.ActionEvent evt) {
Registro tela = new Registro();
tela.setVisible(true);
dispose();
}
/**
* @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 ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButtonCadastrese;
private javax.swing.JButton jButtonEntrar;
private javax.swing.JButton jButtonEsqueciMeulogin;
private javax.swing.JButton jButtonSair;
private javax.swing.JCheckBox jCheckBoxLembrarsenha;
private javax.swing.JLabel jLabelJatemcadastro;
private javax.swing.JLabel jLabelNaoconsigoacessar;
private javax.swing.JLabel jLabelNomeUsuario;
private javax.swing.JLabel jLabelSenha;
private javax.swing.JPasswordField pass;
private javax.swing.JTextField user;
// End of variables declaration
}
@VictorAlves eu também não sei.
Faz o seguinte:
Pegue um jPanel e o extenda pela tela do JFrame.
Ai altere a cor do JPanel.
Pelo menos vair ser um início, até surgir uma resposta mais adequada.