JaVa
   

List of Listings

Multiple Classes

Code Listing 4-1: Alien.java
Code Listing 4-2: Universe.java
Code Listing 4-3: MainApp.java
Code Listing 4-4: Creatures.java
Code Listing 4-5: Alien.java
Code Listing 4-6: Human.java
Code Listing 4-7: Beings.java

Packages, Utilities, and Error Handling

Code Listing 5-1: Addition.java
Code Listing 5-2: Subtraction.java
Code Listing 5-3: compile.bat
Code Listing 5-4: The test app (TestApp.java)
Code Listing 5-5: MyApp.java
Code Listing 5-6: MyApplet.java
Code Listing 5-7: view.html
Code Listing 5-8: ArrayListExample.java
Code Listing 5-9: ArrayListSearchRemove.java
Code Listing 5-10: LinkedListExample.java
Code Listing 5-11: StackExample.java
Code Listing 5-12: BrokenArray.java
Code Listing 5-13: BrokenArrayHandled.java
Code Listing 5-14: BrokenArrayThrow.java
Code Listing 5-15: MyException.java
Code Listing 5-16: TestApp.java
Code Listing 5-17: TestApp.java

Stream I/O

Code Listing 6-1: Console input
Code Listing 6-2: Tic-tac-toe example
Code Listing 6-3: Writing data to a file
Code Listing 6-4: Reading data from a file
Code Listing 6-5: The PlayerData class
Code Listing 6-6: Object serialization

Threads

Code Listing 7-1: SimpleThread1.java
Code Listing 7-2: SimpleThread2.java
Code Listing 7-3: StoppingThread.java
Code Listing 7-4: Countdown.java
Code Listing 7-5: DaemonThread.java

apps and Applets

Code Listing 8-1: Simple app (extending a JFrame)
Code Listing 8-2: Simple app (JFrame as a member)
Code Listing 8-3: Simple applet
Code Listing 8-4: view.html (used to view the applet)
Code Listing 8-5: view.html
Code Listing 8-6: AppletParam.java
Code Listing 8-7: Look and feel example

Graphics

Code Listing 9-1: TemplateGraphicsapp.java
Code Listing 9-2: TemplateGraphicsApplet.java
Code Listing 9-3: DrawingShapes.java
Code Listing 9-4: AffinedTransformer.java
Code Listing 9-5: UsingFonts.java
Code Listing 9-6: OffScreenSprite.java
Code Listing 9-7: TransparentSprite.java
Code Listing 9-8: BlendingTest.java
Code Listing 9-9: RandomImage.java
Code Listing 9-10: TrackerImageLoadingapp.java
Code Listing 9-11: TrackerImageLoadingApplet.java
Code Listing 9-12: ImageIOLoadingapp.java
Code Listing 9-13: PassiveRendering.java
Code Listing 9-14: ActiveRendering.java
Code Listing 9-15: ActiveRenderingApplet.java
Code Listing 9-16: ActivelyPassiveRenderingRepaints.java
Code Listing 9-17: VolatileImageRendering.java
Code Listing 9-18: FullScreenDemo.java

Using the Mouse and Keyboard

Code Listing 10-1: SimpleMouse.java
Code Listing 10-2: MouseProcessable
Code Listing 10-3: MouseProcessor
Code Listing 10-4: AdvancedMouse.java
Code Listing 10-5: KeyProcessable
Code Listing 10-6: KeyProcessor
Code Listing 10-7: Animator
Code Listing 10-8: AdvancedKeyboard.java
Code Listing 10-9: EventProcessable
Code Listing 10-10: EventProcessor
Code Listing 10-11: Animator.java
Code Listing 10-12: EventAndFocusHandling.java

Using Sound and Music

Code Listing 11-1: Loading and playing a sound in an applet
Code Listing 11-2: HTML for viewing the applet
Code Listing 11-3: Loading and playing a sound in an app
Code Listing 11-4: Playing samples in the Java Sound API
Code Listing 11-5: Streaming audio
Code Listing 11-6: Playing MIDI music with the Java Sound API
Code Listing 11-7: The sound manager
Code Listing 11-8: Sound manager example app

Game Programming Techniques

Code Listing 12-1: AnimatedNumbers.java
Code Listing 12-2: StickWalker.java
Code Listing 12-3: HiresTimeExample
Listing 12-4: Bounding circle example
Listing 12-5: Bounding box example
Code Listing 12-6: TemplateScreen.java
Code Listing 12-7: Globals.java
Code Listing 12-8: SampleScreen.java
Code Listing 12-9: Keyboard.java
Code Listing 12-10: Mouse.java
Code Listing 12-11: GameFramework.java
Code Listing 12-12: DemoScreen1.java
Code Listing 12-13: DemoScreen2.java
Code Listing 12-14: DemoScreen3.java
Code Listing 12-15: PauseScreen.java
Listing 12-16: Tile Scroller example (works with the framework)
Code Listing 12-17: Tile Walker example (works with the framework)

Introduction to GUI

Code Listing 13-1: Using the JButton object
Code Listing 13-2: Using the JTextField
Code Listing 13-3: Using the JButton object
Code Listing 13-4: The GUIComponent class
Code Listing 13-5: The GUIContainer class
Code Listing 13-6: The GUISystem class
Code Listing 13-7: The GUIButton class
Code Listing 13-8: Using the custom GUI system

Using the JDBC

Code Listing 16-1: Connecting to a database
Code Listing 16-2: Inserting data into a table from Java
Code Listing 16-3: Retrieving data from a table into Java
Code Listing 16-4: The skeleton app frame
Code Listing 16-5: The skeleton app frame with GUI objects
Code Listing 16-6: The TableHandler class
Code Listing 16-7: The final Highscore class
Code Listing 16-8: Accessing database metadata
Code Listing 16-9: Using prepared statements

Introduction to Networking

Code Listing 17-1: TCP echo server
Code Listing 17-2: TCP echo client
Code Listing 17-3: UDP echo server
Code Listing 17-4: UDP echo client
Code Listing 17-5: SampleServer.java
Code Listing 17-6: ClientHandler.java
Code Listing 17-7: Player.java
Code Listing 17-8: Protocol.java
Code Listing 17-9: NetworkEvent.java
Code Listing 17-10: NetworkListener.java
Code Listing 17-11: NetworkHandler.java
Code Listing 17-12: SampleClient.java

Introduction to NIO Networking

Code Listing 18-1: ByteBufferExample.java
Code Listing 18-2: BlockingServer.java
Code Listing 18-3: BlockingClient.java
Code Listing 18-4: NonBlockingServer.java
Code Listing 18-5: NonBlockingClient.java

Bonus Chapter: A Tour of the Swing GUI

Code Listing 1: Using the JLabel
Code Listing 2: Using the JButton object
Code Listing 3: Using the JButton object
Code Listing 4: Using the JTextField
Code Listing 5: Using the JPasswordField
Code Listing 6: Using the JTextArea
Code Listing 7: Adding in a JTextArea to a JScrollPane
Code Listing 8: Using the JComboBox
Code Listing 9: Using the JCheckBox
Code Listing 10: Creating image check boxes
Code Listing 11: Using the JRadioButton
Code Listing 12: Image radio buttons
Code Listing 13: Using the JProgressBar
Code Listing 14: Using the JList
Code Listing 15: Implementing a scrollable JList
Code Listing 16: Using the JTable
Code Listing 17: Using the JTree
Code Listing 18: Using the JEditorPane to load HTML
Code Listing 19: Using the JOptionPane
Code Listing 20: Using the JMenu
Code Listing 21: Using tool tips
JaVa
   
Comments