⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jtime.java

📁 基于netbeans的java桌面应用程序合集
💻 JAVA
字号:
/*
 * jtime.java
 *
 * Created on 2007年12月1日, 下午5:38
 */

package org.Adam;

/**
 *
 * @author  Administrator
 */
public class jtime extends javax.swing.JFrame implements Runnable{
   String strLabel, strPmd, strPmdTemp;
    Thread T;
public void init(){ 
        strLabel = new String("☆这是一个跑马灯程序☆"); 
        strPmdTemp = ""; 
        T = new Thread(this);  
        T.start();
}
public void run(){    
        while(true)  {   
        strPmd = ""; 
        for(int i = 0; i < strLabel.length(); i++)   
        {   this.jLabel1.setText(strPmd);
        strPmd += strLabel.charAt(i);
        try    {     T.sleep(500);    }   
        catch(Exception e)    {     
        e.printStackTrace();    }       
        }       
        for(int i = 0; i < strPmd.length(); i++)  
        {        strPmdTemp = strPmd.substring(i, strPmd.length()); 
            this.jLabel1.setText(strPmdTemp);    
            try    {     T.sleep(500);   
        }    catch(Exception e)    
        {     e.printStackTrace();   
        }         
        }  
        }
}
    /** Creates new form jtime */
    public jtime() {
        initComponents();
        init();
        this.setLocationRelativeTo(this);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap(347, Short.MAX_VALUE)
                .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new jtime().setVisible(true);
            }
        });
    }

  
    
    // 变量声明 - 不进行修改//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    // 变量声明结束//GEN-END:variables
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -