📄 alljframe.java
字号:
.add(jLabel10))))
.add(jLabel8)
.add(jLabel7))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 51, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(okButton)
.add(cancelButton))
.add(22, 22, 22))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(idfield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(16, 16, 16)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(namefield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(18, 18, 18)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jRadioButton1)
.add(jRadioButton2))
.add(19, 19, 19)
.add(jLabel9))
.add(agefield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(15, 15, 15)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(hometown, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel10))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 13, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel5)
.add(jRadioButton3)
.add(jRadioButton4))
.add(14, 14, 14)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(worktimefield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel6))
.add(24, 24, 24)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel7)
.add(salaryfield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(okButton))
.add(21, 21, 21)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel8)
.add(statusfield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(layout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cancelButton)))
.add(37, 37, 37))
);
pack();
}// </editor-fold>//GEN-END:initComponents
public void set(String id,String name,String sex,int age ,String hometown,String marriage,int worktime,int salary,String status)
{
this.idfield.setText(id);
this.namefield.setText(name);
if(sex.equals("男")) this.jRadioButton1.setSelected(true);
if(sex.equals("女")) this.jRadioButton2.setSelected(true);
this.agefield.setText(String.valueOf(age));
this.hometown.setSelectedItem(hometown);
if(marriage.equals("已婚"))this.jRadioButton3.setSelected(true);
if(marriage.equals("未婚"))this.jRadioButton4.setSelected(true);
this.worktimefield.setText(String.valueOf(worktime));
this.salaryfield.setText(String.valueOf(salary));
this.statusfield.setText(status);
}
private void okButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okButtonMouseClicked
if(totalJFrame.op.equals("查找")){this.dispose();}
if(totalJFrame.op.equals("新增"))
{
String hometown=String.valueOf(this.hometown.getSelectedItem());
String sex=null,marriage=null;
if(this.jRadioButton1.isSelected()) sex="男";
if(this.jRadioButton2.isSelected()) sex="女";
if(this.jRadioButton3.isSelected()) marriage="已婚";
if(this.jRadioButton4.isSelected()) marriage="未婚";
employee emp=new employee(this.idfield.getText(),this.namefield.getText(),sex,Integer.parseInt(this.agefield.getText()),hometown,marriage,Integer.parseInt(this.worktimefield.getText()),Integer.parseInt(this.salaryfield.getText()),this.statusfield.getText());
totalJFrame.cpy.add(emp);
this.dispose();
}//GEN-LAST:event_okButtonMouseClicked
if(totalJFrame.op.equals("编辑"))
{
String hometown=String.valueOf(this.hometown.getSelectedItem());
String sex=null,marriage=null;
if(this.jRadioButton1.isSelected()) sex="男";
if(this.jRadioButton2.isSelected()) sex="女";
if(this.jRadioButton3.isSelected()) marriage="已婚";
if(this.jRadioButton4.isSelected()) marriage="未婚";
employee emp=new employee(this.idfield.getText(),this.namefield.getText(),sex,Integer.parseInt(this.agefield.getText()),hometown,marriage,Integer.parseInt(this.worktimefield.getText()),Integer.parseInt(this.salaryfield.getText()),this.statusfield.getText());
totalJFrame.cpy.Sedit(emp);
this.dispose();
}
if(totalJFrame.op.equals("删除"))
{
totalJFrame.cpy.Sdelete(this.idfield.getText());
this.dispose();
}
}
private void cancelButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelButtonMouseClicked
this.dispose();
}//GEN-LAST:event_cancelButtonMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new allJFrame().setVisible(true);
}
});
}
// 变量声明 - 不进行修改//GEN-BEGIN:variables
private javax.swing.JTextField agefield;
private javax.swing.JButton cancelButton;
private javax.swing.JComboBox hometown;
private javax.swing.JTextField idfield;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JRadioButton jRadioButton4;
private javax.swing.ButtonGroup marriagebuttonGroup;
private javax.swing.JTextField namefield;
private javax.swing.JButton okButton;
private javax.swing.JTextField salaryfield;
private javax.swing.ButtonGroup sexbuttonGroup;
private javax.swing.JTextField statusfield;
private javax.swing.JTextField worktimefield;
// 变量声明结束//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -