java¶à線³ÌµÄ實Àý
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.event.*;
public class ThreadDemo extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
public ThreadDemo() {
JButton btn = new JButton("Click me");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Thread thread1 = new Thread(new Runnable() {
public void run() {
Graphics g = getGraphics();
for (int i = 10; i < 300; i += 10) {
try {
Thread.sleep(100);
g.drawOval(i, 100, 10, 10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
Thread thread2 = new Thread(new Runnable() {
public void run() {
Graphics g = getGraphics();
for (int i = 10; i < 300; i += 10) {
try {
Thread.sleep(500);
g.drawOval(i, 150, 15, 15);
g.draw3DRect(i, i, i, i, true);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
thread1.start();
thread2.start();
}
});
getContentPane().add(btn, BorderLayout.NORTH);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize(320, 200);
setVisible(true);
}
public static void main(String[] args) {
new ThreadDemo();
}
}
Ïà¹ØÎĵµ£º
È«ÇòʯÓÍÍø£¨www.cippe.net£©´´½¨ÓÚ2004Ä꣬Öص㱨µÀÈ«ÇòʯÓ͹¤ÒµÐ²úÆ·¡¢Ð¼¼Êõ£¬¼á³ÖÆ·ÅÆ»¯¡¢×¨Òµ»¯¡¢¹ú¼Ê»¯µÄÕ½ÂÔ·¢Õ¹·½Ïò£¬´Ù½øÈ«ÇòʯÓ͹¤Òµ¼¼Êõ½»Á÷Óë×°±¸Ã³Ò×£¬ÍƽøÖйúʯÓ͹¤Òµ»¯·¢Õ¹Ëٶȣ¡
ÍøÕ¾º¸ÇµØÖÊ¿±Ì½¡¢ÓÍÆø²Ø¡¢×ê¾®¡¢²â¾®¡¢²ÉÓÍ¡¢×°±¸¡¢º£ÑóʯÓÍ¡¢´¢ÔË¡¢Á¶»¯µÈרҵÁìÓò£¬´´°ìÁËʯÓÍ×ÊѶ¡¢Ð²úƷм¼Êõ¡¢Ê¯Ó ......
Ò».ÔÚj2seÀïÎÒÃÇ¿ÉÒÔʹÓÃMath.random()·½·¨À´²úÉúÒ»¸öËæ»úÊý£¬Õâ¸ö²úÉúµÄËæ»úÊýÊÇ0-1Ö®¼äµÄÒ»¸ödouble£¬ÎÒÃÇ¿ÉÒÔ°ÑËû³ËÒÔÒ»¶¨µÄÊý£¬±ÈÈç˵³ËÒÔ100£¬Ëû¾ÍÊǸö100ÒÔÄÚµÄËæ»ú£¬Õâ¸öÔÚj2meÖÐûÓС£
¶þ.ÔÚjava.utilÕâ¸ö°üÀïÃæÌṩÁËÒ»¸öRandomµÄÀ࣬ÎÒÃÇ¿ÉÒÔн¨Ò»¸öRandomµÄ¶ÔÏóÀ´²úÉúËæ»úÊý£¬Ëû¿ÉÒÔ²úÉúËæ»úÕûÊý¡¢Ëæ»úfloat¡¢ ......
http://blog.csdn.net/hbcui1984/archive/2009/12/10/4980805.aspx
Ò»¡¢¸ÅÊö
JNI(java native interface)£¬JAVA±¾µØ½Ó¿Úµ÷Óã¬Ä¿µÄÊÇΪÁËJAVA¿ÉÒÔµ÷Óñ¾µØ³ÌÐò£¬Ö÷ÒªÓŵãÓУº
Ìá¸ßЧÂÊ£¬½â¾öÐÔÄÜÎÊÌâ
·ÀÖ¹·´±àÒ룬Ìá¸ßºËÐÄ´úÂ밲ȫÐÔ
ÔöÇ¿±¾»ú½Ó¿Úµ÷ÓÃ
ǶÈëʽ¿ª·¢Ó¦ÓÃ
ÈçÏÂͨ¹ýÒ»¸ö×î¼òµ¥µÄÐ ......
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class CipherTest {
public static void main(String[] args) {
try {
byte[] keydata = { (byte) 0x00, (byte) 0x01, (byte) 0x02,
(byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06,
......
Õ⼸ÌìÍøÂçÓÐÎÊÌ⣬ËùÒÔ½ñÌìÒ»Æð×ܽá³öÀ´
ÀàµÄС½á
1£¬Àà³éÏóÁËËùÓоßÓÐÒ»¶¨¹²ÐÔµÄʵÌåµÄ¹²Í¬Ìسơ£Ò»¸öÀàÖУ¬±äÁ¿ÓÃÀ´±íʾÊôÐÔ£¬·½·¨ÓÃÀ´±íʾ¹¦ÄÜ£¬Àà°ÑÊý¾ÝºÍ¶ÔÊý¾ÝµÄ²Ù×÷·â×°³ÉÒ»¸öÕûÌå¡£³ÌÐòÓïÑÔÖУ¬Í¨¹ýÀà´´½¨¶ÔÏó¡£
2£¬¹¹Ô캯ÊýµÄ×÷ÓÃÔÚÓÚÉùÃ÷ÀàµÄ¶ÔÏóºó£¬ÎªÆä·ÖÅä´¢´æµ¥Ôª£¬¼´´´½¨ÊµÀý¡£
3,²»Í¬¶ÔÏóµÄʵÀý±äÁ¿½« ......