Minggu, 03 Juli 2011

How to import java.awt.event

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code = "Assign" width = "500" height = "300">
</applet>
*/

public class Assign extends Applet implements ActionListener
{
Button b1;
Button b2;
List l1;
List l2;
String str = "";
String msg = "";
Font f1;
public void init()
{
setBackground(Color.BLACK);
setForeground(Color.RED);
f1 = new Font("Times New Roman",Font.BOLD,20);
setFont(f1);
l1 = new List(4,false);
l2 = new List(4,false);
l1.add("DBMS");
l1.add("MIS");
l1.add("SE");
l1.add("C");
l1.add("ORACLE");
l1.add("VB");
l1.add("D.S");
l1.add("B.A");
b1 = new Button(">>");
b2 = new Button("<<");
add(l1);
add(b1);
add(b2);
add(l2);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
repaint();
}

public void paint(Graphics g)
{
msg = l1.getSelectedItem();
l2.add(msg,0);
l1.remove(msg);
}
}

Tidak ada komentar:

Posting Komentar