ece 462 object-oriented programming using c++ and java ... · yhl graphical user interface 1 ece...
TRANSCRIPT
![Page 1: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/1.jpg)
YHL Graphical User Interface 1
ECE 462Object-Oriented Programming
using C++ and Java
Graphical User Interface
Yung-Hsiang [email protected]
![Page 2: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/2.jpg)
YHL Graphical User Interface 2
GUI using C++ / Qt
![Page 3: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/3.jpg)
YHL Graphical User Interface 3
Qt + Eclipse
![Page 4: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/4.jpg)
YHL Graphical User Interface 4
![Page 5: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/5.jpg)
YHL Graphical User Interface 5
![Page 6: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/6.jpg)
YHL Graphical User Interface 6
![Page 7: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/7.jpg)
YHL Graphical User Interface 7
![Page 8: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/8.jpg)
YHL Graphical User Interface 8
![Page 9: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/9.jpg)
YHL Graphical User Interface 9
![Page 10: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/10.jpg)
YHL Graphical User Interface 10
![Page 11: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/11.jpg)
YHL Graphical User Interface 11
![Page 12: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/12.jpg)
YHL Graphical User Interface 12
![Page 13: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/13.jpg)
YHL Graphical User Interface 13
![Page 14: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/14.jpg)
YHL Graphical User Interface 14
Path Setting (if there are problems)
![Page 15: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/15.jpg)
YHL Graphical User Interface 15
![Page 16: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/16.jpg)
YHL Graphical User Interface 16
![Page 17: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/17.jpg)
YHL Graphical User Interface 17
![Page 18: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/18.jpg)
YHL Graphical User Interface 18
Qt\bin and MinGW\bin should be in the path
![Page 19: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/19.jpg)
YHL Graphical User Interface 19
![Page 20: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/20.jpg)
YHL Graphical User Interface 20
![Page 21: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/21.jpg)
YHL Graphical User Interface 21
![Page 22: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/22.jpg)
YHL Graphical User Interface 22
![Page 23: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/23.jpg)
YHL Graphical User Interface 23
Qt Widget Box
![Page 24: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/24.jpg)
YHL Graphical User Interface 24
![Page 25: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/25.jpg)
YHL Graphical User Interface 25
![Page 26: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/26.jpg)
YHL Graphical User Interface 26
![Page 27: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/27.jpg)
YHL Graphical User Interface 27
![Page 28: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/28.jpg)
YHL Graphical User Interface 28
![Page 29: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/29.jpg)
YHL Graphical User Interface 29
![Page 30: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/30.jpg)
YHL Graphical User Interface 30
![Page 31: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/31.jpg)
YHL Graphical User Interface 31
![Page 32: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/32.jpg)
YHL Graphical User Interface 32
![Page 33: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/33.jpg)
YHL Graphical User Interface 33
![Page 34: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/34.jpg)
YHL Graphical User Interface 34
![Page 35: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/35.jpg)
YHL Graphical User Interface 35
Signals and Slots
i.e. events and handlers
![Page 36: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/36.jpg)
YHL Graphical User Interface 36
![Page 37: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/37.jpg)
YHL Graphical User Interface 37
![Page 38: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/38.jpg)
YHL Graphical User Interface 38
![Page 39: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/39.jpg)
YHL Graphical User Interface 39
![Page 40: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/40.jpg)
YHL Graphical User Interface 40
![Page 41: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/41.jpg)
YHL Graphical User Interface 41
![Page 42: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/42.jpg)
YHL Graphical User Interface 42
![Page 43: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/43.jpg)
YHL Graphical User Interface 43
![Page 44: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/44.jpg)
YHL Graphical User Interface 44
![Page 45: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/45.jpg)
YHL Graphical User Interface 45
![Page 46: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/46.jpg)
YHL Graphical User Interface 46
![Page 47: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/47.jpg)
YHL Graphical User Interface 47
![Page 48: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/48.jpg)
YHL Graphical User Interface 48
![Page 49: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/49.jpg)
YHL Graphical User Interface 49
![Page 50: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/50.jpg)
YHL Graphical User Interface 50
![Page 51: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/51.jpg)
YHL Graphical User Interface 51
![Page 52: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/52.jpg)
YHL Graphical User Interface 52
![Page 53: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/53.jpg)
YHL Graphical User Interface 53
![Page 54: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/54.jpg)
YHL Graphical User Interface 54
![Page 55: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/55.jpg)
YHL Graphical User Interface 55
Default Parameter Values
![Page 56: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/56.jpg)
YHL Graphical User Interface 56
Default Parameter Values in C++
• always start from the last parameterfunc1(int x, int y, int z = 0) ...func1(int x, int y = 1, int z = 0) ...func1(int x = 2, int y = 1, int z = 0) ...⇒ func1(1,2,3) means x = 1, y = 2, z = 3⇒ func1(4, 5) means x = 4, y = 5, z = 0⇒ func1(6) means x = 6, y = 1, z = 0⇒ func1() means x = 2, y = 1, z = 0
• cannot skip any parameter (otherwise, ambiguous)func1(int x = 2, int y, int z = 0) ...⇒ what does func1(3, 4) mean?
![Page 57: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/57.jpg)
YHL Graphical User Interface 57
Graphical User Interface (GUI)
• Most GUIs are built using OOP because OOP is a natural way to support GUI.
• GUI has "containers", such as QWidget, that can include buttons, labels, scrollbars ...
• When the widget is redrawn (restore from minimized, maximized, or content update), the frame asks each component to redraw itself.
• Each object knows how to redraw itself because paintEvent(C++ / Qt) or paintComponent (Java) is overridden.
![Page 58: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/58.jpg)
YHL Graphical User Interface 58
GUI using Java
![Page 59: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/59.jpg)
YHL Graphical User Interface 59
JFrame is a derived class of Container
![Page 60: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/60.jpg)
YHL Graphical User Interface 60
![Page 61: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/61.jpg)
YHL Graphical User Interface 61
many derived classes
![Page 62: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/62.jpg)
YHL Graphical User Interface 62
Derived classesoverride paintComponent
![Page 63: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/63.jpg)
YHL Graphical User Interface 63
JFrame
similar to QWidget
![Page 64: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/64.jpg)
YHL Graphical User Interface 64
A frame may contain many objects,such as buttons, labels, scrollbar ...
add componentsfrom the palette
![Page 65: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/65.jpg)
YHL Graphical User Interface 65
The objects are contained in the NewJFrame class
![Page 66: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/66.jpg)
YHL Graphical User Interface 66
The objects are created by using new.Netbeans creates initComponent.Do not modify it.
![Page 67: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/67.jpg)
YHL Graphical User Interface 67
Handle User Actions
![Page 68: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/68.jpg)
YHL Graphical User Interface 68
Handle Button Click
EventsAction
Action Performed
![Page 69: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/69.jpg)
YHL Graphical User Interface 69
![Page 70: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/70.jpg)
YHL Graphical User Interface 70
![Page 71: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/71.jpg)
YHL Graphical User Interface 71
Handle Scrollbar Events
EventsChange
State Changed
![Page 72: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/72.jpg)
YHL Graphical User Interface 72
![Page 73: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/73.jpg)
YHL Graphical User Interface 73
![Page 74: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/74.jpg)
YHL Graphical User Interface 74
![Page 75: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/75.jpg)
YHL Graphical User Interface 75
![Page 76: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/76.jpg)
YHL Graphical User Interface 76
JSlider default range is 0 - 100
![Page 77: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/77.jpg)
YHL Graphical User Interface 77
Handle Mouse Motion
EventsMouse MotionMouseMoved
![Page 78: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/78.jpg)
YHL Graphical User Interface 78
![Page 79: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/79.jpg)
YHL Graphical User Interface 79
![Page 80: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/80.jpg)
YHL Graphical User Interface 80
Self Test
![Page 81: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/81.jpg)
YHL Qt Signals and Slots 1
ECE 462Object-Oriented Programming
using C++ and Java
Qt Signals and Slots
Yung-Hsiang [email protected]
![Page 82: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/82.jpg)
YHL Qt Signals and Slots 2
Write Qt Programs without Eclipse(still Eclipse for version control)
A better way to know how it works.
Many examples are obtained by modified Qt samples. Copyright Trolltech.
![Page 83: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/83.jpg)
YHL Qt Signals and Slots 3
Qt Examples
![Page 84: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/84.jpg)
YHL Qt Signals and Slots 4
![Page 85: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/85.jpg)
YHL Qt Signals and Slots 5
![Page 86: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/86.jpg)
YHL Qt Signals and Slots 6
![Page 87: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/87.jpg)
YHL Qt Signals and Slots 7
Simple ExampleVertical Layout
![Page 88: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/88.jpg)
YHL Qt Signals and Slots 8
![Page 89: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/89.jpg)
YHL Qt Signals and Slots 9
![Page 90: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/90.jpg)
YHL Qt Signals and Slots 10
![Page 91: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/91.jpg)
YHL Qt Signals and Slots 11
![Page 92: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/92.jpg)
YHL Qt Signals and Slots 12
Create Qt Executable
1. qmake -project2. qmake3. make
• This works for both Linux and Windows.
![Page 93: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/93.jpg)
YHL Qt Signals and Slots 13
![Page 94: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/94.jpg)
YHL Qt Signals and Slots 14
![Page 95: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/95.jpg)
YHL Qt Signals and Slots 15
![Page 96: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/96.jpg)
YHL Qt Signals and Slots 16
![Page 97: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/97.jpg)
YHL Qt Signals and Slots 17
![Page 98: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/98.jpg)
YHL Qt Signals and Slots 18
derived class of QWidget
macro to enable signals and slots
default value of the parent widget
![Page 99: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/99.jpg)
YHL Qt Signals and Slots 19
this includes many Qt classes
window's title vertical layout
add a button
add a label
add a slider
![Page 100: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/100.jpg)
YHL Qt Signals and Slots 20
GUI and OOP
vbox->addWidget(button1);vbox->addWidget(label1);vbox->addWidget(edit1);vbox->addWidget(slider1);
• These are objects of different classes.• These classes are derived class of QWidget.• If a function requires an object of QWidget, the function
can be called with an object of QLabel.• Any QLabel object is also a QWidget object (wrong in
the other direction).
![Page 101: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/101.jpg)
YHL Qt Signals and Slots 21
![Page 102: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/102.jpg)
YHL Qt Signals and Slots 22
![Page 103: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/103.jpg)
YHL Qt Signals and Slots 23
![Page 104: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/104.jpg)
YHL Qt Signals and Slots 24
![Page 105: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/105.jpg)
YHL Qt Signals and Slots 25
QPushButton, QLineEdit, and QSlider all inherit QWidget
![Page 106: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/106.jpg)
YHL Qt Signals and Slots 26
![Page 107: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/107.jpg)
YHL Qt Signals and Slots 27
![Page 108: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/108.jpg)
YHL Qt Signals and Slots 28
![Page 109: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/109.jpg)
YHL Qt Signals and Slots 29
![Page 110: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/110.jpg)
YHL Qt Signals and Slots 30
![Page 111: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/111.jpg)
YHL Qt Signals and Slots 31
Now, you should understand why GUI is often built with OOP.
![Page 112: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/112.jpg)
YHL Qt Signals and Slots 32
Eclipse + Emacs
use the version control in Eclipseedit code using Emacs
![Page 113: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/113.jpg)
YHL Qt Signals and Slots 33
![Page 114: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/114.jpg)
YHL Qt Signals and Slots 34
![Page 115: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/115.jpg)
YHL Qt Signals and Slots 35
not the defaultworkspace
![Page 116: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/116.jpg)
YHL Qt Signals and Slots 36
do not build automatically
![Page 117: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/117.jpg)
YHL Qt Signals and Slots 37
![Page 118: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/118.jpg)
YHL Qt Signals and Slots 38
![Page 119: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/119.jpg)
YHL Qt Signals and Slots 39
![Page 120: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/120.jpg)
YHL Qt Signals and Slots 40
do not commit Makefile
![Page 121: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/121.jpg)
YHL Qt Signals and Slots 41
Add Slots and Connect Signals
![Page 122: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/122.jpg)
YHL Qt Signals and Slots 42
add private functions (slots)
CVS version numbershown in emacs
make the objects attributesbecause they are used inmultiple functions
![Page 123: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/123.jpg)
YHL Qt Signals and Slots 43
objects
![Page 124: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/124.jpg)
YHL Qt Signals and Slots 44
![Page 125: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/125.jpg)
YHL Qt Signals and Slots 45
![Page 126: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/126.jpg)
YHL Qt Signals and Slots 46
![Page 127: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/127.jpg)
YHL Qt Signals and Slots 47
![Page 128: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/128.jpg)
YHL Qt Signals and Slots 48
![Page 129: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/129.jpg)
YHL Qt Signals and Slots 49
![Page 130: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/130.jpg)
YHL Qt Signals and Slots 50
![Page 131: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/131.jpg)
YHL Qt Signals and Slots 51
![Page 132: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/132.jpg)
YHL Qt Signals and Slots 52
Draw Geometric Shapes
![Page 133: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/133.jpg)
YHL Qt Signals and Slots 53
new object
![Page 134: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/134.jpg)
YHL Qt Signals and Slots 54
new object
![Page 135: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/135.jpg)
YHL Qt Signals and Slots 55
![Page 136: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/136.jpg)
YHL Qt Signals and Slots 56
![Page 137: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/137.jpg)
YHL Qt Signals and Slots 57
draw rectangle
![Page 138: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/138.jpg)
YHL Qt Signals and Slots 58
draw circle
![Page 139: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/139.jpg)
YHL Qt Signals and Slots 59
draw text
![Page 140: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/140.jpg)
YHL Qt Signals and Slots 60
![Page 141: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/141.jpg)
YHL Qt Signals and Slots 61
Handle Mouse Event
![Page 142: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/142.jpg)
YHL Qt Signals and Slots 62
called when mouse movesdoes not have to use connect function
![Page 143: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/143.jpg)
YHL Qt Signals and Slots 63
![Page 144: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/144.jpg)
YHL Qt Signals and Slots 64
![Page 145: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/145.jpg)
YHL Qt Signals and Slots 65
Collision Detection
![Page 146: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/146.jpg)
YHL Qt Signals and Slots 66
detect collisionwith the boundary(static values)
![Page 147: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/147.jpg)
YHL Qt Signals and Slots 67
Timer Update
![Page 148: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/148.jpg)
YHL Qt Signals and Slots 68
![Page 149: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/149.jpg)
YHL Qt Signals and Slots 69
![Page 150: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/150.jpg)
YHL Qt Signals and Slots 70
Memory Management
What is created by new should be destroyed by delete.
![Page 151: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/151.jpg)
YHL Qt Signals and Slots 71
![Page 152: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/152.jpg)
YHL Qt Signals and Slots 72
![Page 153: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/153.jpg)
YHL Qt Signals and Slots 73
Qt and Valgrind
Valgrind and Qt do not work well together.
Fortunately, we can follow a simple rule for memory management.
![Page 154: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/154.jpg)
YHL Qt Signals and Slots 74
Delete every object that is created by new.
![Page 155: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/155.jpg)
YHL Qt Signals and Slots 75
Self Test
![Page 156: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/156.jpg)
YHL Java Events and Handlers 1
ECE 462Object-Oriented Programming
using C++ and Java
Java Events and Handlers
Yung-Hsiang [email protected]
![Page 157: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/157.jpg)
YHL Java Events and Handlers 2
![Page 158: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/158.jpg)
YHL Java Events and Handlers 3
![Page 159: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/159.jpg)
YHL Java Events and Handlers 4
![Page 160: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/160.jpg)
YHL Java Events and Handlers 5
![Page 161: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/161.jpg)
YHL Java Events and Handlers 6
![Page 162: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/162.jpg)
YHL Java Events and Handlers 7
add one button and two labels
![Page 163: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/163.jpg)
YHL Java Events and Handlers 8
change the text
![Page 164: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/164.jpg)
YHL Java Events and Handlers 9
Add a Derived Class of JPanel
![Page 165: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/165.jpg)
YHL Java Events and Handlers 10
![Page 166: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/166.jpg)
YHL Java Events and Handlers 11
![Page 167: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/167.jpg)
YHL Java Events and Handlers 12
![Page 168: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/168.jpg)
YHL Java Events and Handlers 13
![Page 169: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/169.jpg)
YHL Java Events and Handlers 14
Handle Mouse Event
![Page 170: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/170.jpg)
YHL Java Events and Handlers 15
![Page 171: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/171.jpg)
YHL Java Events and Handlers 16
![Page 172: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/172.jpg)
YHL Java Events and Handlers 17
![Page 173: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/173.jpg)
YHL Java Events and Handlers 18
![Page 174: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/174.jpg)
YHL Java Events and Handlers 19
![Page 175: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/175.jpg)
YHL Java Events and Handlers 20
![Page 176: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/176.jpg)
YHL Java Events and Handlers 21
![Page 177: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/177.jpg)
YHL Java Events and Handlers 22
![Page 178: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/178.jpg)
YHL Java Events and Handlers 23
![Page 179: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/179.jpg)
YHL Java Events and Handlers 24
![Page 180: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/180.jpg)
YHL Java Events and Handlers 25
Shrink the Panel
![Page 181: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/181.jpg)
YHL Java Events and Handlers 26
![Page 182: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/182.jpg)
YHL Java Events and Handlers 27
![Page 183: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/183.jpg)
YHL Java Events and Handlers 28
![Page 184: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/184.jpg)
YHL Java Events and Handlers 29
Add Timer
![Page 185: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/185.jpg)
YHL Java Events and Handlers 30
![Page 186: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/186.jpg)
YHL Java Events and Handlers 31
![Page 187: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/187.jpg)
YHL Java Events and Handlers 32
![Page 188: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/188.jpg)
YHL Java Events and Handlers 33
Format String
![Page 189: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/189.jpg)
YHL Java Events and Handlers 34
![Page 190: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/190.jpg)
YHL Java Events and Handlers 35
![Page 191: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/191.jpg)
YHL Java Events and Handlers 36
Start and Pause
![Page 192: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/192.jpg)
YHL Java Events and Handlers 37
![Page 193: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/193.jpg)
YHL Java Events and Handlers 38
![Page 194: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/194.jpg)
YHL Java Events and Handlers 39
![Page 195: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/195.jpg)
YHL Java Events and Handlers 40
Add JPanel to Contain Button and Labels
![Page 196: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/196.jpg)
YHL Java Events and Handlers 41
![Page 197: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/197.jpg)
YHL Java Events and Handlers 42
![Page 198: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/198.jpg)
YHL Java Events and Handlers 43
Self Test
![Page 199: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/199.jpg)
YHL Array 1
ECE 462Object-Oriented Programming
using C++ and Java
Array
Yung-Hsiang [email protected]
![Page 200: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/200.jpg)
YHL Array 2
Array
Java
int [] dataArray = new int[4];dataArray[2] = 7;// Java uses garbage collection// start from [0]User [] usrList = new User[10];// int dataarray[8] ⇒ error// Java arrays know their lengthsdataArray.length;
C++
int * dataArray = new int[4];dataArray[2] = 7;delete [] dataArray; // use []// sameUser * usrList = new User[10];int dataArray[8];// not for C++
![Page 201: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/201.jpg)
YHL Array 3
Java Array
![Page 202: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/202.jpg)
YHL Array 4
Array of int
![Page 203: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/203.jpg)
YHL Array 5
![Page 204: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/204.jpg)
YHL Array 6
Array of Objects
![Page 205: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/205.jpg)
YHL Array 7
![Page 206: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/206.jpg)
YHL Array 8
![Page 207: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/207.jpg)
YHL Array 9
Person [] personArray = new Person[8];
personArray[index] = new Person (...)Peter, 5
personArray[index] = new Person (...)Lisa, 12
![Page 208: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/208.jpg)
YHL Array 10
C++ Array
![Page 209: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/209.jpg)
YHL Array 11
Array of int
![Page 210: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/210.jpg)
YHL Array 12
![Page 211: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/211.jpg)
YHL Array 13
Array of Objects
![Page 212: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/212.jpg)
YHL Array 14
![Page 213: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/213.jpg)
YHL Array 15
![Page 214: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/214.jpg)
YHL Array 16
![Page 215: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/215.jpg)
YHL Array 17
![Page 216: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/216.jpg)
YHL Array 18
Person * * personArray = new Person* [arraySize];
personArray[index] = new Person (...)Peter, 5
personArray[index] = new Person (...)Lisa, 12
![Page 217: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/217.jpg)
YHL Array 19
Objects Contain Arrays
![Page 218: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/218.jpg)
YHL Array 20
Java
![Page 219: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/219.jpg)
YHL Array 21
![Page 220: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/220.jpg)
YHL Array 22
![Page 221: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/221.jpg)
YHL Array 23
C++
![Page 222: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/222.jpg)
YHL Array 24
need another attribute to store the number of elements in the array
![Page 223: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/223.jpg)
YHL Array 25
![Page 224: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/224.jpg)
YHL Array 26
![Page 225: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/225.jpg)
YHL Array 27
delete without [] (because it is not an array)
![Page 226: ECE 462 Object-Oriented Programming using C++ and Java ... · YHL Graphical User Interface 1 ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang](https://reader035.vdocuments.site/reader035/viewer/2022062506/5f01bd107e708231d400ccc3/html5/thumbnails/226.jpg)
YHL Array 28
Self Test