Modul 3

Posted: Oktober 27, 2010 in Praktikum Java II

TUGAS PRAKTIKUM
JAVA II

Hasan Fadli
123090089
PLUG 8

Asisten : Shiddieqy Y. Katili

 

TEKNIK INFORMATIKA
FAKULTAS TEKNOLOGI INDUSTRI
UNIVERSITAS PEMBANGUNAN NASIONAL “VETERAN” YOGYAKARTA
2010

TUGAS


Listing Program


import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

class properties extends JFrame implements ActionListener{

JLabel Lusername = new JLabel(“Username”);

JLabel Lpassword = new JLabel(“Password”);

JPasswordField Ppassword = new JPasswordField(20);

JTextField Tusername = new JTextField(20);

JButton bOk = new JButton(“Ok”);

JButton bCancel = new JButton(“Cancel”);

public properties( String Judul ){

add(Lusername);

add(Tusername);

add(Lpassword);

add(Ppassword);

add(bOk);

add(bCancel);

setVisible(true);

setSize(350, 150);

setLayout(null);

setDefaultCloseOperation(3);

setTitle(Judul);

setLayout(new FlowLayout());

bOk.addActionListener(this);

bCancel.addActionListener(this);

}

public void actionPerformed(ActionEvent ae) {

if(ae.getSource() == bOk) {

if(Tusername.getText().equals(“123090089”)&&Ppassword.getText().equals(“java2”))

JOptionPane.showMessageDialog(this, “Login Success\n” +

“”, “message”,

JOptionPane.INFORMATION_MESSAGE);

else

JOptionPane.showMessageDialog(this, “Login Failed\n” +

“Please, Try Again!”, “message”,

JOptionPane.INFORMATION_MESSAGE);

Tusername.setText(“”);

Ppassword.setText(“”);

}

if(ae.getSource()==bCancel){

System.exit(0);

}

}

}

public class Login {

public static void main(String[] args) {

properties p = new properties(“Login”);

}

}

PrintScreen Output


Tampilan awal :

Tampilan jika di input :

Tampilan jika di klick OK (UserName dan Password benar) :

Tampilan jika di klick OK (UserName dan Password salah) :

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s