保存到文本文件

时间:2016-05-24 06:08:29

标签: java button textbox

我正在创建一个程序,我从用户那里获得输入,然后我希望将所述输入放入文本文件中。目前我已经有了弹出窗口,文本框和按钮,但是如何才能按下按钮,文本框中的文本会保存到新的文本文件中?

private JLabel intro;
private JButton submit;
private JTextField a1, a2, a3, a4, a5, a6, a7;

public Work() {
    setLayout(new FlowLayout());

    intro=new JLabel ("<html>Please give each subject a weight of importance and a relative score<br>the product functional business goal<br>product's release strategic intent<br>product's new functionality<br>product's improved functionality<br>product's quality (performance, reliability…)<br>product's development enabler<br>timeing related competative factors (there is potential impact of delaying - time to market, is it a market differentiator)</html>");
    add(intro);


    a1=new JTextField (30);
    add(a1);


    submit=new JButton ("Submit");
    add(submit);
}

public static void main (String args[]){
    Work gui=new Work();
    gui.setDefaultCloseOperation(JFrame .EXIT_ON_CLOSE);
    gui.setVisible(true);
    gui.setSize(1000, 800);
    gui.setTitle("Test");
}

}

0 个答案:

没有答案