2个回答
展开全部
package t;
import java.awt.Button;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextField;
public class UI extends Frame {
public UI() {
super("登录界面");
Panel p = new Panel();
p.setLayout(null);
Label l1=new Label("用户名");
l1.setBounds(20,20, 100,30);
Label l2=new Label("密码");
l2.setBounds(20,55, 100,30);
TextField t1=new TextField();
t1.setBounds(120,20, 100,20);
TextField t2=new TextField();
t2.setBounds(120,55, 100,20);
Button enter = new Button("确定");
enter.setBounds(100,90, 50,30);
Button help = new Button("取消");
help.setBounds(160,90, 50,30);
p.add(l1);
p.add(l2);
p.add(t1);
p.add(t2);
p.add(enter);
p.add(help);
p.setBounds(0,0,200,200);
this.add(p);
this.setBounds(100,100,300,200);
this.setVisible(true);
}
public static void main(String args[]) {
new UI();
}
}
import java.awt.Button;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextField;
public class UI extends Frame {
public UI() {
super("登录界面");
Panel p = new Panel();
p.setLayout(null);
Label l1=new Label("用户名");
l1.setBounds(20,20, 100,30);
Label l2=new Label("密码");
l2.setBounds(20,55, 100,30);
TextField t1=new TextField();
t1.setBounds(120,20, 100,20);
TextField t2=new TextField();
t2.setBounds(120,55, 100,20);
Button enter = new Button("确定");
enter.setBounds(100,90, 50,30);
Button help = new Button("取消");
help.setBounds(160,90, 50,30);
p.add(l1);
p.add(l2);
p.add(t1);
p.add(t2);
p.add(enter);
p.add(help);
p.setBounds(0,0,200,200);
this.add(p);
this.setBounds(100,100,300,200);
this.setVisible(true);
}
public static void main(String args[]) {
new UI();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询