📄 frame1.java
字号:
package spell;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.text.*;public class Frame1 extends JFrame { JPanel contentPane; private String values=""; JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JTextField jTextField1 = new JTextField(); JScrollPane jScrollPane1 = new JScrollPane(); JTextArea jTextArea1 = new JTextArea(); JButton jButton1 = new JButton(); GridBagLayout gridBagLayout1 = new GridBagLayout(); //Construct the frame public Frame1() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); jLabel1.setBackground(Color.black); jLabel1.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel1.setForeground(Color.white); jLabel1.setOpaque(true); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText("拼音查询 V1.0.1 Battel 1"); contentPane.setLayout(gridBagLayout1); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocale(java.util.Locale.getDefault()); this.setResizable(false); this.setSize(new Dimension(400, 300)); this.setState(Frame.NORMAL); this.setTitle("XCode-Studio工作室创意篇"); jLabel2.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel2.setText("输入查询字"); jTextField1.setFont(new java.awt.Font("Dialog", 0, 12)); jTextField1.setBorder(BorderFactory.createLoweredBevelBorder()); jTextField1.setText(""); jTextArea1.setBackground(Color.white); jTextArea1.setFont(new java.awt.Font("Dialog", 0, 13)); jTextArea1.setForeground(new Color(255, 83, 0)); jTextArea1.setEditable(false); jTextArea1.setText(""); jTextArea1.setLineWrap(true); jButton1.setFont(new java.awt.Font("Dialog", 0, 12)); jButton1.setForeground(Color.red); jButton1.setOpaque(false); jButton1.setText("退出"); jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this)); contentPane.setBackground(new Color(145, 208, 214)); contentPane.add(jLabel1, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 282, 0)); contentPane.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(58, 25, 0, 0), 14, 12)); contentPane.add(jTextField1, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(61, 0, 6, 50), 240, 0)); contentPane.add(jScrollPane1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(28, 30, 0, 48), 320, 70)); contentPane.add(jButton1, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(21, 68, 32, 162), 14, -2)); jScrollPane1.getViewport().add(jTextArea1, null); jTextField1.getDocument().addDocumentListener(new javax.swing.event.DocumentListener() { public void insertUpdate(javax.swing.event.DocumentEvent e) { values=CnToSpell.getStringSpell(jTextField1.getText()," "); jTextArea1.setText(values); } public void removeUpdate(javax.swing.event.DocumentEvent e) { values=CnToSpell.getStringSpell(jTextField1.getText()," "); jTextArea1.setText(values); } public void changedUpdate(javax.swing.event.DocumentEvent e) { } }); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jButton1_actionPerformed(ActionEvent e) { System.exit(0); }}class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener { Frame1 adaptee; Frame1_jButton1_actionAdapter(Frame1 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -