java:Applet²¼¾ÖÎÊÌâ,ÈçºÎÌí¼Ó°´Å¥£¬±êÇ©ÎÊÌâ×ܽá
½ñÌìѧϰÁËapplet²¼¾ÖÎÊÌ⣺
°´Å¥¡¢±êÇ©ÊÇÔõÑù¼ÓÈëµ½applet³ÌÐò(ÈÝÆ÷)µ±ÖÐÈ¥µÄÄØ£¿
ÐèÒªÓõ½²¼¾ÖÈÝÆ÷¹ÜÀíÆ÷(LayoutManager)£ºËüÓÃÓÚÐÖúÈÝÆ÷È·¶¨¼ÓÈëµÄ×é¼þ(°´Å¥µÈ)Ó¦¸Ã·ÅÖõÄλÖÃ
awtÌṩÁË4Öг£ÓõIJ¼¾ÖÈÝÆ÷¹ÜÀíÆ÷
>>FlowLayout
>>BorderLayout
>>GridLayout
>>CardLayout
appletĬÈÏʹÓÃFlowLayout,appletʹÓÃÈÝÆ÷¹ÜÀíÆ÷µÄ·½·¨ÈçÏ£º
setLayout (new BorderLayout)
setLayout()·½·¨ÊÇappletÀà¼Ì³ÐContainerÀàÖеķ½·¨¶øÀ´£¬Òò´ËÔÚapplet³ÌÐòÖпÉÒÔÖ±½Óµ÷ÓÃ
applet¼ÓÈë°´Å¥Ò»¶¨ÐèÒªÉÏÃæµÄÈÝÆ÷¹ÜÀíÆ÷ô£¿
²»Ò»¶¨£¬¿ÉÒÔÏÈ setLayout(null); È»ºó×Ô¼ºÈ·¶¨×é¼þ·ÅÖõÄϸ½Ú£¬´úÂëÂé·³¡£
Èç¹ûÄã²»Óò¼¾Ö¹ÜÀíÆ÷£¨JframeÖеÄÓ÷¨£©£º
JButton b1 = new JButton("hello");
getContentPane().add(b1);
b1.setLocation(100,10);
ÒÔÏÂÊÇÈÝÆ÷¹ÜÀíÆ÷³£ÓõÄ4ÖÖ²¼¾Öд·¨
=================================================
applet ʹÓà FlowLayout ²¼¾Ö£º
Ö¸¶¨²¼¾Ö:setLayout(new FlowLayout())
¼ÓÈë×é¼þ£ºadd(×é¼þʵÀý)
×÷ÓãºÓÉ×óµ½ÓÒ£¬ÓÉÉϵ½ÏÂÒÀ´Î·ÅÖÃ×é¼þ
¼ÓÈë×é¼þʹÓÃappletÀà¼Ì³ÐContainerÀàÖеķ½·¨³ÉÔ±add();
=================================================
import java.awt.*;
import java.applet.*;
public class UseFlowLayout extends Applet{
public void init()
{
setLayout(new FlowLayout()); //ÒòΪÊÇĬÈϹÜÀíÆ÷£¬¿ÉÒÔÊ¡ÂÔ
//setLayout()·½·¨ÊÇappletÀà¼Ì³ÐContainerÀàÖеķ½·¨¶øÀ´£¬Òò´ËÔÚapplet³ÌÐòÖпÉÒÔÖ±½Óµ÷ÓÃ
for(int i = 0; i<5;i++){
add(new Button("°´Å¥" + i )); //¼ÓÈë5¸ö°´Å¥
//appletÀà¼Ì³ÐContainerÀàÖеķ½·¨³ÉÔ±add();
}
}
}
==================================================
appletʹÓÃBorderLayout();
Ö¸¶¨²¼¾Ö£ºsetLayout(new BorderLayout());
¼ÓÈë×é¼þ£ºadd(×é¼þʵÀý,λÖó£Á¿)
×÷Ó㺴ËÖÖ²¼¾Ö½«ÈÝÆ÷»®·ÖΪ5¸öÇøÓò£¬·Ö±ðÊÇÉÏ¡¢Ï¡¢×ó¡¢ÓÒ¡¢ÖÐ
[λÖó£Á¿]Ö¸¶¨ÁË×é¼þ½«Òª·ÅÖõ
Ïà¹ØÎĵµ£º
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* @author troy(J2EE)
* @version 1.0
*/
public class Test {
public static void main(String[] args) throws Exception {
DateFormat df = DateFormat.getDateInstance();
&n ......
¹ØÓÚjavaµÄhttpÐÒéÎļþÉÏ´«ÊµÓÃÀýÌâÒ»
(2006-07-25 16:43:56)
תÔØ
·ÖÀࣺ
java
¹ØÓÚjavaµÄhttpÐÒéÉÏ´«:(¼òµ¥ÊµÓöøÇÒ½¡×³;Ëٶȿì)
´Ë·½·¨±ÈapacheµÄÎļþÉÏ´«°ü(uploadfile1.1:¾ÍÎļþÉÏ´«¹¦ÄܶøÑÔ)Ҫǿ¶àÁË
1.Ö»ÐèÒªÒ»¸öMultipartRequest.java»ù±¾Îļþ¾ÍÐС£
2.ǰ̨htmlµÄ»ù±¾¸ñʽ
<html ......
/**
* Copyright (c) 2010 IBOBO Corporation. All Rights Reserved.
*/
package com.ibm.util.dao.hib;
/**
* [Java Generics] get T.Class from <T>
*
* @author <a ......
ѧϰ֮·×ÜÊDz¢²»Æ½Ì¹µÄ£¬Õâ²»£¬Ò»¿ªÊ¼¾ÍÓöµ½ÎÊÌâÁË£ºBad version number in .class file¡£°æ±¾²»¶Ô£¿¿ÉÊÇÎÒÓõÄjavaÒÔ¼°javac¶¼ÊÇJDK5ѽ£¬Ôõô»ØÊ£¿³ýÁ˱àÒë°æ±¾¸úÔËÐа汾²»Ò»ÖÂÍâÊDz»»á³öÏÖÕâÖÖ¿ÉÄܵġ£Í»È»ÏëÆðÇ°¼¸ÌìÊÔÁËÒ»ÏÂJDK6£¬°ÑEclipseµÄJDK±àÒëÆ÷Ñ¡³ÉJDK6ÁË¡£¹ûÈ»£¬½«Æä¸Ä»ØÈ¥JDK5¾ÍÐÐÁË¡£
================== ......
ÅжÏÒ»¸öÎļþÊÇ·ñΪ¶þ½øÖÆÎļþ
public static boolean isBinary(File file) {
boolean isBinary = false;
try {
FileInputStream fin = new FileInputStream(file);
long len = file.length();
for (int j = 0; j < (int) len; j++) {
int t = fin.read();
......