?? input_word.java
字號:
//package library2;import java.awt.BorderLayout;import javax.swing.JFrame;import javax.swing.JLabel;import java.awt.*;import javax.swing.JButton;import javax.swing.JTextField;import javax.swing.JCheckBox;import javax.swing.JTextArea;import javax.swing.JToggleButton;import java.io.*;import java.text.*;import java.awt.event.*;import java.awt.*;import java.util.*;import javax.swing.*;/** * <p>Title: </p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2005</p> * * <p>Company: </p> * * @author not attributable * @version 1.0 */public class input_word extends JFrame implements ActionListener{ JLabel jLabel1 = new JLabel(); JTextArea word_infor = new JTextArea(); JButton 確定 = new JButton(); JButton 退出 = new JButton(); public input_word() { try { jbInit(); } catch (Exception exception) { exception.printStackTrace(); } } private void jbInit() throws Exception {setTitle("we"); setTitle("英語一百"); getContentPane().setLayout(null); setSize(500,350); jLabel1.setText("請輸入單詞相關信息"); jLabel1.setBounds(new Rectangle(125, 29, 218, 62)); 退出.setBounds(new Rectangle(316, 261, 66, 33)); 退出.setText("退出");退出.addActionListener(this); 確定.setBounds(new Rectangle(139, 252, 77, 35)); 確定.setText("確定");確定.addActionListener(this); //this.setTitle("goodstay"); this.getContentPane().add(退出); this.getContentPane().add(jLabel1); this.getContentPane().add(word_infor); this.getContentPane().add(確定); word_infor.setText(""); word_infor.setBounds(new Rectangle(97, 105, 173, 131)); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) throws IOException { input_word input_word_object = new input_word(); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("確定")) { String str; str = word_infor.getText(); word_infor.setText(""); StringTokenizer tokenizer; tokenizer = new StringTokenizer(str); String str_end, str_zh; int number ; str_end = str_zh = tokenizer.nextToken("\n"); number = Integer.parseInt(str_zh); str_zh = tokenizer.nextToken("\n"); for(int i=0; i<number; i++) { str_end = str_end + ";" + str_zh; str_zh = tokenizer.nextToken("\n"); } words.add(str_end); JOptionPane.showMessageDialog(null, "單詞已成功存儲!", "output", JOptionPane.PLAIN_MESSAGE); } else if(e.getActionCommand().equals("退出")) { setVisible(false); choose choose_object = new choose(); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -