Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Modelo;
- public class Login {
- private String nome;
- private String senha;
- public String getNome() {
- return nome;
- }
- public void setNome(String nome) {
- this.nome = nome;
- }
- public String getSenha() {
- return senha;
- }
- public void setSenha(String senha) {
- this.senha = senha;
- }
- }
- Segue a minha Conexão
- package Modelo;
- import java.sql.*;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- public class Conexao {
- public Statement stm;
- public ResultSet rs;
- public static final String URL = "jdbc:mysql://localhost:3306/gestaosenha";
- private static final String driver = "com.mysql.jdbc.Driver";
- public static final String USER = "root";
- public static final String SENHA = "12345";
- public Connection conn;
- public static Connection Conectar()
- throws SQLException
- {
- try {
- System.setProperty("jdbc.Drivers",driver);
- return DriverManager.getConnection(URL, USER, SENHA);
- } catch (SQLException se) {
- throw new SQLException("Erro ao conectar"+se.getMessage());
- }
- }
- }
- Segue o View
- private void EntrarMouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- if ((jtextfildNome.getText().isEmpty()) || (jPasswordField1Senha.getText().isEmpty())) {
- JOptionPane.showMessageDialog(null, "Preencha os campos Nome e Senha" );
- }
- else
- {
- JOptionPane.showMessageDialog(null, "O USUÁRIO " + jtextfildNome.getText() + " LOGOU" );
- dispose();
- new Administrador ().setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement