50,526
社区成员
发帖
与我相关
我的任务
分享
package t000;
import javax.swing.*;
import java.awt.*;
public class One extends JFrame{
static final int WIDTH=300;
static final int HEIGHT=200;
public One(){
super("One JFrame");
Container c=this.getContentPane();
c.setLayout(new FlowLayout());
JTextField messageText=new JTextField(10);
Label meaasgeLabel=new Label("Message:");
JButton okBtn=new JButton("OK");
c.add(meaasgeLabel);
c.add(messageText);
c.add(okBtn);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(WIDTH,HEIGHT);
this.setVisible(true);
}
public static void main(String[] args){
new One();
}
}