javaʱ¼ä¶¯Ì¬ÏÔʾ Á½ÖÖ·½·¨
ʱ¼ä¶¯Ì¬ÏÔʾ
1.·½·¨Ò» ÓÃTimerTask
ÀûÓÃjava.util.TimerºÍjava.util.TimerTaskÀ´×ö¶¯Ì¬¸üУ¬±Ï¾¹Ã¿´Î¸üпÉÒÔ¿´×÷ÊǼÆʱ1Ãë·¢ÉúÒ»´Î¡£
´úÂëÈçÏ£º
import java.awt.Dimension;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* This class is a simple JFrame implementation to explain how to
* display time dynamically on the JSwing-based interface.
* @author Edison
*
*/
public class TimeFrame extends JFrame
{
/*
* Variables
*/
private JPanel timePanel;
private JLabel timeLabel;
private JLabel displayArea;
private String DEFAULT_TIME_FORMAT = "HH:mm:ss";
private String time;
private int ONE_SECOND = 1000;
public TimeFrame()
{
timePanel = new JPanel();
timeLabel = new JLabel("CurrentTime: ");
displayArea = new JLabel();
configTimeArea();
timePanel.add(timeLabel);
timePanel.add(displayArea);
this.add(timePanel);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setSize(new Dimension(200,70));
this.setLocationRelativeTo(null);
}
/**
* This method creates a timer task to update the time per second
*/
private void configTimeArea() {
Timer tmr = new Timer();
tmr.scheduleAtFixedRate(new JLabelTimerTask(),new Date(), ONE_SECOND);
}
/**
* Timer task to update the time display area
*
*/
protected class JLabelTimerTask extends TimerTask{
SimpleDateFormat dateFormatter = new SimpleDateFormat(DEFAULT_TIME_FORMAT);
@Override
public void run() {
time = da
Ïà¹ØÎĵµ£º
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ1ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
¶þ¡¢¿Î³ÌÄÚÈÝÓ뿼ºËÄ¿±ê
µÚ1Õ JavaÓïÑÔ»ù´¡
(Ò»)¿Î³ÌÄÚÈÝ
1.1 JavaÓïÑÔµÄÌصã
1.2 JavaÓ¦ÓóÌÐòºÍСӦÓóÌÐò
1.3 Java³ÌÐòµÄ¿ª·¢¹ý³Ì
1.4±êʶ·ûºÍ¹Ø¼ü×Ö
l.5»ù±¾Êý¾ÝÀàÐÍ
1.5.1 Âß¼ÀàÐÍ
1 ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ4ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ4Õ Êý×éºÍ×Ö·û´®
(Ò»)¿Î³ÌÄÚÈÝ
4.1 Êý×é
4.1.1 һάÊý×é
4.1.2 ¶àάÊý×é
4.2 ×Ö·û´®
4.2.1 ×Ö·û´®³£Á¿
4.2.2 ×Ö·û´®ÉùÃ÷ºÍ´´½¨
4.2.3 ×Ö·û´®»ù±¾²Ù×÷
4.2.4 StringTokenizerÀà
4.2.5×Ö· ......
µÚ5ÕÂͼÐνçÃæÉè¼Æ(Ò»)
(Ò»)¿Î³ÌÄÚÈÝ
5.1 ͼÐνçÃæÉè¼Æ»ù´¡
5.1.1 AWI’ºÍSwing
5.1.2×é¼þºÍÈÝÆ÷
5.1.3ʼþÇý¶¯³ÌÐòÉè¼Æ»ù´¡
5.2¿ò¼Ü´°¿Ú .
5.3±êÇ©¡¢°´Å¥ºÍ°´Å¥Ê¼þ
5.3.1 ±êÇ©
5.3.2°´Å¥ºÍ°´Å¥Ê¼þ´¦Àí
5.4Ãæ°å
5.4.1 JPanel
5.4.2 JScrollPane
5.5²¼¾ÖÉè¼Æ
5.5.1 FlowI.ayout²¼¾Ö
5.5.2 BorderI.a ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ6ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ6Õ ͼÐνçÃæÉè¼Æ(¶þ)
(Ò»)¿Î³ÌÄÚÈÝ
6.1Ñ¡Ôñ¿òºÍµ¥Ñ¡°´Å¥
6.1.1Ñ¡Ôñ¿ò
6.1.2µ¥Ñ¡¿ò
6.1.3µ¥Ñ¡°´Å¥
6.1.4Ñ¡ÔñÏîĿʼþ´¦Àí
6.2ÁбíºÍ×éºÏ¿ò
6.2.1Áбí
6.2.2×éºÏ¿ò
6.3²Ëµ¥
6.3.1²Ëµ¥Ìõ¡ ......
//´òÓ¡³ömess±íµÄÁÐÊýÊǶàÉÙ
public static void main(String[] args){
String sql="select count(*) from mess";
ResultSet set=null;
try {
Object paramValues[] = new Object[0];
set = DBUtil.preExec ......