importjavax.swing.*;importjava.awt.FlowLayout;publicclassTkj{publicstaticvoidmain(String[]args){JFrameaa=newJFrame();//声明aaa.setVisible(true);//可见aa.setTitle("肥羊");...
import javax.swing.*;import java.awt.FlowLayout;public class Tkj { public static void main(String[]args){ JFrame aa=new JFrame();//声明a aa.setVisible(true);//可见 aa.setTitle("肥羊");//标题 aa.setSize(200,200);//大小 aa.setLocation(200,200);//位置 aa.setResizable(true);//能否拉大小 aa.setLayout(new FlowLayout());//创建布局面板 //创建标签 JLabel label1=new JLabel("肥羊账号:"); aa.add(label1); JTextField userName = new JTextField(10); aa.add(userName); JLabel label2=new JLabel("肥羊密码:"); aa.add(label2); JPasswordField password=new JPasswordField(10); aa.add(password); //按钮 JButton loginBan = new JButton("登入"); aa.add(loginBan); JButton resetBan = new JButton("退出"); aa.add(resetBan); aa.pack(); ImageIcon img = new ImageIcon("QQ图片20141212152800.jpg"); JLabel imgLabel = new JLabel(img); }}
展开