用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

小鱼宝宝    -  云代码空间

——

sa

2017-05-24|1081阅||

摘要:asd

/*
 * Form_update.java
 *
 * Created on __DATE__, __TIME__
 */


package www.baidu.com.form;


import java.awt.Toolkit;


import javax.swing.JOptionPane;


import www.baidu.com.subject.Subject;
import www.baidu.com.system.Update;


/**
 *
 * @author  __USER__
 */
public class Form_update extends javax.swing.JFrame {


/** Creates new form Form_update */
public Form_update(Subject subject) {
initComponents(subject);
//禁用最大化窗口按钮
this.setResizable(false);
this.setTitle("修改学生成绩");
//设置剧中窗口
int w = (Toolkit.getDefaultToolkit().getScreenSize().width - 510) / 2;
        int h = (Toolkit.getDefaultToolkit().getScreenSize().height - 290) / 2;
        this.setLocation(w, h);
}


/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents(Subject a) {


jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField(""+a.getId());
jTextField1.setEditable(false);
jTextField2 = new javax.swing.JTextField(a.getName());
jTextField3 = new javax.swing.JTextField(""+a.getChinese());
jTextField4 = new javax.swing.JTextField(""+a.getEnglish());
jTextField5 = new javax.swing.JTextField(""+a.getMath());
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();


setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);


jLabel1.setText("\u7f16\u53f7:");


jLabel2.setText("\u59d3\u540d:");


jLabel3.setText("\u8bed\u6587:");


jLabel4.setText("\u82f1\u8bed:");


jLabel5.setText("\u6570\u5b66:");


jButton1.setText("\u4fee\u6539");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});


jButton2.setText("\u653e\u5f03");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});


javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addGroup(
javax.swing.GroupLayout.Alignment.LEADING,
layout.createSequentialGroup()
.addComponent(
jLabel5)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
jTextField5)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(
jLabel4)
.addComponent(
jLabel2)
.addComponent(
jLabel3)
.addComponent(
jLabel1))
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addComponent(
jTextField2)
.addComponent(
jTextField3)
.addComponent(
jTextField4)
.addComponent(
jTextField1,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.PREFERRED_SIZE,
92,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(67, Short.MAX_VALUE))
.addGroup(
layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(jButton1)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED,
46, Short.MAX_VALUE)
.addComponent(jButton2).addGap(43, 43, 43)));
layout.setVerticalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(
jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(
jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(
jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(
jTextField4,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addGap(18, 18, 18)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(
jTextField5,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addContainerGap(21, Short.MAX_VALUE)));


pack();
}// </editor-fold>
//GEN-END:initComponents


private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//放弃修改信息
this.setVisible(false);
Form_table form_table=new Form_table();
form_table.setVisible(true);this.setVisible(false);
}


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//修改信息
int id = Integer.parseInt(jTextField1.getText());
String name = jTextField2.getText();
int chinese = Integer.parseInt(jTextField3.getText());
int english = Integer.parseInt(jTextField4.getText());
int math = Integer.parseInt(jTextField5.getText());
Subject subject = new Subject();
subject.setId(id);
subject.setName(name);
subject.setChinese(chinese);
subject.setEnglish(english);
subject.setMath(math);
boolean x = Update.getAllSubject(subject);
if (x) {
JOptionPane.showMessageDialog(null, "修改成功!", "消息",JOptionPane.WARNING_MESSAGE);
this.setVisible(false);
Form_table form_table=new Form_table();
form_table.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "修改失败!", "消息",JOptionPane.WARNING_MESSAGE);
this.setVisible(false);
Form_table form_table=new Form_table();
form_table.setVisible(true);
}
}


/**
* @param args the command line arguments
*/
// public static void main(String args[]) {
// java.awt.EventQueue.invokeLater(new Runnable() {
// public void run() {
// new Form_update().setVisible(true);
// }
// });
// }


//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
// End of variables declaration//GEN-END:variables


}
顶 0踩 0收藏
文章评论
    发表评论

    个人资料

    • 昵称: 小鱼宝宝
    • 等级: 初级程序员
    • 积分: 18
    • 代码: 2 个
    • 文章: 15 篇
    • 随想: 0 条
    • 访问: 8 次
    • 关注

    人气文章

    人气代码

    最新提问

      站长推荐