Update StolowkaZPM.java

This commit is contained in:
s441433 2019-01-09 01:35:11 +01:00
parent 11838626a5
commit c0b9ad4878

View File

@ -1,46 +1,28 @@
//import javax.swing.*;
//import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
//import javax.swing.JLayeredPane;
//import javax.swing.JOptionPane;
//import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
//import java.awt.Image;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
//import java.awt.event.FocusListener;
import java.awt.*;
//import javax.swing.JPanel;
//import com.jgoodies.forms.layout.FormLayout;
//import com.jgoodies.forms.layout.ColumnSpec;
//import com.jgoodies.forms.layout.RowSpec;
//import javax.swing.JDesktopPane;
//import javax.swing.JToolBar;
import javax.swing.SwingConstants;
//import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
//import javax.swing.JPanel;
public class StolowkaZPM {
private JFrame frmStolowkaZpm;
private JLabel lblNewLabel;
//public String Dalej;
//private JLabel podajPINlabel;
//private JLabel pinView;
//private String Dalej;
//public StolowkaZPM() {Dalej=null;}
//public StolowkaZPM(String n) {Dalej=n;}
//public StolowkaZPM(StolowkaZPM P) {Dalej=P.Dalej;}
//public String GetDalej() {return Dalej;}
protected String Dalej;
/**
* Launch the application.
@ -109,11 +91,28 @@ public class StolowkaZPM {
frmStolowkaZpm.getContentPane().add(lblZbliKartDo);
lblZbliKartDo.setFont(new Font("Tahoma", Font.PLAIN, 40));
JPasswordField rfidView = new JPasswordField();
JTextField rfidView = new JTextField();
rfidView.setHorizontalAlignment(SwingConstants.CENTER);
frmStolowkaZpm.getContentPane().add(rfidView);
rfidView.setFont(new Font("Tahoma", Font.PLAIN, 50));
rfidView.setToolTipText("numer karty");
JLabel podajPINlabel = new JLabel("PODAJ PIN (4 CYFRY)");
podajPINlabel.setHorizontalAlignment(SwingConstants.CENTER);
frmStolowkaZpm.getContentPane().add(podajPINlabel);
podajPINlabel.setFont(new Font("Tahoma", Font.PLAIN, 40));
JPasswordField pinView = new JPasswordField();
pinView.setHorizontalAlignment(SwingConstants.CENTER);
frmStolowkaZpm.getContentPane().add(pinView);
pinView.setFont(new Font("Tahoma", Font.PLAIN, 50));
pinView.setToolTipText("PIN");
JButton btnZaloguj = new JButton("Zaloguj");
btnZaloguj.setFont(new Font("Tahoma", Font.PLAIN, 50));
btnZaloguj.setBounds(724, 298, 213, 69);
frmStolowkaZpm.getContentPane().add(btnZaloguj);
rfidView.addActionListener(new ActionListener() {
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
@ -121,52 +120,62 @@ public class StolowkaZPM {
//**************************************
try {
String query = "SELECT * FROM users WHERE RFID=?";
String query = "SELECT * FROM users WHERE RFID=? AND Blokada=?";
PreparedStatement pst = conn.prepareStatement(query);
pst.setString(1, rfidView.getText());
pst.setString(2, "false");
ResultSet rFID = pst.executeQuery();
String Dalej = rFID.getString("PIN");
String imie = rFID.getString("User");
int count = 0;
while (rFID.next()) {
count=count+1;
}
if (count == 1) {
//rfidView.setText("");
rfidView.setText(imie);
//JOptionPane.showMessageDialog(frmStolowkaZpm, "Zalogowano!");
//JOptionPane.showMessageDialog(frmStolowkaZpm, Dalej);
//oknoPIN wpiszPin = new oknoPIN();
//wpiszPin.noweOkno();
frmStolowkaZpm.remove(lblZbliKartDo);
//frmStolowkaZpm.remove(lblZbliKartDo);
//frmStolowkaZpm.remove(rfidView);
/*
JLabel podajPINlabel = new JLabel("PODAJ PIN (4 CYFRY)");
podajPINlabel.setHorizontalAlignment(SwingConstants.CENTER);
frmStolowkaZpm.getContentPane().add(podajPINlabel);
podajPINlabel.setFont(new Font("Tahoma", Font.PLAIN, 40));
frmStolowkaZpm.remove(rfidView);
JPasswordField pinView = new JPasswordField();
pinView.setHorizontalAlignment(SwingConstants.CENTER);
frmStolowkaZpm.getContentPane().add(pinView);
pinView.setFont(new Font("Tahoma", Font.PLAIN, 50));
pinView.setToolTipText("numer karty");
pinView.setToolTipText("PIN");
JButton btnZaloguj = new JButton("Zaloguj");
btnZaloguj.setFont(new Font("Tahoma", Font.PLAIN, 50));
btnZaloguj.setBounds(724, 298, 213, 69);
frmStolowkaZpm.getContentPane().add(btnZaloguj);
*/
btnZaloguj.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String Dalej1 = pinView.getText();
rfidView.setText("");
pinView.setText("");
if(Dalej.equals(Dalej1)){
DrukujBilet wybierzMenu = new DrukujBilet();
wybierzMenu.oknoDrukujBilet();}
else{
pinView.setText("");
wybierzMenu.oknoDrukujBilet();
}else{
//JOptionPane.showMessageDialog(frmStolowkaZpm, Dalej1);
//JOptionPane.showMessageDialog(frmStolowkaZpm, Dalej);
}
@ -212,6 +221,7 @@ public class StolowkaZPM {
} else {
rfidView.setText("");
pinView.setText("");
//JOptionPane.showMessageDialog(frmStolowkaZpm, "NIE Zalogowano!");
}
rFID.close();