Java Applet ʵÏÖÒ»¸ö°ë¾¶²»¶ÏÔö´óµÄ²ÊɫСÇò¶¯»
×÷ΪApplet³ÌÐòµÄÒ»¸öÈëÃÅ£¬ÎÒÃǽñÌì̽ÌÖÒ»ÏÂÈçºÎʵÏÖÒ»¸ö°ë¾¶²»¶ÏÔö´óµÄСÇò¶¯»£¬ÕýÈçÏÂͼËùʾ¡£
Éè¼ÆµÄ¹Ø¼ü˼Ï룺
ÎÒÃÇÐèÒªÉ趨һ¸öСÇòµÄÔ²ÐÄ×ø±ê£¬×îºÃÊÇÔÚ´°¿ÚµÄÖÐÑ룬ȻºóÁîСÇòµÄ°ë¾¶²»¶ÏÔö´ó£¬²»¶ÏµÄÖØ»æ£¬ÒÔʵÏÖСÇòµÄÔö´ó¶¯»¡£
Éè¼Æ·½°¸£º
ÎÒÃÇÒª»æÖÆÐ¡Çò£¬¾ÍÓõ½ÁËÒ»¸öGraphicsÀ࣬GraphicsÀàÓлæÖƵŦÄÜ¡£
È»ºóÔÙÉè¼ÆÒ»¸öÏß³ÌרÃÅÓÃÀ´¿ØÖƶ¯»µÄ²¥·Å£¬ÎÒÃÇÖØÔØrun()·½·¨£¬ÔÚÆäÖÐʵÏÖСÇò°ë¾¶µÄÔö¼Ó£¬ÒÔ¼°µ÷Óô°ÌåµÄÖØ»æº¯Êý£¬Ã¿¸ôÒ»¶¨Ê±¼äÖØ»æ´°Ìå¡£
½ÓÏÂÀ´ÊµÏÖpaint(Graphics g)º¯Êý£¬À´»æÖÆÒ»¸ö²ÊɫԲÇò£¬Õâ¸öº¯ÊýÖÐÒª×öµÄ¾ÍºÜ¼òµ¥ÁË£¬ÓÃÌØ¶¨µÄÑÕÉ«¸²¸ÇÒ»¸öÒ»¶¨´óСµÄÔ²ÐÎÇøÓò
ÏÂÃæ¾ÍÊÇÔ´´úÂë
import java.awt.*;
import java.applet.Applet;
import javax.swing.JApplet;
public class Circle extends JApplet implements Runnable{
int x;//Ô²ÐÄx×ø±ê Ϊx-r/2
int y;//Ô²ÐÄy×ø±ê Ϊy-r/2
int r;//°ë¾¶
private Image img;
private Graphics graph;
public void init(){
Dimension de = this.getSize();
x = de.height/2;
y = de.width/2;
r = 1;
};
public void start(){
//¶¨ÒåÒ»¸öÏß³Ì
Dimension de = this.getSize();
x = de.height/2;
y = de.width/2;
r = 1;
Thread animation = new Thread(this);
animation.start();
}
public void stop(){
}
public void destroy(){
}
public void run(){
Dimension de1 = this.getSize();
while(true){
r += 1;
if(r>(de1.height/2)||r>(de1.width/2)){
r = 1;;
}
repaint();
try
{
// ÔÝÍ£Ïß³Ì30ºÁÃë
Thread.sleep (30);
}
catch (InterruptedException ex)
{
}
}
}
public void paint (Graphics g) {
//ÉèÖÃÇòµÄÑÕÉ«
g.setColor (Color.PINK);
// ´Óx-r/2,y-r/2λÖô¦»Ò»¸öʵÐĵÄÔ²
g.fillOval(x-r/2,y-r/2,r,r);
}
//Ë«»º³å»úÖÆ
public void update (Graphics g)
{
// ³õʼ»¯buffer
if (img == nul
Ïà¹ØÎĵµ£º
JDK1.5ÖУ¬StringÀàÐÂÔöÁËÒ»¸öºÜÓÐÓõľ²Ì¬·½·¨String.format():
format(Locale l, String format, Object... args) ʹÓÃÖ¸¶¨µÄÓïÑÔ»·¾³¡¢¸ñʽ×Ö·û´®ºÍ²ÎÊý·µ»ØÒ»¸ö¸ñʽ»¯×Ö·û´®¡£
format(String format, Object... args) ʹÓÃÖ¸¶¨µÄ¸ñʽ×Ö·û´®ºÍ²ÎÊý·µ»ØÒ»¸ö¸ñʽ»¯×Ö·û´®¡£
¾Ù¼¸¸öÕâ¸ö·½·¨ÊµÓõÄÀý×Ó(×¢ÊÍÊÇÊä³ö½á¹û)£º ......
JXL.JAR ²Ù×÷ExcelÎļþ¿ªÔ´°ü
ÕâÀï¼òµ¥½²Ð©ÏîÄ¿ÖÐÓõ½µÄһЩ·½·¨£¡£¨ÏîÄ¿µÄ»·¾³ÊÇStruts2 hibernate3 resin3 £©
// ExcelÎļþ´æ·Å·¾¶
String path = ServletActionContext.getServletContext().getRealPath("")+"userfiles\\train_excel\\text.xls";
// Éú³ÉExcelÎļþ
WritableWorkbook wwb = Workbook.creat ......
ÔÚJavaÖÐÓÐʱ»áÓö¼ûÂÒÂëµÄÇé¿ö£¬ÕâÀïÌṩÁ˼¸ÖÖת»»·½·¨
£¨Ò»£©JavaÖеıàÂëת»»
£¨¶þ£©¿ÉÒÔÔÚweb.xmlÎļþÖÐÅäÖõÄ×Ô¼ºÐ´µÄ¹ýÂËÆ÷
µÚÒ»ÖÖ·½·¨×î¼òµ¥Ò²×î·½±ã£¬µ«ÊÇÖ»ÄÜÓÃÔÚÉÙÁ¿µÄµØ·½»òÊÇż¶ûÒ»Á½´ÎתÂ룬Èç¹û´óÃæ»ýʹÓþͲ»·½±ãÁË£¬Ò²´ó´óÔö¼ÓÁ˱àÂëÁ¿£¬Èç¹ûÄãµÄÏîÄ¿ÀïûÓÐÓÃSpringµÄ¿ò¼Ü¿ª ......
ÎļþÉÏ´«·½·¨£¨Ò»´ÎÉÏ´«Ò»¸öÎļþ£¬¶à¸öÎļþµÄ»°£¬Çëдѻ·µ÷Óã©
Upload.uploadFile(theFile, filePath)
˵Ã÷£º
theFile£ºÀàÐÍÊÇFormFile
filePath£ºactionÖз¾¶»ñÈ¡·½·¨ this.getServlet().getServletContext().getRealPath("/")
µ÷Óô˷½·¨·µ»ØÎļþÉÏ´«ºóµÄ·¾¶Ãû
ÉÏ´«¶à¸öÎļþʱ£¬ÇëÉèÖÃÿ¸öÎ ......
Ò»°ãÇé¿ö»ñµÃ±¾µØËùÓеÄipµØÖ·£º
try {
InetAddress address = InetAddress.getLocalHost();
System.out.println(address.getHostAddress());
String name = address.getHostName();
System.out.println(name);
InetAddress[] addresses = &nbs ......