Java - Kullanıcı Girişi
Kamu KullaniciGirisi () {
initPencere ();
}
private void initPencere () {
eklemek (initPanel ());
setTitle ("Pazar Otomasyonu Girişi");
setSize (350.150);
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo (boş);
SetVisible (true);
}
Dize kullaniciadi = "gazi";
Dize sifre = "123456";
Özel JPanel initPanel () {
JPanel paneli = yeni JPanel (yeni GridLayout (3, 2,20,10));
panel.setBackground (Color.orange);
JLabel kullaniciAdiLabel = new JLabel ("Kullanıcı Adı:");
kullaniciAdiLabel.setForeground (Color.blue);
JLabel sifreLabel = new JLabel ("Şifre");
sifreLabel.setForeground (Color.blue);
JTextField kullaniciAdiField = Yeni JTextField (20);
kullaniciAdiField.setBackground (Color.orange);
kullaniciAdiField.setForeground (Color.blue);
JTextField sifreField = Yeni JTextField (20);
sifreField.setBackground (Color.orange);
sifreField.setForeground (Color.blue);
JButton girisButton = new JButton ("Giriş");
JButton cikisButton = new JButton ("çıkış");
ImageIcon simgesi = new ImageIcon ("images / giris-32.png");
girisButton.setIcon (simge);
ImageIcon icon2 = new ImageIcon ("images / cikis-32.png");
cikisButton.setIcon (icon2);
panel.add (kullaniciAdiLabel);
panel.add (kullaniciAdiField);
panel.add (sifreLabel);
panel.add (sifreField);
panel.add (girisButton);
panel.add (cikisButton);
girisButton.addActionListener (yeni actionPerformed () {
Override
public void actionPerformed (ActionEvent arg0) {
Eğer (kullaniciAdi.equals (kullaniciAdiField.getText ())
&&
sifre.equals (sifreField.getText ())) {
Yeni SatisİslemleriGui ();
}
else {
JOptionPane.showMessageDialog (boş, "Hatalı Şifre");
} }
});
cikisButton.addActionListener (yeni actionPerformed () {
Override
public void actionPerformed (ActionEvent arg0) {
) (elden;
}
});
paneli dönmek;
}
}

Hiç yorum yok:
Yorum Gönder