Netbeans를 사용하여 이름, 성, ID 번호, 성별 및 교육 수준을 묻는 jframe을 만듭니다. 나는 OOP와 특별히 자바에 익숙하지 않으므로 제발 저를 참아주고 가난한 단어를 변명하십시오. 개체 변수에 값 전달
i는 제 i가 JFrame의 생성이어서 공용 클래스package registros;
public class estudiantes {
String nombre;
String apellido;
String sexo;
String ci;
String nived;
}
생성 아이디어 나 버튼 "Insertar"(jButton3ActionPerformed에 jbutton3을()) 공격이 다른 값을 획득해야한다는 것이다 jtextareas, radiobuttons 및 checkboxes를 사용하여 다른 객체 변수의 값을 설정하고 마지막으로 객체를 벡터에 배치합니다. 내가 뭘 도움이 필요하면 해당 버튼을, 나는 (???)
package registros;
import java.util.*;
public class NewJFrame extends javax.swing.JFrame {
estudiantes es;
Vector v = new Vector (5,1);
String sexoValue;
public NewJFrame() {
this.es = new estudiantes();
initComponents();
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jCheckBox1 = new javax.swing.JCheckBox();
jCheckBox2 = new javax.swing.JCheckBox();
jCheckBox3 = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Registro Estudiantes");
jLabel1.setText("Nombre");
jLabel2.setText("Apellido");
jLabel3.setText("C.I.");
jLabel5.setText("Nivel de Instruccion");
jButton1.setText("Actualizar");
jButton2.setText("Buscar");
jButton3.setText("Insertar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Eliminar");
jButton5.setText("Salir");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
buttonGroup1.add(jRadioButton1);
jRadioButton1.setText("Masculino");
buttonGroup1.add(jRadioButton2);
jRadioButton2.setText("Femenino");
jRadioButton1.getAccessibleContext().setAccessibleName("btnMasc");
jRadioButton2.getAccessibleContext().setAccessibleName("btnFem");
jTextField1.setName(""); // NOI18N
jLabel4.setText("Sexo");
jCheckBox1.setText("Primaria");
jCheckBox2.setText("Secundaria");
jCheckBox3.setText("Universidad");
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt){
String nombreValue = jTextField1.getText();
String apellidoValue = jTextField2.getText();
String ciValue = jTextField3.getText();
if (jRadioButton1.isSelected()){
sexoValue ="Masculino";
}
else
sexoValue = "Femenino";
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
나는 그리드의 코드를 생략했다 "객체를 입력"하는 방법을 모른다