Olá a todos. Eu estou tentando executar um projeto que criei no Netbens, mas o mesmo não executa (no caso quando clico no botão cuja ActionPerform ja esta configurada), gera o seguinte erro:
run:
Exception in thread “AWT-EventQueue-0” java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: testesoma.TelaTesteSoma.setText
at testesoma.TelaTesteSoma.btnClicActionPerformed(TelaTesteSoma.java:124)
at testesoma.TelaTesteSoma.access$000(TelaTesteSoma.java:14)
at testesoma.TelaTesteSoma$1.actionPerformed(TelaTesteSoma.java:50)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
CONSTRUÍDO COM SUCESSO (tempo total: 16 segundos)
Este é meu código:
/*
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
*/
package testesoma;
import javax.swing.JLabel;
/**
*
-
@author sr-stark
*/
public class TelaTesteSoma extends javax.swing.JFrame {/**
- Creates new form TelaTesteSoma
*/
public TelaTesteSoma() {
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() {
jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); btnClic = new javax.swing.JButton(); txtN1 = new javax.swing.JTextField(); txtN2 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); lblResul = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText(“Primeiro número”);jLabel2.setText(“Segundo número”);btnClic.setText(“CALCULAR”); btnClic.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnClicActionPerformed(evt); } });
txtN1.setText(“0”);txtN2.setText(“0”);jLabel3.setFont(new java.awt.Font(“Ubuntu”, 1, 18)); // NOI18N
jLabel3.setText(“Somador de números”);lblResul.setText(“0”);jLabel5.setText(“Resultado”);javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(40, 40, 40) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addGap(85, 85, 85) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtN1) .addComponent(txtN2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblResul, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(layout.createSequentialGroup() .addGap(107, 107, 107) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addGap(156, 156, 156) .addComponent(btnClic))) .addContainerGap(55, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(jLabel3) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txtN1, 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.BASELINE) .addComponent(jLabel2) .addComponent(txtN2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnClic) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblResul) .addComponent(jLabel5)) .addContainerGap(21, Short.MAX_VALUE)) );
pack();
}//
private void btnClicActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Double resp1 = Double.parseDouble(txtN1.getText()); Double resp2 = Double.parseDouble(txtN2.getText()); Double soma = resp1 + resp2; lblResul = setText(Double.toString(soma)); }
/**
-
@param args the command line arguments
/
public static void main(String args[]) {
/ Set the Nimbus look and feel /
//
/ 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(TelaTesteSoma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaTesteSoma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaTesteSoma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaTesteSoma.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { new TelaTesteSoma().setVisible(true); }); }
- For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
// Variables declaration - do not modify private javax.swing.JButton btnClic; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel5; private javax.swing.JLabel lblResul; private javax.swing.JTextField txtN1; private javax.swing.JTextField txtN2; // End of variables declaration
private JLabel setText(String toString) { throw new UnsupportedOperationException(“Not supported yet.”); //To change body of generated methods, choose Tools | Templates. } }
- Creates new form TelaTesteSoma
Estou rodando o Netbeans no Ubuntu. Será que alguém poderia me ajudar por favor?