Java GUI
Ò»¡¢BorderLayoutTest.java
package com.briup.md08;
import java.awt.*;
import javax.swing.*;
/*BorderLayoutÌصã
1¡¢×é¼þµÄ´óСÓÉÈÝÆ÷¾ö¶¨
2¡¢ÈÝÆ÷±»»®·ÖΪ5¸öÇøÓò£¬Ã¿¸öÇøÓòÖ»ÄÜÖ±½Ó¼ÓÈë3¸ö×é¼þ
3¡¢×é¼þ¼ÓÈëµÄλÖÃÐèÒªÖ¸¶¨£¬Ä¬ÈÏΪCENTER
4¡¢×é¼þÖ®¼äĬÈÏûÓмä϶
5¡¢Èç¹û³ýCENTER ÒÔÍâµÄÇøÓòûÓмÓÈë×é¼þ£¬Æä¿Õ¼ä½«±»ÆäËûÇøÓòºÏÀí·ÖÅ䣻Èç¹ûCENTERÇøÓòûÓмÓÈë×é¼þ£¬Æä¿Õ¼ä½«»á±£Áô£»Í¨³£ÔÚʹÓÃÖбØÐëÔÚCENTER¼ÓÈë×é¼þ£¬ÆäËüÇøÓò¿ÉÒÔÊÓÐèÒª¾ö¶¨
ÒªÇ󣺱£³ÖÈÝÆ÷´óСΪ800*600£¬½«FlowLayoutTestÖÐ100¸öJButton·Åµ½CENTERÇøÓò£¨Ã¿¸ö°´Å¥´óСÏàͬ£¬Ã¿ÐÐ10¸ö°´Å¥£©
*/
public class BorderLayoutTest{
private JFrame f;
private Container c;
private JPanel jp;
public BorderLayoutTest(){
f=new JFrame("Border Layout");
c=f.getContentPane();
c.setLayout(new BorderLayout(10,10));
/*Ìí¼Ó×é¼þ£ºadd£¨×é¼þ£¬Ìí¼ÓλÖã©*/
JPanel jp=new JPanel();
jp.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
for(int i=1;i<=100;i++){
if(i<10)
jp.add(new JButton("00"+i));
else if(i<100)
jp.add(new JButton("0"+i));
else
jp.add(new JButton(""+i));
}
c.add(new JButton("1"),BorderLayout.EAST);
c.add(new JButton("2"),BorderLayout.WEST);
c.add(new JButton("3"),BorderLayout.NORTH);
c.add(new JButton("4"),BorderLayout.SOUTH);
c.add(jp,BorderLayout.CENTER);
f.addWindowListener(new WindowClose());
c.setBackground(Color.red);
f.setSize(800,600);
f.setVisible(true);
}
public static void main(String[] args){
new BorderLayoutTest();
}
}
¶þ¡¢CardLayoutTest.java
package com.briup.md08;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/*CardLayoutµÄÌصã
1¡¢ÈÝÆ÷°´ÕÕ¼ÓÈëµÄÏȺó˳Ðò¹ÜÀíÿÕÅ¿¨Æ¬£¬ÏȼÓÈëµÄÔÚÇ°
2¡¢¿¨Æ¬
Ïà¹ØÎĵµ£º
½ñÌìÔÚ¹äÂÛ̳µÄʱºò¿´µ½ÓÐÈ˽ò½òÀÖµÀ£º´ÓC++¸Éµ½×ªÐÍΪjavaÊÇÍ˲½
ÎÒ²»ÈÏΪÊÇÕâÑù£¬Ê×ÏÈÓ¦¸ÃÒ»¸öÈ˵ÄÐËȤ£¬¼ÓÉÏÕâÃÅÓïÑÔ£¬ÕâÃŹ¤×÷ÊÇ·ñ·ûºÏÄã
¸É×Ô¼ºÏ²»¶µÄÓïÑÔ±àÂë²ÅÊÇ×îÖØÒªµÄ£¬µ±È»java±È½ÏÈÝÒ׵㣬ÎÒÒ²ÊÇÕâÑùÈÏΪµÄ
µ«ÊÇjava²¢²»ÊÇ´ó¼ÒËù˵µÄÄÇôÈÝÒ×£¬µ±½ñÉç»á˲»¸Ò˵×Ô¼º»ássh£¬µ±ÊÇ×Ô¼ºÎÊÐÄ×Ô¼ºÑ§µÃÓжàºÃ£¬
ÔÚ ......
Finalizer ²»¿É¼Æ»®µÄ,Ò²ÊÇΣÏÕµÄ,Ò»°ãÒ²ÊDz»±ØÒªµÄ.
²»ÄÜÔÚfinalizerÖзÅÈκÎÓëÒÀÀµÊ±¼äÏà¹ØµÄ²Ù×÷,ÒòΪÄã²»ÖªµÀËüʲôʱºò±»Ö´ÐÐ. ±ÈÈçÔÚfinalizerÖйرÕÎļþµÄ×ö·¨¾ÍÊÇ´íÎóµÄ, ¸ù¾ÝJVMµÄʵÏÖ·½Ê½²»Í¬,ÓпÉÄܵ¼Ö´ò¿ªµÄÎļþÊý¹ý¶à¶øÎÞ·¨ÔÙ´ò¿ªÎļþ.
Ò²²»ÄÜÔÚfinalizerÖиıä״̬,Èç¸øÊý¾Ý¿â½âËøµÈ.
finalizer»¹ÄÜ´øÀ´Ñ ......
javaÖеÄËÄÖÖÀàÐ͵ļ¯ºÏÀà
£¨1£©Vector £¨2£©BitSet£¨3£©Stack£¨4£©HashTable
2ö¾ÙÆ÷
ÔÚÈκμ¯ºÏÀàÖУ¬±ØÐëͨ¹ýijÖÖ·½·¨ÔÚÆäÖÐÖÃÈë¶ÔÏó£¬ÔÙÓÃÁíÒ»ÖÖ·½·¨´ÓÖÐÈ¡µÃ¶ÔÏó¡£ÔÚVectorÖУ¬addElement()¾ÍÊÇÎÒÃDzåÈë¶ÔÏó²ÉÓõķ½·¨
£¬¶þelementAt()ÔòÊÇÌáÈ¡¶ÔÏóµÄΨһ·½·¨¡£
Iterator¿ÉÒÔ´ïµ½Õâ¸öÄ¿µÄ£¬ËüÊÇÒ»¸ö¶ÔÏó£¬×÷ÓÃÊDZ ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr()£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/ µÄURL·´Ïò´úÀíΪhttp://www.xxx.com/ µÄURLʱ£¬ÓÃrequest.getRemoteAddr()·½·¨»ñÈ¡ ......