📄 language.java
字号:
package untitled5;import java.io.*;import java.net.*;import java.sql.*;import java.lang.*;import javax.sql.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class language extends JFrame { JPanel contentPane; XYLayout xYLayout1 = new XYLayout(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JTextField jTextField1 = new JTextField(); JLabel jLabel4 = new JLabel(); JTextField jTextField2 = new JTextField(); JButton jButton1 = new JButton(); //Construct the frame public language() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); jLabel1.setFont(new java.awt.Font("SansSerif", 0, 25)); jLabel1.setForeground(Color.red); jLabel1.setText("物流管理系统"); contentPane.setLayout(xYLayout1); this.setSize(new Dimension(500, 400)); this.setTitle("物流管理系统"); jLabel2.setFont(new java.awt.Font("SansSerif", 0, 30)); jLabel2.setText("仓库信息统计子页面"); jLabel3.setFont(new java.awt.Font("SansSerif", 0, 25)); jLabel3.setText("仓库编码"); jTextField1.setText(""); jLabel4.setFont(new java.awt.Font("SansSerif", 0, 25)); jLabel4.setText("仓库名称"); jTextField2.setText(""); jButton1.setFont(new java.awt.Font("SansSerif", 0, 30)); jButton1.setMargin(new Insets(2, 14, 2, 14)); jButton1.setText("提交"); jButton1.addActionListener(new language_jButton1_actionAdapter(this)); contentPane.setBackground(UIManager.getColor("Desktop.background")); contentPane.add(jLabel1, new XYConstraints(186, 1, -1, 26)); contentPane.add(jLabel2, new XYConstraints(126, 37, -1, -1)); contentPane.add(jLabel3, new XYConstraints(90, 135, -1, -1)); contentPane.add(jTextField1, new XYConstraints(197, 136, 151, 37)); contentPane.add(jLabel4, new XYConstraints(92, 211, -1, -1)); contentPane.add(jTextField2, new XYConstraints(196, 215, 154, 35)); contentPane.add(jButton1, new XYConstraints(201, 298, -1, 39)); } //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 validID() { try { //定义显示的字符串 String str1; String str2; String str3; String str4; String str5; str1 = jTextField1.getText(); str2 = jTextField2.getText(); //装载jdbc驱动程序 String driverName = "oracle.jdbc.OracleDriver"; Driver driver = (Driver) Class.forName(driverName).newInstance(); //连接数据库 Connection con = DriverManager.getConnection( "jdbc:oracle:thin:@thsspc0791:1521:tongfang", "sa", "tongfang"); PreparedStatement pstmt = con.prepareStatement( " insert Ware_Info('WareNumber','Name')values(?,?)"); pstmt.setString(1, str1); pstmt.setString(2, str2); ResultSet res = pstmt.executeQuery(); pstmt.close(); con.close(); }catch (InstantiationException e) { System.out.println(e.getMessage()); }catch (IllegalAccessException e) { System.out.println(e.getMessage()); }catch (ClassNotFoundException e) { System.out.println(e.getMessage()); }catch (SQLException edd) { edd.printStackTrace() ; System.out.println(edd.getMessage()); } } void jButton1_actionPerformed(ActionEvent e) { ///////////////////////////// validID(); }}class language_jButton1_actionAdapter implements java.awt.event.ActionListener { language adaptee; language_jButton1_actionAdapter(language adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -