import java.sql.*;
import javax.swing.JOptionPane;
/*
* 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.
*/
/**
*
* @author Laguardia
*/
public class logins extends javax.swing.JFrame {
Connection con;
ResultSet rs;
PreparedStatement pst;
/**
* Creates new form logins
*/
public logins() {
initComponents();
}
public Connection getConnection(){
try{ //username //database =pass no password
Connection con = (Connection)DriverManager.getConnection("jdbc:mysql://localhost/voting_system","root","");
return con;
}
catch(Exception e){
}
return null;
}
/**
* 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() {
usertext = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
passtext = new javax.swing.JPasswordField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(0, 0, 0));
usertext.setFont(new java.awt.Font("Courier New", 1, 18)); // NOI18N
usertext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
usertextActionPerformed(evt);
}
});
usertext.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
usertextKeyPressed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Courier New", 1, 18)); // NOI18N
jLabel1.setText("ID Number");
jLabel2.setFont(new java.awt.Font("Courier New", 1, 18)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel2.setText("Password");
jButton2.setBackground(new java.awt.Color(0, 0, 0));
jButton2.setFont(new java.awt.Font("Courier New", 1, 24)); // NOI18N
jButton2.setText("LOGIN");
jButton2.setToolTipText("");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jButton2MouseEntered(evt);
}
});
jButton2.addInputMethodListener(new java.awt.event.InputMethodListener() {
public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
}
public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
jButton2InputMethodTextChanged(evt);
}
});
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
passtext.setFont(new java.awt.Font("Courier New", 1, 18)); // NOI18N
passtext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
passtextActionPerformed(evt);
}
});
passtext.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
passtextKeyPressed(evt);
}
});
jButton1.setBackground(new java.awt.Color(0, 0, 0));
jButton1.setFont(new java.awt.Font("Courier New", 1, 18)); // NOI18N
jButton1.setText("Main Menu");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(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()
.addGap(139, 139, 139)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(95, 95, 95)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(usertext)
.addComponent(passtext, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(157, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(111, 111, 111)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(usertext, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(9, 9, 9)
.addComponent(passtext, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(27, 27, 27)
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addContainerGap(153, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void usertextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usertextActionPerformed
String yes="yes";
String no="no";
String passid=usertext.getText();
String login = "SELECT * FROM account WHERE id_number ='"+usertext.getText()+"' AND password = '"+passtext.getText() + " ' AND status = '"+no +"'";
String already = "SELECT * FROM account WHERE id_number ='"+usertext.getText()+"' AND password = '"+passtext.getText() + " ' AND
没有合适的资源?快使用搜索试试~ 我知道了~
简单的Java投票系统源码.rar
共94个文件
class:48个
form:9个
java:9个
2 下载量 119 浏览量
2023-09-06
22:53:44
上传
评论
收藏 4.49MB RAR 举报
温馨提示
简单的Java投票系统源码 简单投票系统是一个维护投票结果正式记录的java项目。整个系统是在NetBeans IDE中制作的。系统采用MySQL数据库作为后台支持。该系统支持该系统所需的所有功能。 关于系统 该系统易于理解和操作。在这里,您必须输入将参加选举的候选人的详细信息。这个项目有很多特点。该项目由两部分组成,一是管理员,二是用户。为了投票,您必须登录系统。用户只能投票。
资源推荐
资源详情
资源评论
收起资源包目录
简单的Java投票系统源码.rar (94个子文件)
classroom-voting-system-master
nbproject
project.properties 2KB
genfiles.properties 475B
build-impl.xml 78KB
project.xml 539B
private
private.xml 486B
private.properties 91B
_config.yml 26B
src
VotersList.form 6KB
voting.form 17KB
AllData.form 5KB
logins.java 19KB
adminmenu.form 7KB
mainmenu.form 12KB
VotersList.java 9KB
adminmenu.java 9KB
AllData.java 9KB
icons
voters.png 20KB
login.png 17KB
voteresult.png 21KB
candidates.png 19KB
voteresult.java 13KB
logins.form 8KB
adminlogin.form 5KB
adminlogin.java 9KB
images
mainmenu.jpg 602KB
blacknwhitepines_edit.jpg 161KB
blacknwhitepines.jpg 708KB
registration.jpg 248KB
forgot.form 10KB
forgot.java 12KB
voting.java 18KB
voteresult.form 18KB
mainmenu.java 9KB
manifest.mf 85B
JarFilesForNetBeans
mysql-connector-java-5.1.46.jar 981KB
rs2xml.jar 168KB
build
classes
adminmenu$1.class 698B
VotersList$3.class 705B
logins$3.class 645B
voting$1.class 677B
voting$3.class 494B
VotersList$2.class 705B
mainmenu$3.class 502B
adminmenu.class 8KB
adminmenu$7.class 506B
forgot.class 9KB
VotersList$4.class 510B
AllData$4.class 498B
adminmenu$6.class 698B
voting.class 12KB
logins$4.class 794B
AllData.class 8KB
logins$1.class 677B
voteresult.class 8KB
logins$2.class 635B
forgot$5.class 494B
VotersList.class 8KB
logins$7.class 635B
forgot$4.class 677B
AllData$2.class 684B
forgot$1.class 677B
mainmenu$1.class 691B
mainmenu$2.class 691B
adminlogin$1.class 705B
adminmenu$3.class 666B
icons
voters.png 20KB
login.png 17KB
voteresult.png 21KB
candidates.png 19KB
voteresult$1.class 510B
adminlogin$2.class 705B
adminmenu$4.class 880B
mainmenu.class 7KB
adminlogin.class 8KB
AllData$1.class 652B
VotersList$1.class 673B
logins$6.class 677B
images
mainmenu.jpg 602KB
blacknwhitepines_edit.jpg 161KB
blacknwhitepines.jpg 708KB
registration.jpg 248KB
adminlogin$3.class 510B
forgot$2.class 677B
adminmenu$5.class 666B
forgot$3.class 677B
voting$2.class 677B
logins$9.class 494B
adminmenu$2.class 698B
logins$5.class 677B
logins.class 13KB
AllData$3.class 684B
logins$8.class 645B
empty
built-jar.properties 116B
generated-sources
ap-source-output
build.xml 4KB
共 94 条
- 1
资源评论
小云同志你好
- 粉丝: 1049
- 资源: 934
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功