hmmm...
lagi-lagi posting tentang programming...
tapi tak apalah...
ok kawan langsung ajj cekidot...
Note : simpan dengan nama "login.java" tanpa kutip .
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class login extends JFrame {
JLabel user=new JLabel("Username");
JLabel pass=new JLabel("Password");
JTextField tuser=new JTextField();
String z="storm";
JPasswordField tpass=new JPasswordField();
JButton blogin=new JButton("LOGIN");
JButton bbatal=new JButton("CANCEL");
public static void main (String [] args ){
login tampilan=new login();
tampilan.setSize(310,170);
Dimension layar=Toolkit.getDefaultToolkit().getScreenSize();
int l=(layar.width-tampilan.getSize().width)/2;
int t=(layar.height-tampilan.getSize().height)/2;
tampilan.setLocation(l,t);
tampilan.setResizable(false);
tampilan.setVisible(true);
}
String q="falcon";
public login(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().setLayout(null);
this.setTitle(".:: Please Login ::.");
user.setFont(new Font("Verdana",1,12));
user.setBounds(new Rectangle(25,20,100,20));
pass.setFont(new Font("Verdana",1,12));
pass.setBounds(new Rectangle(25,50,100,20));
tuser.setBounds(new Rectangle(110,22,140,20));
tpass.setBounds(new Rectangle(110,52,140,20));
blogin.setBounds(new Rectangle(60,92,80,20));
blogin.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent ae){
tlogin();
}
});
bbatal.setBounds(new Rectangle(160,92,80,20));
bbatal.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
batal();
}
});
this.getContentPane().add(user,null);
this.getContentPane().add(pass,null);
this.getContentPane().add(tuser,null);
this.getContentPane().add(tpass,null);
this.getContentPane().add(blogin,null);
this.getContentPane().add(bbatal,null);
}
public void batal(){
System.exit(0);
}
public void tlogin(){
String u=z;
String p=q;
if(tuser.getText().equals(p)&&tpass.getText().equals(u))
{
JOptionPane.showMessageDialog(null,"Welcome to eaglecyber system");
System.exit(0);
}
else{
JOptionPane.showMessageDialog(null,"Incorect Username and Password");
tpass.setText("");
tuser.setText("");
}
}
}
terima kasih...
semoga bermanfaat...
9 komentar:
boleh-boleh, manteb nih sourcenya..
lebih keren lagi klo dihubungkan dengan database, hehe...
thx for sharing...
# Movie downloadzz : wah makasih saranya ...lain kali akan saya coba tuh ...
masih newbee soalnya..
hehhehe
wah coding yang keren. kapan2 di coba akh
silahkan dicoba gan....
semoga bermanfaat...
Mantaaap sob ,
thanks atas infonya
banner anda sudah syapasang dan follow , follow back yah !!
# imam77 : sama2 sob...
ok nanti saya follow balik...
how to get username n password?
Mantap bro, tolong donk di hubungkn dg data base...
(y)
bagus tutorialnya.. nice share.. :)
Posting Komentar