View Mode: Normal | Article List
Category: Java | < | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | >

Unicode 汉字内码表

[ 2006-10-10 02:38:50 | Author: zhenhua ]
啊:21834 阿:38463 埃:22467 挨:25384 哎:21710 唉:21769 哀:21696 皑:30353 癌:30284 蔼:34108
矮:30702 艾:33406 碍:30861 爱:29233 隘:38552 鞍:38797 氨:27688 安:23433 俺:20474 按:25353 暗:26263 岸:23736 胺:33018 案:26696 肮:32942 昂:26114 盎:30414 凹:20985 敖:25942 熬:29100 翱:32753 袄:34948 傲:20658 奥:22885 懊:25034 澳:28595 芭:33453 捌:25420
扒:25170 叭:21485 吧:21543 笆:31494 八:20843 疤:30116 巴:24052 拔:25300 跋:36299 靶:38774 把:25226 耙:32793 坝:22365 霸:38712 罢:32610 爸:29240 白:30333 柏:26575 百:30334 摆:25670 佰:20336 败:36133 拜:25308
...

Read More...

循环取值

[ 2006-09-21 19:25:54 | Author: zhenhua ]
无限分级
Quote

public static String getTraceName(HashMap hs) {
String tracemark = DBConnect.doSql("select tracemark from " + TABLE +
" where urlname = '" + StringUtil.notNull("urlname",hs) +
"'");
if (tracemark==null)
return "";
StringBuffer tree = new StringBuffer();
Category cate = new Category();
int levelLength = 6;
int level = tracemark.length() / levelLength - 1;
...

Read More...

Java Applet/加解密小程序

[ 2006-07-21 19:45:04 | Author: zhenhua ]
经常用到密码转换,每次都要手工编译,比较烦琐,索性写了个GUI,这样方便多了。
除了加密算法外,其他代码都是公开的:/?id=384

算法保密` [biggrin] [idea]

����Ŵ�
...

Read More...

24点游戏

[ 2006-07-19 19:48:26 | Author: zhenhua ]

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;

public class YH24 {
 Frame f = new Frame("24点游戏"); // main frame

 TextField t1 = new TextField("1",3); //text 1 2 3 4
 TextField t2 = new TextField("2",3);
 TextField t3 = new TextField("3",3);
 TextField t4 = new TextField("4",3);
 TextArea t5 = new TextArea("", 5,29, TextArea.SCROLLBARS_VERTICAL_ONLY); //textArea 1
...

Read More...

Java GUI 简单输入

[ 2006-07-19 19:47:02 | Author: zhenhua ]
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JDialog;
import javax.swing.JButton;
import java.awt.event.*;

/**
 * Class SimpleInput - input class for input of simple input types
 * via simple dialog box.
 * eg. int, char, String,float or boolean.
 *
 * @author: Bruce Quig
 * @author: Michael Kolling
 *
 * @version: 1.0
 * Date: 04.03.1999
 */

public class SimpleInput
{
 // instance variables
 static final String STRING_TITLE = "Enter a String";
...

Read More...

Java 抓图/屏幕截图

[ 2006-07-13 17:20:21 | Author: zhenhua ]
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

/*******************************************************************
 * 该JavaBean可以直接在其他Java应用程序中调用,实现屏幕的"拍照"
 * This JavaBean is used to snapshot the GUI in a
 * Java application! You can embeded
 * it in to your java application source code, and us
 * it to snapshot the right GUI of the application
...

Read More...

Java抓取文件保存到本地

[ 2006-07-12 12:51:17 | Author: zhenhua ]
可以抓取图片、Flash、电影/视频文件等等,保存到本地目录。多用于采集系统

Test.java

import java.io.*;
import java.net.*;

public class Test {
 public boolean saveUrlAs(String photoUrl, String fileName) {
//此方法只能用于HTTP协议
 try {
 URL url = new URL(photoUrl);
 HttpURLConnection connection = (HttpURLConnection) url.
 openConnection();
 DataInputStream in = new DataInputStream(connection.getInputStream());
 DataOutputStream
...

Read More...

String API

[ 2006-06-14 19:29:41 | Author: zhenhua ]
char charAt(int index)
 返回指定索引处的 char 值。
int codePointAt(int index)
 返回指定索引处的字符(Unicode 代码点)。
int codePointBefore(int index)
 返回指定索引之前的字符(Unicode 代码点)。
int codePointCount(int beginIndex, int endIndex)
 返回此 String 的指定文本范围中的 Unicode 代码点数。
int compareTo(String anotherString)
 按字典顺序比较两个字符串。
int compareToIgnoreCase(String str)
 不考虑大小写,按字典顺序比较两个字符串。
String concat(String str)
 将指定字符串联到此字符串的结尾。
boolean contains(CharSequence s)
...

Read More...