• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

包爱;

导入Java。awt。*;

导入javax。挥棒。*;

公共类NullLayoutDemo1扩展了JFrame {

/**

*

*/

private static final long serialVersionUID=1L;

公共静态void main(String[] args) {

//TODO自动生成的方法存根

nulllayoutdemo 1 A=new nulllayoutdemo 1();

答set visible(真);//显示

答。setdefaultcloseoperation(JFrame .EXIT _ ON _ CLOSE);//关闭

A.setSize(1000,600);//大小

}

NullLayoutDemo1(){

超级('不被定义');

容器c=getContentPane();

c。设置布局(空);//将自定义排版,取消默认排版

c。设置背景(颜色。黑色);//设置背景颜色为黑色

JButton JB[]=new JButton[27];

for(int I=0;i 27i ) {

jb =新的JButton(');//添加27个按钮

c。add(JB);//将按钮放到C板面当中

jb.设置背景(颜色。红色);//设置按钮为红色背景

}

JLabel label=new JLabel('心形');

label.setBounds(450,10,70,70);

标签。设置前景(颜色。白色);//字体白色

label.setFont(新字体('宋体,字体。粗体,30));//设置字体,加粗,大小30px

c。添加(标签);

//将按钮位置调整为一个心形

jb[0].setBounds (300,70,50,50);//(X轴位置,Y轴位置,按钮宽度,按钮高度)

jb[1].setBounds (375,70,50,50);

jb[2].setBounds (520,70,50,50);

jb[3]的缩写.setBounds (600,70,50,50);

jb[4].setBounds (260,140,50,50);

jb[5]的缩写.setBounds (335,140,50,50);

jb[6]的缩写.setBounds (410,140,50,50);

jb[7].setBounds (485,140,50,50);

jb[8].setBounds (560,140,50,50);

jb[9].setBounds (635,140,50,50);

jb[10].setBounds (230,210,50,50);

jb[11].setBounds (305,210,50,50);

jb[12].setBounds (380,210,50,50);

jb[13].setBounds (455,210,50,50);

jb[14].setBounds (530,210,50,50);

jb[15].setBounds (605,210,50,50);

jb[16].setBounds (680,210,50,50);

jb[17].setBounds (260,280,50,50);

jb[18].setBounds (335,280,50,50);

jb[19].setBounds (410,280,50,50);

jb[20].setBounds (485,280,50,50);

jb[21].setBounds (560,280,50,50);

jb[22].setBounds (635,280,50,50);

jb[23].setBounds (380,350,50,50);

jb[24].setBounds (455,350,50,50);

jb[25].setBounds (530,350,50,50);

jb[26].setBounds (455,420,50,50);

}

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now