As an appletProgramAs shown in.
Key design ideas:
We need to set the coordinates of the circle center of a ball, preferably in the center of the window, and then increase the radius of the ball and re-draw it to achieve the animation of increasing the ball.
Design Scheme:
To draw a ball, we use a graphics class. The graphics class has the function of drawing.
Then we design a thread to control the playing of the
Basic technology:
There are many ways to implement animations in Java, but they do the same thing, by drawing a series of frames on the screen to create a sense of motion.
We first construct a program framework, and then slowly expand, so that the function is more complete.
To use a thread:
To update the screen more than once per second, you must create a thread to implement the
).setDuration(1000).start();This is the y direction:RotatingObjectAnimator.ofFloat"rotation"0360F).setDuration(1000).start();Perform:Combo AnimationsObjectanimator. Offloat(ImageView,"Rotation",0F theF. Setduration( +). Start();Objectanimator. Offloat(ImageView,"Translationx",0F theF. Setduration( +). Start();Objectanimator. Offloat(ImageView,"Translationy",0F theF. Setduration( +). Start();Perform:Be able to see these three animations executed at the same timeUsing propertyvaluesholderPropertyv
Package Com.tanzhou.test;import Java.applet.applet;import java.awt.*; import Java.net.malformedurlexception;import Java.net.URL;/** * In Java there are two ways to implement multi-threading, one is to inherit the thread class, one is to implement the Runnable interface; * @author Administrator * * In the actual development can be determined to runnable interface as the main * 1, Draw interface 2, draw the boundary Face (show static time) 3, call threa
One: Show hidden animationCreate a Anim directory in the Res directory and create a alpha.xml file insideAdd a picture to the displayed page, and then in the Mainactivity.java file, get the object that needs to be animated, get an animated object that will animate the object to animate the methodPackage Cn.szy.com;import Android.app.activity;import Android.os.bundle;import android.view.animation.Animation; Import Android.view.animation.animationutils;import Android.widget.imageview;public class
ObjectiveTwo days ago in the company's internal blog to see a colleague to share the online services hanging off cpu100% article, let me think of hashmap in the improper use of the death cycle problem, here do a collation and summary, also by the way review under HashMap.Directly on the test code Depending on the machine configuration and performance, the number of threads and put quantities of the test results variespublic class Hashmapinfinitelooptest {/** * based on JDK1.7 test HashMap The s
==null) {currentimage=0;Animationtimer=new Timer (delay, this); Instantiating a Timer objectAnimationtimer.start (); Start runningelse if (!animationtimer.isrunning ())//If not runningAnimationtimer.restart (); Run again}
public void StopAnimation () {Animationtimer.stop (); Stop animation}
public static void Main (String args[]) {Animatoricon animation = new Animatoricon (); Instantiating an animated ico
Java environment:1. What are bytecode and virtual machines?2. Setting of environment variables3. Some common Java commands4. How does the computer run the Java program?5. Java Garbage collector6. Basic data types and conversions for JavaExample: The first
It is easy to draw an animation using Java, so that a thread can call itself regularly. Remember to set an exit (end) condition.
Import Org. Eclipse. SWT. SWT; Import Org. Eclipse. SWT. layout. filllayout; Import Org. Eclipse. SWT. Widgets. display; Import Org. Eclipse. SWT. Widgets. shell; Import Org. Eclipse. SWT. Widgets. text; Public Class Animation
Applets are small programs that run in a browser, and Java is also popular in the world from applets. By writing this applet, we can learn the following knowledge:
1. Applet and the main interface in JApplet
2. Image loading and Mediatracker use
3. Use of threads and direct communication with multiple threads
4. Use of the Thread.Join () method
5. Use of volatile keywords
First look at the running effect: click to run
The main part of the
(1) create a Windows exe program
The exe program or service program made of Windows by Java is really full and abnormal, but if you don't remember the background program on a server, which of the following idiots accidentally shut down, or if someone kills the
Java Note: Part 4: Java program first run; Part 4: java
# Daily nagging # This blog won't be published on time, because Xiaoxing has something to do today. However, I was eager to hear from fans, so I stayed up late last night. Thanks to xiaoxinghahahao (for example, I have to finish my
Introduction:
FtpClient is a powerful FTP upload download tool, you can achieve a variety of ways of FTP file transfer, you can support the upload download a variety of large files (has been used in practice), and the existence of the official website so that users convenient use of this tool and so on.
1. First, the program to set the FTP request mode is passive mode, that is, the program to request the F
. The reference tutorial for Java beginners is very good.Free Download: Think Java7. Data structures and algorithms with object-oriented Design Patterns in JavaThis book is very helpful for learning about the data structure of Java. The author is Bruno R. Preiss. You can read it online, or you can download the source code for the tutorial.Data structures and algorithms with object-oriented Design Patterns i
A simple example of a Linux Java program communicating with a C language program through a socketthis morning, I experimented with a Java program communicating with a C language program through a socket. Because did not learn
PackageCom.swift;ImportJava.io.File;ImportJava.io.FileFilter;ImportJava.io.FileInputStream;ImportJava.io.FileOutputStream; Public classIo_filefilter { Public Static voidMain (string[] args)throwsexception{/** Write a program to copy all the. java files under the E:\neck directory to the E:\jpg directory and change the original file extension from. java to. jpg*/f
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.