Chapter 16: Creating Windows

slimwhimperΛογισμικό & κατασκευή λογ/κού

3 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

61 εμφανίσεις

1

Chapter 16: Creating Windows

2

Basics of GUI Programming


How to create a Window. TryWindow.java


You always need a JFrame component before
creating a window


You can use a ToolKit object to get information
about the environment in which your program is
running or a method in the GraphicsEnvironment
class


Ex1: Using Toolkit
\
TryWindow.java


EX2: Using GraphicsEnvironment
\
TryWindow.java


Point object. Ex: PlayingPoints.java


Changing Color and Cursor. Ex: TryWindow.java

3

Basics of GUI Programming (Cont.)


Getting Information from the local graphics
environment. Ex: SysInfo.java


Swing Components: JButton, JMenu, JLabel,
JTextArea, JTextField, etc.


Layout Managers: FlowLayout. Ex
TryFlowLayout.java


Ex: TryApplet.java


BorderLayout. Ex:TryBorderLayout.java


CardLayout: Ex: TryCardLayout.java (Applet)


GridLayout: Ex: TryGridLayout.java


Creating Menus: Ex: Sketcher.java