102 lines
3.0 KiB
Java
102 lines
3.0 KiB
Java
import javax.swing.JFrame;
|
|
import javax.swing.JLayeredPane;
|
|
import javax.swing.JOptionPane;
|
|
//import javax.swing.JTextField;
|
|
import javax.swing.JLabel;
|
|
import java.awt.event.ActionListener;
|
|
import java.awt.event.ActionEvent;
|
|
import javax.swing.JPasswordField;
|
|
import java.awt.event.FocusAdapter;
|
|
import java.awt.event.FocusEvent;
|
|
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 javax.swing.JPanel;
|
|
|
|
public class StolowkaZPM {
|
|
|
|
private JFrame frmStowkaZpm;
|
|
private JPasswordField rfidView;
|
|
|
|
/**
|
|
* Launch the application.
|
|
*/
|
|
public static void main(String[] args) {
|
|
EventQueue.invokeLater(new Runnable() {
|
|
public void run() {
|
|
try {
|
|
StolowkaZPM window = new StolowkaZPM();
|
|
window.frmStowkaZpm.setVisible(true);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Create the application.
|
|
*/
|
|
public StolowkaZPM() {
|
|
initialize();
|
|
}
|
|
|
|
/**
|
|
* Initialize the contents of the frame.
|
|
*/
|
|
private void initialize() {
|
|
frmStowkaZpm = new JFrame();
|
|
frmStowkaZpm.addFocusListener(new FocusAdapter() {
|
|
@Override
|
|
public void focusGained(FocusEvent arg0) {
|
|
}
|
|
//public void centreWindow(Window JFrame) {
|
|
// Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
|
|
// int x = (int) ((dimension.getWidth() - JFrame.getWidth()) / 2);
|
|
// int y = (int) ((dimension.getHeight() - JFrame.getHeight()) / 2);
|
|
// JFrame.setLocation(x, y);
|
|
//}
|
|
|
|
});
|
|
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
|
|
int x = (int) ((size.getWidth() - frmStowkaZpm.getWidth()) / 2);
|
|
int y = (int) ((size.getHeight() - frmStowkaZpm.getHeight()) / 2);
|
|
frmStowkaZpm.setLocation(x, y);
|
|
|
|
frmStowkaZpm.setTitle("Sto\u0142\u00F3wka ZPM");
|
|
frmStowkaZpm.setBounds(1, 1, 499, 356);
|
|
frmStowkaZpm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
frmStowkaZpm.getContentPane().setLayout(new GridLayout(0, 1, 0, 0));
|
|
|
|
JLabel lblZbliKartDo = new JLabel("Zbli\u017C kart\u0119 do czytnika RFID");
|
|
lblZbliKartDo.setHorizontalAlignment(SwingConstants.CENTER);
|
|
frmStowkaZpm.getContentPane().add(lblZbliKartDo);
|
|
lblZbliKartDo.setFont(new Font("Tahoma", Font.PLAIN, 40));
|
|
|
|
rfidView = new JPasswordField();
|
|
rfidView.setHorizontalAlignment(SwingConstants.CENTER);
|
|
frmStowkaZpm.getContentPane().add(rfidView);
|
|
rfidView.setFont(new Font("Tahoma", Font.PLAIN, 17));
|
|
rfidView.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
@SuppressWarnings("deprecation")
|
|
String RFID=rfidView.getText();
|
|
if (RFID.equals("0005492974")){
|
|
rfidView.setText("");
|
|
JOptionPane.showMessageDialog(frmStowkaZpm, "Zalogowano!");
|
|
} else {
|
|
rfidView.setText("");
|
|
JOptionPane.showMessageDialog(frmStowkaZpm, "NIE Zalogowano!");
|
|
}
|
|
}
|
|
});
|
|
rfidView.setToolTipText("numer karty");
|
|
}
|
|
}
|