Presentation is loading. Please wait.

Presentation is loading. Please wait.

Final project.

Similar presentations


Presentation on theme: "Final project."— Presentation transcript:

1 Final project

2 Design your own user interface, but the project has to include the following components and event handlers JFrame JPanel JButton JCheckBox JTextField JMenuBar, JMenu, JMenuItem Either ActionListener, ItemListener or MouseListener

3 Remarks Make the GUI pleasant-looking, clear and clean.
DO NOT COPY from anywhere or anybody. Do your own work.

4 example

5 ItemListener Refer to the slide slide06-0moreGUI

6 MouseListener Done on the class level 5 methods have to be implemented
public class <ClassName> implements MouseListner{.. 5 methods have to be implemented public void mousePressed(MouseEvent evt); public void mouseReleased(MouseEvent evt); public void mouseClicked(MouseEvent evt); public void mouseEntered(MouseEvent evt); public void mouseExited(MouseEvent evt); you can leave the body of a method empty if you don’t want to implement the method.

7 MouseListener Done on the component’s level
Still need to implement all 5 methods, leave the body of a method empty if you don’t want to implement the method Next slide show how it is done

8 txtLog.addMouseListener(new MouseListener() {
public void mouseEntered(java.awt.event.MouseEvent evt) { System.out.println("mouse entered”); } public void mouseExited(java.awt.event.MouseEvent evt) { System.out.println("mouse exit..“); } public void mouseClicked(MouseEvent evt){ System.out.println("mouse clicked”); } public void mouseReleased(MouseEvent evt){ System.out.println("mouse released”); } public void mousePressed(MouseEvent evt){ System.out.println(“mouse pressed..“); float hue = (float)Math.random(); txtLog.setBackground( Color.getHSBColor(hue, 1.0F, 1.0F) ); }


Download ppt "Final project."

Similar presentations


Ads by Google