开发工具:
文件大小: 327kb
下载次数: 0
上传时间: 2012-09-20
详细说明: java+sql房屋租赁系统 例: import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.JFrame; import java.awt.Dimension; import java.awt.SystemColor; import javax.swing.JLabel; import java.awt.Rectangle; import javax.swing.SwingConstants; import java.awt.Font; import java.awt.Point; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import javax.swing.JTextField; import javax.swing.JButton; import database.DatabaseUtil; public class DeleteHouseImformation extends JFrame { private s tatic final long serialVersionUID = 1L; private JPanel jContentPane = null; private JLabel jLabel = null; private JLabel jLabel1 = null; private JLabel jLabel2 = null; private JLabel jLabel3 = null; private JLabel jLabel4 = null; private JLabel jLabel5 = null; private JLabel jLabel6 = null; private JTextField jTextField = null; private JTextField jTextField1 = null; private JTextField jTextField2 = null; private JTextField jTextField3 = null; private JTextField jTextField4 = null; private JTextField jTextField5 = null; private JButton jButton = null; private JButton jButton1 = null; private JButton jButton2 = null; /** * This is the default constructor */ public DeleteHouseImformation() { super(); initialize(); } /** * This method initializes this * * @return void */ private void initialize() { this.setSize(453, 286); this.setContentPane(getJContentPane()); this.setTitle("删除房屋信息"); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jLabel6 = new JLabel(); jLabel6.setText("HouseStatus:"); jLabel6.setSize(new Dimension(97, 18)); jLabel6.setHorizontalAlignment(SwingConstants.RIGHT); jLabel6.setLocation(new Point(18, 210)); jLabel5 = new JLabel(); jLabel5.setText("HouseAddress:"); jLabel5.setSize(new Dimension(97, 18)); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setLocation(new Point(18, 180)); jLabel4 = new JLabel(); jLabel4.setText("HousseStyle:"); jLabel4.setSize(new Dimension(97, 18)); jLabel4.setHorizontalAlignment(SwingConstants.RIGHT); jLabel4.setLocation(new Point(18, 150)); jLabel3 = new JLabel(); jLabel3.setText("MaxNumder:"); jLabel3.setSize(new Dimension(97, 18)); jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); jLabel3.setLocation(new Point(18, 120)); jLabel2 = new JLabel(); jLabel2.setText("HouseRent:"); jLabel2.setSize(new Dimension(97, 18)); jLabel2.setHorizontalAlignment(SwingConstants.RIGHT); jLabel2.setLocation(new Point(18, 90)); jLabel1 = new JLabel(); jLabel1.setText("HouseID:"); jLabel1.setSize(new Dimension(97, 18)); jLabel1.setHorizontalAlignment(SwingConstants.RIGHT); jLabel1.setLocation(new Point(18, 60)); jLabel = new JLabel(); jLabel.setBounds(new Rectangle(75, 11, 295, 41)); jLabel.setHorizontalAlignment(SwingConstants.CENTER); jLabel.setHorizontalTextPosition(SwingConstants.CENTER); jLabel.setFont(new Font("\u534e\u6587\u65b0\u9b4f", Font.BOLD, 24)); jLabel.setText("请输入要删除的房屋信息"); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.setBackground(SystemColor.inactiveCaption); jContentPane.setFont(new Font("Dialog", Font.PLAIN, 12)); jContentPane.add(jLabel, null); jContentPane.add(jLabel1, null); jContentPane.add(jLabel2, null); jContentPane.add(jLabel3, null); jContentPane.add(jLabel4, null); jContentPane.add(jLabel5, null); jContentPane.add(jLabel6, null); jContentPane.add(getJTextField(), null); jContentPane.add(getJTextField1(), null); jContentPane.add(getJTextField2(), null); jContentPane.add(getJTextField3(), null); jContentPane.add(getJTextField4(), null); jContentPane.add(getJTextField5(), null); jContentPane.add(getJButton(), null); jContentPane.add(getJButton1(), null); jContentPane.add(getJButton2(), null); } return jContentPane; } /** * This method initializes jTextField * * @return javax.swing.JTextField */ private JTextField getJTextField() { if (jTextField == null) { jTextField = new JTextField(); jTextField.setLocation(new Point(118, 58)); jTextField.setSize(new Dimension(130, 22)); } return jTextField; } /** * This method initializes jTextField1 * * @return javax.swing.JTextField */ private JTextField getJTextField1() { if (jTextField1 == null) { jTextField1 = new JTextField(); jTextField1.setLocation(new Point(118, 90)); jTextField1.setSize(new Dimension(130, 22)); } return jTextField1; } /** * This method initializes jTextField2 * * @return javax.swing.JTextField */ private JTextField getJTextField2() { if (jTextField2 == null) { jTextField2 = new JTextField(); jTextField2.setLocation(new Point(118, 118)); jTextField2.setSize(new Dimension(130, 22)); } return jTextField2; } /** * This method initializes jTextField3 * * @return javax.swing.JTextField */ private JTextField getJTextField3() { if (jTextField3 == null) { jTextField3 = new JTextField(); jTextField3.setLocation(new Point(118, 152)); jTextField3.setSize(new Dimension(130, 22)); } return jTextField3; } /** * This method initializes jTextField4 * * @return javax.swing.JTextField */ private JTextField getJTextField4() { if (jTextField4 == null) { jTextField4 = new JTextField(); jTextField4.setLocation(new Point(118, 182)); jTextField4.setSize(new Dimension(130, 22)); } return jTextField4; } /** * This method initializes jTextField5 * * @return javax.swing.JTextField */ private JTextField getJTextField5() { if (jTextField5 == null) { jTextField5 = new JTextField(); jTextField5.setLocation(new Point(118, 208)); jTextField5.setSize(new Dimension(130, 22)); } return jTextField5; } /** * This method initializes jButton * * @return javax.swing.JButton */ private JButton getJButton() { if (jButton == null) { jButton = new JButton(); jButton.setLocation(new Point(344, 122)); jButton.setText("删除"); jButton.setSize(new Dimension(64, 29)); jButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { //String url = "jdbc:jtds:sqlserver://localhost:1433;DatabaseName=housesystem"; Connection con = DatabaseUtil.getConnection(); try { //Class.forName("net.sourceforge.jtds.jdbc.Driver"); //Connection con = DriverManager.getConnection(url,"sa","123456"); Statement stmt = con.createStatement(); String HouseID = jTextField.getText(); String HouseRent = jTextField1.getText(); String MaxNumder =jTextField2.getText(); String HousseStyle = jTextField3.getText(); String HouseAddress = jTextField4.getText(); String HouseStatus = jTextField5.getText(); String SQL="DELETE FROM HouseImformation WHERE HouseID=('"+HouseID+"') OR HouseRent=('"+HouseRent+"') OR MaxNumder=('"+MaxNumder+"') OR HousseStyle=('"+HousseStyle+"') OR HouseAddress=('"+HouseAddress+"') OR HouseStatus=('"+HouseStatus+"')"; stmt.executeUpdate(SQL); stmt.close(); con.close(); } catch (Exception ex) { } System.out.println("删除成功!");// TODO Auto-generated Event stub actionPerformed() } }); } return jButton; } /** * This method initializes jButton1 * * @return javax.swing.JButton */ private JButton getJButton1() { if (jButton1 == null) { jButton1 = new JButton(); jButton1.setBounds(new Rectangle(348, 159, 64, 29)); jButton1.setText("退出"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { dispose(); // TODO Auto-generated Event stub actionPerformed() } }); } return jButton1; } /** * This method initializes jButton2 * * @return javax.swing.JButton */ private JButton getJButton2() { if (jButton2 == null) { jButton2 = new JButton(); jButton2.setText("清空"); jButton2.setSize(new Dimension(64, 29)); jButton2.setLocation(new Point(350, 199)); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jTextField.setText(""); jTextField1.setText(""); jTextField2.setText(""); jTextField3.setText(""); jTextField4.setText(""); jTextField5.setText(""); // TODO Auto-generated Event stub actionPerformed() } }); } return jButton2; } } // @jve:decl-index=0:visual-constraint="205,9" ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.