Professional Documents
Culture Documents
Uploading Instructions: A Source Code
Uploading Instructions: A Source Code
Uploading Instructions: A Source Code
02
Fall 2014
CS506- Web Design and Development
Total Marks: 20
Due Date:10/12/14
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit if:
o
o
o
o
o
Uploading instructions
You have to upload only a source code file with (.java) extension. Assignment in any other format
(extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in
.doc (Word document) or .txt files or .exe file, no reward will be given in any case.
Note: Use Notepad or Notepad++ , or NetBeans for coding and JDK package for java source code compilation
and running (A video tutorial of JDK installation and configuration is given in course download section)
Objective
The objective of this assignment is
o To understanding of User Graphical Interface, layout mangers, frames and Event Handling concepts in
java programs.
Problem Statement:
You are required to write a java program which handles the MouseEvent by implementing MouseListener
interface.
Detailed Description:
Develop a GUI component and set the layout using FlowLayout manger. The program should have two text
fields used for displaying your name and VUID as a default text. There should also be two labels in your GUI.
Following four controls should be used in your GUI application.
Following is the behavior of your GUI Application which handles the Mouse Events program.
When mouse enter the boundary of frame window default text should be appeared in the
respective textfields i.e. your name and VUID
When mouse exit the boundary of frame window default text should be removed from the text
fields, it sets empty.
For this your class has to implement the MouseListener interface, MouseListener interface has following five
abstract methods.
public interface MouseListener {
public void mousePressed (MouseEvent me);
public void mouseClicked (MouseEvent me);
public void mouseReleased (MouseEvent me);
public void mouseEntered (MouseEvent me);
public void mouseExited (MouseEvent me);
}
But your class will implement the logic in last two methods,
public void mouseEntered (MouseEvent me);
You will write the logic in above method when mouse enter the frame window i.e. setting of text in respective
text fields
public void mouseExited (MouseEvent me);
You will write the logic in above method when mouse leaves the frame window i.e. clearing of text in respective
text fields
Remaining methods will have an empty body.
Sample Output:
Mouse enter the boundary of frame window