📄 stuupdateframe.java
字号:
package com.hb.studentmanager.ui;
import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import com.hb.studentmanager.action.StuAction;
import com.hb.studentmanager.tools.ChooseFile;
import com.hb.studentmanager.tools.DateChooserJButton;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class StuUpdateFrame extends javax.swing.JDialog {
public JLabel stuidjLabel;
public JLabel namejLabel;
public JTextField teljTextField;
public JButton submjButton;
public JTextArea beizjTextArea;
public JScrollPane beizjScrollPane;
public JTextArea addjTextArea;
public JScrollPane jScrollPane;
public JLabel beizjLabel;
public JLabel addressjLabel;
public JButton phojButton;
public JLabel phojLabel;
public JComboBox zhengzjComboBox;
public JComboBox classjComboBox;
public DateChooserJButton datejButton;
public ButtonGroup buttonGroup1;
public JRadioButton womenjRadioButton;
public JRadioButton manjRadioButton;
public JTextField namejTextField;
public JTextField stuidjTextField;
public JLabel classjLabel;
public JLabel zhengzjLabel;
public JLabel teljLabel;
public JLabel datejLabel;
public JLabel sexjLabel;
public File file=null;
public DefaultComboBoxModel classjComboBoxModel;
StuMainFrame smf=new StuMainFrame();
/**
* Auto-generated main method to display this JDialog
*/
// public static void main(String[] args) {
// JFrame frame = new JFrame();
// StuUpdateFrame inst = new StuUpdateFrame(frame);
// inst.setVisible(true);
// }
public StuUpdateFrame(StuMainFrame smf) {
super();
this.smf=smf;
initGUI();
int width=Toolkit.getDefaultToolkit().getScreenSize().width;
int height=Toolkit.getDefaultToolkit().getScreenSize().height;
this.setLocation((width-450)/2, (height-470)/2);
this.setResizable(false);
}
private void initGUI() {
try {
{
getContentPane().setLayout(null);
this.setTitle("\u4fee\u6539\u5b66\u751f\u5b66\u4e60");
{
{
buttonGroup1 = new ButtonGroup();
}
stuidjLabel = new JLabel();
getContentPane().add(stuidjLabel);
stuidjLabel.setText("\u5b66\u53f7\uff1a");
stuidjLabel.setBounds(14, 7, 63, 28);
}
{
namejLabel = new JLabel();
getContentPane().add(namejLabel);
namejLabel.setText("\u59d3\u540d\uff1a");
namejLabel.setBounds(14, 63, 63, 28);
}
{
sexjLabel = new JLabel();
getContentPane().add(sexjLabel);
sexjLabel.setText("\u6027\u522b\uff1a");
sexjLabel.setBounds(14, 112, 63, 28);
}
{
datejLabel = new JLabel();
getContentPane().add(datejLabel);
datejLabel.setText("\u51fa\u751f\u65e5\u671f\uff1a");
datejLabel.setBounds(14, 168, 70, 28);
}
{
teljLabel = new JLabel();
getContentPane().add(teljLabel);
teljLabel.setText("\u8054\u7cfb\u7535\u8bdd\uff1a");
teljLabel.setBounds(14, 294, 70, 28);
}
{
zhengzjLabel = new JLabel();
getContentPane().add(zhengzjLabel);
zhengzjLabel.setText("\u653f\u6cbb\u9762\u8c8c\uff1a");
zhengzjLabel.setBounds(14, 357, 70, 28);
}
{
classjLabel = new JLabel();
getContentPane().add(classjLabel);
classjLabel.setText("\u6240\u5728\u73ed\u7ea7\uff1a");
classjLabel.setBounds(14, 231, 70, 28);
}
{
stuidjTextField = new JTextField();
getContentPane().add(stuidjTextField);
stuidjTextField.setBounds(91, 7, 126, 28);
stuidjTextField.setEditable(false);
}
{
namejTextField = new JTextField();
getContentPane().add(namejTextField);
namejTextField.setBounds(91, 63, 126, 28);
}
{
manjRadioButton = new JRadioButton();
getContentPane().add(manjRadioButton);
manjRadioButton.setText("\u7537");
manjRadioButton.setBounds(91, 112, 63, 28);
buttonGroup1.add(manjRadioButton);
}
{
womenjRadioButton = new JRadioButton();
getContentPane().add(womenjRadioButton);
womenjRadioButton.setText("\u5973");
womenjRadioButton.setBounds(154, 112, 63, 28);
buttonGroup1.add(womenjRadioButton);
}
{
datejButton = new DateChooserJButton();
getContentPane().add(datejButton);
datejButton.setBounds(91, 168, 126, 28);
}
{
classjComboBoxModel = new DefaultComboBoxModel();
StuAction sa=new StuAction();
sa.getClassName(classjComboBoxModel);//得到班号
classjComboBox = new JComboBox();
getContentPane().add(classjComboBox);
classjComboBox.setModel(classjComboBoxModel);
classjComboBox.setBounds(91, 231, 126, 28);
classjComboBox.setSelectedItem("null");
}
{
teljTextField = new JTextField();
getContentPane().add(teljTextField);
teljTextField.setBounds(91, 294, 126, 28);
}
{
ComboBoxModel zhengzjComboBoxModel = new DefaultComboBoxModel(
new String[] { "团员","党员" });
zhengzjComboBox = new JComboBox();
getContentPane().add(zhengzjComboBox);
zhengzjComboBox.setModel(zhengzjComboBoxModel);
zhengzjComboBox.setBounds(91, 357, 126, 28);
}
{
phojLabel = new JLabel();
getContentPane().add(phojLabel);
phojLabel.setText(" \u663e\u793a\u7167\u7247\u5904");
phojLabel.setBounds(315, 7, 105, 119);
phojLabel.setSize(105, 120);
}
{
phojButton = new JButton();
getContentPane().add(phojButton);
phojButton.setText("\u9009\u62e9\u7167\u7247");
phojButton.setBounds(322, 126, 91, 28);
phojButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
phojButtonActionPerformed(evt);
}
});
}
{
addressjLabel = new JLabel();
getContentPane().add(addressjLabel);
addressjLabel.setText("\u5bb6\u5ead\u4f4f\u5740\uff1a");
addressjLabel.setBounds(315, 175, 70, 28);
}
{
beizjLabel = new JLabel();
getContentPane().add(beizjLabel);
beizjLabel.setText("\u5907\u6ce8\uff1a");
beizjLabel.setBounds(315, 287, 63, 28);
}
{
jScrollPane = new JScrollPane();
getContentPane().add(jScrollPane);
jScrollPane.setBounds(315, 203, 105, 77);
{
addjTextArea = new JTextArea();
jScrollPane.setViewportView(addjTextArea);
addjTextArea.setBounds(266, 259, 63, 28);
addjTextArea.setLineWrap(true);
}
}
{
beizjScrollPane = new JScrollPane();
getContentPane().add(beizjScrollPane);
beizjScrollPane.setBounds(315, 315, 105, 77);
{
beizjTextArea = new JTextArea();
beizjScrollPane.setViewportView(beizjTextArea);
beizjTextArea.setBounds(280, 364, 63, 28);
beizjTextArea.setLineWrap(true);
}
}
{
submjButton = new JButton();
getContentPane().add(submjButton);
submjButton.setText("\u63d0\u4ea4");
submjButton.setBounds(329, 406, 84, 28);
submjButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
submjButtonActionPerformed(evt);
}
});
}
}
setSize(450, 470);
} catch (Exception e) {
e.printStackTrace();
}
}
private void phojButtonActionPerformed(ActionEvent evt) {
ChooseFile cF=new ChooseFile();
file=cF.chooseFile();
if(file!=null){
ImageIcon icon = new ImageIcon(file.getAbsolutePath());
this.phojLabel.setText("");
this.phojLabel.setIcon(icon);
}
}
private void submjButtonActionPerformed(ActionEvent evt) {
StuAction sa=new StuAction();
try
{
if(this.stuidjTextField.getText().getBytes().length>20||this.teljTextField.getText().getBytes().length>20
||addjTextArea.getText().getBytes().length>100||beizjTextArea.getText().getBytes().length>100){
JOptionPane.showMessageDialog(this, "输入的字符太长");
}
else{
int i=JOptionPane.showConfirmDialog(this, "是否确定修改","警告!",JOptionPane.OK_OPTION);
if(i==1)
{
return;
}
if(this.classjComboBox.getSelectedItem()==null){
this.classjComboBox.setSelectedItem(null);
}
sa.updateStu(this);
this.setVisible(false);
smf.gettable(smf.s1,smf.s2,smf.s3,smf.s4,smf.s5,smf.s6,smf.s7);
}
}catch(Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -