Java on Windows, macOS, and Linux
Installing Java 8 and 9 for Developers
Installing the Eclipse IDE for Java Developers
Installing the WindowBuilder Editor
Customizing Eclipse’s Look and Feel
Installing Android Studio for Mobile App Development
Getting to Know Java with JShell
Working with Java Expressions in JShell
Declaring Java Variables in JShell
2
BUILD A HI-LO GUESSING GAME APP!
Planning the Game Step-by-Step
Getting User Input from the Keyboard
Making the Program Print Output
if Statements: Testing for the Right Conditions
3
CREATING A GUI FOR OUR GUESSING GAME
Creating a GUI in Four Lines of Code
Creating an Interactive GUI in 10 Lines of Code!
Setting Up the GUI App in Eclipse
GUI Design with Eclipse’s WindowBuilder Editor
Setting GUI Properties in the Properties Pane
Customizing GUI Components in the Palette Pane
Naming GUI Components for Coding
Connecting the GUI to Your Java Code
Adding a Method to Check the Player’s Guess
Getting Text from a JTextField
Listening for User Events: Click to Guess!
Allowing Users to Press Enter to Guess
Automatically Removing Old Guesses
#1: Showing Users How Many Tries They Took
#2: Showing and Hiding a Play Again Button
4
CREATING YOUR FIRST ANDROID APP
Starting a New Android Studio App Project
Building the GUI Layout in Design View
Naming GUI Components in Android Studio
Connecting the GUI to Java in Android Studio
Adding Methods to Check the Guess and Begin a New Game
Running the App on the Android Emulator
Running the App on a Real Android Device
Running the App on Your Device
Centering the User’s Guess in the Text Field
Adding a Listener for the Enter Key
Adding One More Finishing Touch
#1: “Toast”-ing to the Number of Tries
#3: Creating a MadLibs Mobile App
5
POLISHING YOUR APP BY ADDING MENUS AND PREFERENCES
Adding an Options Menu in Android
Adding Items to the Menu’s XML File
Creating an Alert Dialog Pop-up for the About Screen
Adding a Variable for the Range
Building the Dialog to Allow the User to Select the Range
Storing User Preferences and Game Stats
Storing and Retrieving the User’s Preferred Range
Storing the Number of Games Won
#1: You Win Some, You Lose Some
Setting Up the Secret Messages App
Creating the Secret Messages Project in Eclipse
Beginning to Code SecretMessages.java
Running Command Line Apps Without Eclipse
Finding Your Workspace Folders
#3: Safely Handling Keys with try and catch
7
CREATING ADVANCED GUIs AND SHARING YOUR APP
Setting Up the Secret Messages GUI App Project
Designing the GUI and Naming Components
Coding the Secret Messages GUI App
Writing the Event Handler for the Encode/Decode Button
Handling Bad Input and User Errors
Building the main() Method and Running the App
Setting Line Wrap and Word Wrap
Handling Bad Input and User Errors: Part 2
Adding a Slider to the Secret Messages GUI
Bonus: Sharing Your App as a Runnable JAR File
#3: Changing the Text to Change the Slider
8
MAKE SECRET MESSAGES A PHONE APP TO SHARE WITH FRIENDS!
Wiring the GUI to the Java Code
Connecting the Encode Button to the encode() Method
Running the App on the Emulator and on an Android Device
Bonus: Customizing the Floating Action Button
Receiving Secret Messages from Other Apps
#2: Changing the SeekBar’s Progress
9
PAINT COLORFUL BUBBLES WITH YOUR MOUSE!
Creating the BubbleDraw Project Files
Storing Bubbles in an ArrayList
Adding a Constructor to the BubblePanel Class
Adding a Method to Draw on the Screen
Handling Mouse Events from the User
Creating a Reusable Event Listener
Bonus: Handling MouseWheel Events
10
ADDING ANIMATION AND COLLISION DETECTION WITH TIMERS
Copying the BubbleDraw Java Project to Create BubbleDrawGUI
Renaming the Main Class and Java File
Adding Animation: Bubbles Rising!
Forever Blowing Bubbles: Adding Random Speed and Direction
Building a GUI for Our Animated Drawing App
Setting Up the GUI Panel and Buttons
Coding the Clear and Pause/Start Buttons
Bouncing off the Walls with Collision Detection
Adding a Slider to Control the Animation Speed
Implementing the Slider Event Handler
11
MAKING BUBBLEDRAW A MULTITOUCH ANDROID APP
Setting Up the BubbleDraw Project
Creating the BubbleView Constructor
Adding the Animation Variables
Creating the BubbleView() Constructor
Preparing the Layout to Use BubbleView
Drawing in Android with the onDraw() Method
Testing BubbleDraw with 100 Bubbles
Fixing the OnTouchListener Error
Using Threaded Animation and Multitasking in Java
Using Touch to Draw with Your Finger
Using Multitouch to Draw with 10 Fingers at a Time!
Testing Multitouch Events on an Android Device
Changing the App Launcher Icon
Adding the Custom Icon to Your App
#1: Combining One-Finger and Multitouch Events, v1.0
#2: Combining One-Finger and Multitouch Events, v2.0
APPENDIX
DEBUGGING AND AVOIDING COMMON ERRORS IN JAVA
Correcting Typos in Android Studio
Avoiding Other Common Spelling Errors