JAVA:ÓöàÏß³ÌʵÏÖʱ¼äµÄ¶¯Ì¬ÏÔʾ
import java.awt.*;
import javax.swing.*;
import java.util.Date;
import java.awt.*;
class Time extends JFrame implements Runnable{//ʵÏÖ½Ó¿Ú
Thread clockThread;
JLabel jLabel=new JLabel();
public Time()
{
Container con=this.getContentPane();
con.add(new Drawtime());
}
public void start(){
//¸Ã·½·¨ÊÇÀàµÄ·½·¨£¬²»ÊÇÏ̵߳ķ½·¨
if(clockThread==null){
clockThread=new Thread(this,"Clock");
/*Ïß³ÌÌåÊÇClock¶ÔÏó±¾Éí£¬Ïß³ÌÃû×ÖΪ"Clock"*/
clockThread.start();//Æô¶¯Ïß³Ì
}
}
public void run(){//run()·½·¨ÖÐÊÇÏß³ÌÖ´ÐеÄÄÚÈÝ
while(clockThread!=null){
repaint();//Ë¢ÐÂÏÔʾ»Ãæ
try{
clockThread.sleep(1000);
//˯Ãß1Ã룬¼´Ã¿¸ô1ÃëÖ´ÐÐÒ»´Î
}
catch(InterruptedException e){}
}
}
public void stop(){
//¸Ã·½·¨ÊÇÀàµÄ·½·¨£¬²»ÊÇÏ̵߳ķ½·¨
clockThread.stop();
clockThread=null;
}
}
public class JFrameDemo
{public static void main(String[] args)
{Time frame=new Time();
frame.setSize(500,300);
frame.setVisible(true); //ÉèÖÃ×é¼þ¿É¼û
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //¹Ø±ÕÈÝ¿Ú£¬²¢½áÊø³ÌÐòµÄÔËÐÐ
frame.start();
frame.run();
frame.stop();
}
}
class Drawtime extends JPanel
{
public void paint(Graphics g){
g.setColor(Color.red);
Font font1=new Font("»ªÎIJÊÔÆ",Font.ITALIC,60);
g.setFont(font1);
Date now=new Date();//»ñµÃµ±Ç°µÄʱ¼ä¶ÔÏó
g.drawString(now.getHours()+":"+now.getMinutes()+":"+now.getSeconds(),140,140);
//ÏÔʾµ±Ç°Ê±¼ä
}
}
Ïà¹ØÎĵµ£º
°²×°Java¿ª·¢Èí¼þʱ£¬Ä¬ÈÏ°²×°°üº¬Á½¸öÎļþ¼Ð£¬Ò»¸öJDK(Java¿ª·¢¹¤¾ßÏä)£¬Ò»¸öJRE(JavaÔËÐл·¾³£¬ÄÚº¬JVM)£¬ÆäÖÐJDKÄÚÁíº¬Ò»¸öJRE¡£Èç¹ûÖ»ÊÇÔËÐÐJava³ÌÐò£¬ÔòJREÒÑ×ã¹»£»¶øJDKÔòÖ»Óпª·¢ÈËÔ±²ÅÓõ½¡£
Ò»¡¢JVMÄÚ´æ·ÖÅäÉèÖÃ
1. JVMÄÚ´æ·ÖÅäÉèÖõIJÎÊýÓÐËĸö£º
-Xmx Java Heap×î´óÖµ£¬Ä¬ÈÏֵΪÎïÀíÄÚ´æµÄ ......
µÚ9Õ ÊäÈëºÍÊä³öÁ÷
(Ò»)¿Î³ÌÄÚÈÝ
9.1×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷
9.1.1 File¶ÔÏó
9.1.2Á÷¶ÔÏó
9.2»º³åʽÊäÈëÊä³ö
9.2.1»º³åʽÊäÈë
9.2.2»º³åʽÊä³ö
9.3Ëæ»ú·ÃÎÊ
9.4Îļþ¶Ô»°¿ò
(¶þ)ѧϰĿµÄÓëÒªÇó
±¾Õ½éÉÜJava³ÌÐòÊý¾ÝÎļþµÄÊäÈëÊä³ö¼¼Êõ¡£ÒªÇóÄܱàд¼òµ¥µÄJavaÎļþ´¦Àí³ÌÐò¡£
(Èý)¿¼ºË֪ʶµãÓ뿼ºËÒªÇó
1.´´½¨File¶ÔÏó£ ......
×î½üÓöµ½Ò»¸öÐèÇóÒªÔÚlinuxÏÂÓÃjava µ÷ÓÃmysql¿Í»§¶ËÔ¶³ÌµÇ½mysql·þÎñÆ÷£¬´Ó¿Í»§¶Ë»úÆ÷µ¼Èëmysql½Å±¾£¬´Ómysql·þÎñÆ÷¶Ëµ¼³ö±íÖеÄÊý¾Ý¡£ÒÔÏÂÊÇÓõ½µÄÖ÷Òª·½·¨£º
Java ´úÂë
/**
* µ¼ÈëÊý¾Ý
* @param ½Å±¾µÄµØÖ·ºÍÃû³Æ
* @return ÊÇ·ñ³ ......