摘要:
以下代码可实现鼠标放在该链接后自动点击的效果,至于什么用处大家看着办吧,呵....开动你的大脑吧.<script language="JavaScript" type="text/JavaScript"> var autoclick_ok=false; var cishu = 1function mClk() { if(!autoclick_ok && cishu==1){ var source=event.srcElement;source.click(); cishu+=1;} } </script><f 阅读全文
随笔档案-2011年05月
JAVA功能代码《13》----在Java中调整数组大小
2011-05-21 17:18 by java线程例子, 240 阅读, 收藏,
摘要:
13.在Java中调整数组大小public class resizeArray { /** * Reallocates an array with a new size, and copies the contents of the old * array to the new array. * * @param oldArray * the old array, to be reallocated. * @param newSize * the new array size. * @return A new array with ... 阅读全文
JAVA功能代码《12》----使用NIO快速复制文件
2011-05-21 17:15 by java线程例子, 239 阅读, 收藏,
摘要:
12.使用NIO快速复制文件public static void fileCopy(File in, File out) throws IOException { FileChannel inChannel = new FileInputStream(in).getChannel(); FileChannel outChannel = new FileOutputStream(out).getChannel(); try { inChannel.transferTo(0, inChannel.size(), outChannel); // original -- apparent... 阅读全文
JAVA功能代码《11》----Java中将Array转换成Map
2011-05-21 17:14 by java线程例子, 321 阅读, 收藏,
摘要:
11.Java中将Array转换成Map下面是参考代码String[][] countries = { { "United States", "New York" }, { "United Kingdom", "London" }, { "Netherland", "Amsterdam" }, { "Japan", "Tokyo" }, { "France", "Paris" } }; Map c 阅读全文
JAVA功能代码《10》----Java获得目录列表
2011-05-20 17:50 by java线程例子, 136 阅读, 收藏,
摘要:
10.Java获得目录列表File dir = new File("directoryName"); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i = 0; i < children.length; i++) { // Get filename of file or directory String filename = children[i]; } }... 阅读全文
JAVA功能代码《9》----Java发送HTTP请求和提取数据
2011-05-20 17:49 by java线程例子, 173 阅读, 收藏,
摘要:
9.Java发送HTTP请求和提取数据try { URL my_url = new URL("www.baidu.com/"); BufferedReader br = new BufferedReader(new InputStreamReader(my_url .openStream())); String strTemp = ""; while (null != (strTemp = br.readLine())) { System.out.println(strTemp); } } catch (Exception ex) { ex.printS 阅读全文
JAVA功能代码《8》----Java创建图片的缩略图
2011-05-20 17:48 by java线程例子, 265 阅读, 收藏,
摘要:
8.Java创建图片的缩略图public void createThumbnail(String filename, int thumbWidth, int thumbHeight, int quality, String outFilename) throws InterruptedException, FileNotFoundException, IOException { // load image from filename Image image = Toolkit.getDefaultToolkit().getImage(filename); MediaTracker... 阅读全文
JAVA功能代码《7》----Java创建ZIP和JAR文件
2011-05-20 17:46 by java线程例子, 182 阅读, 收藏,
摘要:
7.Java创建ZIP和JAR文件if (args.length < 2) { System.err.println("usage: java ZipIt Zip.zip file1 file2 file3"); System.exit(-1); } File zipFile = new File(args[0]); if (zipFile.exists()) { System.err.println("Zip file already exists, please try another"); System.exit(-2); } FileOut 阅读全文
JAVA功能代码《6》----用Java实现屏幕截图
2011-05-20 17:39 by java线程例子, 240 阅读, 收藏,
摘要:
6.用Java实现屏幕截图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;/******************************************************************* * 用Java实现屏幕截图 * 该JavaBean可以直接在其他Jav 阅读全文
JAVA功能代码《5》----将Java中的util.Date转换成sql.Date
2011-05-19 16:32 by java线程例子, 218 阅读, 收藏,
摘要:
5.将Java中的util.Date转换成sql.Date这一片段显示如何将一个java util Date转换成sql Date用于数据库,代码如下:java.util.Date utilDate = new java.util.Date(); java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); 阅读全文
JAVA功能代码《4》----在Java中将String型转换成Date型
2011-05-19 16:22 by java线程例子, 192 阅读, 收藏,
摘要:
4.在Java中将String型转换成Date型SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date date = format.parse("2011-05-19 16:19:19"); } catch (ParseException e) { e.printStackTrace(); } 阅读全文
JAVA功能代码《3》----获取Java现在正调用的方法名
2011-05-19 16:13 by java线程例子, 173 阅读, 收藏,
摘要:
3.获取Java现在正调用的方法名String methodName = Thread.currentThread().getStackTrace()[1] .getMethodName(); 阅读全文
JAVA功能代码《2》----向文件中写入文本
2011-05-19 16:05 by java线程例子, 194 阅读, 收藏,
摘要:
2.向文件中写入文本BufferedWriter out = null; try { out = new BufferedWriter(new FileWriter("filename", true)); out.write("aString"); } catch (IOException e) { // error processing code } finally { if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace()... 阅读全文
JAVA功能代码《1》----把Strings转换成int和把int转换成String
2011-05-19 15:44 by java线程例子, 258 阅读, 收藏,
摘要:
本文整理自网络,将为大家介绍开发人员非常有用的Java功能代码。这些代码,可以成为大家在今后的开发过程中,Java编程手册的重要部分。1. 把Strings转换成int和把int转换成StringString a = String.valueOf(2);//integer to numeric string int i = Integer.parseInt(a);//numeric string to an int 阅读全文
浙公网安备 33010602011771号