Вы находитесь на странице: 1из 13

1...........................................................................................................................................

1.
, .
( ) .
.
.

<html>
<head>
<title>Bomber</title>
</head>
<body bgcolor="#000000"><CENTER>
<applet code="Bomber.class" width=800 height=600>
<param name="imageDir" value="img">
</applet>
</CENTER>
</body>
</html>
import
import
import
import
import
import

java.applet.Applet;
java.awt.*;
java.awt.event.ActionListener;
java.awt.event.ActionEvent;
java.net.URLClassLoader;
java.net.URL;

public class Bomber extends Applet implements Runnable, ActionListener {


MoveImage goal;
MoveImage bomb;
Button b;
private int getIntParam(String name, int def) {
String s = getParameter(name);
if(s != null) return Integer.parseInt(s);
else return def;

}
private boolean getBoolParam(String name, boolean def) {
String s = getParameter(name);
if(s != null)
return Boolean.valueOf(s).booleanValue();
else
return def;
}
public void init() {
b = new Button("");
b.addActionListener(this);
add(b);
mySize = size();
mt = new MediaTracker(this);
hrHeight = getIntParam("hrHeight", 3) - 1;
hrY = getIntParam("hrY", (mySize.height - hrHeight) / 2);
imageDir = getParameter("imageDir");
if(imageDir == null)
imageDir = ".";
hr = new Rectangle(0, hrY, mySize.width - 1, hrHeight);
goal = new Goal(getImage(imageDir + "/goal.jpg", this), 0, mySize, 4,

hr.y);

bomb = new Bomb(getImage(imageDir + "/bomb.png", this), 0, mySize, 4,


hr.y + hr.height / 2);
}
public void start() {
if(thread == null) {
thread = new Thread(this);
thread.start();
}
}
public void stop() {
if(thread != null) {
thread.stop();
thread = null;
}
}
private Image getImage(String name, Component cmp) {
Image img = null;
URLClassLoader urlLoader =
(URLClassLoader)cmp.getClass().getClassLoader();
URL fileLoc = urlLoader.findResource(name);
img = cmp.getToolkit().createImage(fileLoc);
MediaTracker tracker = new MediaTracker(cmp);
tracker.addImage(img, 0);
try {
tracker.waitForID(0);
if (tracker.isErrorAny()) {
System.out.println("Error loading image " + name);
}
} catch (Exception ex) { ex.printStackTrace(); }
return img;
}
public void run() {
while (true) {

synchronized(this) {
Graphics g = getGraphics();
goal.draw(g);
if(size().getHeight()/2 <= bomb.y) {
((Bomb)bomb).isMoving = false;
bomb.setImage(getImage(imageDir + "/blow.jpg", this));
}
bomb.draw(g);
}

try {
Thread.currentThread();
Thread.sleep(50L);
}
catch (InterruptedException e) {
e.printStackTrace();
}

}
public Bomber() { }
int hrY;
int hrHeight;
String imageDir;
Color bgColor;
Dimension mySize;
Rectangle hr;
Image backImage;
Image offImage;
Thread thread;
MediaTracker mt;
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
startBomb();
}
}

private void startBomb() {


((Bomb)bomb).repaint = true;
bomb.draw(getGraphics());
((Bomb)bomb).repaint = false;
bomb.setImage(getImage(imageDir + "/bomb.png", this));
bomb.init();
((Bomb)bomb).isMoving = true;
}

2.
GUI-

.


.
.
12-
( 12- )
IntelliJ IDEA
Sybase9.

. 2.1.
,
5 :
1.
2. ()

3.
4.


5.

. 2.2.

. 2.3.

. 2.4.

. 2.5.

. 2.6.

3.
.
UML: ,
, .
JavaScript CSS

: psp082323.16mb.com

:
Css
body

text-align:
center; /* this centers the container in IE 5*
browsers. The text is then set to the left aligned
default in the #container selector */;
background-color : #FFE5F0;padding:0;margin:0;
}
td {
border: 4px solid #d9d9d9;
border-collapse: collapse;
}
Index.html
<frameset rows="220,*" cols="*">
<frame src="logo.html" name="logoFrame"
scrolling="no" noresize>
<frameset cols="200,*">
<frame src="menu.html" name="menuFrame"
scrolling="no" noresize>
<frame src="main.html" name="mainFrame">
</frameset>
</frameset>

UML

.1 -

.2 -

.3 -


1.

. JAVA. . .: ,

2.

- -

1996.
, , , ,
, - ,
, . [. ].
: http://www.cfin.ru/finanalysis/cf_criteria2.shtml