Update oknoPIN.java
This commit is contained in:
parent
7d2457a0ff
commit
3fae5fa42d
@ -1,33 +1,37 @@
|
|||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import java.awt.Toolkit;
|
//import java.awt.Toolkit;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.BoxLayout;
|
//import javax.swing.BoxLayout;
|
||||||
import javax.swing.JTree;
|
//import javax.swing.JTree;
|
||||||
import javax.swing.JSlider;
|
//import javax.swing.JSlider;
|
||||||
import javax.swing.JToggleButton;
|
//import javax.swing.JToggleButton;
|
||||||
import com.jgoodies.forms.layout.FormLayout;
|
//import com.jgoodies.forms.layout.FormLayout;
|
||||||
import com.jgoodies.forms.layout.ColumnSpec;
|
//import com.jgoodies.forms.layout.ColumnSpec;
|
||||||
import com.jgoodies.forms.layout.RowSpec;
|
//import com.jgoodies.forms.layout.RowSpec;
|
||||||
import com.jgoodies.forms.layout.FormSpecs;
|
//import com.jgoodies.forms.layout.FormSpecs;
|
||||||
import javax.swing.JTextField;
|
//import javax.swing.JTextField;
|
||||||
import javax.swing.JPasswordField;
|
import javax.swing.JPasswordField;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
public class oknoPIN {
|
|
||||||
|
public class oknoPIN extends StolowkaZPM {
|
||||||
|
|
||||||
private JFrame PodajPin;
|
private JFrame PodajPin;
|
||||||
private JPasswordField passwordField;
|
private JPasswordField passwordField;
|
||||||
|
//public String Dalej;
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the application.
|
|
||||||
*/
|
|
||||||
public static void noweOkno() {
|
public static void noweOkno() {
|
||||||
EventQueue.invokeLater(new Runnable() {
|
EventQueue.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -41,17 +45,19 @@ public class oknoPIN {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
Connection conn=null;
|
||||||
* Create the application.
|
|
||||||
*/
|
public oknoPIN () {
|
||||||
public oknoPIN() {
|
initialize2();
|
||||||
initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the contents of the frame.
|
* Initialize the contents of the frame.
|
||||||
*/
|
*/
|
||||||
private void initialize() {
|
private void initialize2 () {
|
||||||
|
//**************************************
|
||||||
|
conn=SQLiteConnection.dbConnector();
|
||||||
|
//**************************************
|
||||||
PodajPin = new JFrame();
|
PodajPin = new JFrame();
|
||||||
PodajPin.setTitle("Podaj PIN");
|
PodajPin.setTitle("Podaj PIN");
|
||||||
PodajPin.setBounds(100, 100, 528, 306);
|
PodajPin.setBounds(100, 100, 528, 306);
|
||||||
@ -77,10 +83,37 @@ public class oknoPIN {
|
|||||||
JButton btnZaloguj = new JButton("Zaloguj");
|
JButton btnZaloguj = new JButton("Zaloguj");
|
||||||
btnZaloguj.setFont(new Font("Tahoma", Font.PLAIN, 50));
|
btnZaloguj.setFont(new Font("Tahoma", Font.PLAIN, 50));
|
||||||
btnZaloguj.addActionListener(new ActionListener() {
|
btnZaloguj.addActionListener(new ActionListener() {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
String query = "SELECT * FROM users WHERE RFID=? and Password=?";
|
||||||
|
PreparedStatement pst2 = conn.prepareStatement(query);
|
||||||
|
pst2.setString(1, "0000");
|
||||||
|
pst2.setString(2, passwordField.getText());
|
||||||
|
ResultSet pass = pst2.executeQuery();
|
||||||
|
int count = 0;
|
||||||
|
while (pass.next()) {
|
||||||
|
count=count+1;
|
||||||
|
}
|
||||||
|
if (count == 1) {
|
||||||
|
passwordField.setText("");
|
||||||
|
JOptionPane.showMessageDialog(PodajPin, "Zalogowano!");
|
||||||
PodajPin.setVisible(false);
|
PodajPin.setVisible(false);
|
||||||
DrukujBilet wybierzMenu = new DrukujBilet();
|
DrukujBilet wybierzMenu = new DrukujBilet();
|
||||||
wybierzMenu.oknoDrukujBilet();
|
wybierzMenu.oknoDrukujBilet();
|
||||||
|
} else {
|
||||||
|
passwordField.setText("");
|
||||||
|
JOptionPane.showMessageDialog(PodajPin, "NIE Zalogowano!");
|
||||||
|
}
|
||||||
|
pass.close();
|
||||||
|
pst2.close();
|
||||||
|
|
||||||
|
} catch (Exception e1){
|
||||||
|
JOptionPane.showMessageDialog(null, e1);
|
||||||
|
passwordField.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btnZaloguj.setBounds(724, 298, 213, 69);
|
btnZaloguj.setBounds(724, 298, 213, 69);
|
||||||
|
Loading…
Reference in New Issue
Block a user