如何使用io流获得对应swing文本输入框内容
展开全部
package bdzhidao;
/*
* 建议你学习一下最基本的布局方式,BorderLayout,FlowLayout,GridLayout,CardLayout,SpingLayout,BoxLayout;
*/
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class Layout extends JFrame{
private static final long serialVersionUID = 1L;
public Layout(){
this.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
this.add(new JTextField(18));
this.add(new JButton("按钮1"));
this.add(new JButton("按钮2"));
}
public static void main(String[] args){
JFrame frame=new Layout();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(240,100);
frame.setVisible(true);
frame.setLocation(200,300);//缺省是显示在桌面左上角
frame.setResizable(false);
}
}
/*
* 建议你学习一下最基本的布局方式,BorderLayout,FlowLayout,GridLayout,CardLayout,SpingLayout,BoxLayout;
*/
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class Layout extends JFrame{
private static final long serialVersionUID = 1L;
public Layout(){
this.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
this.add(new JTextField(18));
this.add(new JButton("按钮1"));
this.add(new JButton("按钮2"));
}
public static void main(String[] args){
JFrame frame=new Layout();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(240,100);
frame.setVisible(true);
frame.setLocation(200,300);//缺省是显示在桌面左上角
frame.setResizable(false);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询