package op;
import java.awt.*;
import javax.swing.*;import java.awt.*;import java.awt.event.*;import tools.*;
/** * <p>Title: </p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2007</p> * * <p>Company: </p> * * @author not attributable * @version 1.0 */public class MarkDialog extends JDialog {
JComboBox jComboBox1 = new JComboBox(); JLabel jLabel1 = new JLabel(); JButton btncancle = new JButton(); JButton btnok = new JButton(); DBConnection dcon = null; String id;
public MarkDialog(Frame owner, String title, boolean modal,String _id) { super(owner, title, modal); try { id = _id; setDefaultCloseOperation(DISPOSE_ON_CLOSE); jbInit(); pack(); } catch (Exception exception) { exception.printStackTrace(); } }
public MarkDialog(String _id) { this(new Frame(), "MarkDialog", false,_id); }
private void jbInit() throws Exception { this.getContentPane().setLayout(null); String[] s={"正常","报废","维修"}; jComboBox1.addItem(s[0]); jComboBox1.addItem(s[1]); jComboBox1.addItem(s[2]); jComboBox1.setBounds(new Rectangle(24, 56, 142, 33)); this.getContentPane().add(jLabel1); btnok.setBounds(new Rectangle(32, 113, 62, 31)); btnok.setText("确定"); btncancle.setBounds(new Rectangle(107, 110, 61, 33)); btncancle.setText("取消"); this.getContentPane().add(jComboBox1); this.getContentPane().add(btnok); this.getContentPane().add(btncancle); jLabel1.setText("编号为"+id+"状态的调整"); this.setResizable(false); jLabel1.setBounds(new Rectangle(20, 15, 153, 33));
btncancle.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { closedialog(); }
}); btnok.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { dcon = new DBConnection(); String values = jComboBox1.getSelectedItem().toString().trim(); String sql = " update Asset set asset_status = '"+values +"' where asset_id = '"+id+"'"; dcon.update(1,sql); closedialog(); } });}private void closedialog(){this.dispose();}
}