?? about.java
字號:
package about;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import javax.swing.text.html.*;
import java.net.*;
public class About extends JDialog
{
private JLabel TopLab;
private MyDongcLabel CenLab;
private JLabel LineLab;
private JLabel MaDengLab;
private JButton btn;
private MyPicLabel mpl;
private JTextPane TextPan1,TextPan2;
Timer t=new Timer(100,new TimerEv());//走馬燈效果
//走馬燈效果用的變量
StringBuffer s=new StringBuffer("謝謝使用!如有問題請聯系我們!");
int len=0;
int loop=0;
int over=0;
int spacelen=15;
boolean b=true;
public About(){}
public About(Frame owner, String title, boolean modal)
{
super(owner,title,modal);
setBounds(300,200,475,330);
setResizable(false);
TopLab=new JLabel(new ImageIcon(About.class.getResource("top.jpg")));
TopLab.setBounds(0,0,475,80);
CenLab=new MyDongcLabel();
CenLab.setBounds(0,80,470,10);
Border br1=new EtchedBorder();
TitledBorder br=new TitledBorder(br1);
LineLab=new JLabel();
LineLab.setBorder(br);
LineLab.setBounds(185,235,270,2);
MaDengLab=new JLabel();
MaDengLab.setBounds(189,240,270,15);
btn=new JButton(" 確 定 ");
btn.setFont(new Font("宋體",0,12));
btn.setBorder(new MyBorder(btn));
btn.setBounds(350,265,80,25);
btn.setFocusPainted(false);
btn.addMouseListener(new MouseListener()
{
public void mouseClicked(MouseEvent e)
{
About.this.dispose();
}
public void mouseEntered(MouseEvent e)
{
Cursor sss=new Cursor(Cursor.HAND_CURSOR);
setCursor(sss);
}
public void mouseExited(MouseEvent e)
{
Cursor sss=new Cursor(Cursor.DEFAULT_CURSOR);
setCursor(sss);
}
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
});
mpl=new MyPicLabel();
mpl.setBounds(10,100,128,128);
TextPan1=new JTextPane();
TextPan1.setEditable(false);
TextPan2=new JTextPane();
TextPan2.setEditable(false);
TextPan1.setBounds(185,100,310,25);
TextPan1.setText("JAVA語言實現的俄羅斯方塊");
TextPan2.setBounds(185,120,310,110);
TextPan2.setText("版本號:V1.0 \n作 者:研發總監:趙德奎\n 分析設計:楊 強\n 程序編寫:小 豬 \n日 期:2008年8月13日\nEMAIL :yangqiang@tarena.com.cn\n公 司:北京達內科技有限公司");//(Tarena IT Training Group)
t.start();
len=s.length();
for(int i=0;i<spacelen;i++)
{
s.insert(0,' ');
}
Container con=getContentPane();
con.setBackground(Color.white);
con.setLayout(null);
con.add(CenLab);
con.add(TopLab);
con.add(mpl);
con.add(TextPan1);
con.add(TextPan2);
con.add(LineLab);
con.add(MaDengLab);
con.add(btn);
setVisible(true);
}
//走馬燈效果
class TimerEv implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
s.deleteCharAt(loop);
s.insert(spacelen+loop,' ');
over++;
if(over>=15)
{
loop++;
over=0;
}
if(loop==15)
{
t.stop();
}
MaDengLab.setText(""+s);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -