javaÄ£ÄâÎ趯×Ö·û
Ô´´úÂ룺
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class brandishString extends Applet implements Runnable, MouseListener {
String str; // ÒªÏÔʾµÄ×Ö·û´®
char strChars[]; // ×Ö·û´®µÄ×Ö·ûÊý×é±íʾ
Thread runner = null; // Ïß³Ì
boolean threadSuspended; // Ï̵߳Ä״̬
int strLength; // ×Ö·û´®³¤¶È
static final int REGULAR_WD = 100; // ×Ö·ûÎ趯µÄ¿í¶È
static final int REGULAR_HT = 50; // ×Ö·ûÎ趯µÄ¸ß¶È
Font regularFont = new Font("Serif", Font.BOLD, 120); // ÉèÖÃ×ÖÌå
public void init() {// ³õʼ»¯·½·¨
this.setBackground(Color.RED);
this.setForeground(Color.BLACK);
str = "08¼Æ±¾²Ü·æ"; // ÉèÖÃĬÈϲÎÊý
strLength = str.length();
strChars = new char[strLength];
str.getChars(0, strLength, strChars, 0); // »ñÈ¡×Ö·ûÊý×é
threadSuspended = false; // ÓÃÀ´ÅжÏÏ̵߳Ä
this.addMouseListener(this); // µ±Ç°¶ÔÏó×Ô¼º¼àÊÓ×Ô¼º
this.setSize(1000, 500); // ÉèÖôóС
}
public void start() { // init()·½·¨Ö´ÐÐÍê×Ô¶¯Ö´ÐÐstart()·½·¨
runner = new Thread(this); // ´´½¨Ò»¸öÏß³Ì
runner.start(); // Æô¶¯Ïß³Ì
}
public void run() {
Thread me = Thread.currentThread(); // »ñÈ¡µ±Ç°Ïß³Ì
while (runner == me) { // Åжϵ±Ç°Ïß³ÌÊÇ·ñºÍrunnerÊÇͬһ¸öÏß³Ì
try {
Thread.sleep(100);
synchronized (this) {// ¶Ôµ±Ç°¶ÔÏó¼ÓËø
if (threadSuspended)
wait(); // ½øÈëµÈ´ý״̬
}
} catch (InterruptedException e) {
} // ²»ÐèÒª±àдÒì³£´úÂë
repaint(); // Ë¢ÐÂÆÁÄ»
}
}
public void paint(Graphics g) {
int length = strChars.length;// Çó×Ö·û³¤¶È
for (int i = 0, x = 0; i < length; i++) {
g.setFont(regularFont); // ÉèÖÃ×ÖÌå
int px = (int) (100 * Math.random() + x);// ÉèÖÃx×ø±ê
int py = (int) (300 * Math.random() + REGULAR_HT);// ÉèÖÃy×ø±ê
g.drawChars(strChars, i, 1, px, py); // Êä³öÒ»¸ö×Ö·û
x += REGULAR_WD;
}
}
public synchronized void mousePressed(Mouse
Ïà¹ØÎĵµ£º
1£®ÏÖÔÚÊäÈën¸öÊý×Ö£¬ÒÔ¶ººÅ£¬·Ö¿ª£»È»ºó¿ÉÑ¡ÔñÉý»òÕß½µÐòÅÅÐò£»°´Ìá½»¼ü¾ÍÔÚÁíÒ»Ò³ÃæÏÔʾ°´Ê²Ã´ÅÅÐò£¬½á¹ûΪ£¬Ìṩreset
import java.util.*;
public class bycomma{
public static String[] splitStringByComma(String source){
if(source==null||source.trim().equals(""))
......
l JBS
1.Áоٳö 10¸öJAVAÓïÑÔµÄÓÅÊÆ
a:Ãâ·Ñ£¬¿ªÔ´£¬¿çƽ̨(ƽ̨¶ÀÁ¢ÐÔ)£¬¼òµ¥Ò×Ó㬹¦ÄÜÍêÉÆ£¬ÃæÏò¶ÔÏ󣬽¡×³ÐÔ£¬¶àỊ̈߳¬½á¹¹ÖÐÁ¢£¬ÆóÒµÓ¦ÓõijÉÊìƽ̨, ÎÞÏßÓ¦ÓÃ
2.ÁоٳöJAVAÖÐ10¸öÃæÏò¶ÔÏó±à³ÌµÄÊõÓï
a:°ü£¬À࣬½Ó¿Ú£¬¶ÔÏó£¬ÊôÐÔ£¬·½·¨£¬¹¹ÔìÆ÷£¬¼Ì³Ð£¬·â×°£¬¶à̬£¬³éÏ󣬷¶ÐÍ
3.ÁоٳöJAVAÖÐ6¸ ......
//±¾³ÌÐòÁ¬½ÓµÄÊÇsql server 2005£¬ÓëÁ¬½Ósql server 2000Óе㲻ͬ£ºdriverNameºÍURL¶¼²»Í¬
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class create{
public void getConnection() th ......
³ÌÐòÔ´´úÂ룺
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane; ......
Ô´³ÌÐò´úÂ룺
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
......