Array
(
)

Problemas ao executar proojetoo no NetBeans

Carlos Silva
   - 05 jan 2013

Bom dia, estou desenvolvendo uma aplicação desktop em Java e usando a IDE NetBeans. O problema é que sempre que vou executar meu projeto ele apenas aparece a mensagem "Construído com sucesso", porém, não abre a tela do projeto ao executar. E até ontem estava tudo funcionando normalmente. Desinstalei e instalei novamente, testei outras versões e o mesmo problema persiste. Por favor, me ajudem, pois preciso entregar a aplicação essa semana e estou desesperado por causa deste problema. Obrigado.

Carlos H
   - 05 jan 2013


Citação:
="CarlosButler"]Bom dia, estou desenvolvendo uma aplicação desktop em Java e usando a IDE NetBeans. O problema é que sempre que vou executar meu projeto ele apenas aparece a mensagem "Construído com sucesso", porém, não abre a tela do projeto ao executar. E até ontem estava tudo funcionando normalmente. Desinstalei e instalei novamente, testei outras versões e o mesmo problema persiste. Por favor, me ajudem, pois preciso entregar a aplicação essa semana e estou desesperado por causa deste problema. Obrigado.
Como faz para "executar o projeto"? Como definiu o projeto, qual a classe principal? Mostra o código do método main da classe principal? Já tentou executar pela linha de comando?

0
|
0

Carlos Silva
   - 05 jan 2013

Eu executo através do "F9". E não acontece nada, somente a mensagem "Construído com sucesso". Tentei executar através da linha de comando também, porém, não obtive resultados.

0
|
0

Carlos H
   - 05 jan 2013


Citação:
="CarlosButler"]Eu executo através do "F9". E não acontece nada, somente a mensagem "Construído com sucesso". Tentei executar através da linha de comando também, porém, não obtive resultados.
tem certeza que F9 é para executar e não somente para compilar o projeto??? Eu não uso e nem tenho o Netbeans, mas tenta com F6 (ou seleciona através do menu: algo como "Run > Run main project")

0
|
0

Douglas Eric
   - 05 jan 2013

Pra executar é o F6 ou o botão com uma setinha de "play"

0
|
0

Douglas Eric
   - 05 jan 2013

Resolvi o problema. Era na classe principal que faltava um ";". E realmente para executar é o "F6", escrevi errado no outro post. Obrigado pela ajuda pessoal.

0
|
0

Douglas Eric
   - 06 jan 2013


Citação:
="CarlosButler"]Resolvi o problema. Era na classe principal que faltava um ";". E realmente para executar é o "F6", escrevi errado no outro post. Obrigado pela ajuda pessoal.
[size=10][i]exatamente por isso que pedi, à toa, para mostrar o código[/i][/size] estranho o Netbeans não indicar a falta do ';' como erro de compilação!?! :espanto:

0
|
0

Douglas Eric
   - 06 jan 2013


Citação:
="cfh"] estranho o Netbeans não indicar a falta do ';' como erro de compilação!?! :espanto:
Erro de compilação? Será que era por isso que tinha um balão vermelho do lado e a linha estava sublinhada em vermelho? :arrow:

0
|
0

Douglas Eric
   - 06 jan 2013

Sim, de compilação! Quando voce tenda executar um projecto no NB em que falta (;) ele avisa-te que um ou mais projectos foram compilados com erro.

0
|
0

Douglas Eric
   - 07 out 2015

Boa noite, sou iniciante em programação e estou com o mesmo problema, alguém poderia me ajudar por favor ? Segue o código, obrigado: package bean; import java.awt.EventQueue; import java.beans.Beans; import java.util.ArrayList; import java.util.List; import javax.persistence.RollbackException; import javax.swing.JFrame; import javax.swing.JPanel; /** * * @author Tom */ public class JCadeMedico extends JPanel { public JCadeMedico() { initComponents(); if (!Beans.isDesignTime()) { entityManager.getTransaction().begin(); } } /** * 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() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("dbconsultorio?zeroDateTimeBehavior=convertToNullPU").createEntityManager(); query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT c FROM Consulta c"); list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList()); masterScrollPane = new javax.swing.JScrollPane(); masterTable = new javax.swing.JTable(); idconsultaLabel = new javax.swing.JLabel(); dataLabel = new javax.swing.JLabel(); horaLabel = new javax.swing.JLabel(); medicoIdmedicoLabel = new javax.swing.JLabel(); pacienteIdpacienteLabel = new javax.swing.JLabel(); idconsultaField = new javax.swing.JTextField(); dataField = new javax.swing.JTextField(); horaField = new javax.swing.JTextField(); medicoIdmedicoField = new javax.swing.JTextField(); pacienteIdpacienteField = new javax.swing.JTextField(); saveButton = new javax.swing.JButton(); refreshButton = new javax.swing.JButton(); newButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); FormListener formListener = new FormListener(); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${idconsulta}")); columnBinding.setColumnName("Idconsulta"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${data}")); columnBinding.setColumnName("Data"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${hora}")); columnBinding.setColumnName("Hora"); columnBinding.setColumnClass(java.util.Date.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${medicoIdmedico}")); columnBinding.setColumnName("Medico Idmedico"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${pacienteIdpaciente}")); columnBinding.setColumnName("Paciente Idpaciente"); columnBinding.setColumnClass(Integer.class); bindingGroup.addBinding(jTableBinding); masterScrollPane.setViewportView(masterTable); idconsultaLabel.setText("Idconsulta:"); dataLabel.setText("Data:"); horaLabel.setText("Hora:"); medicoIdmedicoLabel.setText("Medico Idmedico:"); pacienteIdpacienteLabel.setText("Paciente Idpaciente:"); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.idconsulta}"), idconsultaField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue("null"); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), idconsultaField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.data}"), dataField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue("null"); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), dataField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.hora}"), horaField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue("null"); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), horaField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.medicoIdmedico}"), medicoIdmedicoField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue("null"); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), medicoIdmedicoField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.pacienteIdpaciente}"), pacienteIdpacienteField, org.jdesktop.beansbinding.BeanProperty.create("text")); binding.setSourceUnreadableValue("null"); bindingGroup.addBinding(binding); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), pacienteIdpacienteField, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); saveButton.setText("Save"); saveButton.addActionListener(formListener); refreshButton.setText("Refresh"); refreshButton.addActionListener(formListener); newButton.setText("New"); newButton.addActionListener(formListener); deleteButton.setText("Delete"); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), deleteButton, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); deleteButton.addActionListener(formListener); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(newButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(refreshButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveButton) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(idconsultaLabel) .addComponent(dataLabel) .addComponent(horaLabel) .addComponent(medicoIdmedicoLabel) .addComponent(pacienteIdpacienteLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(idconsultaField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent(dataField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent(horaField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent(medicoIdmedicoField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE) .addComponent(pacienteIdpacienteField, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteButton, newButton, refreshButton, saveButton}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(idconsultaLabel) .addComponent(idconsultaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(dataLabel) .addComponent(dataField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(horaLabel) .addComponent(horaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(medicoIdmedicoLabel) .addComponent(medicoIdmedicoField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(pacienteIdpacienteLabel) .addComponent(pacienteIdpacienteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveButton) .addComponent(refreshButton) .addComponent(deleteButton) .addComponent(newButton)) .addContainerGap()) ); bindingGroup.bind(); } // Code for dispatching events from components to event handlers. private class FormListener implements java.awt.event.ActionListener { FormListener() {} public void actionPerformed(java.awt.event.ActionEvent evt) { if (evt.getSource() == saveButton) { JCadeMedico.this.saveButtonActionPerformed(evt); } else if (evt.getSource() == refreshButton) { JCadeMedico.this.refreshButtonActionPerformed(evt); } else if (evt.getSource() == newButton) { JCadeMedico.this.newButtonActionPerformed(evt); } else if (evt.getSource() == deleteButton) { JCadeMedico.this.deleteButtonActionPerformed(evt); } } }// </editor-fold> @SuppressWarnings("unchecked") private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) { entityManager.getTransaction().rollback(); entityManager.getTransaction().begin(); java.util.Collection data = query.getResultList(); for (Object entity : data) { entityManager.refresh(entity); } list.clear(); list.addAll(data); } private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) { int[] selected = masterTable.getSelectedRows(); List<bean.Consulta> toRemove = new ArrayList<bean.Consulta>(selected.length); for (int idx = 0; idx < selected.length; idx++) { bean.Consulta c = list.get(masterTable.convertRowIndexToModel(selected[idx])); toRemove.add(c); entityManager.remove(c); } list.removeAll(toRemove); } private void newButtonActionPerformed(java.awt.event.ActionEvent evt) { bean.Consulta c = new bean.Consulta(); entityManager.persist(c); list.add(c); int row = list.size() - 1; masterTable.setRowSelectionInterval(row, row); masterTable.scrollRectToVisible(masterTable.getCellRect(row, 0, true)); } private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) { try { entityManager.getTransaction().commit(); entityManager.getTransaction().begin(); } catch (RollbackException rex) { rex.printStackTrace(); entityManager.getTransaction().begin(); List<bean.Consulta> merged = new ArrayList<bean.Consulta>(list.size()); for (bean.Consulta c : list) { merged.add(entityManager.merge(c)); } list.clear(); list.addAll(merged); } } // Variables declaration - do not modify private javax.swing.JTextField dataField; private javax.swing.JLabel dataLabel; private javax.swing.JButton deleteButton; private javax.persistence.EntityManager entityManager; private javax.swing.JTextField horaField; private javax.swing.JLabel horaLabel; private javax.swing.JTextField idconsultaField; private javax.swing.JLabel idconsultaLabel; private java.util.List<bean.Consulta> list; private javax.swing.JScrollPane masterScrollPane; private javax.swing.JTable masterTable; private javax.swing.JTextField medicoIdmedicoField; private javax.swing.JLabel medicoIdmedicoLabel; private javax.swing.JButton newButton; private javax.swing.JTextField pacienteIdpacienteField; private javax.swing.JLabel pacienteIdpacienteLabel; private javax.persistence.Query query; private javax.swing.JButton refreshButton; private javax.swing.JButton saveButton; private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration 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(JCadeMedico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JCadeMedico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JCadeMedico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JCadeMedico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame(); frame.setContentPane(new JCadeMedico()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }); } }

0
|
0