package swing;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Test {
public static void main(String[] args) {
new Text2().setVisible(true);
}
}
class Text2 extends JFrame{
private JButton button;
private JTextField text;
public Text2(){
//设置窗口属性
super("我是标题");
this.setSize(250,200);
this.setLayout(null);
this.setLocation(500,500);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
button = new JButton("按钮");
text = new JTextField(20);
JPan
swing学习3--按钮触发事件及获取文本框值
最新推荐文章于 2024-07-08 00:01:13 发布