📄 teaupdateframe.java
字号:
package com.hb.studentmanager.ui;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import com.hb.studentmanager.action.TeaAction;
import com.hb.studentmanager.tools.ChooseFile;
import com.hb.studentmanager.tools.DateChooserJButton;
/**
* 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 TeaUpdateFrame extends javax.swing.JDialog {
public JPanel mainPanel1;
public JTextField telTextField1;
public JScrollPane aspScrollPane1;
public JLabel dateLabel1;
private JButton dateButton1;
public JButton koButton1;
public JScrollPane remScrollPane1;
public JTextArea remTextArea1;
public JLabel remLabel1;
public JScrollPane addScrollPane1;
public JTextArea addTextArea1;
public JLabel addLabel1;
public JButton phoButton1;
public JLabel phoLabel1;
public JTextArea aspTextArea1;
public JLabel aspLabel1;
public JComboBox levComboBox1;
public JLabel levLabel1;
public JLabel telLabel1;
public ButtonGroup buttonGroup1;
public JRadioButton femaleRadioButton1;
public JRadioButton manRadioButton1;
public JLabel sexLabel1;
public JTextField teanameTextField1;
public JLabel nameLabel1;
public JLabel idLabel1;
public JLabel teaidLabel1;
public DateChooserJButton dateButton;
TeaMainFrame tmf=new TeaMainFrame();
public File file=null;
/**
* Auto-generated main method to display this JFrame
*/
//public static void main(String[] args) {
//TeaUpdateFrame inst = new TeaUpdateFrame();
//inst.setVisible(true);
//}
public TeaUpdateFrame(TeaMainFrame tmf) {
super();
this.tmf=tmf;
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 {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("\u4fee\u6539\u6559\u5e08\u4fe1\u606f");
getContentPane().setLayout(null);
{
{
buttonGroup1 = new ButtonGroup();
}
mainPanel1 = new JPanel();
getContentPane().add(mainPanel1);
mainPanel1.setBounds(0, 0, 441, 448);
mainPanel1.setLayout(null);
{
teaidLabel1 = new JLabel();
mainPanel1.add(teaidLabel1);
teaidLabel1.setText("\u6559\u5e08\u7f16\u53f7:");
teaidLabel1.setBounds(7, 14, 56, 28);
}
{
idLabel1 = new JLabel();
mainPanel1.add(idLabel1);
idLabel1.setBounds(70, 14, 140, 28);
idLabel1.setText("\u6559\u5e08\u7f16\u53f7\u7684\u663e\u793a");
}
{
nameLabel1 = new JLabel();
mainPanel1.add(nameLabel1);
nameLabel1.setText("\u6559\u5e08\u59d3\u540d:");
nameLabel1.setBounds(7, 56, 56, 28);
}
{
teanameTextField1 = new JTextField();
mainPanel1.add(teanameTextField1);
teanameTextField1.setBounds(70, 56, 140, 28);
}
{
sexLabel1 = new JLabel();
mainPanel1.add(sexLabel1);
sexLabel1.setText("\u6027\u522b\uff1a");
sexLabel1.setBounds(7, 98, 49, 28);
}
{
manRadioButton1 = new JRadioButton();
mainPanel1.add(manRadioButton1);
manRadioButton1.setText("\u7537");
manRadioButton1.setBounds(70, 98, 49, 28);
buttonGroup1.add(manRadioButton1);
}
{
femaleRadioButton1 = new JRadioButton();
mainPanel1.add(femaleRadioButton1);
femaleRadioButton1.setText("\u5973");
femaleRadioButton1.setBounds(140, 98, 56, 28);
buttonGroup1.add(femaleRadioButton1);
}
{
telLabel1 = new JLabel();
mainPanel1.add(telLabel1);
telLabel1.setText("\u8054\u7cfb\u65b9\u5f0f:");
telLabel1.setBounds(7, 140, 56, 28);
}
{
telTextField1 = new JTextField();
mainPanel1.add(telTextField1);
telTextField1.setBounds(70, 140, 140, 28);
}
{
levLabel1 = new JLabel();
mainPanel1.add(levLabel1);
levLabel1.setText("\u6559\u5e08\u7ea7\u522b:");
levLabel1.setBounds(7, 231, 56, 28);
}
{
ComboBoxModel levComboBox1Model = new DefaultComboBoxModel(
new String[] { " ","教授", "副教授","讲师" , "助教" });
levComboBox1 = new JComboBox();
mainPanel1.add(levComboBox1);
levComboBox1.setModel(levComboBox1Model);
levComboBox1.setBounds(70, 238, 133, 28);
}
{
aspLabel1 = new JLabel();
mainPanel1.add(aspLabel1);
aspLabel1.setText("\u4e3b\u653b\u65b9\u5411:");
aspLabel1.setBounds(7, 287, 56, 28);
}
{
aspScrollPane1 = new JScrollPane();
mainPanel1.add(aspScrollPane1);
aspScrollPane1.setBounds(77, 287, 119, 112);
{
aspTextArea1 = new JTextArea();
aspScrollPane1.setViewportView(aspTextArea1);
aspTextArea1.setBounds(266, 287, 133, 112);
aspTextArea1.setLineWrap(true);
}
}
{
phoLabel1 = new JLabel();
mainPanel1.add(phoLabel1);
phoLabel1.setText("\u7c98\u8d34\u7167\u7247\u5904");
phoLabel1.setBounds(308, 14, 112, 84);
}
{
phoButton1 = new JButton();
mainPanel1.add(phoButton1);
phoButton1.setText("\u6dfb\u52a0\u7167\u7247");
phoButton1.setBounds(301, 105, 91, 28);
phoButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
phoButton1ActionPerformed(evt);
}
});
}
{
addLabel1 = new JLabel();
mainPanel1.add(addLabel1);
addLabel1.setText("\u5bb6\u5ead\u4f4f\u5740:");
addLabel1.setBounds(224, 147, 56, 28);
}
{
addScrollPane1 = new JScrollPane();
mainPanel1.add(addScrollPane1);
addScrollPane1.setBounds(287, 154, 126, 105);
{
addTextArea1 = new JTextArea();
addScrollPane1.setViewportView(addTextArea1);
addTextArea1.setBounds(188, 174, 123, 102);
addTextArea1.setLineWrap(true);
}
}
{
remLabel1 = new JLabel();
mainPanel1.add(remLabel1);
remLabel1.setText("\u5907\u6ce8\uff1a");
remLabel1.setBounds(224, 287, 56, 28);
}
{
remScrollPane1 = new JScrollPane();
mainPanel1.add(remScrollPane1);
remScrollPane1.setBounds(287, 287, 126, 105);
{
remTextArea1 = new JTextArea();
remScrollPane1.setViewportView(remTextArea1);
remTextArea1.setBounds(234, 278, 108, 105);
remTextArea1.setLineWrap(true);
}
}
{
koButton1 = new JButton();
mainPanel1.add(koButton1);
koButton1.setText("\u63d0\u4ea4");
koButton1.setBounds(336, 406, 77, 28);
koButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
koButton1ActionPerformed(evt);
}
});
}
{
dateLabel1 = new JLabel();
mainPanel1.add(dateLabel1);
dateLabel1.setText("\u51fa\u751f\u65e5\u671f:");
dateLabel1.setBounds(7, 189, 56, 28);
}
{
dateButton = new DateChooserJButton();
mainPanel1.add(dateButton);
dateButton.setBounds(70, 189, 140, 28);
}
}
pack();
setSize(450, 470);
} catch (Exception e) {
e.printStackTrace();
}
}
private void phoButton1ActionPerformed(ActionEvent evt) {
ChooseFile cF=new ChooseFile();
file=cF.chooseFile();
if(file!=null){
ImageIcon icon = new ImageIcon(file.getAbsolutePath());
this.phoLabel1.setText("");
this.phoLabel1.setIcon(icon);
}
}
private void koButton1ActionPerformed(ActionEvent evt) {
TeaAction ta=new TeaAction();
if(this.teanameTextField1.getText().getBytes().length>20||this.telTextField1.getText().getBytes().length>20||this.addTextArea1.getText().getBytes().length>100||this.remTextArea1.getText().getBytes().length>100||this.aspTextArea1.getText().getBytes().length>50)
{
if(this.teanameTextField1.getText().getBytes().length>20)
{
JOptionPane.showMessageDialog(this, "教师姓名输入的字数长度超过了20!!");
}
if(this.telTextField1.getText().getBytes().length>20)
{
JOptionPane.showMessageDialog(this, "教师电话输入的字数长度超过了20!!");
}
if(this.aspTextArea1.getText().getBytes().length>50)
{
JOptionPane.showMessageDialog(this, "教师的主攻方向输入的字数长度超过了50!!");
}
if(this.addTextArea1.getText().getBytes().length>100)
{
JOptionPane.showMessageDialog(this, "教师地址输入的字数长度超过了100!!");
}
if(this.remTextArea1.getText().getBytes().length>100)
{
JOptionPane.showMessageDialog(this, "备注输入的字数长度超过了100!!");
}
}
else
{
try
{
int i=JOptionPane.showConfirmDialog(this, "是否确定修改","警告!",JOptionPane.OK_OPTION);
if(i==1)
{
return;
}
ta.addteacher1(this);
this.setVisible(false);
tmf.gettable(tmf.s0,tmf.s1,tmf.s2,tmf.s3,tmf.s4,tmf.s5);
}catch(Exception e)
{
e.printStackTrace();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -