?? addwordsframe.java
字號:
package end;import java.awt.*;import javax.swing.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author unascribed * @version 1.0 */class AddWordsFrame extends JFrame { JPanel contentPane; JTextPane Wordsin = new JTextPane(); JTextPane Transin = new JTextPane(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); Image icon; public AddWordsFrame() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.setSize(320,240); icon=getToolkit().getImage("ico.gif"); this.setIconImage(icon); contentPane =(JPanel)this.getContentPane(); contentPane.setSize(320,240); contentPane.setLayout(null); contentPane.setBackground(new Color(226, 245, 255)); contentPane.setAlignmentX((float) 1.0); contentPane.setAlignmentY((float) 1.0); contentPane.setToolTipText(""); contentPane.setActionMap(null); Wordsin.setBackground(new Color(245, 251, 255)); Wordsin.setFont(new java.awt.Font("SansSerif", 0, 12)); Wordsin.setForeground(Color.blue); Wordsin.setBounds(new Rectangle(85, 8, 208, 22)); Transin.setBackground(new Color(245, 251, 255)); Transin.setFont(new java.awt.Font("SansSerif", 0, 12)); Transin.setForeground(Color.blue); Transin.setBounds(new Rectangle(17, 60, 191, 150)); jButton1.setBackground(new Color(188, 244, 224)); jButton1.setBounds(new Rectangle(214, 127, 89, 28)); jButton1.setFont(new java.awt.Font("SansSerif", 0, 12)); jButton1.setText("確定"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); jButton2.setBackground(new Color(188, 244, 224)); jButton2.setBounds(new Rectangle(213, 173, 91, 28)); jButton2.setFont(new java.awt.Font("SansSerif", 0, 12)); jButton2.setText("取消"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton2_actionPerformed(e); } }); this.setFont(new java.awt.Font("SansSerif", 0, 12)); this.setResizable(false); this.setTitle("添加單詞"); jLabel1.setBackground(new Color(245, 251, 255)); jLabel1.setFont(new java.awt.Font("SansSerif", 0, 12)); jLabel1.setText("輸入單詞"); jLabel1.setBounds(new Rectangle(3, 6, 75, 28)); jLabel2.setBounds(new Rectangle(5, 38, 75, 24)); jLabel2.setBackground(new Color(245, 251, 255)); jLabel2.setFont(new java.awt.Font("SansSerif", 0, 12)); jLabel2.setText("輸入解釋"); contentPane.add(Transin, null); contentPane.add(jButton1, null); contentPane.add(jButton2, null); contentPane.add(Wordsin, null); contentPane.add(jLabel1, null); contentPane.add(jLabel2, null); } void jButton1_actionPerformed(ActionEvent e) { if(Wordsin.getText()!="") { frame.addwords(Wordsin.getText(),Transin.getText()); } close(); } void jButton2_actionPerformed(ActionEvent e) { close(); } void close() { processWindowEvent(new WindowEvent(this,WindowEvent.WINDOW_CLOSING)); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -