GUI Programming using Java

These slides refer to Java 1.0. They have been updated. For a new version see http://jan.newmarch.name/java/swingtut/tut1a.html and http://jan.newmarch.name/java/swingtut/tut1b.html . There is also a Swing tutorial http://jan.newmarch.name/java/swingtut/tut2.html .

Jan Newmarch jan@newmarch.name


Last modified: 12 February, 1998. These slides are Copyright Jan Newmarch, 1995, 1996. This tutorial discusses using the AWT (Abstract Window Toolkit) of Java to perform platform-independent GUI programming. It makes the following assumptions: Familiarity with C; Exposure to OO programming; Familiarity with a GUI library - preferably Motif. Implementation details are based in Xt/Motif. The intended audience is Xt/Motif programmers who want to see what Java programming can offer, and understand its strengths and limitations.

1. PART A: Java

2. Simple Types and Statements

3. Arrays

4. Classes

5. Methods

6. Interfaces

7. Standard Libraries

8. Addresses Example

9. Addresses (1)

10. Addresses (2)

11. Addresses (3)

12. Addresses (4)

13. Addresses (5)

14. Addresses (6)

15. Addresses (7)

16. Addresses (8)

17. Addresses (9)

18. Addresses (10)

19. PART B: GUI Library

20. Applet vs Application

21. GUI Hierarchy

22. Primitive Components

23. Container Components

24. MenuComponents

25. Layout Objects

26. Component Objects

27. Label

28. Label (2)

29. Hello World

30. Frame

31. Resources

32. Resources (2)

33. Label Resources

34. Button

35. AWT events

36. AWT Events (2)

37. AWT Constants

38. AWT Event fields

39. AWT Event Handling

40. Default AWT Event Handling

41. Application Event Handling

42. Frame overrides handleEvent()

43. Frame overrides convenience methods

44. ``Primitive'' overrides handleEvent()

45. ``Primitive'' overrides convenience methods

46. Button with event handling

47. Button with event handling (2)

48. Implementation of event handling

49. List

50. List Events

51. SelectList event handler

52. SelectList convenience handlers

53. TextComponent

54. TextField

55. TextField: Password Entry

56. TextField: Password Entry (2)

57. TextArea

58. TextArea (2)

59. FileDialog

60. FileDialog (2)

61. FileDialog Parent

62. Panel

63. AddressBook example

64. AddressBook Widget Structure

65. AddressBook methods

66. AddressBook code

67. AddressBook (2)

68. AddressBook (3)

69. AddressBook (4)

70. AddressBook (5)

71. AddressBook (6)

72. AddressBook (7)

73. AddressBook (8)

74. Geometry

75. Size Calculations

76. Geometry Calculations

77. Insets and Layout Objects

78. BorderLayout

79. BorderLayout (2)

80. BorderLayout (3)

81. FlowLayout

82. FlowLayout (2)

83. FlowLayout (3)

84. GridLayout

85. GridLayout (2)

86. GridLayout (3)

87. GridBagLayout

88. GridBagLayout: Direction of Addition

89. GridBagLayout: Direction of Addition (2)

90. GridBagLayout: Direction of Addition (3)

91. GridBagLayout: Direction of Addition (4)

92. GridBagLayout: Direction of Addition (5)

93. GridBagLayout: Direction of Addition (6)

94. GridBagLayout: Direction of Addition (7)

95. GridBagLayout: Direction of Addition (8)

96. GridBagLayout: Cell Size Requests

97. GridBagLayout: Multiple Rows

98. GridBagLayout: Multiple Rows (2)

99. GridBagLayout: Multiple Rows (3)

100. GridBagLayout: Cell Size Granting

101. Denied Request

102. Accepted Request

103. Accepted Request (2)

104. GridBaglayout: Resizing

105. GridBaglayout: Fill

106. GridBaglayout: Anchors

107. A Complex Layout

108. A Complex Layout (2)

109. CardLayout

110. CardLayout (2)

111. CardLayout (3)

112. Menus

113. MenuBar

114. Menu

115. MenuItem and CheckboxMenuItem

116. Menu Example

117. Menu selection handling

118. Dirty menu selection handling

119. Cleaner menu selection handling

120. Cleaner menu selection handling (2)

121. A complete menu

122. A complete menu (2)

123. A complete menu (3)

124. A complete menu (4)

125. Dialogs

126. About Dialog

127. About Dialog (2)

128. About Dialog (3)

129. Fonts

130. Graphics

131. PART C: ADDING COMBOBOX WIDGET

132. Java Files

133. ComboBox.java

134. ComboBox.java (2)

135. ComboBoxPeer.java

136. MComboBoxPeer.java

137. MComboBoxPeer.java (2)

138. MComboBoxPeer.java (3)

139. MComboBoxPeer.java (4)

140. MComboBoxPeer.java (5)

141. AWT Files

142. Java Compilation

143. C Files

144. Create function

145. Create function (2)

146. Create function (3)

147. Create function (4)

148. Create function (5)

149. Create function (6)

150. Callback Function

151. Callback Function (2)

152. Returning Java strings

153. getString for MComboBoxPeer

154. Action Method in Peer

155. Conclusion