package visao;
public class Tela extends javax.swing.JFrame {
/**
* Creates new form Tela
*/
public Tela() {
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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jtfCosseno = new javax.swing.JTextField();
jtfSeno = new javax.swing.JTextField();
jtfTangente = new javax.swing.JTextField();
jtfCatetoOposto = new javax.swing.JTextField();
jtfCatetoA = new javax.swing.JTextField();
jtfHipotenusa = new javax.swing.JTextField();
jtbSeno = new javax.swing.JToggleButton();
jtbCosseno = new javax.swing.JToggleButton();
jtbTangente = new javax.swing.JToggleButton();
jLabel1 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jtfAngulo = new javax.swing.JTextField();
jtfTipoDoTriangulo = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setLayout(null);
jtfCosseno.setEditable(false);
jtfCosseno.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfCossenoActionPerformed(evt);
}
});
jPanel1.add(jtfCosseno);
jtfCosseno.setBounds(180, 480, 130, 50);
jtfSeno.setEditable(false);
jtfSeno.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfSenoActionPerformed(evt);
}
});
jPanel1.add(jtfSeno);
jtfSeno.setBounds(40, 480, 130, 50);
jtfTangente.setEditable(false);
jPanel1.add(jtfTangente);
jtfTangente.setBounds(320, 480, 130, 50);
jtfCatetoOposto.setBorder(javax.swing.BorderFactory.createTitledBorder("Cateto oposto"));
jtfCatetoOposto.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfCatetoOpostoActionPerformed(evt);
}
});
jPanel1.add(jtfCatetoOposto);
jtfCatetoOposto.setBounds(140, 360, 120, 60);
jtfCatetoA.setBorder(javax.swing.BorderFactory.createTitledBorder("Cateto adjacente"));
jtfCatetoA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfCatetoAActionPerformed(evt);
}
});
jPanel1.add(jtfCatetoA);
jtfCatetoA.setBounds(420, 260, 110, 60);
jtfHipotenusa.setBorder(javax.swing.BorderFactory.createTitledBorder("Hipotenusa"));
jtfHipotenusa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfHipotenusaActionPerformed(evt);
}
});
jPanel1.add(jtfHipotenusa);
jtfHipotenusa.setBounds(230, 160, 80, 60);
jtbSeno.setText("Seno");
jtbSeno.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtbSenoActionPerformed(evt);
}
});
jPanel1.add(jtbSeno);
jtbSeno.setBounds(40, 450, 130, 23);
jtbCosseno.setText("Cosseno");
jtbCosseno.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtbCossenoActionPerformed(evt);
}
});
jPanel1.add(jtbCosseno);
jtbCosseno.setBounds(180, 450, 130, 23);
jtbTangente.setText("Tangente");
jtbTangente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtbTangenteActionPerformed(evt);
}
});
jPanel1.add(jtbTangente);
jtbTangente.setBounds(320, 450, 130, 23);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Trigonometria.png"))); // NOI18N
jPanel1.add(jLabel1);
jLabel1.setBounds(0, 0, 610, 570);
jTabbedPane1.addTab("Seno, Cosseno e Tangente", jPanel1);
jPanel2.setLayout(null);
jLabel3.setText("Para saber como se classifica o seu triângulo,insira o seu angulo a esquerda e em seguida confira a direita");
jPanel2.add(jLabel3);
jLabel3.setBounds(20, 120, 570, 14);
jtfAngulo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfAnguloActionPerformed(evt);
}
});
jPanel2.add(jtfAngulo);
jtfAngulo.setBounds(30, 210, 140, 50);
jtfTipoDoTriangulo.setEditable(false);
jPanel2.add(jtfTipoDoTriangulo);
jtfTipoDoTriangulo.setBounds(300, 210, 190, 50);
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/linhas.jpg"))); // NOI18N
jPanel2.add(jLabel2);
jLabel2.setBounds(0, 0, 600, 540);
jTabbedPane1.addTab("Tipo do triângulo", jPanel2);
getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER);
setSize(new java.awt.Dimension(622, 607));
setLocationRelativeTo(null);
}// </editor-fold>
private void jtfCatetoOpostoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jtfCatetoAActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jtfHipotenusaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jtbSenoActionPerformed(java.awt.event.ActionEvent evt) {
double valor1 = Double.parseDouble(jtfCatetoOposto.getText());
double valor2 = Double.parseDouble(jtfHipotenusa.getText());
double resultado = valor1 / valor2;
String resultadoString;
resultadoString = String.valueOf(resultado);
jtfSeno.setText(resultadoString);
}
private void jtfSenoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jtfCossenoActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jtbCossenoActionPerformed(java.awt.event.ActionEvent evt) {
double valor1b = Double.parseDouble(jtfCatetoA.getText());
double valor2b = Double.parseDouble(jtfHipotenusa.getText());
double resultadob = valor1b / valor2b;
String resultadoStringb;
resultadoStringb = String.valueOf(resultadob);
jtfCosseno.setText(resultadoStringb);
}
private void jtbTangenteActionPerformed(java.awt.event.ActionEvent evt) {
double valor1c = Double.parseDouble(jtfCatetoOposto.getText());
double valor2c = Double.parseDouble(jtfCatetoA.getText());
double resultadoc = valor1c / valor2c;
String resultadoStringc;
resultadoStringc = String.valueOf(resultadoc);
jtfTangente.setText(resultadoStringc);
}
private void jtfAnguloActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
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(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Tela.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 Tela().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JToggleButton jtbCosseno;
private javax.swing.JToggleButton jtbSeno;
private javax.swing.JToggleButton jtbTangente;
private javax.swing.JTextField jtfAngulo;
private javax.swing.JTextField jtfCatetoA;
private javax.swing.JTextField jtfCatetoOposto;
private javax.swing.JTextField jtfCosseno;
private javax.swing.JTextField jtfHipotenusa;
private javax.swing.JTextField jtfSeno;
private javax.swing.JTextField jtfTangente;
private javax.swing.JTextField jtfTipoDoTriangulo;
// End of variables declaration
}
Eu recém tinha terminado o meu código e fechei o netbeans (eu salvei tudo certinho) aí eu resolvi abrir dnv uns minutos depois e o meu código estava cheio de erros pra todos os lados. Ele estava rodando normalmente antes e executava o que eu tinha feito perfeitamente, alguém pode me ajudar?