JavaͼÐνçÃæ±à³Ì×ܽá
1. ²¼¾Ö¹ÜÀíÆ÷
ÈÝÆ÷Àï×é¼þµÄ´óСºÍλÖÃÊÇÓɲ¼¾Ö¹ÜÀíÆ÷À´¾ö¶¨µÄ¡£ÈÝÆ÷¶Ô²¼¾Ö¹ÜÀíÆ÷µÄÌض¨ÊµÀý±£³ÖÒ»¸öÒýÓ㬵±ÈÝÆ÷ÐèÒª¶¨Î»Ò»¸ö×é¼þʱ£¬Ëü½«µ÷Óò¼¾Ö¹ÜÀíÆ÷À´Íê³É£¬¾ö¶¨Ò»¸ö×é¼þµÄ´óСʱҲÊÇÈç´Ë¡£
ÔÚawtÖÐÓÐÎåÖÖ²¼¾Ö¹ÜÀíÆ÷
BorderLayOut
FlowLayOut
GridLayOut
GardLayOut
GridBagLayOut
1. BorderLayOut Ëü½«ÈÝÆ÷×é¼þ·Ö³É±±¡¢ÄÏ¡¢¶«¡¢Î÷¡¢ÖÐÎå¸öÇøÓò£¬Ã¿¸öÇøÓò×î¶àÖ»ÄÜ°üº¬Ò»¸ö×é¼þ, ²¢Í¨¹ýÏàÓ¦µÄ³£Á¿½øÐбêʶ£ºNORTH¡¢SOUTH¡¢EAST¡¢WEST¡¢CENTER¡£ÀýÈ磺
Panel p = new Panel();
p.setLayout(new BorderLayout());
p.add(new Button("Okay"), BorderLayout.SOUTH);
2. FlowLayOut Á÷ʽ²¼¾Ö¹ÜÀíÆ÷£¬Ëü½«×é¼þÒÀ´ÎÅÅÁУ¬Á÷µÄ·½ÏòÈ¡¾öÓÚÈÝÆ÷µÄ componentOrientation ÊôÐÔ£¬Ëü¿ÉÄÜÊÇÒÔÏÂÁ½¸öÖµÖеÄÒ»¸ö£ºComponentOrientation.LEFT_TO_RIGHT ComponentOrientation.RIGHT_TO_LEFT
3. GridLayOut Ëü½«ÈÝÆ÷×é¼þ·Ö¸î³ÉÍø¸ñ×´ £¬¿ÉÒÔÖ¸¶¨·Ö¸î³É¼¸Ðм¸ÁУ¬¿ÉÒÔͨ¹ý¹¹Ô캯ÊýGridLayout(int rows, int cols)À´Ö¸¶¨ÐÐÁС£
4. GardLayOut
5. GridBagLayOut ¸´ÔӵIJ¼¾Ö¹ÜÀí¡£
AWTʼþÄ£ÐÍ
Events(ʼþ)£ºÃèÊö·¢ÉúÁËʲôµÄ¶ÔÏó¡£
Event Source(ʼþÔ´)£ºÊ¼þµÄ²úÉúÆ÷¡£
Event Handlers(ʼþ´¦ÀíÆ÷):½ÓÊÕʼþ¶ÔÏó¡¢½âÊÍʼþ¶ÔÏó²¢´¦ÀíÓû§½»»¥µÄ·½·¨¡£
²Ëµ¥
ÔÚjavaÖв˵¥ÓÉÈýÏî×é³É²Ëµ¥À¸¡¢²Ëµ¥¡¢²Ëµ¥Ïî·Ö±ðÊÇÈý¸öÀàMenuBar,Menu,MenuItem.
Ìí¼Ó²Ëµ¥µÄ²½ÖèÈçÏ£º
MenuBar objMenuBar = new MenuBar(); //´´½¨Ò»¸ö²Ëµ¥À¸
//´´½¨Á½¸ö²Ëµ¥
Menu objFileMenu = new Menu("Îļþ");
Menu objEditMenu = new Menu("±à¼");
//´´½¨²Ëµ¥Ïî
MenuItem mi1 = new MenuItem("´ò¿ª");
Menu
Ïà¹ØÎĵµ£º
MySQL£º
String Driver="com.mysql.jdbc.Driver"; //Çý¶¯³ÌÐò
String URL="jdbc:mysql://localhost:3306/db_name"; //Á¬½ÓµÄURL,db_nameΪÊý¾Ý¿âÃû
String Username="username"; //̞
String Password="password"; //ÃÜÂë
Class.forName(Driver).new Instance();
......
±¾ÖÜÓöµ½Ò»¸öjavaÂÒÂëÎÊÌ⣬ÓÚÊǶÔjavaµÄ±àÂëÎÊÌâ×öÁËһЩʵÑéºÍÁ˽⡣¼òµ¥·ÖÎöÈçÏ£º
ÏÈ¿´ÏÂÈçÏ´úÂ룺
import
java.io.UnsupportedEncodingException;
public
class
CharSetTest {
public
static
void
main(String[] args)
throws
UnsupportedEncodingException {
String test =
"
ÀºÇò
" ......
1.2 ¹¤³§·½·¨£¨Factory Method£©Ä£Ê½
¹¤³§·½·¨Ä£Ê½ÊÇÀàµÄ´´½¨Ä£Ê½£¬ÓÖ½ÐÐéÄâ¹¹Ôì×Ó£¨Virtual Constructor£©Ä£Ê½»òÕ߶à̬ÐÔ¹¤³§£¨Polymorphic Factory£©Ä£Ê½¡£
¹¤³§·½·¨Ä£Ê½µÄÓÃÒâÊǶ¨ÒåÒ»¸ö´´½¨²úÆ·¶ÔÏóµÄ¹¤³§½Ó¿Ú£¬½«Êµ¼Ê¹¤×÷ÍƳٵ½×ÓÀàÖС£
1.2.1 ¹¤ ......
1.Èç¹ûÔÚÏÂÃæµÄ´úÂëÖУ¬tryLock¸Ä³Élock£¬ÄÇô»áÒ»Ö±µÈ´ý£¬Ö±µ½Äܹ»ËøÉÏÎļþΪֹ£¬µ«tryLock»áÁ¢¼´·µ»Ø¡£
Èç¹ûÒ»¸öµ÷ÓÃÁËtryLock£¬»òlock²¢Çҳɹ¦ËøÉÏÖ¸¶¨ÎļþºóµÄ³ÌÐò£¬ÔÚûÓÐÊÍ·ÅÎļþËøµÄÇé¿öÏ£¨Ã»Óе÷ÓÃrelease£©³ÌÐò¾Í½áÊø£¨°üº¬Ç¿ÖƽáÊøµÄÇé¿ö£©£¬ÄÇôÎļþËø»á×Ô¶¯±»ÊÍ·Å¡£
2.´úÂëÖеÄsleepÊÇΪÁ˱ãÓÚÑéÖ¤³ÌÐòÓõġ ......