JBuilder 2005 Development Applet game full touch

Source: Internet
Author: User
Tags thread touch

Introduction

Xiang Embroidery brought together the Hunan woman tired months of painstaking effort, we call it labor-intensive, a chip gathered a number of High-tech technology, we call it technology-intensive, an example of a rich knowledge of the point, whether it can be called knowledge-intensive? Using a net to catch more fish is the fisherman's pursuit, and through an example to learn more knowledge points is the hope of our developers.

This article is intended to explain how to develop an applet application under JBuilder 2005 through a familiar fingering practice game, through which you will be able to learn about graphical user interface development, animation, sound playback, event handling, multithreading, I/O read-write, applet packaging, Applet security model, digital signature, JRE plug-in production, JDK5.0 and other aspects of knowledge, and timely introduction of some of the author's development experience.

Fingering Practice Applet Game Introduction

1, interface and function

The interface of the applet game for fingering exercises is shown in the following illustration:

Figure 1 The user interface for the fingering exercise

As shown in the figure above, this applet consists of 11 components, and the left main interface is the Canvas canvas component, which is divided into 10 columns. The program randomly produces falling letters in these columns, the user presses the matching letter keyboard key, that is hit, the corresponding letter will disappear, the correct number is incremented by 1; the letter fell to the bottom of the canvas, has not been hit, the number of failures is increased by 1; each generation of a falling letter, the total is incremented by 1.

The game provides 3 JButton buttons to control the start/pause, end, and save game performance of the game. The first button appears as a triangular arrow icon before the game is started, click to start the game, and then switch the button icon to a paused icon. The second is the Stop button, which displays the end of the icon, and when the game is running or paused, clicking the button stops the game so that you can start over again. and the third button saves the game's score to the client's D:\result.txt file.

The entire interface takes the BorderLayout layout manager, the canvas is located in the Borderlayout.center area, and the right console JPanel is located in the Borderlayout.east area. The JPanel of the console takes the GridLayout layout manager.

2. Program composition

Each falling letter corresponds to a thread instance, called the Dropcharthread thread, which is generated by a generator, which is also a thread called the Generatedropthread thread, and the following is the class diagram of the applet:

Figure 2 Applet class diagram

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.