├── .gitignore ├── LICENSE ├── README.md ├── corejava.zip ├── corejava ├── gutenberg │ ├── alice30.txt │ └── crsto10.txt ├── v1ch02 │ ├── ImageViewer │ │ ├── ImageViewer.java │ │ ├── cay.jpg │ │ ├── duke.gif │ │ └── mug.png │ ├── RoadApplet │ │ ├── RoadApplet.html │ │ ├── RoadApplet.jar │ │ ├── RoadApplet.java │ │ ├── RoadApplet.mf │ │ ├── RoadComponent.java │ │ └── makejar │ └── Welcome │ │ └── Welcome.java ├── v1ch03 │ ├── BigIntegerTest │ │ └── BigIntegerTest.java │ ├── CompoundInterest │ │ └── CompoundInterest.java │ ├── FirstSample │ │ └── FirstSample.java │ ├── InputTest │ │ └── InputTest.java │ ├── LotteryArray │ │ └── LotteryArray.java │ ├── LotteryDrawing │ │ └── LotteryDrawing.java │ ├── LotteryOdds │ │ └── LotteryOdds.java │ ├── Retirement │ │ └── Retirement.java │ └── Retirement2 │ │ └── Retirement2.java ├── v1ch04 │ ├── CalendarTest │ │ └── CalendarTest.java │ ├── ConstructorTest │ │ └── ConstructorTest.java │ ├── EmployeeTest │ │ └── EmployeeTest.java │ ├── PackageTest │ │ ├── PackageTest.java │ │ └── com │ │ │ └── horstmann │ │ │ └── corejava │ │ │ └── Employee.java │ ├── ParamTest │ │ └── ParamTest.java │ └── StaticTest │ │ └── StaticTest.java ├── v1ch05 │ ├── abstractClasses │ │ ├── Employee.java │ │ ├── Person.java │ │ ├── PersonTest.java │ │ └── Student.java │ ├── arrayList │ │ ├── ArrayListTest.java │ │ └── Employee.java │ ├── arrays │ │ └── CopyOfTest.java │ ├── enums │ │ └── EnumTest.java │ ├── equals │ │ ├── Employee.java │ │ ├── EqualsTest.java │ │ └── Manager.java │ ├── inheritance │ │ ├── Employee.java │ │ ├── Manager.java │ │ └── ManagerTest.java │ ├── methods │ │ └── MethodTableTest.java │ ├── objectAnalyzer │ │ ├── ObjectAnalyzer.java │ │ └── ObjectAnalyzerTest.java │ └── reflection │ │ └── ReflectionTest.java ├── v1ch06 │ ├── anonymousInnerClass │ │ └── AnonymousInnerClassTest.java │ ├── clone │ │ ├── CloneTest.java │ │ └── Employee.java │ ├── innerClass │ │ └── InnerClassTest.java │ ├── interfaces │ │ ├── Employee.java │ │ └── EmployeeSortTest.java │ ├── lambda │ │ └── LambdaTest.java │ ├── localInnerClass │ │ └── LocalInnerClassTest.java │ ├── proxy │ │ └── ProxyTest.java │ ├── staticInnerClass │ │ └── StaticInnerClassTest.java │ └── timer │ │ └── TimerTest.java ├── v1ch07 │ ├── except │ │ ├── ExceptTest.java │ │ └── manifest.mf │ ├── exceptional │ │ └── ExceptionalTest.java │ ├── logging │ │ └── LoggingImageViewer.java │ └── stackTrace │ │ └── StackTraceTest.java ├── v1ch08 │ ├── genericAlgorithms │ │ ├── GenericAlgorithms.java │ │ └── Pair.java │ ├── genericReflection │ │ └── GenericReflectionTest.java │ ├── pair1 │ │ ├── Pair.java │ │ └── PairTest1.java │ ├── pair2 │ │ ├── Pair.java │ │ └── PairTest2.java │ └── pair3 │ │ ├── Employee.java │ │ ├── Manager.java │ │ ├── Pair.java │ │ └── PairTest3.java ├── v1ch09 │ ├── circularArrayQueue │ │ └── CircularArrayQueueTest.java │ ├── linkedList │ │ └── LinkedListTest.java │ ├── map │ │ ├── Employee.java │ │ └── MapTest.java │ ├── priorityQueue │ │ └── PriorityQueueTest.java │ ├── set │ │ └── SetTest.java │ ├── shuffle │ │ └── ShuffleTest.java │ ├── sieve │ │ ├── Sieve.java │ │ └── sieve.cpp │ └── treeSet │ │ ├── Item.java │ │ └── TreeSetTest.java ├── v1ch10 │ ├── blue-ball.gif │ ├── draw │ │ └── DrawTest.java │ ├── fill │ │ └── FillTest.java │ ├── font │ │ └── FontTest.java │ ├── icon.gif │ ├── image │ │ └── ImageTest.java │ ├── listFonts │ │ └── ListFonts.java │ ├── notHelloWorld │ │ └── NotHelloWorld.java │ ├── simpleFrame │ │ └── SimpleFrameTest.java │ └── sizedFrame │ │ └── SizedFrameTest.java ├── v1ch11 │ ├── action │ │ ├── ActionFrame.java │ │ └── ActionTest.java │ ├── blue-ball.gif │ ├── button │ │ ├── ButtonFrame.java │ │ └── ButtonTest.java │ ├── mouse │ │ ├── MouseComponent.java │ │ ├── MouseFrame.java │ │ └── MouseTest.java │ ├── plaf │ │ ├── PlafFrame.java │ │ └── PlafTest.java │ ├── red-ball.gif │ └── yellow-ball.gif ├── v1ch12 │ ├── ace.gif │ ├── blue-ball.gif │ ├── border │ │ ├── BorderFrame.java │ │ └── BorderTest.java │ ├── calculator │ │ ├── Calculator.java │ │ ├── CalculatorFrame.java │ │ └── CalculatorPanel.java │ ├── checkBox │ │ ├── CheckBoxFrame.java │ │ └── CheckBoxTest.java │ ├── circleLayout │ │ ├── CircleLayout.java │ │ ├── CircleLayoutFrame.java │ │ └── CircleLayoutTest.java │ ├── colorChooser │ │ ├── ColorChooserFrame.java │ │ ├── ColorChooserPanel.java │ │ └── ColorChooserTest.java │ ├── comboBox │ │ ├── ComboBoxFrame.java │ │ └── ComboBoxTest.java │ ├── copy.gif │ ├── cut.gif │ ├── dataExchange │ │ ├── DataExchangeFrame.java │ │ ├── DataExchangeTest.java │ │ ├── PasswordChooser.java │ │ └── User.java │ ├── dialog │ │ ├── AboutDialog.java │ │ ├── DialogFrame.java │ │ └── DialogTest.java │ ├── eventTracer │ │ ├── EventTracer.java │ │ └── EventTracerTest.java │ ├── exit.gif │ ├── fileChooser │ │ ├── FileChooserTest.java │ │ ├── FileIconView.java │ │ ├── ImagePreviewer.java │ │ └── ImageViewerFrame.java │ ├── gridbag │ │ ├── FontFrame.java │ │ ├── GBC.java │ │ └── GridBagLayoutTest.java │ ├── groupLayout │ │ ├── FontFrame.java │ │ └── GroupLayoutTest.java │ ├── jack.gif │ ├── king.gif │ ├── menu │ │ ├── MenuFrame.java │ │ └── MenuTest.java │ ├── nine.gif │ ├── optionDialog │ │ ├── ButtonPanel.java │ │ ├── OptionDialogFrame.java │ │ └── OptionDialogTest.java │ ├── palette.gif │ ├── paste.gif │ ├── queen.gif │ ├── radioButton │ │ ├── RadioButtonFrame.java │ │ └── RadioButtonTest.java │ ├── red-ball.gif │ ├── robot │ │ ├── ButtonFrame.java │ │ └── RobotTest.java │ ├── slider │ │ ├── SliderFrame.java │ │ └── SliderTest.java │ ├── ten.gif │ ├── text │ │ ├── TextComponentFrame.java │ │ └── TextComponentTest.java │ ├── toolBar │ │ ├── ToolBarFrame.java │ │ └── ToolBarTest.java │ └── yellow-ball.gif ├── v1ch13 │ ├── META-INF │ │ └── services │ │ │ └── serviceLoader.Cipher │ ├── NotHelloWorldApplet.html │ ├── ResourceTest.jar │ ├── applet │ │ └── NotHelloWorld.java │ ├── chart │ │ ├── Chart.html │ │ └── Chart.java │ ├── java.policy.applet │ ├── preferences │ │ └── PreferencesTest.java │ ├── properties │ │ └── PropertiesTest.java │ ├── resource │ │ ├── ResourceTest.java │ │ ├── ResourceTest.mf │ │ ├── about.gif │ │ └── about.txt │ ├── serviceLoader │ │ ├── Cipher.java │ │ ├── ServiceLoaderTest.java │ │ └── impl │ │ │ └── CaesarCipher.java │ ├── systemInfo │ │ └── SystemInfo.java │ └── webstart │ │ ├── Calculator.jar │ │ ├── Calculator.java │ │ ├── Calculator.jnlp │ │ ├── CalculatorFrame.java │ │ ├── CalculatorPanel.java │ │ ├── calc_icon32.png │ │ └── calc_icon64.png ├── v1ch14 │ ├── blockingQueue │ │ └── BlockingQueueTest.java │ ├── bounce │ │ ├── Ball.java │ │ ├── BallComponent.java │ │ └── Bounce.java │ ├── bounceThread │ │ ├── Ball.java │ │ ├── BallComponent.java │ │ └── BounceThread.java │ ├── forkJoin │ │ └── ForkJoinTest.java │ ├── future │ │ └── FutureTest.java │ ├── swing │ │ └── SwingThreadTest.java │ ├── swingWorker │ │ └── SwingWorkerTest.java │ ├── synch │ │ ├── Bank.java │ │ └── SynchBankTest.java │ ├── synch2 │ │ ├── Bank.java │ │ └── SynchBankTest2.java │ ├── threadPool │ │ └── ThreadPoolTest.java │ └── unsynch │ │ ├── Bank.java │ │ └── UnsynchBankTest.java ├── v2ch01 │ ├── collecting │ │ ├── CollectingIntoMaps.java │ │ ├── CollectingResults.java │ │ └── DownstreamCollectors.java │ ├── optional │ │ └── OptionalTest.java │ ├── parallel │ │ └── ParallelStreams.java │ └── streams │ │ ├── CountLongWords.java │ │ ├── CreatingStreams.java │ │ └── PrimitiveTypeStreams.java ├── v2ch02 │ ├── employee.dat │ ├── employee2.dat │ ├── employee3.dat │ ├── findDirectories │ │ └── FindDirectories.java │ ├── match │ │ └── HrefMatch.java │ ├── memoryMap │ │ ├── MemoryMapTest.java │ │ └── MemoryMapTest2.java │ ├── objectStream │ │ ├── Employee.java │ │ ├── Manager.java │ │ ├── ObjectStreamTest.java │ │ └── employee.dat │ ├── randomAccess │ │ ├── DataIO.java │ │ ├── Employee.java │ │ └── RandomAccessTest.java │ ├── randomAccess2 │ │ ├── Employee.java │ │ └── RandomAccessTest.java │ ├── regex │ │ └── RegexTest.java │ ├── serialClone │ │ └── SerialCloneTest.java │ ├── textFile │ │ ├── Employee.java │ │ ├── TextFileTest.java │ │ └── employee.dat │ └── zip │ │ └── ZipTest.java ├── v2ch03 │ ├── dom │ │ ├── TreeViewer.java │ │ └── server.xml │ ├── fontdialog-schema.xml │ ├── fontdialog.xml │ ├── gridbag.dtd │ ├── gridbag.xsd │ ├── read │ │ ├── GridBagPane.java │ │ └── GridBagTest.java │ ├── sax │ │ └── SAXTest.java │ ├── stax │ │ └── StAXTest.java │ ├── transform │ │ ├── TransformTest.java │ │ ├── employee.dat │ │ ├── makehtml.xsl │ │ └── makeprop.xsl │ ├── write │ │ ├── RectangleComponent.java │ │ ├── XMLWriteFrame.java │ │ └── XMLWriteTest.java │ └── xpath │ │ ├── XPathTester.java │ │ ├── fontdialog.xml │ │ └── gridbag.dtd ├── v2ch04 │ ├── inetAddress │ │ └── InetAddressTest.java │ ├── interruptible │ │ └── InterruptibleSocketTest.java │ ├── mail │ │ ├── MailTest.java │ │ ├── mail.properties │ │ └── message.txt │ ├── post │ │ ├── PostTest.java │ │ └── post.properties │ ├── server │ │ └── EchoServer.java │ ├── socket │ │ └── SocketTest.java │ ├── threaded │ │ └── ThreadedEchoServer.java │ └── urlConnection │ │ └── URLConnectionTest.java ├── v2ch05 │ ├── Authors.sql │ ├── Books.sql │ ├── BooksAuthors.sql │ ├── Publishers.sql │ ├── database.properties │ ├── derby.log │ ├── exec │ │ └── ExecSQL.java │ ├── query │ │ └── QueryTest.java │ ├── test │ │ └── TestDB.java │ └── view │ │ └── ViewDB.java ├── v2ch06 │ ├── formatting │ │ └── Formatting.java │ ├── localdates │ │ └── LocalDates.java │ ├── timeline │ │ └── Timeline.java │ └── zonedTimes │ │ └── ZonedTimes.java ├── v2ch07 │ ├── collation │ │ ├── CollationTest.java │ │ ├── EnumCombo.java │ │ └── GBC.java │ ├── dateFormat │ │ ├── DateTimeFormatterTest.java │ │ ├── EnumCombo.java │ │ └── GBC.java │ ├── numberFormat │ │ ├── GBC.java │ │ └── NumberFormatTest.java │ └── retire │ │ ├── GBC.java │ │ ├── LocaleCombo.java │ │ ├── Retire.java │ │ ├── RetireResources.java │ │ ├── RetireResources_de.java │ │ ├── RetireResources_zh.java │ │ ├── RetireStrings.properties │ │ ├── RetireStrings_de.properties │ │ └── RetireStrings_zh.properties ├── v2ch08 │ ├── buttons1 │ │ ├── ButtonFrame.java │ │ ├── Renjin.properties │ │ ├── groovy.properties │ │ ├── init.Renjin │ │ ├── init.sisc │ │ ├── nashorn.properties │ │ └── sisc.properties │ ├── buttons2 │ │ ├── ButtonFrame.java │ │ └── action.properties │ ├── buttons3 │ │ ├── ButtonFrame.java │ │ └── ButtonTest.java │ ├── bytecodeAnnotations │ │ ├── EntryLogger.java │ │ ├── EntryLoggingAgent.jar │ │ ├── EntryLoggingAgent.java │ │ ├── EntryLoggingAgent.mf │ │ └── LogEntry.java │ ├── compiler │ │ ├── ByteArrayJavaClass.java │ │ ├── CompilerTest.java │ │ ├── MapClassLoader.java │ │ └── StringBuilderJavaSource.java │ ├── rect │ │ ├── Point.java │ │ ├── Rectangle.java │ │ └── SourceLevelAnnotationDemo.java │ ├── runtimeAnnotations │ │ ├── ActionListenerFor.java │ │ └── ActionListenerInstaller.java │ ├── script │ │ └── ScriptTest.java │ ├── set │ │ ├── Item.java │ │ └── SetTest.java │ └── sourceAnnotations │ │ ├── ToString.java │ │ ├── ToStringAnnotationProcessor.java │ │ └── ToStrings.java ├── v2ch09 │ ├── Calculator.caesar │ ├── CalculatorFrame.caesar │ ├── CalculatorPanel$1.caesar │ ├── CalculatorPanel$CommandAction.caesar │ ├── CalculatorPanel$InsertAction.caesar │ ├── CalculatorPanel.caesar │ ├── FileReadApplet.html │ ├── aes │ │ ├── AESTest.java │ │ └── Util.java │ ├── applet.policy │ ├── auth │ │ ├── AuthTest.java │ │ ├── AuthTest.policy │ │ ├── SysPropAction.java │ │ ├── action.jar │ │ ├── jaas.config │ │ └── login.jar │ ├── classLoader │ │ ├── Caesar.java │ │ ├── ClassLoaderTest.java │ │ └── GBC.java │ ├── hash │ │ ├── Digest.java │ │ └── input.txt │ ├── jaas │ │ ├── JAASFrame.java │ │ ├── JAASTest.java │ │ ├── JAASTest.policy │ │ ├── SimpleCallbackHandler.java │ │ ├── SimpleLoginModule.java │ │ ├── SimplePrincipal.java │ │ ├── SysPropAction.java │ │ ├── jaas.config │ │ └── password.txt │ ├── permissions │ │ ├── PermissionTest.java │ │ ├── PermissionTest.policy │ │ └── WordCheckPermission.java │ ├── rsa │ │ ├── RSATest.java │ │ └── Util.java │ ├── signed │ │ └── FileReadApplet.java │ └── verifier │ │ ├── VerifierTest.html │ │ └── VerifierTest.java ├── v2ch10 │ ├── editorPane │ │ ├── EditorPaneFrame.java │ │ └── EditorPaneTest.java │ ├── internalFrame │ │ ├── DesktopFrame.java │ │ ├── Earth.gif │ │ ├── InternalFrameTest.java │ │ ├── Jupiter.gif │ │ ├── Mars.gif │ │ ├── Mercury.gif │ │ ├── Neptune.gif │ │ ├── Pluto.gif │ │ ├── Saturn.gif │ │ ├── Uranus.gif │ │ ├── Venus.gif │ │ └── document.gif │ ├── layer │ │ ├── ColorFrame.java │ │ └── LayerTest.java │ ├── list │ │ ├── ListFrame.java │ │ └── ListTest.java │ ├── listRendering │ │ ├── FontCellRenderer.java │ │ ├── ListRenderingFrame.java │ │ └── ListRenderingTest.java │ ├── longList │ │ ├── LongListFrame.java │ │ ├── LongListTest.java │ │ └── WordListModel.java │ ├── progressBar │ │ ├── ProgressBarFrame.java │ │ └── ProgressBarTest.java │ ├── progressMonitor │ │ ├── ProgressMonitorFrame.java │ │ └── ProgressMonitorTest.java │ ├── progressMonitorInputStream │ │ ├── ProgressMonitorInputStreamTest.java │ │ └── TextFrame.java │ ├── spinner │ │ ├── PermutationSpinnerModel.java │ │ ├── SpinnerFrame.java │ │ └── SpinnerTest.java │ ├── splitPane │ │ ├── Earth.gif │ │ ├── Jupiter.gif │ │ ├── Mars.gif │ │ ├── Mercury.gif │ │ ├── Neptune.gif │ │ ├── Planet.java │ │ ├── Pluto.gif │ │ ├── Saturn.gif │ │ ├── SplitPaneFrame.java │ │ ├── SplitPaneTest.java │ │ ├── Uranus.gif │ │ └── Venus.gif │ ├── tabbedPane │ │ ├── Earth.gif │ │ ├── Jupiter.gif │ │ ├── Mars.gif │ │ ├── Mercury.gif │ │ ├── Neptune.gif │ │ ├── Pluto.gif │ │ ├── Saturn.gif │ │ ├── TabbedPaneFrame.java │ │ ├── TabbedPaneTest.java │ │ ├── Uranus.gif │ │ ├── Venus.gif │ │ ├── red-ball.gif │ │ └── yellow-ball.gif │ ├── table │ │ └── TableTest.java │ ├── tableCellRender │ │ ├── ColorTableCellEditor.java │ │ ├── ColorTableCellRenderer.java │ │ ├── Earth.gif │ │ ├── Jupiter.gif │ │ ├── Mars.gif │ │ ├── Mercury.gif │ │ ├── Moons.gif │ │ ├── Neptune.gif │ │ ├── PlanetTableModel.java │ │ ├── Pluto.gif │ │ ├── Saturn.gif │ │ ├── TableCellRenderFrame.java │ │ ├── TableCellRenderTest.java │ │ ├── Uranus.gif │ │ └── Venus.gif │ ├── tableModel │ │ └── InvestmentTable.java │ ├── tableRowColumn │ │ ├── Earth.gif │ │ ├── Jupiter.gif │ │ ├── Mars.gif │ │ ├── Mercury.gif │ │ ├── Neptune.gif │ │ ├── PlanetTableFrame.java │ │ ├── Pluto.gif │ │ ├── Saturn.gif │ │ ├── TableRowColumnTest.java │ │ ├── Uranus.gif │ │ └── Venus.gif │ ├── tableSelection │ │ ├── TableSelectionFrame.java │ │ └── TableSelectionTest.java │ ├── textChange │ │ ├── ChangeTrackingTest.java │ │ └── ColorFrame.java │ ├── textFormat │ │ ├── FormatTest.java │ │ ├── FormatTestFrame.java │ │ ├── IPAddressFormatter.java │ │ └── IntFilter.java │ ├── tree │ │ ├── SimpleTree.java │ │ └── SimpleTreeFrame.java │ ├── treeEdit │ │ ├── TreeEditFrame.java │ │ └── TreeEditTest.java │ ├── treeModel │ │ ├── ObjectInspectorFrame.java │ │ ├── ObjectInspectorTest.java │ │ ├── ObjectTreeModel.java │ │ └── Variable.java │ └── treeRender │ │ ├── ClassNameTreeCellRenderer.java │ │ ├── ClassTree.java │ │ ├── ClassTreeFrame.java │ │ ├── blue-ball.gif │ │ ├── red-ball.gif │ │ └── yellow-ball.gif ├── v2ch11 │ ├── book │ │ ├── Banner.java │ │ ├── BookTest.java │ │ ├── BookTestFrame.java │ │ ├── PrintPreviewCanvas.java │ │ └── PrintPreviewDialog.java │ ├── cj2.gif │ ├── cj8v2.png │ ├── composite │ │ ├── CompositeComponent.java │ │ ├── CompositeTest.java │ │ ├── CompositeTestFrame.java │ │ └── Rule.java │ ├── desktopApp │ │ ├── DesktopAppFrame.java │ │ ├── DesktopAppTest.java │ │ └── GBC.java │ ├── dnd │ │ ├── SampleComponents.java │ │ ├── SwingDnDFrame.java │ │ └── SwingDnDTest.java │ ├── dndImage │ │ ├── ImageListDnDFrame.java │ │ ├── ImageListDnDTest.java │ │ ├── ImageTransferable.java │ │ ├── images1 │ │ │ ├── Jupiter.gif │ │ │ ├── Mars.gif │ │ │ ├── Mercury.gif │ │ │ ├── Neptune.gif │ │ │ ├── Pluto.gif │ │ │ ├── Uranus.gif │ │ │ └── Venus.gif │ │ └── images2 │ │ │ ├── Earth.gif │ │ │ └── Saturn.gif │ ├── imageIO │ │ ├── ImageIOFrame.java │ │ ├── ImageIOTest.java │ │ └── e-mail.gif │ ├── imageProcessing │ │ ├── ImageProcessingFrame.java │ │ └── ImageProcessingTest.java │ ├── imageTransfer │ │ ├── ImageTransferFrame.java │ │ ├── ImageTransferTest.java │ │ └── ImageTransferable.java │ ├── print │ │ ├── PrintComponent.java │ │ ├── PrintTest.java │ │ └── PrintTestFrame.java │ ├── printService │ │ └── PrintServiceTest.java │ ├── rasterImage │ │ ├── RasterImageFrame.java │ │ └── RasterImageTest.java │ ├── renderQuality │ │ ├── GBC.java │ │ ├── RenderQualityTest.java │ │ ├── RenderQualityTestFrame.java │ │ └── face.gif │ ├── serialTransfer │ │ ├── SerialTransferFrame.java │ │ └── SerialTransferTest.java │ ├── shape │ │ └── ShapeTest.java │ ├── splashScreen │ │ ├── SplashScreenTest.java │ │ └── splash.png │ ├── stroke │ │ └── StrokeTest.java │ ├── systemTray │ │ ├── SystemTrayTest.java │ │ ├── cookie.png │ │ └── fortunes │ └── transferText │ │ ├── TextTransferFrame.java │ │ └── TextTransferTest.java └── v2ch12 │ ├── employee │ ├── Employee.c │ ├── Employee.java │ └── EmployeeTest.java │ ├── helloNative │ ├── HelloNative.c │ ├── HelloNative.h │ ├── HelloNative.java │ └── HelloNativeTest.java │ ├── invocation │ ├── InvocationTest.c │ └── Welcome.java │ ├── printf1 │ ├── Printf1.c │ ├── Printf1.java │ └── Printf1Test.java │ ├── printf2 │ ├── Printf2.c │ ├── Printf2.java │ └── Printf2Test.java │ ├── printf3 │ ├── Printf3.c │ ├── Printf3.java │ └── Printf3Test.java │ ├── printf4 │ ├── Printf4.c │ ├── Printf4.java │ └── Printf4Test.java │ └── win32reg │ ├── Win32RegKey.c │ ├── Win32RegKey.java │ └── Win32RegKeyTest.java └── mysol ├── ch2 ├── ch2_ImageViewer │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ ├── cay.jpg │ ├── duke.gif │ ├── mug.png │ └── src │ │ └── ch2_ImageViewer │ │ └── ch2_ImageViewer.java ├── ch2_RoadApplet │ ├── RoadApplet.html │ ├── RoadApplet.java │ ├── RoadApplet.mf │ ├── RoadComponent.java │ └── makejar └── ch2_welcome │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ └── src │ └── ch2 │ └── ch2_welcome.java ├── ch3 ├── ch3_1_simple │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_1_simple │ │ └── ch3_1_simple.java ├── ch3_2_constants │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_2_constants │ │ └── ch3_2_constants.java ├── ch3_2_inputTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_2_inputTest │ │ └── ch3_2_inputTest.java ├── ch3_3_retirement │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_3_retirement │ │ └── ch3_3_retirement.java ├── ch3_4_retirement2 │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_4_retirement2 │ │ └── ch3_4_retirement2.java ├── ch3_5_lotteryOdds │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_5_lotteryOdds │ │ └── ch3_5_lotteryOdds.java ├── ch3_6_bigIntegerTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_6_bigIntegerTest │ │ └── ch3_6_bigIntegerTest.java ├── ch3_7_lotteryDrawing │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_7_lotteryDrawing │ │ └── ch3_7_lotteryDrawing.java ├── ch3_8_compoundInterest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch3_8_compoundInterest │ │ └── ch3_8_compoundInterest.java └── ch3_9_lotteryArray │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ └── src │ └── ch3_9_lotteryArray │ └── ch3_9_lotteryArray.java ├── ch4 ├── ch4_1_calendarTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch4_1_calendarTest │ │ └── ch4_1_calendarTest.java ├── ch4_2_employeeTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch4_2_employeeTest │ │ └── ch4_2_employeeTest.java ├── ch4_3_staticTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch4_3_staticTest │ │ └── ch4_3_staticTest.java ├── ch4_4_paramTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch4_4_paramTest │ │ └── ch4_4_paramTest.java ├── ch4_5_constructorTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch4_5_constructorTest │ │ └── ch4_5_constructorTest.java └── ch4_6_packageTest │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ └── src │ └── ch4_6_packageTest │ └── ch4_6_packageTest.java ├── ch5 ├── ch5_11_arrayListTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_11_arrayListTest │ │ ├── ArrayListTest.java │ │ └── Employee.java ├── ch5_12_enumTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_12_enumTest │ │ └── EnumTest.java ├── ch5_13_reflectionTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_13_reflectionTest │ │ └── ReflectionTest.java ├── ch5_14_objectAnalyzerTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_14_objectAnalyzerTest │ │ ├── ObjectAnalyzer.java │ │ └── ObjectAnalyzerTest.java ├── ch5_16_copyOfTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_16_copyOfTest │ │ └── CopyOfTest.java ├── ch5_17_methodTableTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_17_methodTableTest │ │ └── MethodTableTest.java ├── ch5_1_Inheritance │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_1_Inheritance │ │ ├── Employee.java │ │ ├── Manager.java │ │ └── ManagerTest.java ├── ch5_4_abstractClasses │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch5_4_abstractClasses │ │ ├── Employee.java │ │ ├── Person.java │ │ ├── PersonTest.java │ │ └── Student.java └── ch5_8_equalsTest │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ └── src │ └── ch5_8_equalsTest │ ├── Employee.java │ ├── EqualsTest.java │ └── Manager.java ├── ch6 ├── ch6_10_proxyTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_10_proxyTest │ │ └── ProxyTest.java ├── ch6_1_employeeSortTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_1_employeeSortTest │ │ ├── Employee.java │ │ └── EmployeeSortTest.java ├── ch6_3_timerTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_3_timerTest │ │ └── TimerTest.java ├── ch6_4_cloneTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_4_cloneTest │ │ ├── CloneTest.java │ │ └── Employee.java ├── ch6_6_lambdaTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_6_lambdaTest │ │ └── LambdaTest.java ├── ch6_7_innerClassTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_7_innerClassTest │ │ └── InnerClassTest.java ├── ch6_8_anonymousInnerClassTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch6_8_anonymousInnerClassTest │ │ └── AnonymousInnerClassTest.java └── ch6_9_staticInnerClassTest │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ └── src │ └── ch6_9_staticInnerClassTest │ └── StaticInnerClassTest.java ├── ch7 ├── ch7_1_stackTraceTest │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch7_1_stackTraceTest │ │ └── StackTraceTest.java └── ch7_2_loggingImageViewer │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ ├── DancingPeaks.gif │ └── src │ └── ch7_2_loggingImageViewer │ └── LoggingImageViewer.java ├── ch8 ├── ch8_1_pairTest1 │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch8_1_pairTest1 │ │ ├── Pair.java │ │ └── PairTest1.java ├── ch8_2_pairTest2 │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch8_2_pairTest2 │ │ ├── Pair.java │ │ └── PairTest2.java ├── ch8_3_pairTest3 │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ └── src │ │ └── ch8_3_pairTest3 │ │ ├── Employee.java │ │ ├── Manager.java │ │ ├── Pair.java │ │ └── PairTest3.java └── ch8_4_genericReflectionTest │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ └── src │ └── ch8_4_genericReflectionTest │ └── GenericReflectionTest.java └── my_progress.txt /corejava.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava.zip -------------------------------------------------------------------------------- /corejava/v1ch02/ImageViewer/cay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch02/ImageViewer/cay.jpg -------------------------------------------------------------------------------- /corejava/v1ch02/ImageViewer/duke.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch02/ImageViewer/duke.gif -------------------------------------------------------------------------------- /corejava/v1ch02/ImageViewer/mug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch02/ImageViewer/mug.png -------------------------------------------------------------------------------- /corejava/v1ch02/RoadApplet/RoadApplet.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch02/RoadApplet/RoadApplet.jar -------------------------------------------------------------------------------- /corejava/v1ch02/RoadApplet/RoadApplet.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Permissions: sandbox 3 | -------------------------------------------------------------------------------- /corejava/v1ch02/RoadApplet/makejar: -------------------------------------------------------------------------------- 1 | javac RoadApplet.java 2 | jar cvfm RoadApplet.jar RoadApplet.mf *.class 3 | rm *.class 4 | -------------------------------------------------------------------------------- /corejava/v1ch02/Welcome/Welcome.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This program displays a greeting for the reader. 3 | * @version 1.30 2014-02-27 4 | * @author Cay Horstmann 5 | */ 6 | public class Welcome 7 | { 8 | public static void main(String[] args) 9 | { 10 | String greeting = "Welcome to Core Java!"; 11 | System.out.println(greeting); 12 | for (int i = 0; i < greeting.length(); i++) 13 | System.out.print("="); 14 | System.out.println(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /corejava/v1ch03/FirstSample/FirstSample.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the first sample program in Core Java Chapter 3 3 | * @version 1.01 1997-03-22 4 | * @author Gary Cornell 5 | */ 6 | public class FirstSample 7 | { 8 | public static void main(String[] args) 9 | { 10 | System.out.println("We will not use 'Hello, World!'"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /corejava/v1ch03/InputTest/InputTest.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | /** 4 | * This program demonstrates console input. 5 | * @version 1.10 2004-02-10 6 | * @author Cay Horstmann 7 | */ 8 | public class InputTest 9 | { 10 | public static void main(String[] args) 11 | { 12 | Scanner in = new Scanner(System.in); 13 | 14 | // get first input 15 | System.out.print("What is your name? "); 16 | String name = in.nextLine(); 17 | 18 | // get second input 19 | System.out.print("How old are you? "); 20 | int age = in.nextInt(); 21 | 22 | // display output on console 23 | System.out.println("Hello, " + name + ". Next year, you'll be " + (age + 1)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /corejava/v1ch04/PackageTest/PackageTest.java: -------------------------------------------------------------------------------- 1 | import com.horstmann.corejava.*; 2 | // the Employee class is defined in that package 3 | 4 | import static java.lang.System.*; 5 | 6 | /** 7 | * This program demonstrates the use of packages. 8 | * @version 1.11 2004-02-19 9 | * @author Cay Horstmann 10 | */ 11 | public class PackageTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | // because of the import statement, we don't have to use 16 | // com.horstmann.corejava.Employee here 17 | Employee harry = new Employee("Harry Hacker", 50000, 1989, 10, 1); 18 | 19 | harry.raiseSalary(5); 20 | 21 | // because of the static import statement, we don't have to use System.out here 22 | out.println("name=" + harry.getName() + ",salary=" + harry.getSalary()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /corejava/v1ch05/abstractClasses/Person.java: -------------------------------------------------------------------------------- 1 | package abstractClasses; 2 | 3 | public abstract class Person 4 | { 5 | public abstract String getDescription(); 6 | private String name; 7 | 8 | public Person(String name) 9 | { 10 | this.name = name; 11 | } 12 | 13 | public String getName() 14 | { 15 | return name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /corejava/v1ch05/abstractClasses/PersonTest.java: -------------------------------------------------------------------------------- 1 | package abstractClasses; 2 | 3 | /** 4 | * This program demonstrates abstract classes. 5 | * @version 1.01 2004-02-21 6 | * @author Cay Horstmann 7 | */ 8 | public class PersonTest 9 | { 10 | public static void main(String[] args) 11 | { 12 | Person[] people = new Person[2]; 13 | 14 | // fill the people array with Student and Employee objects 15 | people[0] = new Employee("Harry Hacker", 50000, 1989, 10, 1); 16 | people[1] = new Student("Maria Morris", "computer science"); 17 | 18 | // print out names and descriptions of all Person objects 19 | for (Person p : people) 20 | System.out.println(p.getName() + ", " + p.getDescription()); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v1ch05/abstractClasses/Student.java: -------------------------------------------------------------------------------- 1 | package abstractClasses; 2 | 3 | public class Student extends Person 4 | { 5 | private String major; 6 | 7 | /** 8 | * @param nama the student's name 9 | * @param major the student's major 10 | */ 11 | public Student(String name, String major) 12 | { 13 | // pass n to superclass constructor 14 | super(name); 15 | this.major = major; 16 | } 17 | 18 | public String getDescription() 19 | { 20 | return "a student majoring in " + major; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /corejava/v1ch05/inheritance/Manager.java: -------------------------------------------------------------------------------- 1 | package inheritance; 2 | 3 | public class Manager extends Employee 4 | { 5 | private double bonus; 6 | 7 | /** 8 | * @param name the employee's name 9 | * @param salary the salary 10 | * @param year the hire year 11 | * @param month the hire month 12 | * @param day the hire day 13 | */ 14 | public Manager(String name, double salary, int year, int month, int day) 15 | { 16 | super(name, salary, year, month, day); 17 | bonus = 0; 18 | } 19 | 20 | public double getSalary() 21 | { 22 | double baseSalary = super.getSalary(); 23 | return baseSalary + bonus; 24 | } 25 | 26 | public void setBonus(double b) 27 | { 28 | bonus = b; 29 | } 30 | } -------------------------------------------------------------------------------- /corejava/v1ch05/objectAnalyzer/ObjectAnalyzerTest.java: -------------------------------------------------------------------------------- 1 | package objectAnalyzer; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * This program uses reflection to spy on objects. 7 | * @version 1.12 2012-01-26 8 | * @author Cay Horstmann 9 | */ 10 | public class ObjectAnalyzerTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | ArrayList squares = new ArrayList<>(); 15 | for (int i = 1; i <= 5; i++) 16 | squares.add(i * i); 17 | System.out.println(new ObjectAnalyzer().toString(squares)); 18 | } 19 | } -------------------------------------------------------------------------------- /corejava/v1ch06/clone/CloneTest.java: -------------------------------------------------------------------------------- 1 | package clone; 2 | 3 | /** 4 | * This program demonstrates cloning. 5 | * @version 1.10 2002-07-01 6 | * @author Cay Horstmann 7 | */ 8 | public class CloneTest 9 | { 10 | public static void main(String[] args) 11 | { 12 | try 13 | { 14 | Employee original = new Employee("John Q. Public", 50000); 15 | original.setHireDay(2000, 1, 1); 16 | Employee copy = original.clone(); 17 | copy.raiseSalary(10); 18 | copy.setHireDay(2002, 12, 31); 19 | System.out.println("original=" + original); 20 | System.out.println("copy=" + copy); 21 | } 22 | catch (CloneNotSupportedException e) 23 | { 24 | e.printStackTrace(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /corejava/v1ch06/interfaces/EmployeeSortTest.java: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * This program demonstrates the use of the Comparable interface. 7 | * @version 1.30 2004-02-27 8 | * @author Cay Horstmann 9 | */ 10 | public class EmployeeSortTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | Employee[] staff = new Employee[3]; 15 | 16 | staff[0] = new Employee("Harry Hacker", 35000); 17 | staff[1] = new Employee("Carl Cracker", 75000); 18 | staff[2] = new Employee("Tony Tester", 38000); 19 | 20 | Arrays.sort(staff); 21 | 22 | // print out information about all Employee objects 23 | for (Employee e : staff) 24 | System.out.println("name=" + e.getName() + ",salary=" + e.getSalary()); 25 | } 26 | } -------------------------------------------------------------------------------- /corejava/v1ch07/except/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /corejava/v1ch08/pair1/Pair.java: -------------------------------------------------------------------------------- 1 | package pair1; 2 | 3 | /** 4 | * @version 1.00 2004-05-10 5 | * @author Cay Horstmann 6 | */ 7 | public class Pair 8 | { 9 | private T first; 10 | private T second; 11 | 12 | public Pair() { first = null; second = null; } 13 | public Pair(T first, T second) { this.first = first; this.second = second; } 14 | 15 | public T getFirst() { return first; } 16 | public T getSecond() { return second; } 17 | 18 | public void setFirst(T newValue) { first = newValue; } 19 | public void setSecond(T newValue) { second = newValue; } 20 | } 21 | -------------------------------------------------------------------------------- /corejava/v1ch08/pair2/Pair.java: -------------------------------------------------------------------------------- 1 | package pair2; 2 | 3 | /** 4 | * @version 1.00 2004-05-10 5 | * @author Cay Horstmann 6 | */ 7 | public class Pair 8 | { 9 | private T first; 10 | private T second; 11 | 12 | public Pair() { first = null; second = null; } 13 | public Pair(T first, T second) { this.first = first; this.second = second; } 14 | 15 | public T getFirst() { return first; } 16 | public T getSecond() { return second; } 17 | 18 | public void setFirst(T newValue) { first = newValue; } 19 | public void setSecond(T newValue) { second = newValue; } 20 | } 21 | -------------------------------------------------------------------------------- /corejava/v1ch08/pair3/Pair.java: -------------------------------------------------------------------------------- 1 | package pair3; 2 | 3 | /** 4 | * @version 1.00 2004-05-10 5 | * @author Cay Horstmann 6 | */ 7 | public class Pair 8 | { 9 | private T first; 10 | private T second; 11 | 12 | public Pair() { first = null; second = null; } 13 | public Pair(T first, T second) { this.first = first; this.second = second; } 14 | 15 | public T getFirst() { return first; } 16 | public T getSecond() { return second; } 17 | 18 | public void setFirst(T newValue) { first = newValue; } 19 | public void setSecond(T newValue) { second = newValue; } 20 | } 21 | -------------------------------------------------------------------------------- /corejava/v1ch09/map/Employee.java: -------------------------------------------------------------------------------- 1 | package map; 2 | 3 | /** 4 | * A minimalist employee class for testing purposes. 5 | */ 6 | public class Employee 7 | { 8 | private String name; 9 | private double salary; 10 | 11 | /** 12 | * Constructs an employee with $0 salary. 13 | * @param n the employee name 14 | */ 15 | public Employee(String name) 16 | { 17 | this.name = name; 18 | salary = 0; 19 | } 20 | 21 | public String toString() 22 | { 23 | return "[name=" + name + ", salary=" + salary + "]"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /corejava/v1ch09/shuffle/ShuffleTest.java: -------------------------------------------------------------------------------- 1 | package shuffle; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * This program demonstrates the random shuffle and sort algorithms. 7 | * @version 1.11 2012-01-26 8 | * @author Cay Horstmann 9 | */ 10 | public class ShuffleTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | List numbers = new ArrayList<>(); 15 | for (int i = 1; i <= 49; i++) 16 | numbers.add(i); 17 | Collections.shuffle(numbers); 18 | List winningCombination = numbers.subList(0, 6); 19 | Collections.sort(winningCombination); 20 | System.out.println(winningCombination); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /corejava/v1ch09/treeSet/TreeSetTest.java: -------------------------------------------------------------------------------- 1 | package treeSet; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * This program sorts a set of item by comparing their descriptions. 7 | * @version 1.12 2015-06-21 8 | * @author Cay Horstmann 9 | */ 10 | public class TreeSetTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | SortedSet parts = new TreeSet<>(); 15 | parts.add(new Item("Toaster", 1234)); 16 | parts.add(new Item("Widget", 4562)); 17 | parts.add(new Item("Modem", 9912)); 18 | System.out.println(parts); 19 | 20 | NavigableSet sortByDescription = new TreeSet<>( 21 | Comparator.comparing(Item::getDescription)); 22 | 23 | sortByDescription.addAll(parts); 24 | System.out.println(sortByDescription); 25 | } 26 | } -------------------------------------------------------------------------------- /corejava/v1ch10/blue-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch10/blue-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch10/icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch10/icon.gif -------------------------------------------------------------------------------- /corejava/v1ch10/listFonts/ListFonts.java: -------------------------------------------------------------------------------- 1 | package listFonts; 2 | 3 | import java.awt.*; 4 | 5 | /** 6 | * @version 1.11 2004-06-05 7 | * @author Cay Horstmann 8 | */ 9 | public class ListFonts 10 | { 11 | public static void main(String[] args) 12 | { 13 | String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment() 14 | .getAvailableFontFamilyNames(); 15 | 16 | for (String fontName : fontNames) 17 | System.out.println(fontName); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /corejava/v1ch11/action/ActionTest.java: -------------------------------------------------------------------------------- 1 | package action; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class ActionTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new ActionFrame(); 16 | frame.setTitle("ActionTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch11/blue-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch11/blue-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch11/button/ButtonTest.java: -------------------------------------------------------------------------------- 1 | package button; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class ButtonTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new ButtonFrame(); 16 | frame.setTitle("ButtonTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch11/mouse/MouseFrame.java: -------------------------------------------------------------------------------- 1 | package mouse; 2 | 3 | import javax.swing.*; 4 | 5 | /** 6 | * A frame containing a panel for testing mouse operations 7 | */ 8 | public class MouseFrame extends JFrame 9 | { 10 | public MouseFrame() 11 | { 12 | add(new MouseComponent()); 13 | pack(); 14 | } 15 | } -------------------------------------------------------------------------------- /corejava/v1ch11/mouse/MouseTest.java: -------------------------------------------------------------------------------- 1 | package mouse; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class MouseTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new MouseFrame(); 16 | frame.setTitle("MouseTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch11/plaf/PlafTest.java: -------------------------------------------------------------------------------- 1 | package plaf; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.32 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class PlafTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new PlafFrame(); 16 | frame.setTitle("PlafTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch11/red-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch11/red-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch11/yellow-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch11/yellow-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch12/ace.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/ace.gif -------------------------------------------------------------------------------- /corejava/v1ch12/blue-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/blue-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch12/border/BorderTest.java: -------------------------------------------------------------------------------- 1 | package border; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-13 8 | * @author Cay Horstmann 9 | */ 10 | public class BorderTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new BorderFrame(); 16 | frame.setTitle("BorderTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/calculator/Calculator.java: -------------------------------------------------------------------------------- 1 | package calculator; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class Calculator 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | CalculatorFrame frame = new CalculatorFrame(); 16 | frame.setTitle("Calculator"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/calculator/CalculatorFrame.java: -------------------------------------------------------------------------------- 1 | package calculator; 2 | 3 | import javax.swing.*; 4 | 5 | /** 6 | * A frame with a calculator panel. 7 | */ 8 | public class CalculatorFrame extends JFrame 9 | { 10 | public CalculatorFrame() 11 | { 12 | add(new CalculatorPanel()); 13 | pack(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /corejava/v1ch12/checkBox/CheckBoxTest.java: -------------------------------------------------------------------------------- 1 | package checkBox; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class CheckBoxTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new CheckBoxFrame(); 16 | frame.setTitle("CheckBoxTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/circleLayout/CircleLayoutFrame.java: -------------------------------------------------------------------------------- 1 | package circleLayout; 2 | 3 | import javax.swing.*; 4 | 5 | /** 6 | * A frame that shows buttons arranged along a circle. 7 | */ 8 | public class CircleLayoutFrame extends JFrame 9 | { 10 | public CircleLayoutFrame() 11 | { 12 | setLayout(new CircleLayout()); 13 | add(new JButton("Yellow")); 14 | add(new JButton("Blue")); 15 | add(new JButton("Red")); 16 | add(new JButton("Green")); 17 | add(new JButton("Orange")); 18 | add(new JButton("Fuchsia")); 19 | add(new JButton("Indigo")); 20 | pack(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /corejava/v1ch12/circleLayout/CircleLayoutTest.java: -------------------------------------------------------------------------------- 1 | package circleLayout; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.33 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class CircleLayoutTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new CircleLayoutFrame(); 16 | frame.setTitle("CircleLayoutTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/colorChooser/ColorChooserFrame.java: -------------------------------------------------------------------------------- 1 | package colorChooser; 2 | 3 | import javax.swing.*; 4 | 5 | /** 6 | * A frame with a color chooser panel 7 | */ 8 | public class ColorChooserFrame extends JFrame 9 | { 10 | private static final int DEFAULT_WIDTH = 300; 11 | private static final int DEFAULT_HEIGHT = 200; 12 | 13 | public ColorChooserFrame() 14 | { 15 | setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); 16 | 17 | // add color chooser panel to frame 18 | 19 | ColorChooserPanel panel = new ColorChooserPanel(); 20 | add(panel); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v1ch12/colorChooser/ColorChooserTest.java: -------------------------------------------------------------------------------- 1 | package colorChooser; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.04 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class ColorChooserTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new ColorChooserFrame(); 16 | frame.setTitle("ColorChooserTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/comboBox/ComboBoxTest.java: -------------------------------------------------------------------------------- 1 | package comboBox; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.35 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class ComboBoxTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new ComboBoxFrame(); 16 | frame.setTitle("ComboBoxTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/copy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/copy.gif -------------------------------------------------------------------------------- /corejava/v1ch12/cut.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/cut.gif -------------------------------------------------------------------------------- /corejava/v1ch12/dataExchange/DataExchangeTest.java: -------------------------------------------------------------------------------- 1 | package dataExchange; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class DataExchangeTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new DataExchangeFrame(); 16 | frame.setTitle("DataExchangeTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/dataExchange/User.java: -------------------------------------------------------------------------------- 1 | package dataExchange; 2 | 3 | /** 4 | * A user has a name and password. For security reasons, the password is stored as a char[], not a 5 | * String. 6 | */ 7 | public class User 8 | { 9 | private String name; 10 | private char[] password; 11 | 12 | public User(String aName, char[] aPassword) 13 | { 14 | name = aName; 15 | password = aPassword; 16 | } 17 | 18 | public String getName() 19 | { 20 | return name; 21 | } 22 | 23 | public char[] getPassword() 24 | { 25 | return password; 26 | } 27 | 28 | public void setName(String aName) 29 | { 30 | name = aName; 31 | } 32 | 33 | public void setPassword(char[] aPassword) 34 | { 35 | password = aPassword; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /corejava/v1ch12/dialog/DialogTest.java: -------------------------------------------------------------------------------- 1 | package dialog; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2012-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class DialogTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new DialogFrame(); 16 | frame.setTitle("DialogTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/exit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/exit.gif -------------------------------------------------------------------------------- /corejava/v1ch12/fileChooser/FileChooserTest.java: -------------------------------------------------------------------------------- 1 | package fileChooser; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.25 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class FileChooserTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new ImageViewerFrame(); 16 | frame.setTitle("FileChooserTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/gridbag/GridBagLayoutTest.java: -------------------------------------------------------------------------------- 1 | package gridbag; 2 | 3 | import java.awt.EventQueue; 4 | 5 | import javax.swing.JFrame; 6 | 7 | /** 8 | * @version 1.35 2015-06-12 9 | * @author Cay Horstmann 10 | */ 11 | public class GridBagLayoutTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> { 16 | JFrame frame = new FontFrame(); 17 | frame.setTitle("GridBagLayoutTest"); 18 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 19 | frame.setVisible(true); 20 | }); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v1ch12/groupLayout/GroupLayoutTest.java: -------------------------------------------------------------------------------- 1 | package groupLayout; 2 | 3 | import java.awt.EventQueue; 4 | 5 | import javax.swing.JFrame; 6 | 7 | /** 8 | * @version 1.01 2015-06-12 9 | * @author Cay Horstmann 10 | */ 11 | public class GroupLayoutTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> { 16 | JFrame frame = new FontFrame(); 17 | frame.setTitle("GroupLayoutTest"); 18 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 19 | frame.setVisible(true); 20 | }); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v1ch12/jack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/jack.gif -------------------------------------------------------------------------------- /corejava/v1ch12/king.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/king.gif -------------------------------------------------------------------------------- /corejava/v1ch12/menu/MenuTest.java: -------------------------------------------------------------------------------- 1 | package menu; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.24 2012-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class MenuTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new MenuFrame(); 16 | frame.setTitle("MenuTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/nine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/nine.gif -------------------------------------------------------------------------------- /corejava/v1ch12/optionDialog/OptionDialogTest.java: -------------------------------------------------------------------------------- 1 | package optionDialog; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class OptionDialogTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new OptionDialogFrame(); 16 | frame.setTitle("OptionDialogTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/palette.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/palette.gif -------------------------------------------------------------------------------- /corejava/v1ch12/paste.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/paste.gif -------------------------------------------------------------------------------- /corejava/v1ch12/queen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/queen.gif -------------------------------------------------------------------------------- /corejava/v1ch12/radioButton/RadioButtonTest.java: -------------------------------------------------------------------------------- 1 | package radioButton; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.34 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class RadioButtonTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new RadioButtonFrame(); 16 | frame.setTitle("RadioButtonTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/red-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/red-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch12/slider/SliderTest.java: -------------------------------------------------------------------------------- 1 | package slider; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.15 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class SliderTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | SliderFrame frame = new SliderFrame(); 16 | frame.setTitle("SliderTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/ten.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/ten.gif -------------------------------------------------------------------------------- /corejava/v1ch12/text/TextComponentTest.java: -------------------------------------------------------------------------------- 1 | package text; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.41 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class TextComponentTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JFrame frame = new TextComponentFrame(); 16 | frame.setTitle("TextComponentTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v1ch12/toolBar/ToolBarTest.java: -------------------------------------------------------------------------------- 1 | package toolBar; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.14 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class ToolBarTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> { 15 | ToolBarFrame frame = new ToolBarFrame(); 16 | frame.setTitle("ToolBarTest"); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch12/yellow-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch12/yellow-ball.gif -------------------------------------------------------------------------------- /corejava/v1ch13/META-INF/services/serviceLoader.Cipher: -------------------------------------------------------------------------------- 1 | serviceLoader.impl.CaesarCipher -------------------------------------------------------------------------------- /corejava/v1ch13/NotHelloWorldApplet.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /corejava/v1ch13/ResourceTest.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch13/ResourceTest.jar -------------------------------------------------------------------------------- /corejava/v1ch13/applet/NotHelloWorld.java: -------------------------------------------------------------------------------- 1 | package applet; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.24 2015-06-12 8 | * @author Cay Horstmann 9 | */ 10 | public class NotHelloWorld extends JApplet 11 | { 12 | public void init() 13 | { 14 | EventQueue.invokeLater(() -> { 15 | JLabel label = new JLabel("Not a Hello, World applet", 16 | SwingConstants.CENTER); 17 | add(label); 18 | }); 19 | } 20 | } -------------------------------------------------------------------------------- /corejava/v1ch13/java.policy.applet: -------------------------------------------------------------------------------- 1 | /* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ 2 | /* DO NOT EDIT */ 3 | 4 | grant { 5 | permission java.security.AllPermission; 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /corejava/v1ch13/resource/ResourceTest.mf: -------------------------------------------------------------------------------- 1 | Main-Class: resource.ResourceTest 2 | -------------------------------------------------------------------------------- /corejava/v1ch13/resource/about.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch13/resource/about.gif -------------------------------------------------------------------------------- /corejava/v1ch13/resource/about.txt: -------------------------------------------------------------------------------- 1 | Core Java: Fundamentals 2 | 10th Edition 3 | Cay Horstmann and Gary Cornell 4 | Copyright © 2016 5 | Prentice-Hall 6 | -------------------------------------------------------------------------------- /corejava/v1ch13/serviceLoader/Cipher.java: -------------------------------------------------------------------------------- 1 | package serviceLoader; 2 | 3 | public interface Cipher 4 | { 5 | byte[] encrypt(byte[] source, byte[] key); 6 | byte[] decrypt(byte[] source, byte[] key); 7 | int strength(); 8 | } -------------------------------------------------------------------------------- /corejava/v1ch13/serviceLoader/impl/CaesarCipher.java: -------------------------------------------------------------------------------- 1 | package serviceLoader.impl; 2 | 3 | import serviceLoader.Cipher; 4 | 5 | public class CaesarCipher implements Cipher 6 | { 7 | public byte[] encrypt(byte[] source, byte[] key) 8 | { 9 | byte[] result = new byte[source.length]; 10 | for (int i = 0; i < source.length; i++) 11 | result[i] = (byte) (source[i] + key[0]); 12 | return result; 13 | } 14 | 15 | public byte[] decrypt(byte[] source, byte[] key) 16 | { 17 | return encrypt(source, new byte[] { (byte) -key[0] }); 18 | } 19 | 20 | public int strength() 21 | { 22 | return 1; 23 | } 24 | } -------------------------------------------------------------------------------- /corejava/v1ch13/systemInfo/SystemInfo.java: -------------------------------------------------------------------------------- 1 | package systemInfo; 2 | 3 | import java.io.*; 4 | import java.util.*; 5 | 6 | /** 7 | * This program prints out all system properties. 8 | * @version 1.10 2002-07-06 9 | * @author Cay Horstmann 10 | */ 11 | public class SystemInfo 12 | { 13 | public static void main(String args[]) 14 | { 15 | try 16 | { 17 | Properties sysprops = System.getProperties(); 18 | sysprops.store(System.out, "System Properties"); 19 | } 20 | catch (IOException e) 21 | { 22 | e.printStackTrace(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /corejava/v1ch13/webstart/Calculator.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch13/webstart/Calculator.jar -------------------------------------------------------------------------------- /corejava/v1ch13/webstart/Calculator.java: -------------------------------------------------------------------------------- 1 | package webstart; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * A calculator with a calculation history that can be deployed as a Java Web Start application. 8 | * @version 1.04 2015-06-12 9 | * @author Cay Horstmann 10 | */ 11 | public class Calculator 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> { 16 | CalculatorFrame frame = new CalculatorFrame(); 17 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 18 | frame.setVisible(true); 19 | }); 20 | } 21 | } -------------------------------------------------------------------------------- /corejava/v1ch13/webstart/Calculator.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Calculator Demo Application 5 | Cay S. Horstmann 6 | Web Start Calculator 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /corejava/v1ch13/webstart/calc_icon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch13/webstart/calc_icon32.png -------------------------------------------------------------------------------- /corejava/v1ch13/webstart/calc_icon64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v1ch13/webstart/calc_icon64.png -------------------------------------------------------------------------------- /corejava/v2ch02/employee.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch02/employee.dat -------------------------------------------------------------------------------- /corejava/v2ch02/employee2.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch02/employee2.dat -------------------------------------------------------------------------------- /corejava/v2ch02/employee3.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch02/employee3.dat -------------------------------------------------------------------------------- /corejava/v2ch02/objectStream/employee.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch02/objectStream/employee.dat -------------------------------------------------------------------------------- /corejava/v2ch02/textFile/employee.dat: -------------------------------------------------------------------------------- 1 | 3 2 | Carl Cracker|75000.0|1987|12|15 3 | Harry Hacker|50000.0|1989|10|1 4 | Tony Tester|40000.0|1990|3|15 5 | -------------------------------------------------------------------------------- /corejava/v2ch03/transform/employee.dat: -------------------------------------------------------------------------------- 1 | Carl Cracker|75000.0|1987|12|15 2 | Harry Hacker|50000.0|1989|10|1 3 | Tony Tester|40000.0|1990|3|15 4 | -------------------------------------------------------------------------------- /corejava/v2ch03/transform/makeprop.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | employee..name= 12 | employee..salary= 14 | employee..hiredate=-- 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /corejava/v2ch03/write/XMLWriteTest.java: -------------------------------------------------------------------------------- 1 | package write; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program shows how to write an XML file. It saves a file describing a modern drawing in SVG 8 | * format. 9 | * @version 1.12 2016-04-27 10 | * @author Cay Horstmann 11 | */ 12 | public class XMLWriteTest 13 | { 14 | public static void main(String[] args) 15 | { 16 | EventQueue.invokeLater(() -> 17 | { 18 | JFrame frame = new XMLWriteFrame(); 19 | frame.setTitle("XMLWriteTest"); 20 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 21 | frame.setVisible(true); 22 | }); 23 | } 24 | } -------------------------------------------------------------------------------- /corejava/v2ch04/mail/mail.properties: -------------------------------------------------------------------------------- 1 | mail.transport.protocol=smtps 2 | mail.smtps.auth=true 3 | mail.smtps.host=smtp.gmail.com 4 | mail.smtps.user=cayhorstmann@gmail.com 5 | -------------------------------------------------------------------------------- /corejava/v2ch04/mail/message.txt: -------------------------------------------------------------------------------- 1 | president@whitehouse.gov 2 | you@yourcompany.com 3 | Invitation 4 | Dear You: 5 | 6 | It is my pleasure to invite you to a black-tie reception 7 | on the front lawn of the White House on April 1, 2013. 8 | 9 | Sincerely, 10 | 11 | 12 | Barack Obama 13 | -------------------------------------------------------------------------------- /corejava/v2ch04/post/post.properties: -------------------------------------------------------------------------------- 1 | # https://www.ssa.gov/locator 2 | # url=https://secure.ssa.gov/ICON/ic001.do 3 | # zipCodeSearched=94118 4 | url=https://tools.usps.com/go/ZipLookupAction.action 5 | User-Agent=HTTPie/0.9.2 6 | redirects=10 7 | tCompany= 8 | tAddress=1 Market Street 9 | tApt= 10 | tCity=San Francisco 11 | sState=CA 12 | mode=1 -------------------------------------------------------------------------------- /corejava/v2ch04/socket/SocketTest.java: -------------------------------------------------------------------------------- 1 | package socket; 2 | 3 | import java.io.*; 4 | import java.net.*; 5 | import java.util.*; 6 | 7 | /** 8 | * This program makes a socket connection to the atomic clock in Boulder, Colorado, and prints 9 | * the time that the server sends. 10 | * 11 | * @version 1.21 2016-04-27 12 | * @author Cay Horstmann 13 | */ 14 | public class SocketTest 15 | { 16 | public static void main(String[] args) throws IOException 17 | { 18 | try (Socket s = new Socket("time-a.nist.gov", 13); 19 | Scanner in = new Scanner(s.getInputStream(), "UTF-8")) 20 | { 21 | while (in.hasNextLine()) 22 | { 23 | String line = in.nextLine(); 24 | System.out.println(line); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /corejava/v2ch05/Publishers.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Publishers (Publisher_Id CHAR(6), Name CHAR(30), URL CHAR(80)); 2 | INSERT INTO Publishers VALUES ('0201', 'Addison-Wesley', 'www.aw-bc.com'); 3 | INSERT INTO Publishers VALUES ('0471', 'John Wiley & Sons', 'www.wiley.com'); 4 | INSERT INTO Publishers VALUES ('0262', 'MIT Press', 'mitpress.mit.edu'); 5 | INSERT INTO Publishers VALUES ('0596', 'O''Reilly', 'www.ora.com'); 6 | INSERT INTO Publishers VALUES ('019', 'Oxford University Press', 'www.oup.co.uk'); 7 | INSERT INTO Publishers VALUES ('013', 'Prentice Hall', 'www.phptr.com'); 8 | INSERT INTO Publishers VALUES ('0679', 'Random House', 'www.randomhouse.com'); 9 | INSERT INTO Publishers VALUES ('07434', 'Simon & Schuster', 'www.simonsays.com'); 10 | SELECT * FROM Publishers; 11 | -------------------------------------------------------------------------------- /corejava/v2ch05/database.properties: -------------------------------------------------------------------------------- 1 | #jdbc.drivers=org.apache.derby.jdbc.ClientDriver 2 | jdbc.url=jdbc:derby://localhost:1527/COREJAVA;create=true 3 | jdbc.username=dbuser 4 | jdbc.password=secret 5 | -------------------------------------------------------------------------------- /corejava/v2ch05/derby.log: -------------------------------------------------------------------------------- 1 | Sat Sep 29 12:42:21 PDT 2012 : Apache Derby Serveur réseau - 10.8.2.2 - (1181258) démarré et prêt à accepter les connexions sur le port 1527 2 | ---------------------------------------------------------------- 3 | Sat Sep 29 12:42:30 PDT 2012: 4 | Amorçage de Derby version The Apache Software Foundation - Apache Derby - 10.8.2.2 - (1181258) : instance a816c00e-013a-138d-0c27-00003f9cbb5b 5 | dans le répertoire de base de données /data/cay/books/cj9/code/v2ch04/COREJAVA avec le chargeur de classe sun.misc.Launcher$AppClassLoader@b99e4c 6 | 7 | java.vendor=Oracle Corporation 8 | java.runtime.version=1.7.0_07-b10 9 | user.dir=/data/cay/books/cj9/code/v2ch04 10 | derby.system.home=/data/cay/books/cj9/code/v2ch04 11 | Chargeur de classe de la base de données démarré - derby.database.classpath='' 12 | -------------------------------------------------------------------------------- /corejava/v2ch07/retire/RetireResources.java: -------------------------------------------------------------------------------- 1 | package retire; 2 | 3 | import java.awt.*; 4 | 5 | /** 6 | * These are the English non-string resources for the retirement calculator. 7 | * @version 1.21 2001-08-27 8 | * @author Cay Horstmann 9 | */ 10 | public class RetireResources extends java.util.ListResourceBundle 11 | { 12 | private static final Object[][] contents = { 13 | // BEGIN LOCALIZE 14 | { "colorPre", Color.blue }, { "colorGain", Color.white }, { "colorLoss", Color.red } 15 | // END LOCALIZE 16 | }; 17 | 18 | public Object[][] getContents() 19 | { 20 | return contents; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /corejava/v2ch07/retire/RetireResources_de.java: -------------------------------------------------------------------------------- 1 | package retire; 2 | 3 | import java.awt.*; 4 | 5 | /** 6 | * These are the German non-string resources for the retirement calculator. 7 | * @version 1.21 2001-08-27 8 | * @author Cay Horstmann 9 | */ 10 | public class RetireResources_de extends java.util.ListResourceBundle 11 | { 12 | private static final Object[][] contents = { 13 | // BEGIN LOCALIZE 14 | { "colorPre", Color.yellow }, { "colorGain", Color.black }, { "colorLoss", Color.red } 15 | // END LOCALIZE 16 | }; 17 | 18 | public Object[][] getContents() 19 | { 20 | return contents; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /corejava/v2ch07/retire/RetireResources_zh.java: -------------------------------------------------------------------------------- 1 | package retire; 2 | 3 | import java.awt.*; 4 | 5 | /** 6 | * These are the Chinese non-string resources for the retirement calculator. 7 | * @version 1.21 2001-08-27 8 | * @author Cay Horstmann 9 | */ 10 | public class RetireResources_zh extends java.util.ListResourceBundle 11 | { 12 | private static final Object[][] contents = { 13 | // BEGIN LOCALIZE 14 | { "colorPre", Color.red }, { "colorGain", Color.blue }, { "colorLoss", Color.yellow } 15 | // END LOCALIZE 16 | }; 17 | 18 | public Object[][] getContents() 19 | { 20 | return contents; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /corejava/v2ch07/retire/RetireStrings.properties: -------------------------------------------------------------------------------- 1 | language=Language 2 | computeButton=Compute 3 | savings=Prior Savings 4 | contrib=Annual Contribution 5 | income=Retirement Income 6 | currentAge=Current Age 7 | retireAge=Retirement Age 8 | deathAge=Life Expectancy 9 | inflationPercent=Inflation 10 | investPercent=Investment Return 11 | retire=Age: {0,number} Balance: {1,number,currency} 12 | -------------------------------------------------------------------------------- /corejava/v2ch07/retire/RetireStrings_de.properties: -------------------------------------------------------------------------------- 1 | language=Sprache 2 | computeButton=Rechnen 3 | savings=Vorherige Ersparnisse 4 | contrib=J\u00e4hrliche Einzahlung 5 | income=Einkommen nach Ruhestand 6 | currentAge=Jetziges Alter 7 | retireAge=Ruhestandsalter 8 | deathAge=Lebenserwartung 9 | inflationPercent=Inflation 10 | investPercent=Investitionsgewinn 11 | retire=Alter: {0,number} Guthaben: {1,number,currency} 12 | -------------------------------------------------------------------------------- /corejava/v2ch07/retire/RetireStrings_zh.properties: -------------------------------------------------------------------------------- 1 | language=\u8bed\u8a00 2 | computeButton=\u8ba1\u7b97 3 | savings=\u65e2\u5b58 4 | contrib=\u6bcf\u5e74\u5b58\u91d1 5 | income=\u9000\u4f11\u6536\u5165 6 | currentAge=\u73b0\u9f84 7 | retireAge=\u9000\u4f11\u5e74\u9f84 8 | deathAge=\u9884\u671f\u5bff\u547d 9 | inflationPercent=\u901a\u8d27\u81a8\u6da8 10 | investPercent=\u6295\u8d44\u62a5\u916c 11 | retire=\u5e74\u9f84: {0,number} \u603b\u7ed3: {1,number,currency} 12 | -------------------------------------------------------------------------------- /corejava/v2ch08/buttons1/Renjin.properties: -------------------------------------------------------------------------------- 1 | yellowButton.action=panel$background <- Color$YELLOW 2 | blueButton.action=panel$background <- Color$BLUE 3 | redButton.action=panel$background <- Color$RED 4 | -------------------------------------------------------------------------------- /corejava/v2ch08/buttons1/groovy.properties: -------------------------------------------------------------------------------- 1 | yellowButton.action=panel.background = java.awt.Color.YELLOW 2 | blueButton.action=panel.background = java.awt.Color.BLUE 3 | redButton.action=panel.background = java.awt.Color.RED -------------------------------------------------------------------------------- /corejava/v2ch08/buttons1/init.Renjin: -------------------------------------------------------------------------------- 1 | import(java.awt.Color) 2 | -------------------------------------------------------------------------------- /corejava/v2ch08/buttons1/init.sisc: -------------------------------------------------------------------------------- 1 | (import s2j) 2 | (define-generic-java-method set-background) 3 | (define-java-class ) 4 | (define-generic-java-field-accessor :yellow) 5 | (define-generic-java-field-accessor :blue) 6 | (define-generic-java-field-accessor :red) 7 | -------------------------------------------------------------------------------- /corejava/v2ch08/buttons1/nashorn.properties: -------------------------------------------------------------------------------- 1 | yellowButton.action=panel.background = java.awt.Color.YELLOW 2 | blueButton.action=panel.background = java.awt.Color.BLUE 3 | redButton.action=panel.background = java.awt.Color.RED -------------------------------------------------------------------------------- /corejava/v2ch08/buttons1/sisc.properties: -------------------------------------------------------------------------------- 1 | # SISC Scheme (http://sisc-scheme.org) 2 | yellowButton.action=(set-background (var 'panel) (:yellow (java-null ))) 3 | blueButton.action= (set-background (var 'panel) (:blue (java-null ))) 4 | redButton.action=(set-background (var 'panel) (:red (java-null ))) 5 | -------------------------------------------------------------------------------- /corejava/v2ch08/buttons2/action.properties: -------------------------------------------------------------------------------- 1 | yellowButton=panel.setBackground(java.awt.Color.YELLOW); 2 | blueButton=panel.setBackground(java.awt.Color.BLUE); 3 | redButton=panel.setBackground(java.awt.Color.RED); -------------------------------------------------------------------------------- /corejava/v2ch08/buttons3/ButtonTest.java: -------------------------------------------------------------------------------- 1 | package buttons3; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.01 2016-05-10 8 | * @author Cay Horstmann 9 | */ 10 | public class ButtonTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> 15 | { 16 | 17 | ButtonFrame frame = new ButtonFrame(); 18 | frame.setTitle("ButtonTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch08/bytecodeAnnotations/EntryLoggingAgent.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch08/bytecodeAnnotations/EntryLoggingAgent.jar -------------------------------------------------------------------------------- /corejava/v2ch08/bytecodeAnnotations/EntryLoggingAgent.mf: -------------------------------------------------------------------------------- 1 | Premain-Class: bytecodeAnnotations.EntryLoggingAgent 2 | -------------------------------------------------------------------------------- /corejava/v2ch08/bytecodeAnnotations/LogEntry.java: -------------------------------------------------------------------------------- 1 | package bytecodeAnnotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @version 1.00 2004-08-17 7 | * @author Cay Horstmann 8 | */ 9 | @Target(ElementType.METHOD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface LogEntry 12 | { 13 | String logger(); 14 | } 15 | -------------------------------------------------------------------------------- /corejava/v2ch08/rect/Point.java: -------------------------------------------------------------------------------- 1 | package rect; 2 | 3 | import sourceAnnotations.ToString; 4 | 5 | @ToString(includeName=false) 6 | public class Point { 7 | private int x; 8 | private int y; 9 | public Point(int x, int y) { 10 | this.x = x; 11 | this.y = y; 12 | } 13 | @ToString(includeName=false) public int getX() { return x; } 14 | @ToString(includeName=false) public int getY() { return y; } 15 | } 16 | -------------------------------------------------------------------------------- /corejava/v2ch08/rect/Rectangle.java: -------------------------------------------------------------------------------- 1 | package rect; 2 | 3 | import sourceAnnotations.ToString; 4 | 5 | @ToString 6 | public class Rectangle { 7 | private Point topLeft; 8 | private int width; 9 | private int height; 10 | public Rectangle(Point topLeft, int width, int height) { 11 | this.topLeft = topLeft; 12 | this.width = width; 13 | this.height = height; 14 | } 15 | @ToString(includeName=false) public Point getTopLeft() { return topLeft; } 16 | @ToString public int getWidth() { return width; } 17 | @ToString public int getHeight() { return height; } 18 | } 19 | -------------------------------------------------------------------------------- /corejava/v2ch08/rect/SourceLevelAnnotationDemo.java: -------------------------------------------------------------------------------- 1 | package rect; 2 | 3 | import sourceAnnotations.ToStrings; 4 | 5 | public class SourceLevelAnnotationDemo 6 | { 7 | public static void main(String[] args) 8 | { 9 | Rectangle rect = new Rectangle(new Point(10, 10), 20, 30); 10 | System.out.println(ToStrings.toString(rect)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /corejava/v2ch08/runtimeAnnotations/ActionListenerFor.java: -------------------------------------------------------------------------------- 1 | package runtimeAnnotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @version 1.00 2004-08-17 7 | * @author Cay Horstmann 8 | */ 9 | 10 | @Target(ElementType.METHOD) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | public @interface ActionListenerFor 13 | { 14 | String source(); 15 | } 16 | -------------------------------------------------------------------------------- /corejava/v2ch08/set/SetTest.java: -------------------------------------------------------------------------------- 1 | package set; 2 | 3 | import java.util.*; 4 | import java.util.logging.*; 5 | 6 | /** 7 | * @version 1.02 2012-01-26 8 | * @author Cay Horstmann 9 | */ 10 | public class SetTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | Logger.getLogger("com.horstmann").setLevel(Level.FINEST); 15 | Handler handler = new ConsoleHandler(); 16 | handler.setLevel(Level.FINEST); 17 | Logger.getLogger("com.horstmann").addHandler(handler); 18 | 19 | Set parts = new HashSet<>(); 20 | parts.add(new Item("Toaster", 1279)); 21 | parts.add(new Item("Microwave", 4104)); 22 | parts.add(new Item("Toaster", 1279)); 23 | System.out.println(parts); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /corejava/v2ch08/sourceAnnotations/ToString.java: -------------------------------------------------------------------------------- 1 | package sourceAnnotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target({ElementType.METHOD, ElementType.TYPE}) 9 | @Retention(RetentionPolicy.SOURCE) 10 | public @interface ToString { 11 | boolean includeName() default true; 12 | } -------------------------------------------------------------------------------- /corejava/v2ch09/Calculator.caesar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/Calculator.caesar -------------------------------------------------------------------------------- /corejava/v2ch09/CalculatorFrame.caesar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/CalculatorFrame.caesar -------------------------------------------------------------------------------- /corejava/v2ch09/CalculatorPanel$1.caesar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/CalculatorPanel$1.caesar -------------------------------------------------------------------------------- /corejava/v2ch09/CalculatorPanel$CommandAction.caesar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/CalculatorPanel$CommandAction.caesar -------------------------------------------------------------------------------- /corejava/v2ch09/CalculatorPanel$InsertAction.caesar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/CalculatorPanel$InsertAction.caesar -------------------------------------------------------------------------------- /corejava/v2ch09/CalculatorPanel.caesar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/CalculatorPanel.caesar -------------------------------------------------------------------------------- /corejava/v2ch09/FileReadApplet.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /corejava/v2ch09/applet.policy: -------------------------------------------------------------------------------- 1 | keystore "client.certs", "JKS"; 2 | 3 | grant signedby "acmeroot" 4 | { 5 | permission java.lang.RuntimePermission "usePolicy"; 6 | permission java.io.FilePermission "/etc/*", "read"; 7 | }; 8 | -------------------------------------------------------------------------------- /corejava/v2ch09/auth/AuthTest.policy: -------------------------------------------------------------------------------- 1 | grant codebase "file:login.jar" 2 | { 3 | permission javax.security.auth.AuthPermission "createLoginContext.Login1"; 4 | permission javax.security.auth.AuthPermission "doAsPrivileged"; 5 | }; 6 | 7 | grant principal com.sun.security.auth.UnixPrincipal "harry" 8 | { 9 | permission java.util.PropertyPermission "user.*", "read"; 10 | }; 11 | -------------------------------------------------------------------------------- /corejava/v2ch09/auth/SysPropAction.java: -------------------------------------------------------------------------------- 1 | package auth; 2 | 3 | import java.security.*; 4 | 5 | /** 6 | This action looks up a system property. 7 | * @version 1.01 2007-10-06 8 | * @author Cay Horstmann 9 | */ 10 | public class SysPropAction implements PrivilegedAction 11 | { 12 | private String propertyName; 13 | 14 | /** 15 | Constructs an action for looking up a given property. 16 | @param propertyName the property name (such as "user.home") 17 | */ 18 | public SysPropAction(String propertyName) { this.propertyName = propertyName; } 19 | 20 | public String run() 21 | { 22 | return System.getProperty(propertyName); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /corejava/v2ch09/auth/action.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/auth/action.jar -------------------------------------------------------------------------------- /corejava/v2ch09/auth/jaas.config: -------------------------------------------------------------------------------- 1 | Login1 2 | { 3 | com.sun.security.auth.module.UnixLoginModule required; 4 | }; 5 | -------------------------------------------------------------------------------- /corejava/v2ch09/auth/login.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch09/auth/login.jar -------------------------------------------------------------------------------- /corejava/v2ch09/hash/input.txt: -------------------------------------------------------------------------------- 1 | Upon my death, my property shall be divided equally among my children; however, my son George shall receive nothing. 2 | -------------------------------------------------------------------------------- /corejava/v2ch09/jaas/JAASTest.java: -------------------------------------------------------------------------------- 1 | package jaas; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program authenticates a user via a custom login and then looks up a system property with the 8 | * user's privileges. 9 | * @version 1.02 2016-05-10 10 | * @author Cay Horstmann 11 | */ 12 | public class JAASTest 13 | { 14 | public static void main(final String[] args) 15 | { 16 | System.setSecurityManager(new SecurityManager()); 17 | EventQueue.invokeLater(() -> 18 | { 19 | JFrame frame = new JAASFrame(); 20 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 21 | frame.setTitle("JAASTest"); 22 | frame.setVisible(true); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /corejava/v2ch09/jaas/JAASTest.policy: -------------------------------------------------------------------------------- 1 | grant codebase "file:login.jar" 2 | { 3 | permission java.awt.AWTPermission "showWindowWithoutWarningBanner"; 4 | permission java.awt.AWTPermission "accessEventQueue"; 5 | permission javax.security.auth.AuthPermission "createLoginContext.Login1"; 6 | permission javax.security.auth.AuthPermission "doAsPrivileged"; 7 | permission javax.security.auth.AuthPermission "modifyPrincipals"; 8 | permission java.io.FilePermission "jaas/password.txt", "read"; 9 | }; 10 | 11 | grant principal jaas.SimplePrincipal "role=admin" 12 | { 13 | permission java.util.PropertyPermission "*", "read"; 14 | }; 15 | -------------------------------------------------------------------------------- /corejava/v2ch09/jaas/SysPropAction.java: -------------------------------------------------------------------------------- 1 | package jaas; 2 | 3 | import java.security.*; 4 | 5 | /** 6 | * This action looks up a system property. 7 | */ 8 | public class SysPropAction implements PrivilegedAction 9 | { 10 | private String propertyName; 11 | 12 | /** 13 | * Constructs an action for looking up a given property. 14 | * @param propertyName the property name (such as "user.home") 15 | */ 16 | public SysPropAction(String propertyName) 17 | { 18 | this.propertyName = propertyName; 19 | } 20 | 21 | public String run() 22 | { 23 | return System.getProperty(propertyName); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /corejava/v2ch09/jaas/jaas.config: -------------------------------------------------------------------------------- 1 | Login1 2 | { 3 | jaas.SimpleLoginModule required pwfile="jaas/password.txt" debug=true; 4 | }; 5 | -------------------------------------------------------------------------------- /corejava/v2ch09/jaas/password.txt: -------------------------------------------------------------------------------- 1 | harry|secret|admin 2 | carl|guessme|HR -------------------------------------------------------------------------------- /corejava/v2ch09/permissions/PermissionTest.policy: -------------------------------------------------------------------------------- 1 | grant 2 | { 3 | permission permissions.WordCheckPermission "sex,drugs,C++", "avoid"; 4 | }; 5 | -------------------------------------------------------------------------------- /corejava/v2ch09/verifier/VerifierTest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /corejava/v2ch10/editorPane/EditorPaneTest.java: -------------------------------------------------------------------------------- 1 | package editorPane; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates how to display HTML documents in an editor pane. 8 | * @version 1.05 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class EditorPaneTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new EditorPaneFrame(); 18 | frame.setTitle("EditorPaneTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Earth.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/InternalFrameTest.java: -------------------------------------------------------------------------------- 1 | package internalFrame; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the use of internal frames. 8 | * @version 1.12 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class InternalFrameTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new DesktopFrame(); 18 | frame.setTitle("InternalFrameTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Jupiter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Jupiter.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Mars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Mars.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Mercury.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Mercury.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Neptune.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Neptune.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Pluto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Pluto.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Saturn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Saturn.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Uranus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Uranus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/Venus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/Venus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/internalFrame/document.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/internalFrame/document.gif -------------------------------------------------------------------------------- /corejava/v2ch10/layer/LayerTest.java: -------------------------------------------------------------------------------- 1 | package layer; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates how a layer can decorate a Swing component. 8 | * @version 1.01 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class LayerTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ColorFrame(); 18 | frame.setTitle("LayerTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/list/ListTest.java: -------------------------------------------------------------------------------- 1 | package list; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates a simple fixed list of strings. 8 | * @version 1.25 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ListTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ListFrame(); 18 | frame.setTitle("ListTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/listRendering/ListRenderingTest.java: -------------------------------------------------------------------------------- 1 | package listRendering; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the use of cell renderers in a list box. 8 | * @version 1.25 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ListRenderingTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ListRenderingFrame(); 18 | frame.setTitle("ListRenderingTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/longList/LongListTest.java: -------------------------------------------------------------------------------- 1 | package longList; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates a list that dynamically computes list entries. 8 | * @version 1.24 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class LongListTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new LongListFrame(); 18 | frame.setTitle("LongListTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /corejava/v2ch10/progressBar/ProgressBarTest.java: -------------------------------------------------------------------------------- 1 | package progressBar; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the use of a progress bar to monitor the progress of a thread. 8 | * @version 1.05 2012-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ProgressBarTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ProgressBarFrame(); 18 | frame.setTitle("ProgressBarTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /corejava/v2ch10/progressMonitor/ProgressMonitorTest.java: -------------------------------------------------------------------------------- 1 | package progressMonitor; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * A program to test a progress monitor dialog. 8 | * @version 1.05 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ProgressMonitorTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ProgressMonitorFrame(); 18 | frame.setTitle("ProgressMonitorTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/progressMonitorInputStream/ProgressMonitorInputStreamTest.java: -------------------------------------------------------------------------------- 1 | package progressMonitorInputStream; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * A program to test a progress monitor input stream. 8 | * @version 1.06 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ProgressMonitorInputStreamTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new TextFrame(); 18 | frame.setTitle("ProgressMonitorInputStreamTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/spinner/SpinnerTest.java: -------------------------------------------------------------------------------- 1 | package spinner; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * A program to test spinners. 8 | * @version 1.03 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class SpinnerTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new SpinnerFrame(); 18 | frame.setTitle("SpinnerTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Earth.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Jupiter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Jupiter.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Mars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Mars.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Mercury.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Mercury.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Neptune.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Neptune.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Pluto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Pluto.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Saturn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Saturn.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/SplitPaneTest.java: -------------------------------------------------------------------------------- 1 | package splitPane; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the split pane component organizer. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class SplitPaneTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new SplitPaneFrame(); 18 | frame.setTitle("SplitPaneTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Uranus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Uranus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/splitPane/Venus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/splitPane/Venus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Earth.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Jupiter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Jupiter.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Mars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Mars.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Mercury.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Mercury.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Neptune.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Neptune.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Pluto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Pluto.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Saturn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Saturn.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/TabbedPaneTest.java: -------------------------------------------------------------------------------- 1 | package tabbedPane; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the tabbed pane component organizer. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class TabbedPaneTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new TabbedPaneFrame(); 18 | frame.setTitle("TabbedPaneTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Uranus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Uranus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/Venus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/Venus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/red-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/red-ball.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tabbedPane/yellow-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tabbedPane/yellow-ball.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/ColorTableCellRenderer.java: -------------------------------------------------------------------------------- 1 | package tableCellRender; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | import javax.swing.table.*; 6 | 7 | /** 8 | * This renderer renders a color value as a panel with the given color. 9 | */ 10 | public class ColorTableCellRenderer extends JPanel implements TableCellRenderer 11 | { 12 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, 13 | boolean hasFocus, int row, int column) 14 | { 15 | setBackground((Color) value); 16 | if (hasFocus) setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); 17 | else setBorder(null); 18 | return this; 19 | } 20 | } -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Earth.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Jupiter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Jupiter.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Mars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Mars.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Mercury.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Mercury.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Moons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Moons.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Neptune.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Neptune.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Pluto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Pluto.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Saturn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Saturn.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/TableCellRenderTest.java: -------------------------------------------------------------------------------- 1 | package tableCellRender; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates cell rendering and editing in a table. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class TableCellRenderTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | 18 | JFrame frame = new TableCellRenderFrame(); 19 | frame.setTitle("TableCellRenderTest"); 20 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 21 | frame.setVisible(true); 22 | }); 23 | } 24 | } -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Uranus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Uranus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableCellRender/Venus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableCellRender/Venus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Earth.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Jupiter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Jupiter.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Mars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Mars.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Mercury.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Mercury.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Neptune.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Neptune.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Pluto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Pluto.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Saturn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Saturn.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/TableRowColumnTest.java: -------------------------------------------------------------------------------- 1 | package tableRowColumn; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates how to work with rows and columns in a table. 8 | * @version 1.22 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class TableRowColumnTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new PlanetTableFrame(); 18 | frame.setTitle("TableRowColumnTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Uranus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Uranus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableRowColumn/Venus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/tableRowColumn/Venus.gif -------------------------------------------------------------------------------- /corejava/v2ch10/tableSelection/TableSelectionTest.java: -------------------------------------------------------------------------------- 1 | package tableSelection; 2 | 3 | /** 4 | @version 1.04 2016-05-10 5 | @author Cay Horstmann 6 | */ 7 | 8 | import java.awt.*; 9 | import javax.swing.*; 10 | 11 | /** 12 | * This program demonstrates selection, addition, and removal of rows and columns. 13 | */ 14 | public class TableSelectionTest 15 | { 16 | public static void main(String[] args) 17 | { 18 | EventQueue.invokeLater(() -> 19 | { 20 | JFrame frame = new TableSelectionFrame(); 21 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 22 | frame.setVisible(true); 23 | }); 24 | } 25 | } -------------------------------------------------------------------------------- /corejava/v2ch10/textChange/ChangeTrackingTest.java: -------------------------------------------------------------------------------- 1 | package textChange; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * @version 1.41 2016-05-10 8 | * @author Cay Horstmann 9 | */ 10 | public class ChangeTrackingTest 11 | { 12 | public static void main(String[] args) 13 | { 14 | EventQueue.invokeLater(() -> 15 | { 16 | JFrame frame = new ColorFrame(); 17 | frame.setTitle("ChangeTrackingTest"); 18 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 19 | frame.setVisible(true); 20 | }); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v2ch10/textFormat/FormatTest.java: -------------------------------------------------------------------------------- 1 | package textFormat; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * A program to test formatted text fields 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class FormatTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new FormatTestFrame(); 18 | frame.setTitle("FormatTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /corejava/v2ch10/tree/SimpleTree.java: -------------------------------------------------------------------------------- 1 | package tree; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program shows a simple tree. 8 | * @version 1.03 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class SimpleTree 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new SimpleTreeFrame(); 18 | frame.setTitle("SimpleTree"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /corejava/v2ch10/treeEdit/TreeEditTest.java: -------------------------------------------------------------------------------- 1 | package treeEdit; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates tree editing. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class TreeEditTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new TreeEditFrame(); 18 | frame.setTitle("TreeEditTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch10/treeModel/ObjectInspectorTest.java: -------------------------------------------------------------------------------- 1 | package treeModel; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates how to use a custom tree model. It displays the fields of an object. 8 | * @version 1.05 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ObjectInspectorTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ObjectInspectorFrame(); 18 | frame.setTitle("ObjectInspectorTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /corejava/v2ch10/treeRender/ClassTree.java: -------------------------------------------------------------------------------- 1 | package treeRender; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates cell rendering and listening to tree selection events. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ClassTree 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ClassTreeFrame(); 18 | frame.setTitle("ClassTree"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /corejava/v2ch10/treeRender/blue-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/treeRender/blue-ball.gif -------------------------------------------------------------------------------- /corejava/v2ch10/treeRender/red-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/treeRender/red-ball.gif -------------------------------------------------------------------------------- /corejava/v2ch10/treeRender/yellow-ball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch10/treeRender/yellow-ball.gif -------------------------------------------------------------------------------- /corejava/v2ch11/book/BookTest.java: -------------------------------------------------------------------------------- 1 | package book; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the printing of a multi-page book. It prints a "banner", by blowing up 8 | * a text string to fill the entire page vertically. The program also contains a generic print 9 | * preview dialog. 10 | * @version 1.13 2016-05-10 11 | * @author Cay Horstmann 12 | */ 13 | public class BookTest 14 | { 15 | public static void main(String[] args) 16 | { 17 | EventQueue.invokeLater(() -> 18 | { 19 | JFrame frame = new BookTestFrame(); 20 | frame.setTitle("BookTest"); 21 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 22 | frame.setVisible(true); 23 | }); 24 | } 25 | } -------------------------------------------------------------------------------- /corejava/v2ch11/cj2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/cj2.gif -------------------------------------------------------------------------------- /corejava/v2ch11/cj8v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/cj8v2.png -------------------------------------------------------------------------------- /corejava/v2ch11/composite/CompositeTest.java: -------------------------------------------------------------------------------- 1 | package composite; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the Porter-Duff composition rules. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class CompositeTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new CompositeTestFrame(); 18 | frame.setTitle("CompositeTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /corejava/v2ch11/desktopApp/DesktopAppTest.java: -------------------------------------------------------------------------------- 1 | package desktopApp; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the desktop app API. 8 | * @version 1.01 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class DesktopAppTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new DesktopAppFrame(); 18 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 19 | frame.setVisible(true); 20 | }); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v2ch11/dnd/SwingDnDTest.java: -------------------------------------------------------------------------------- 1 | package dnd; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the basic Swing support for drag and drop. 8 | * @version 1.11 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class SwingDnDTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new SwingDnDFrame(); 18 | frame.setTitle("SwingDnDTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/ImageListDnDTest.java: -------------------------------------------------------------------------------- 1 | package dndImage; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates drag and drop in an image list. 8 | * @version 1.02 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ImageListDnDTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ImageListDnDFrame(); 18 | frame.setTitle("ImageListDnDTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Jupiter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Jupiter.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Mars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Mars.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Mercury.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Mercury.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Neptune.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Neptune.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Pluto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Pluto.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Uranus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Uranus.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images1/Venus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images1/Venus.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images2/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images2/Earth.gif -------------------------------------------------------------------------------- /corejava/v2ch11/dndImage/images2/Saturn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/dndImage/images2/Saturn.gif -------------------------------------------------------------------------------- /corejava/v2ch11/imageIO/ImageIOTest.java: -------------------------------------------------------------------------------- 1 | package imageIO; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program lets you read and write image files in the formats that the JDK supports. Multi-file 8 | * images are supported. 9 | * @version 1.04 2016-05-10 10 | * @author Cay Horstmann 11 | */ 12 | public class ImageIOTest 13 | { 14 | public static void main(String[] args) 15 | { 16 | EventQueue.invokeLater(() -> 17 | { 18 | JFrame frame = new ImageIOFrame(); 19 | frame.setTitle("CompositeTest"); 20 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 21 | frame.setVisible(true); 22 | }); 23 | } 24 | } -------------------------------------------------------------------------------- /corejava/v2ch11/imageIO/e-mail.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/imageIO/e-mail.gif -------------------------------------------------------------------------------- /corejava/v2ch11/imageProcessing/ImageProcessingTest.java: -------------------------------------------------------------------------------- 1 | package imageProcessing; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates various image processing operations. 8 | * @version 1.04 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class ImageProcessingTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new ImageProcessingFrame(); 18 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 19 | frame.setVisible(true); 20 | }); 21 | } 22 | } -------------------------------------------------------------------------------- /corejava/v2ch11/imageTransfer/ImageTransferTest.java: -------------------------------------------------------------------------------- 1 | package imageTransfer; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the transfer of images between a Java application and the system 8 | * clipboard. 9 | * @version 1.23 2016-05-10 10 | * @author Cay Horstmann 11 | */ 12 | public class ImageTransferTest 13 | { 14 | public static void main(String[] args) 15 | { 16 | EventQueue.invokeLater(() -> 17 | { 18 | JFrame frame = new ImageTransferFrame(); 19 | frame.setTitle("ImageTransferTest"); 20 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 21 | frame.setVisible(true); 22 | }); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /corejava/v2ch11/print/PrintTest.java: -------------------------------------------------------------------------------- 1 | package print; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates how to print 2D graphics 8 | * @version 1.13 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class PrintTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new PrintTestFrame(); 18 | frame.setTitle("PrintTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch11/rasterImage/RasterImageTest.java: -------------------------------------------------------------------------------- 1 | package rasterImage; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates how to build up an image from individual pixels. 8 | * @version 1.14 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class RasterImageTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new RasterImageFrame(); 18 | frame.setTitle("RasterImageTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch11/renderQuality/RenderQualityTest.java: -------------------------------------------------------------------------------- 1 | package renderQuality; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the effect of the various rendering hints. 8 | * @version 1.11 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class RenderQualityTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new RenderQualityTestFrame(); 18 | frame.setTitle("RenderQualityTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch11/renderQuality/face.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/renderQuality/face.gif -------------------------------------------------------------------------------- /corejava/v2ch11/serialTransfer/SerialTransferTest.java: -------------------------------------------------------------------------------- 1 | package serialTransfer; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the transfer of serialized objects between virtual machines. 8 | * @version 1.03 2016-05-10 9 | * @author Cay Horstmann 10 | */ 11 | public class SerialTransferTest 12 | { 13 | public static void main(String[] args) 14 | { 15 | EventQueue.invokeLater(() -> 16 | { 17 | JFrame frame = new SerialTransferFrame(); 18 | frame.setTitle("SerialTransferTest"); 19 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 20 | frame.setVisible(true); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /corejava/v2ch11/splashScreen/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/splashScreen/splash.png -------------------------------------------------------------------------------- /corejava/v2ch11/systemTray/cookie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/corejava/v2ch11/systemTray/cookie.png -------------------------------------------------------------------------------- /corejava/v2ch11/transferText/TextTransferTest.java: -------------------------------------------------------------------------------- 1 | package transferText; 2 | 3 | import java.awt.*; 4 | import javax.swing.*; 5 | 6 | /** 7 | * This program demonstrates the transfer of text between a Java application and the system 8 | * clipboard. 9 | * @version 1.14 2016-05-10 10 | * @author Cay Horstmann 11 | */ 12 | public class TextTransferTest 13 | { 14 | public static void main(String[] args) 15 | { 16 | EventQueue.invokeLater(() -> 17 | { 18 | JFrame frame = new TextTransferFrame(); 19 | frame.setTitle("TextTransferTest"); 20 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 21 | frame.setVisible(true); 22 | }); 23 | } 24 | } -------------------------------------------------------------------------------- /corejava/v2ch12/employee/Employee.c: -------------------------------------------------------------------------------- 1 | /** 2 | @version 1.10 1999-11-13 3 | @author Cay Horstmann 4 | */ 5 | 6 | #include "Employee.h" 7 | 8 | #include 9 | 10 | JNIEXPORT void JNICALL Java_Employee_raiseSalary(JNIEnv* env, jobject this_obj, jdouble byPercent) 11 | { 12 | /* get the class */ 13 | jclass class_Employee = (*env)->GetObjectClass(env, this_obj); 14 | 15 | /* get the field ID */ 16 | jfieldID id_salary = (*env)->GetFieldID(env, class_Employee, "salary", "D"); 17 | 18 | /* get the field value */ 19 | jdouble salary = (*env)->GetDoubleField(env, this_obj, id_salary); 20 | 21 | salary *= 1 + byPercent / 100; 22 | 23 | /* set the field value */ 24 | (*env)->SetDoubleField(env, this_obj, id_salary, salary); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /corejava/v2ch12/employee/Employee.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.10 1999-11-13 3 | * @author Cay Horstmann 4 | */ 5 | 6 | public class Employee 7 | { 8 | private String name; 9 | private double salary; 10 | 11 | public native void raiseSalary(double byPercent); 12 | 13 | public Employee(String n, double s) 14 | { 15 | name = n; 16 | salary = s; 17 | } 18 | 19 | public void print() 20 | { 21 | System.out.println(name + " " + salary); 22 | } 23 | 24 | static 25 | { 26 | System.loadLibrary("Employee"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /corejava/v2ch12/employee/EmployeeTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.10 1999-11-13 3 | * @author Cay Horstmann 4 | */ 5 | 6 | public class EmployeeTest 7 | { 8 | public static void main(String[] args) 9 | { 10 | Employee[] staff = new Employee[3]; 11 | 12 | staff[0] = new Employee("Harry Hacker", 35000); 13 | staff[1] = new Employee("Carl Cracker", 75000); 14 | staff[2] = new Employee("Tony Tester", 38000); 15 | 16 | for (Employee e : staff) 17 | e.raiseSalary(5); 18 | for (Employee e : staff) 19 | e.print(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /corejava/v2ch12/helloNative/HelloNative.c: -------------------------------------------------------------------------------- 1 | /* 2 | @version 1.10 1997-07-01 3 | @author Cay Horstmann 4 | */ 5 | 6 | #include "HelloNative.h" 7 | #include 8 | 9 | JNIEXPORT void JNICALL Java_HelloNative_greeting(JNIEnv* env, jclass cl) 10 | { 11 | printf("Hello Native World!\n"); 12 | } 13 | -------------------------------------------------------------------------------- /corejava/v2ch12/helloNative/HelloNative.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class HelloNative */ 4 | 5 | #ifndef _Included_HelloNative 6 | #define _Included_HelloNative 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: HelloNative 12 | * Method: greeting 13 | * Signature: ()V 14 | */ 15 | JNIEXPORT void JNICALL Java_HelloNative_greeting 16 | (JNIEnv *, jclass); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /corejava/v2ch12/helloNative/HelloNative.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.11 2007-10-26 3 | * @author Cay Horstmann 4 | */ 5 | class HelloNative 6 | { 7 | public static native void greeting(); 8 | } 9 | -------------------------------------------------------------------------------- /corejava/v2ch12/helloNative/HelloNativeTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.11 2007-10-26 3 | * @author Cay Horstmann 4 | */ 5 | class HelloNativeTest 6 | { 7 | public static void main(String[] args) 8 | { 9 | HelloNative.greeting(); 10 | } 11 | 12 | static 13 | { 14 | System.loadLibrary("HelloNative"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /corejava/v2ch12/invocation/Welcome.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.20 2004-02-28 3 | * @author Cay Horstmann 4 | */ 5 | public class Welcome 6 | { 7 | public static void main(String[] args) 8 | { 9 | String[] greeting = new String[3]; 10 | greeting[0] = "Welcome to Core Java"; 11 | greeting[1] = "by Cay Horstmann"; 12 | greeting[2] = "and Gary Cornell"; 13 | 14 | for (String g : greeting) 15 | System.out.println(g); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf1/Printf1.c: -------------------------------------------------------------------------------- 1 | /** 2 | @version 1.10 1997-07-01 3 | @author Cay Horstmann 4 | */ 5 | 6 | #include "Printf1.h" 7 | #include 8 | 9 | JNIEXPORT jint JNICALL Java_Printf1_print(JNIEnv* env, jclass cl, 10 | jint width, jint precision, jdouble x) 11 | { 12 | char fmt[30]; 13 | jint ret; 14 | sprintf(fmt, "%%%d.%df", width, precision); 15 | ret = printf(fmt, x); 16 | fflush(stdout); 17 | return ret; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf1/Printf1.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.10 1997-07-01 3 | * @author Cay Horstmann 4 | */ 5 | class Printf1 6 | { 7 | public static native int print(int width, int precision, double x); 8 | 9 | static 10 | { 11 | System.loadLibrary("Printf1"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf1/Printf1Test.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.10 1997-07-01 3 | * @author Cay Horstmann 4 | */ 5 | class Printf1Test 6 | { 7 | public static void main(String[] args) 8 | { 9 | int count = Printf1.print(8, 4, 3.14); 10 | count += Printf1.print(8, 4, count); 11 | System.out.println(); 12 | for (int i = 0; i < count; i++) 13 | System.out.print("-"); 14 | System.out.println(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf2/Printf2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.10 1997-07-01 3 | * @author Cay Horstmann 4 | */ 5 | class Printf2 6 | { 7 | public static native String sprint(String format, double x); 8 | 9 | static 10 | { 11 | System.loadLibrary("Printf2"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf2/Printf2Test.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @version 1.10 1997-07-01 3 | * @author Cay Horstmann 4 | */ 5 | class Printf2Test 6 | { 7 | public static void main(String[] args) 8 | { 9 | double price = 44.95; 10 | double tax = 7.75; 11 | double amountDue = price * (1 + tax / 100); 12 | 13 | String s = Printf2.sprint("Amount due = %8.2f", amountDue); 14 | System.out.println(s); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf3/Printf3.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | /** 4 | * @version 1.10 1997-07-01 5 | * @author Cay Horstmann 6 | */ 7 | class Printf3 8 | { 9 | public static native void fprint(PrintWriter out, String format, double x); 10 | 11 | static 12 | { 13 | System.loadLibrary("Printf3"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf3/Printf3Test.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | /** 4 | * @version 1.10 1997-07-01 5 | * @author Cay Horstmann 6 | */ 7 | class Printf3Test 8 | { 9 | public static void main(String[] args) 10 | { 11 | double price = 44.95; 12 | double tax = 7.75; 13 | double amountDue = price * (1 + tax / 100); 14 | PrintWriter out = new PrintWriter(System.out); 15 | Printf3.fprint(out, "Amount due = %8.2f\n", amountDue); 16 | out.flush(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf4/Printf4.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | /** 4 | * @version 1.10 1997-07-01 5 | * @author Cay Horstmann 6 | */ 7 | class Printf4 8 | { 9 | public static native void fprint(PrintWriter ps, String format, double x); 10 | 11 | static 12 | { 13 | System.loadLibrary("Printf4"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /corejava/v2ch12/printf4/Printf4Test.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | /** 4 | * @version 1.10 1997-07-01 5 | * @author Cay Horstmann 6 | */ 7 | class Printf4Test 8 | { 9 | public static void main(String[] args) 10 | { 11 | double price = 44.95; 12 | double tax = 7.75; 13 | double amountDue = price * (1 + tax / 100); 14 | PrintWriter out = new PrintWriter(System.out); 15 | /* This call will throw an exception--note the %% */ 16 | Printf4.fprint(out, "Amount due = %%8.2f\n", amountDue); 17 | out.flush(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_ImageViewer/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_ImageViewer/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch2_ImageViewer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_ImageViewer/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_ImageViewer/cay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/mysol/ch2/ch2_ImageViewer/cay.jpg -------------------------------------------------------------------------------- /mysol/ch2/ch2_ImageViewer/duke.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/mysol/ch2/ch2_ImageViewer/duke.gif -------------------------------------------------------------------------------- /mysol/ch2/ch2_ImageViewer/mug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/mysol/ch2/ch2_ImageViewer/mug.png -------------------------------------------------------------------------------- /mysol/ch2/ch2_RoadApplet/RoadApplet.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Permissions: sandbox 3 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_RoadApplet/makejar: -------------------------------------------------------------------------------- 1 | javac RoadApplet.java 2 | jar cvfm RoadApplet.jar RoadApplet.mf *.class 3 | rm *.class 4 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_welcome/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_welcome/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch2 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_welcome/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch2/ch2_welcome/src/ch2/ch2_welcome.java: -------------------------------------------------------------------------------- 1 | package ch2; 2 | 3 | public class ch2_welcome { 4 | 5 | public static void main(String[] args){ 6 | 7 | String greeting = "Welcome to Core Java!"; 8 | System.out.println(greeting); 9 | for (int i = 0; i < greeting.length(); i++){ 10 | System.out.print("="); 11 | } 12 | System.out.println(); 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_1_simple/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_1_simple/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_1_simple 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_1_simple/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_1_simple/src/ch3_1_simple/ch3_1_simple.java: -------------------------------------------------------------------------------- 1 | package ch3_1_simple; 2 | 3 | public class ch3_1_simple { 4 | 5 | public static void main(String[] args){ 6 | System.out.println("We will not use 'Hello, World!'"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_constants/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_constants/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_2_constants 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_constants/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_constants/src/ch3_2_constants/ch3_2_constants.java: -------------------------------------------------------------------------------- 1 | package ch3_2_constants; 2 | 3 | public class ch3_2_constants { 4 | 5 | public static final double CM_PER_INCH = 2.54; 6 | 7 | public static void main(String[] args) { 8 | 9 | //final double CM_PER_INCH = 2.54; 10 | double paperWidth = 8.5, paperHeight = 11; 11 | System.out.println("Paper size in Centim: " + paperWidth * 12 | CM_PER_INCH + " by " + paperHeight * CM_PER_INCH); 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_inputTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_inputTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_2_inputTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_inputTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_2_inputTest/src/ch3_2_inputTest/ch3_2_inputTest.java: -------------------------------------------------------------------------------- 1 | package ch3_2_inputTest; 2 | 3 | import java.util.*; 4 | 5 | public class ch3_2_inputTest { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner in = new Scanner(System.in); 10 | 11 | System.out.println("What is your name?"); 12 | String name = in.nextLine(); 13 | 14 | System.out.println("How old are you?"); 15 | int age = in.nextInt(); 16 | 17 | System.out.println("Hello, " + name + ". Next year, you'll be " + (age + 1)); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_3_retirement/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_3_retirement/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_3_retirement 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_3_retirement/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_4_retirement2/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_4_retirement2/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_4_retirement2 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_4_retirement2/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_5_lotteryOdds/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_5_lotteryOdds/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_5_lotteryOdds 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_5_lotteryOdds/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_5_lotteryOdds/src/ch3_5_lotteryOdds/ch3_5_lotteryOdds.java: -------------------------------------------------------------------------------- 1 | package ch3_5_lotteryOdds; 2 | 3 | import java.util.*; 4 | 5 | public class ch3_5_lotteryOdds { 6 | 7 | public static void main(String[] args) { 8 | 9 | Scanner in = new Scanner(System.in); 10 | 11 | System.out.println("How many numbers do you need to draw?"); 12 | int k = in.nextInt(); 13 | System.out.println("highest number you can draw: "); 14 | int n = in.nextInt(); 15 | 16 | int lotteryOdds = 1; 17 | 18 | for(int i = 1; i <= k; i++) { 19 | lotteryOdds = lotteryOdds * (n - i + 1) / i; 20 | } 21 | 22 | System.out.println("you odds are 1 in " + lotteryOdds + ". Good luck!"); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_6_bigIntegerTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_6_bigIntegerTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_6_bigIntegerTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_6_bigIntegerTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_7_lotteryDrawing/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_7_lotteryDrawing/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_7_lotteryDrawing 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_7_lotteryDrawing/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_8_compoundInterest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_8_compoundInterest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_8_compoundInterest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_8_compoundInterest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_9_lotteryArray/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_9_lotteryArray/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch3_9_lotteryArray 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch3/ch3_9_lotteryArray/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_1_calendarTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_1_calendarTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch4_1_calendarTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_1_calendarTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_2_employeeTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_2_employeeTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch4_2_employeeTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_2_employeeTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_3_staticTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_3_staticTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch4_3_staticTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_3_staticTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_4_paramTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_4_paramTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch4_4_paramTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_4_paramTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_5_constructorTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_5_constructorTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch4_5_constructorTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_5_constructorTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_6_packageTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_6_packageTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch4_6_packageTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch4/ch4_6_packageTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_11_arrayListTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_11_arrayListTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_11_arrayListTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_11_arrayListTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_11_arrayListTest/src/ch5_11_arrayListTest/ArrayListTest.java: -------------------------------------------------------------------------------- 1 | package ch5_11_arrayListTest; 2 | 3 | import java.util.*; 4 | 5 | public class ArrayListTest { 6 | 7 | public static void main(String[] args) { 8 | 9 | ArrayList staff = new ArrayList<>(); 10 | 11 | staff.add(new Employee("James Wang", 75000, 1987, 12, 15)); 12 | staff.add(new Employee("Harry Hacker", 45000, 1989, 10, 11)); 13 | staff.add(new Employee("Tony Yuan", 105000, 1985, 06, 22)); 14 | 15 | for(Employee e : staff) { 16 | e.raiseSalary(5); 17 | } 18 | 19 | for(Employee e : staff) { 20 | System.out.println("name = " + e.getName() + ", salary = " 21 | + e.getSalary() + ", hireDay = " + e.getHireDay()); 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_12_enumTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_12_enumTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_12_enumTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_12_enumTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_13_reflectionTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_13_reflectionTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_13_reflectionTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_13_reflectionTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_14_objectAnalyzerTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_14_objectAnalyzerTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_14_objectAnalyzerTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_14_objectAnalyzerTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_14_objectAnalyzerTest/src/ch5_14_objectAnalyzerTest/ObjectAnalyzerTest.java: -------------------------------------------------------------------------------- 1 | package ch5_14_objectAnalyzerTest; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class ObjectAnalyzerTest { 6 | 7 | public static void main(String[] args) { 8 | ArrayList squares = new ArrayList<>(); 9 | for (int i = 1; i <= 5; i++) 10 | squares.add(i * i); 11 | System.out.println(new ObjectAnalyzer().toString(squares)); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_16_copyOfTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_16_copyOfTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_16_copyOfTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_16_copyOfTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_17_methodTableTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_17_methodTableTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_17_methodTableTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_17_methodTableTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_1_Inheritance/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_1_Inheritance/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_1_Inheritance 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_1_Inheritance/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_1_Inheritance/src/ch5_1_Inheritance/Manager.java: -------------------------------------------------------------------------------- 1 | package ch5_1_Inheritance; 2 | 3 | public class Manager extends Employee { 4 | 5 | private double bonus; 6 | 7 | public Manager(String name, double salary, int year, int month, int day) { 8 | super(name, salary, year, month, day); 9 | bonus = 0; 10 | } 11 | 12 | public double getSalary() { 13 | double baseSalary = super.getSalary(); 14 | return baseSalary + bonus; 15 | } 16 | 17 | public void setBonus(double b) { 18 | bonus = b; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_1_Inheritance/src/ch5_1_Inheritance/ManagerTest.java: -------------------------------------------------------------------------------- 1 | package ch5_1_Inheritance; 2 | 3 | public class ManagerTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | Manager boss = new Manager("James Wang", 120000, 1976, 8, 23); 8 | boss.setBonus(12000); 9 | 10 | Employee[] staff = new Employee[3]; 11 | staff[0] = boss; 12 | staff[1] = new Employee("Peter Nike", 65000, 1983, 6, 16); 13 | staff[2] = new Employee("Tom Hacker", 75000, 1987, 12, 21); 14 | 15 | for(Employee e : staff) { 16 | System.out.println("name = " + e.getName() + ", salary = " + e.getSalary()); 17 | } 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_4_abstractClasses/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_4_abstractClasses/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_4_abstractClasses 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_4_abstractClasses/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_4_abstractClasses/src/ch5_4_abstractClasses/Person.java: -------------------------------------------------------------------------------- 1 | package ch5_4_abstractClasses; 2 | 3 | public abstract class Person { 4 | 5 | public abstract String getDescription(); 6 | private String name; 7 | 8 | public Person(String name) { 9 | this.name = name; 10 | } 11 | 12 | public String getName() { 13 | return name; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_4_abstractClasses/src/ch5_4_abstractClasses/PersonTest.java: -------------------------------------------------------------------------------- 1 | package ch5_4_abstractClasses; 2 | 3 | import ch5_4_abstractClasses.Employee; 4 | 5 | public class PersonTest { 6 | 7 | public static void main(String[] args) { 8 | 9 | Person[] people = new Person[2]; 10 | people[0] = new Employee("Peter Boli", 95000, 1986, 9, 11); 11 | people[1] = new Student("Tom Hanks", "EE"); 12 | 13 | for(Person p : people) { 14 | System.out.println(p.getName() + ", " + p.getDescription()); 15 | } 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_4_abstractClasses/src/ch5_4_abstractClasses/Student.java: -------------------------------------------------------------------------------- 1 | package ch5_4_abstractClasses; 2 | 3 | public class Student extends Person { 4 | 5 | private String major; 6 | 7 | public Student(String name, String major) { 8 | super(name); 9 | this.major = major; 10 | } 11 | 12 | public String getDescription() { 13 | return "a student majoring in " + this.major; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_8_equalsTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_8_equalsTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch5_8_equalsTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch5/ch5_8_equalsTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_10_proxyTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_10_proxyTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_10_proxyTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_10_proxyTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_1_employeeSortTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_1_employeeSortTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_1_employeeSortTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_1_employeeSortTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_1_employeeSortTest/src/ch6_1_employeeSortTest/EmployeeSortTest.java: -------------------------------------------------------------------------------- 1 | package ch6_1_employeeSortTest; 2 | 3 | import java.util.*;; 4 | 5 | public class EmployeeSortTest { 6 | 7 | public static void main(String[] args) { 8 | 9 | Employee[] staff = new Employee[3]; 10 | 11 | staff[0] = new Employee("James Wang", 75000); 12 | staff[1] = new Employee("Harry Hacker", 45000); 13 | staff[2] = new Employee("Tony Yuan", 105000); 14 | 15 | Arrays.sort(staff); 16 | 17 | for(Employee e : staff) { 18 | System.out.println("name = " + e.getName() + ", salary = " 19 | + e.getSalary()); 20 | } 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_3_timerTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_3_timerTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_3_timerTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_3_timerTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_3_timerTest/src/ch6_3_timerTest/TimerTest.java: -------------------------------------------------------------------------------- 1 | package ch6_3_timerTest; 2 | 3 | import java.awt.*; 4 | import java.awt.event.*; 5 | import java.util.*; 6 | import javax.swing.*; 7 | import javax.swing.Timer; 8 | 9 | public class TimerTest { 10 | 11 | public static void main(String[] args) { 12 | 13 | ActionListener listener = new TimePrinter(); 14 | 15 | Timer t = new Timer(3000, listener); 16 | t.start(); 17 | 18 | JOptionPane.showMessageDialog(null, "Quit programs?"); 19 | System.exit(0); 20 | 21 | } 22 | 23 | } 24 | 25 | class TimePrinter implements ActionListener { 26 | public void actionPerformed(ActionEvent event) { 27 | System.out.println("At the tone, the time is: " + new Date()); 28 | Toolkit.getDefaultToolkit().beep(); 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_4_cloneTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_4_cloneTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_4_cloneTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_4_cloneTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_4_cloneTest/src/ch6_4_cloneTest/CloneTest.java: -------------------------------------------------------------------------------- 1 | package ch6_4_cloneTest; 2 | 3 | public class CloneTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | try { 8 | 9 | Employee original = new Employee("Jmaes Wang", 65000); 10 | original.setHireDay(2000, 8, 12); 11 | Employee copy = original.clone(); 12 | copy.raiseSalary(10); 13 | copy.setHireDay(2013, 5, 23); 14 | System.out.println("original: " + original); 15 | System.out.println("copy: " + copy); 16 | } catch(CloneNotSupportedException e) { 17 | e.printStackTrace(); 18 | } 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_6_lambdaTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_6_lambdaTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_6_lambdaTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_6_lambdaTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_7_innerClassTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_7_innerClassTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_7_innerClassTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_7_innerClassTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_8_anonymousInnerClassTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_8_anonymousInnerClassTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_8_anonymousInnerClassTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_8_anonymousInnerClassTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_9_staticInnerClassTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_9_staticInnerClassTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch6_9_staticInnerClassTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch6/ch6_9_staticInnerClassTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_1_stackTraceTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_1_stackTraceTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch7_1_stackTraceTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_1_stackTraceTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_2_loggingImageViewer/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_2_loggingImageViewer/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch7_2_loggingImageViewer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_2_loggingImageViewer/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch7/ch7_2_loggingImageViewer/DancingPeaks.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/specter01wj/Core_JAVA_Volume1/8ca9c76bf17e49e0d4654973fff7889caf4644e8/mysol/ch7/ch7_2_loggingImageViewer/DancingPeaks.gif -------------------------------------------------------------------------------- /mysol/ch8/ch8_1_pairTest1/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_1_pairTest1/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch8_1_pairTest1 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_1_pairTest1/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_1_pairTest1/src/ch8_1_pairTest1/Pair.java: -------------------------------------------------------------------------------- 1 | package ch8_1_pairTest1; 2 | 3 | public class Pair { 4 | 5 | private T first; 6 | private T second; 7 | 8 | public Pair() { first = null; second = null; } 9 | 10 | public Pair(T first, T second) { 11 | this.first = first; 12 | this.second = second; 13 | } 14 | 15 | public T getFirst() { return first; } 16 | public T getSecond() { return second; } 17 | 18 | public void setFirst(T newValue) { this.first = newValue; } 19 | public void setSecond(T newValue) { this.second = newValue; } 20 | } 21 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_1_pairTest1/src/ch8_1_pairTest1/PairTest1.java: -------------------------------------------------------------------------------- 1 | package ch8_1_pairTest1; 2 | 3 | public class PairTest1 { 4 | 5 | public static void main(String[] args) { 6 | 7 | String[] words = {"James", "John", "Thomas", "Mary"}; 8 | Pair mm = ArrayAlg.minmax(words); 9 | System.out.println("min: " + mm.getFirst()); 10 | System.out.println("max: " + mm.getSecond()); 11 | } 12 | 13 | } 14 | 15 | class ArrayAlg { 16 | 17 | public static Pair minmax(String[] a) { 18 | 19 | if(a == null || a.length == 0) return null; 20 | String min = a[0], max = a[0]; 21 | 22 | for(int i = 1; i < a.length; i++) { 23 | if(min.compareTo(a[i]) > 0) min = a[i]; 24 | if(max.compareTo(a[i]) < 0) max = a[i]; 25 | } 26 | 27 | return new Pair<>(min, max); 28 | } 29 | 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_2_pairTest2/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_2_pairTest2/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch8_2_pairTest2 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_2_pairTest2/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_2_pairTest2/src/ch8_2_pairTest2/Pair.java: -------------------------------------------------------------------------------- 1 | package ch8_2_pairTest2; 2 | 3 | public class Pair { 4 | 5 | private T first; 6 | private T second; 7 | 8 | public Pair() { first = null; second = null; } 9 | 10 | public Pair(T first, T second) { 11 | this.first = first; 12 | this.second = second; 13 | } 14 | 15 | public T getFirst() { return first; } 16 | public T getSecond() { return second; } 17 | 18 | public void setFirst(T newValue) { this.first = newValue; } 19 | public void setSecond(T newValue) { this.second = newValue; } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_3_pairTest3/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_3_pairTest3/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch8_3_pairTest3 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_3_pairTest3/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_3_pairTest3/src/ch8_3_pairTest3/Pair.java: -------------------------------------------------------------------------------- 1 | package ch8_3_pairTest3; 2 | 3 | public class Pair { 4 | private T first; 5 | private T second; 6 | 7 | public Pair() { first = null; second = null; } 8 | public Pair(T first, T second) { this.first = first; this.second = second; } 9 | 10 | public T getFirst() { return first; } 11 | public T getSecond() { return second; } 12 | 13 | public void setFirst(T newValue) { first = newValue; } 14 | public void setSecond(T newValue) { second = newValue; } 15 | } 16 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_4_genericReflectionTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_4_genericReflectionTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch8_4_genericReflectionTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /mysol/ch8/ch8_4_genericReflectionTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | --------------------------------------------------------------------------------