Examples From Java Examples in a Nutshell, 2nd Edition

Working with the Examples

The Java examples are all defined in sub-packages of the package com.davidflanagan.examples. This means that you'll find the example source code in subdirectories of the directory com/davidflanagan/examples/

Chapter 1: Java Basics 1-1 Hello.java
1-2 FizzBuzz.java
1-3 Fibonacci.java
1-4 Echo.java
1-5 Reverse.java
1-6 FizzBuzz2.java
1-7 Factorial.java
1-8 Factorial2.java
1-9 Factorial3.java
1-10 Factorial4.java
1-11 FactComputer.java
1-12 FactQuoter.java
1-13 Rot13Input.java
1-14 SortNumbers.java
1-15 Sieve.java

Chapter 2: Objects, Classes, and Interfaces

2-1 Rect.java
2-2 RectTest.java
2-3 DrawableRect.java
2-4 ColoredRect.java
2-5 ComplexNumber.java
2-6 Randomizer.java
2-7 Averager.java
2-8 LinkedList.java
2-9 Sorter.java

Chapter 3: Input/Output

3-1 Delete.java
3-2 FileCopy.java
3-3 FileViewer.java
3-4 FileLister.java
3-5 Compress.java
3-6 RemoveHTMLReader.java
3-7 GrepReader.java
3-8 HTMLWriter.java

Chapter 4: Threads

4-1 ThreadDemo.java
4-2 ThreadLister.java
4-3 Deadlock.java
4-4 TimerTask.java
4-5 Timer.java

Chapter 5: Networking

5-1 GetURL.java
5-2 GetURLInfo.java
5-3 SendMail.java
5-4 HttpClient.java
5-5 HttpMirror.java
5-6 SimpleProxyServer.java
5-7 Who.java
5-8 GenericClient.java
5-9 Server.java
5-10 ProxyServer.java
5-11 UDPSend.java
5-12 UDPReceive.java

Chapter 6: Security and Cryptography

6-1 SafeServer.java
6-2 SafeServer.policy
6-3 SecureService.java
6-4 Manifest.java
6-5 TripleDES.java

Chapter 7: Internationalization

7-1 UnicodeDisplay.java
7-2 ConvertEncoding.java
7-3 Portfolio.java
7-4 SimpleMenu.java
7-5 LocalizedError.java

Chapter 8: Reflection

8-1 ShowClass.java
8-2 Command.java

Chapter 9: Object Serialization

9-1 Serializer.java
9-2 IntList.java
9-3 CompactIntList.java

Chapter 10: Graphical User Interfaces

10-1 ShowComponent.java
10-2 Containers.java
10-3 FlowLayoutPane.java
10-4 GridLayoutPane.java
10-5 BorderLayoutPane.java
10-6 BoxLayoutPane.java
10-7 GridBagLayoutPane.java
10-8 NullLayoutPane.java
10-9 ColumnLayout.java
10-10 ColumnLayoutPane.java
10-11 ScribblePane1.java
10-12 ScribblePane2.java
10-13 ScribblePane3.java
10-14 ScribblePane4.java
10-15 ItemChooser.java
10-16 Scribble.java
10-17 CommandAction.java
10-18 FontChooser.java
10-19 PropertyTable.java
10-20 ComponentTree.java
10-21 WebBrowser.java
10-22 GUIResourceBundle.java
10-23 ResourceParser.java
10-24 CommandParser.java
10-25 ActionParser.java
10-26 MenuBarParser.java
10-27 MenuParser.java
10-28 ThemeManager.java
10-29 AppletMenuBar.java

Chapter 11: Graphics

11-1 GraphicsSampler.java
11-2 FontList.java
11-3 ColorGradient.java
11-4 BouncingCircle.java
11-5 GraphicsExample.java
11-6 Shapes.java
11-7 Transforms.java
11-8 LineStyles.java
11-9 Stroking.java
11-10 Paints.java
11-11 AntiAlias.java
11-12 CompositeEffects.java
11-13 ImageOps.java
11-14 Spiral.java
11-15 CustomStrokes.java
11-16 GenericPaint.java
11-17 Hypnosis.java
11-18 GraphicsExampleFrame.java

Chapter 12: Printing

12-1 ScribblePrinter1.java
12-2 ScribblePrinter2.java
12-3 HardcopyWriter.java
12-4 PrintableDocument.java

Chapter 13: Data Transfer

13-1 S impleCutAndPaste.java
13-2 Scribble.java
13-3 ScribbleCutAndPaste.java
13-4 ScribbleDragAndDrop.java

Chapter 14: JavaBeans

14-1 MultiLineLabel.java
14-2 Alignment.java
14-3 YesNoPanel.java
14-4 AnswerEvent.java
14-5 AnswerListener.java
14-6 YesNoPanelBeanInfo.java
14-7 AlignmentEditor.java
14-8 YesNoPanelMessageEditor.java
14-9 YesNoPanelCustomizer.java

Chapter 15: Applets

15-1 FirstApplet.java
15-2 Clock.java
15-3 Scribble.java
15-4 EventTester.java
15-5 ColorScribble.java
15-6 Soundmap.java

Chapter 16: Remote Method Invocation

16-1 Bank.java
16-2 RemoteBankServer.java
16-3 Mud.java
16-4 MudServer.java
16-5 MudPlace.java
16-6 MudPerson.java
16-7 MudClient.java

Chapter 17: Database Access with SQL

17-1 ExecuteSQL.java
17-2 GetDBInfo.java
17-3 MakeAPIDB.java
17-4 LookupAPI.java
17-5 RemoteDBBankServer.java

Chapter 18: Servlets and JSP

18-1 Hello.java
18-2 Counter.java
18-3 Query.java
18-4 login.jsp
18-5 forcelogin.jsp
18-6 portal.jsp
18-7 UserBean.java
18-8 Logout.java
18-9 DecorBox.java
18-10 WEB-INF/tlds/decor_0_1.tld
18-11 web.xml
18-12 makewar.sh: a script for packaging a web application

Chapter 19: XML

19-1 ListServlets1.java
19-2 ListServlets2.java
19-3 WebAppConfig.java
19-4 XMLDocumentWriter.java
19-5 DOMTreeWalkerTreeModel.java
19-6 WebAppConfig2.java 1