Java 7 for Absolute Beginners
CHAPTER 10 ■ ANIMATION public class ScootBall implements ActionListener { private static final long serialVersionUID = 1L; Scoot ...
CHAPTER 10 ■ ANIMATION animationThread = new Thread(scootBallPanel); scootBallPanel.setAnimating(true); animationThread.start(); ...
CHAPTER 10 ■ ANIMATION if (animating) { g.setColor(Color.RED); g.fillOval(xPosition, height / 2, 10 ,10); xPosition += 20; if (x ...
CHAPTER 10 ■ ANIMATION The heart of the ScootBallPanel class is the run method, which implements the corresponding run method in ...
CHAPTER 10 ■ ANIMATION object-oriented programming, encapsulation, and embodies a primary goal of nearly all software systems, s ...
CHAPTER 10 ■ ANIMATION Listing 10-3. The Fireworks class package com.bryantcs.examples.animation; import java.awt.BorderLayout; ...
CHAPTER 10 ■ ANIMATION fireworksPanel.setBackground(Color.WHITE); frame.getContentPane().add(fireworksPanel,BorderLayout.CENTER) ...
CHAPTER 10 ■ ANIMATION Listing 10-4. The FireworksPanel class package com.bryantcs.examples.animation; import java.awt.Graphics; ...
CHAPTER 10 ■ ANIMATION public class Firework { private int startX, startY, burstX, burstY, burstStep, currentStep, panelHeight, ...
CHAPTER 10 ■ ANIMATION g.drawLine(burstX, burstY, endX, endY); } } currentStep++; } // This firework is done, so the panel // cl ...
CHAPTER 10 ■ ANIMATION will do the job), and then take a close look at it (perhaps by making a screen capture and zooming in on ...
CHAPTER 10 ■ ANIMATION private JFrame frame = new Jframe("MouseSprites"); // Here's our very slow timer. 4 times a second – vroo ...
CHAPTER 10 ■ ANIMATION @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } ...
CHAPTER 10 ■ ANIMATION import java.io.IOException; import java.util.ArrayList; import javax.imageio.ImageIO; import javax.swing. ...
CHAPTER 10 ■ ANIMATION The the MouseSprite class, shown in Listing 10-8, draws each of the four sprites in turn. Conceptually, i ...
CHAPTER 10 ■ ANIMATION Figure 10-5. The MouseSprite program I can catch only two bullseyes in the screen shot. This problem of t ...
CHAPTER 10 ■ ANIMATION How to put an image from a file onto the screenIn the first draft of this chapter, I didn't add screen sh ...
C H A P T E R 1 1 205 Debugging with Eclipse Not every error throws an exception; sometimes, due to poor programming, your code ...
CHAPTER 11 ■ DEBUGGING WITH ECLIPSE Figure 11-1. Fireworks problem As you can see, I accidentally created searchlights rather th ...
CHAPTER 11 ■ DEBUGGING WITH ECLIPSE Set a breakpoint on that line and restart your application. When you get to that line, step ...
«
6
7
8
9
10
11
12
13
14
15
»
Free download pdf