?? instructions.java~2~
字號:
package Chapter1;import java.io.*;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;import java.awt.Rectangle;import java.awt.Font;public class Instructions extends JFrame implements ActionListener{ public static final int WIDTH=400; public static final int HEIGHT=400; JLabel jLabel1 = new JLabel(); JButton jButton1 = new JButton(); public Instructions() { setSize(WIDTH,HEIGHT); setTitle("使用說明"); Container contentPane=getContentPane(); contentPane.setBackground(Color.green); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("提交")) { //用于獲取用戶輸入的信息 try { String url="jdbc:odbc:MySecondAccess"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection(url,"",""); Statement stmt=con.createStatement(); String SQLOrder="INSERT INTO BasicInformation "; stmt.executeUpdate(SQLOrder); stmt.close(); con.close(); } catch(Exception ex) { System.out.println(ex.getStackTrace()); System.out.println(ex.getMessage()); } } else if (e.getActionCommand().equals("重置")) { } else if (e.getActionCommand().equals("返回")) { this.setVisible(false); ManagerInterface n=new ManagerInterface(); n.setVisible(true); } } public static void main(String[] args) { Instructions n=new Instructions(); n.setVisible(true); } private void jbInit() throws Exception { jLabel1.setFont(new java.awt.Font("Dialog", 1, 13)); jLabel1.setRequestFocusEnabled(true); jLabel1.setText("此系統用于管理學生信息,包括學生信息的輸入和查詢等功能!"); jLabel1.setBounds(new Rectangle(8, 56, 376, 152)); this.getContentPane().setLayout(null); jButton1.setBounds(new Rectangle(169, 242, 73, 25)); jButton1.setFont(new java.awt.Font("Dialog", 1, 13)); jButton1.setText("返回"); this.getContentPane().add(jLabel1, null); this.getContentPane().add(jButton1, null); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -