資源簡(jiǎn)介
使用java桌面布局實(shí)現(xiàn)九九乘法表,桌面布局同九九乘法表完全相同,點(diǎn)擊每個(gè)按鈕,計(jì)算出相應(yīng)的值
代碼片段和文件信息
import?java.awt.*;
import?java.awt.event.*;
import?javax.swing.JButton;
import?javax.swing.JOptionPane;
import?foundation.user;
import?jdbcodbc.MyDblink;
public?class?ninene?extends?frame?implements?ActionListener{
Label?label;//label歡迎登錄username?用戶名標(biāo)簽password?密碼標(biāo)簽
List?list;//list列表
Button?bu[][]=new?Button[9][9];//denglu?登錄按鈕chongzhi?重置按鈕Exit?退出按鈕
String?ss[]=new?String[81];
Panel?panel[]=new?Panel[10];//容器panelpanel1panel2?
public?ninene(){//主界面構(gòu)造方法
????super(“九九乘法表“);
????list=new?List();
????list.setBackground(Color.lightGray);
// label=new?Label(“九九乘法表“);
for(int?i=1;i<=9;i++){
for(int?j=1;j<=9;j++){
bu[i-1][j-1]=new?Button(j+“x“+i);
bu[i-1][j-1].setBackground(Color.green);
bu[i-1][j-1].addActionListener(this);
}
}
for(int?i=1;i<=10;i++){
panel[i-1]=new?Panel();
}
panel[0]=new?Panel(new?GridLayout(91));
for(int?i=1;i<=9;i++){
panel[i]=new?Panel(new?G
評(píng)論
共有 條評(píng)論