estou montando um formulario no net beans que deve conter nome,curso,nota1,nota2. Terá botão cadastrar, informações, situação. quando clicar no cadastrar deve sumir o que foi inserido. No informações deve aparecer tudo que foi cadastrado, e no situação deve aparecer a media e se o aluno foi aprovado ou reprovado. Já montei a classe aluno o formulario, so não to conseguindo codificar. Poderiam me ajudar.
obrigado
Poste aqui o que você já fez!! Para que possamos te ajudar!!
Oi,
Baixe essa apostila:http://acervobrasil.blogspot.com/2008/10/apostila-java-2-com-banco-de-dados.html
Boa sorte!
[quote=jsalvador]estou montando um formulario no net beans que deve conter nome,curso,nota1,nota2. Terá botão cadastrar, informações, situação. quando clicar no cadastrar deve sumir o que foi inserido. No informações deve aparecer tudo que foi cadastrado, e no situação deve aparecer a media e se o aluno foi aprovado ou reprovado. Já montei a classe aluno o formulario, so não to conseguindo codificar. Poderiam me ajudar.
obrigado[/quote]
package Model;
public class Aluno {
private String nome;
private String curso;
private float nota1;
private float nota2;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCurso() {
return curso;
}
public void setCurso(String curso) {
this.curso = curso;
}
public float getNota1() {
return nota1;
}
public void setNota1(float nota1) {
this.nota1 = nota1;
}
public float getNota2() {
return nota2;
}
public void setNota2(float nota2) {
this.nota2 = nota2;
}
public void cadastrar(String nome,String curso, float nota1, float nota2){
setNome(nome);
setCurso(curso);
setNota1(nota1);
setNota2(nota2);
}
public String informacao(){
return "nome"+getNome()+"curso"+getCurso()+"nota1"+getNota1()+"nota2"+getNota2();
};
public float verMedia(){
return(nota1+nota2)/2;
}
public String situacao(){
if (verMedia()>=7){
return “aluno aprovado”;
}
else {
return “aluno reprovado”;
}}
}
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
/*
- FrmAluno.java
- Created on 05/10/2010, 20:35:10
*/
package View;
import Model.Aluno;
import javax.swing.JOptionPane;
/**
*
-
@author salvador
*/
public class FrmAluno extends javax.swing.JFrame {
Aluno pr = new Aluno();/** Creates new form FrmAluno */
public FrmAluno() {
initComponents();
}/** 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.
*/
@SuppressWarnings(“unchecked”)
//
private void initComponents() {jButton4 = new javax.swing.JButton();
NOME = new javax.swing.JLabel();
CURSO = new javax.swing.JLabel();
NOTA1 = new javax.swing.JLabel();
NOTA2 = new javax.swing.JLabel();
txtNome = new javax.swing.JTextField();
txtCurso = new javax.swing.JTextField();
txtNota1 = new javax.swing.JTextField();
txtNota2 = new javax.swing.JTextField();
btnCADASTRAR = new javax.swing.JButton();
btnSITUAÇÃO = new javax.swing.JButton();
btnSAIR = new javax.swing.JButton();
btnINFORMACOES = new javax.swing.JButton();
lblSituacao = new javax.swing.JLabel();jButton4.setText(“jButton4”);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
NOME.setText(“NOME”);
CURSO.setText(“CURSO”);
NOTA1.setText(“NOTA 1”);
NOTA2.setText(“NOTA2”);
txtNome.setName(“txtNome”); // NOI18N
txtCurso.setName(“txtCurso”); // NOI18N
txtNota1.setName(“txtNota1”); // NOI18N
txtNota2.setName(“txtNota2”); // NOI18N
txtNota2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNota2ActionPerformed(evt);
}
});btnCADASTRAR.setText(“CADASTRAR”);
btnCADASTRAR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCADASTRARActionPerformed(evt);
}
});btnSITUAÇÃO.setText(“SITUAÇÃO”);
btnSITUAÇÃO.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSITUAÇÃOActionPerformed(evt);
}
});btnSAIR.setText(“SAIR”);
btnSAIR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSAIRActionPerformed(evt);
}
});btnINFORMACOES.setText(“INFORMAÇÕES”);
btnINFORMACOES.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnINFORMACOESActionPerformed(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(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(NOTA2)
.addComponent(NOME)
.addComponent(CURSO)
.addComponent(NOTA1)
.addGroup(layout.createSequentialGroup()
.addComponent(btnCADASTRAR, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(btnINFORMACOES)
.addGap(27, 27, 27)
.addComponent(btnSITUAÇÃO, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnSAIR, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblSituacao, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtCurso)
.addComponent(txtNome, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)
.addComponent(txtNota2)
.addComponent(txtNota1, javax.swing.GroupLayout.Alignment.LEADING)))))
.addContainerGap(291, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NOME)
.addComponent(txtNome, 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.TRAILING)
.addComponent(CURSO)
.addComponent(txtCurso, 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.LEADING)
.addComponent(NOTA2, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtNota1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NOTA1))
.addGap(18, 18, 18)
.addComponent(txtNota2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(lblSituacao, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnINFORMACOES)
.addComponent(btnSITUAÇÃO)
.addComponent(btnCADASTRAR)
.addComponent(btnSAIR))
.addGap(33, 33, 33))
);pack();
}//
private void txtNota2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}private void btnCADASTRARActionPerformed(java.awt.event.ActionEvent evt) {
pr.cadastrar(txtNome.getText(),txtCurso.getText(),
Float.parseFloat(txtNota1.getText()),
Float.parseFloat(txtNota2.getText()));
txtNome.setText("");
txtCurso.setText("");
txtNota1.setText("");
txtNota2.setText("");
}private void btnINFORMACOESActionPerformed(java.awt.event.ActionEvent evt) {
JOptionPane.showMessageDialog(null,“Informações\n\n”+pr.informacao());
}private void btnSITUAÇÃOActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}private void btnSAIRActionPerformed(java.awt.event.ActionEvent evt) {
dispose(); // TODO add your handling code here:
}/**
-
@param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmAluno().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel CURSO;
private javax.swing.JLabel NOME;
private javax.swing.JLabel NOTA1;
private javax.swing.JLabel NOTA2;
private javax.swing.JButton btnCADASTRAR;
private javax.swing.JButton btnINFORMACOES;
private javax.swing.JButton btnSAIR;
private javax.swing.JButton btnSITUAÇÃO;
private javax.swing.JButton jButton4;
private javax.swing.JLabel lblSituacao;
private javax.swing.JTextField txtCurso;
private javax.swing.JTextField txtNome;
private javax.swing.JTextField txtNota1;
private javax.swing.JTextField txtNota2;
// End of variables declaration -
}
estou montando um formulario no net beans que deve conter nome,curso,nota1,nota2. Terá botão cadastrar, informações, situação. quando clicar no cadastrar deve sumir o que foi inserido. No informações deve aparecer tudo que foi cadastrado, e no situação deve aparecer a media e se o aluno foi aprovado ou reprovado. Já montei a classe aluno o formulario, so não to conseguindo codificar. Poderiam me ajudar.
obrigado
package Model;
public class Aluno {
private String nome;
private String curso;
private float nota1;
private float nota2;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCurso() {
return curso;
}
public void setCurso(String curso) {
this.curso = curso;
}
public float getNota1() {
return nota1;
}
public void setNota1(float nota1) {
this.nota1 = nota1;
}
public float getNota2() {
return nota2;
}
public void setNota2(float nota2) {
this.nota2 = nota2;
}
public void cadastrar(String nome,String curso, float nota1, float nota2){
setNome(nome);
setCurso(curso);
setNota1(nota1);
setNota2(nota2);
}
public String informacao(){
return “nome”+getNome()+“curso”+getCurso()+“nota1”+getNota1()+“nota2”+getNota2();
};
public float verMedia(){
return(nota1+nota2)/2;
}
public String situacao(){
if (verMedia()>=7){
return “aluno aprovado”;
}
else {
return “aluno reprovado”;
}}
}
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
/*
- FrmAluno.java
- Created on 05/10/2010, 20:35:10
*/
package View;
import Model.Aluno;
import javax.swing.JOptionPane;
/**
*
-
@author salvador
*/
public class FrmAluno extends javax.swing.JFrame {
Aluno pr = new Aluno();
/** Creates new form FrmAluno */
public FrmAluno() {
initComponents();
}
/** 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.
*/
@SuppressWarnings(“unchecked”)
//
private void initComponents() {
jButton4 = new javax.swing.JButton();
NOME = new javax.swing.JLabel();
CURSO = new javax.swing.JLabel();
NOTA1 = new javax.swing.JLabel();
NOTA2 = new javax.swing.JLabel();
txtNome = new javax.swing.JTextField();
txtCurso = new javax.swing.JTextField();
txtNota1 = new javax.swing.JTextField();
txtNota2 = new javax.swing.JTextField();
btnCADASTRAR = new javax.swing.JButton();
btnSITUAÇÃO = new javax.swing.JButton();
btnSAIR = new javax.swing.JButton();
btnINFORMACOES = new javax.swing.JButton();
lblSituacao = new javax.swing.JLabel();
jButton4.setText(“jButton4”);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
NOME.setText(“NOME”);
CURSO.setText(“CURSO”);
NOTA1.setText(“NOTA 1”);
NOTA2.setText(“NOTA2”);
txtNome.setName(“txtNome”); // NOI18N
txtCurso.setName(“txtCurso”); // NOI18N
txtNota1.setName(“txtNota1”); // NOI18N
txtNota2.setName(“txtNota2”); // NOI18N
txtNota2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNota2ActionPerformed(evt);
}
});
btnCADASTRAR.setText(“CADASTRAR”);
btnCADASTRAR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCADASTRARActionPerformed(evt);
}
});
btnSITUAÇÃO.setText(“SITUAÇÃO”);
btnSITUAÇÃO.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSITUAÇÃOActionPerformed(evt);
}
});
btnSAIR.setText(“SAIR”);
btnSAIR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSAIRActionPerformed(evt);
}
});
btnINFORMACOES.setText(“INFORMAÇÕES”);
btnINFORMACOES.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnINFORMACOESActionPerformed(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(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(NOTA2)
.addComponent(NOME)
.addComponent(CURSO)
.addComponent(NOTA1)
.addGroup(layout.createSequentialGroup()
.addComponent(btnCADASTRAR, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(btnINFORMACOES)
.addGap(27, 27, 27)
.addComponent(btnSITUAÇÃO, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 1
.addComponent(btnSAIR, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblSituacao, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtCurso)
.addComponent(txtNome, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)
.addComponent(txtNota2)
.addComponent(txtNota1, javax.swing.GroupLayout.Alignment.LEADING)))))
.addContainerGap(291, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NOME)
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 1
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(CURSO)
.addComponent(txtCurso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 1
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NOTA2, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtNota1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NOTA1))
.addGap(18, 18, 1
.addComponent(txtNota2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 1
.addComponent(lblSituacao, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
.addGap(18, 18, 1
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnINFORMACOES)
.addComponent(btnSITUAÇÃO)
.addComponent(btnCADASTRAR)
.addComponent(btnSAIR))
.addGap(33, 33, 33))
);
pack();
}//
private void txtNota2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnCADASTRARActionPerformed(java.awt.event.ActionEvent evt) {
pr.cadastrar(txtNome.getText(),txtCurso.getText(),
Float.parseFloat(txtNota1.getText()),
Float.parseFloat(txtNota2.getText()));
txtNome.setText("");
txtCurso.setText("");
txtNota1.setText("");
txtNota2.setText("");
}
private void btnINFORMACOESActionPerformed(java.awt.event.ActionEvent evt) {
JOptionPane.showMessageDialog(null,“Informações\n\n”+pr.informacao());
}
private void btnSITUAÇÃOActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnSAIRActionPerformed(java.awt.event.ActionEvent evt) {
dispose(); // TODO add your handling code here:
}
/**
-
@param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmAluno().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel CURSO;
private javax.swing.JLabel NOME;
private javax.swing.JLabel NOTA1;
private javax.swing.JLabel NOTA2;
private javax.swing.JButton btnCADASTRAR;
private javax.swing.JButton btnINFORMACOES;
private javax.swing.JButton btnSAIR;
private javax.swing.JButton btnSITUAÇÃO;
private javax.swing.JButton jButton4;
private javax.swing.JLabel lblSituacao;
private javax.swing.JTextField txtCurso;
private javax.swing.JTextField txtNome;
private javax.swing.JTextField txtNota1;
private javax.swing.JTextField txtNota2;
// End of variables declaration
}
jsalvador,
Utilize as tags (code e /code) , para que o código seja compreendido com mais facilidade!!!
[code]package Model;
public class Aluno {
private String nome;
private String curso;
private float nota1;
private float nota2;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCurso() {
return curso;
}
public void setCurso(String curso) {
this.curso = curso;
}
public float getNota1() {
return nota1;
}
public void setNota1(float nota1) {
this.nota1 = nota1;
}
public float getNota2() {
return nota2;
}
public void setNota2(float nota2) {
this.nota2 = nota2;
}
public void cadastrar(String nome,String curso, float nota1, float nota2){
setNome(nome);
setCurso(curso);
setNota1(nota1);
setNota2(nota2);
}
public String informacao(){
return “nome”+getNome()+“curso”+getCurso()+“nota1”+getNota1()+“nota2”+getNota2();
};
public float verMedia(){
return(nota1+nota2)/2;
}
public String situacao(){
if (verMedia()>=7){
return “aluno aprovado”;
}
else {
return “aluno reprovado”;
}}
}
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
/*
- FrmAluno.java
- Created on 05/10/2010, 20:35:10
*/
package View;
import Model.Aluno;
import javax.swing.JOptionPane;
/**
*
-
@author salvador
*/
public class FrmAluno extends javax.swing.JFrame {
Aluno pr = new Aluno();
/** Creates new form FrmAluno */
public FrmAluno() {
initComponents();
}
/** 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.
*/
@SuppressWarnings(“unchecked”)
//
private void initComponents() {
jButton4 = new javax.swing.JButton();
NOME = new javax.swing.JLabel();
CURSO = new javax.swing.JLabel();
NOTA1 = new javax.swing.JLabel();
NOTA2 = new javax.swing.JLabel();
txtNome = new javax.swing.JTextField();
txtCurso = new javax.swing.JTextField();
txtNota1 = new javax.swing.JTextField();
txtNota2 = new javax.swing.JTextField();
btnCADASTRAR = new javax.swing.JButton();
btnSITUAÇÃO = new javax.swing.JButton();
btnSAIR = new javax.swing.JButton();
btnINFORMACOES = new javax.swing.JButton();
lblSituacao = new javax.swing.JLabel();
jButton4.setText(“jButton4”);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
NOME.setText(“NOME”);
CURSO.setText(“CURSO”);
NOTA1.setText(“NOTA 1”);
NOTA2.setText(“NOTA2”);
txtNome.setName(“txtNome”); // NOI18N
txtCurso.setName(“txtCurso”); // NOI18N
txtNota1.setName(“txtNota1”); // NOI18N
txtNota2.setName(“txtNota2”); // NOI18N
txtNota2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNota2ActionPerformed(evt);
}
});
btnCADASTRAR.setText(“CADASTRAR”);
btnCADASTRAR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCADASTRARActionPerformed(evt);
}
});
btnSITUAÇÃO.setText(“SITUAÇÃO”);
btnSITUAÇÃO.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSITUAÇÃOActionPerformed(evt);
}
});
btnSAIR.setText(“SAIR”);
btnSAIR.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSAIRActionPerformed(evt);
}
});
btnINFORMACOES.setText(“INFORMAÇÕES”);
btnINFORMACOES.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnINFORMACOESActionPerformed(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(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(NOTA2)
.addComponent(NOME)
.addComponent(CURSO)
.addComponent(NOTA1)
.addGroup(layout.createSequentialGroup()
.addComponent(btnCADASTRAR, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(btnINFORMACOES)
.addGap(27, 27, 27)
.addComponent(btnSITUAÇÃO, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 1
.addComponent(btnSAIR, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblSituacao, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtCurso)
.addComponent(txtNome, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)
.addComponent(txtNota2)
.addComponent(txtNota1, javax.swing.GroupLayout.Alignment.LEADING)))))
.addContainerGap(291, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NOME)
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 1
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(CURSO)
.addComponent(txtCurso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 1
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NOTA2, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtNota1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NOTA1))
.addGap(18, 18, 1
.addComponent(txtNota2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 1
.addComponent(lblSituacao, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
.addGap(18, 18, 1
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnINFORMACOES)
.addComponent(btnSITUAÇÃO)
.addComponent(btnCADASTRAR)
.addComponent(btnSAIR))
.addGap(33, 33, 33))
);
pack();
}//
private void txtNota2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnCADASTRARActionPerformed(java.awt.event.ActionEvent evt) {
pr.cadastrar(txtNome.getText(),txtCurso.getText(),
Float.parseFloat(txtNota1.getText()),
Float.parseFloat(txtNota2.getText()));
txtNome.setText("");
txtCurso.setText("");
txtNota1.setText("");
txtNota2.setText("");
}
private void btnINFORMACOESActionPerformed(java.awt.event.ActionEvent evt) {
JOptionPane.showMessageDialog(null,“Informações\n\n”+pr.informacao());
}
private void btnSITUAÇÃOActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnSAIRActionPerformed(java.awt.event.ActionEvent evt) {
dispose(); // TODO add your handling code here:
}
/**
-
@param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmAluno().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel CURSO;
private javax.swing.JLabel NOME;
private javax.swing.JLabel NOTA1;
private javax.swing.JLabel NOTA2;
private javax.swing.JButton btnCADASTRAR;
private javax.swing.JButton btnINFORMACOES;
private javax.swing.JButton btnSAIR;
private javax.swing.JButton btnSITUAÇÃO;
private javax.swing.JButton jButton4;
private javax.swing.JLabel lblSituacao;
private javax.swing.JTextField txtCurso;
private javax.swing.JTextField txtNome;
private javax.swing.JTextField txtNota1;
private javax.swing.JTextField txtNota2;
// End of variables declaration
} [/code]