Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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¸öÇøÓò£¬·Ö±ðÊÇÉÏ¡¢Ï¡¢×ó¡¢ÓÒ¡¢ÖÐ
[λÖó£Á¿]Ö¸¶¨ÁË×é¼þ½«Òª·ÅÖõ


Ïà¹ØÎĵµ£º

JAVA×î¶Ì·¾¶´úÂë

import java.util.LinkedList;
import java.util.List;
public class ShortestPaths {
     private static String showPath[] = { "", "", "", "", "", "" }; 
      
     & ......

JAVA³£ÓòÙ×÷Óï¾ä ÏîÄ¿ÖеÄ×ܽáÈý


»ñµÃmysqlºÍoracleÁ´½ÓµÄÀà
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectDB {
private static final String MYSQL = "jdbc:mysql://";
private static final String ORACLE = "jdbc:oracle:thin:@";
private ConnectD ......

JAVA³£ÓòÙ×÷Óï¾ä ÏîÄ¿ÖеÄ×ܽáËÄ


 eclipseÑ¡Ò»¸ö±äÁ¿ºó£¬Õâ¸öÀàÀïµÄ¸Ã±äÁ¿²»±äÉ«ÎÊÌâ½â¾ö£º
alt + shift + o

/**
* дÈëÈÕÖ¾
* filePath ÈÕÖ¾ÎļþµÄ·¾¶
* code ҪдÈëÈÕÖ¾ÎļþµÄÄÚÈÝ

*/

public

static

boolean
print(String filePath,String code) {

try
{
File tofile
=
new
File(filePath);
......

JAVA³£ÓòÙ×÷Óï¾ä ÏîÄ¿ÖеÄ×ܽáÎå


Êý×ֵĸñʽ»¯
DecimalFormat df = new DecimalFormat(",###.00");  
double aNumber = 33665448856.6568975; 
String result = df.format(aNumber);  
Sytem. out.println(result);

Êä³ö½á¹ûΪ£º
33,665,448,856.66 
·ÖÎö×Ö·û´® 
StringTokenizer(String s) ¹¹ÔìÒ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ