.


:




:

































 

 

 

 


,




3

Java, Internet, , WWW. , , , (, , ..), " ", .

. 1. Java-

. , Web, , , , .. - Web .

, - , , , . , . - . , web- , web- .

, , . . , .

, .

, . , . - , , , web-.

JApplet javax.swing.

, Applet. , . , .

- JApplet Applet. JApplet , . . , , Applet.

.

public void init()

start(). , - .

public void start()

"" . , , , , . stop , , . stop , start .

public void stop()

, . stop destroy.

public void destroy()

.

init() . (listeners) , .

Java , ( , ).

, Applet, , .

Init

init . .

Start

start init. , .

, init , start HTML-, , . , , WWW-, , start.

Paint

paint . AWT , , , . , , , paint.

Update

update Applet , paint. paint , update , , . , update. update, paint, AWT, update.

Stop

stop , HTML-, . stop . , . , , start.

Destroy

destroy , (, Netscape) , . , .

Repaint

repaint . , , update. , , update . AWT, update . , repaint (time) , .

repaint(time)

repaint, ( repaint).

repaint (x, , w, h)

, , .

repaint(time, x, , w, h)

.

,

: , .

:

  1. , ;
  2. () Swing, .;

:

  1. . JTextField, JButton JLabel. , .
  2. JPanel . " "; - " ". "" BorderLayout.
  3. 2 , "" , .
  4. 2 , , , . , ArrayList.
  5. 2 "". . , TreeSet.
  6. y = a-√x*cos(ax). JLabel, ": = a-√x * cos(ax)"; , JTextField, , (, 0.1) . =0. , . , .
  7. , , ..
  8. , GIF-, .
  9. (, , ). . .
  10. . 1 9.
  11. . "", "", "", "" . .
  12. ( ). "" . .
  13. . , .
  14. 12 , "" .
  15. . , .
  16. ( ) / /.

 

 

1

, " ", , "".

// AppDemo.java AppDemo.java:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

 

public class AppDemo extends JApplet {

JTextField txt = new JTextField(15);

public AppDemo() {}

public void init() {

Container c = getContentPane();

c.setLayout(new FlowLayout());

JLabel lbl = new JLabel(" ");

c.add(lbl);

JButton btn = new JButton(" ");

btn.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

txt.setText("");

}

});

c.add(btn);

c.add(txt);

} }

. JFrame JApplet getContentPane(). .. Java, init().

web-, . HTML-. , AppDemo

<html>

<head><title>First Applet</title></head>

<body>

-

<applet code=AppDemo width=400 height=200>

</applet>

</body>

</html>

, HTML, . <applet>. code, width height. code. , , jar-, archive applet. AppDemo.shtml, , .4.

.2.





:


: 2016-10-07; !; : 788 |


:

:

: , , , , .
==> ...

1284 - | 1185 -


© 2015-2024 lektsii.org - -

: 0.019 .