Ir ao conteúdo

vitao1020

Membro Pleno
  • Posts

    77
  • Cadastrado em

  • Última visita

Tudo que vitao1020 postou

  1. Gostaria de saber se quando acesso um servidor ssh pelo putty, caso eu faça um teste pra verificar o meu ip. O ip que irá mostrar deve ser o do servidor ssh?
  2. Galera, Possuo um fone que tá causando retorno, procurei soluções e encontrei que deveria instalar o driver Realtek de audio mas não consigo instalar ele na minha máquina. Instalo ele e reinicio mas continua como se não tivesse instalado nada, possuo um driver de audio que utilizo (VIA HD AUDIO) mas por ele não consigo resolver esse problema por isso quero efetuar a troca do driver, a minha placa-mãe é uma LOG H81H3 -M4.
  3. Boa tarde galera, Gostaria de saber se a placa-mãe log h81h3-m4 suporta um i3-9100f LG1151? ou tem algum problema
  4. @Lightfury como faço isso de redefinir por ftp? adicionado 0 minutos depois @GabrielZen óbvio que já fiz isso né mano
  5. Boa tarde galera Possuo um roteador asus rt-n300, esqueci o login e a senha para acesso as configurações, tentei o botão de reset e parece que não está funcionando, alguém sabe algo que eu consiga dar um hard reset ou recuperar meu login e senha de acesso a ele? a configuração dele é pelo router.asus.com
  6. @AlNexus sim, tava pensando nesse processador aí, mas essa fonte já possuo
  7. @AlNexus acha que um i5 cairia bem nessa configuração? pensei em um i5 9400f
  8. Gostaria de saber se a placa-mãe Gigabyte Z370M Aorus Gaming, Intel LGA 1151, mATX, DDR4 suportaria uma placa de video RX 570 4GB GDDR5
  9. @Phoenyx certeza? e qual processador duraria um certo tempo com ele? é de quebra a placa-mãe também
  10. @Phoenyx seria bom uma rx 570 4gb ou uma gtx?
  11. @Pico eu queria atualizar minha placa-mãe pra pegar um processador melhor e uma placa de vídeo também mas que aproveitasse minhas ddr3
  12. Boa noite, gostaria de saber qual placa-mãe com 4 slots de memoria poderia tá pegando para fazer um upgrade na minha máquina? lembrando que já tenho duas memorias ddr3 então a placa-mãe teria que ser ddr3 também, futuramente também queria trocar o processador colocar um i5-9400, qual seria a melhor placa-mãe com 4 slots para isso? me indicaram essa : https://www.kabum.com.br/produto/79455/placa-mãe-asus-m5a78l-m-plus-usb3-amd-am3-matx-ddr3?gclid=Cj0KCQjwlJfsBRDUARIsAIDHsWoXSsgt-l4UbyRa3Sa8zk8UJcRKpAadQtYtMUkDaefVd-ryV-D7zJ4aAiaYEALw_wcB mas não sei se está muito antiga ou se vai servir para o que estou pretendendo
  13. @iHollyZinhO implementei isso ao código mas agora a lista fica "invisível" e não aparece nem quando eu aperto o botão de listar
  14. @devair1010 é windows q uso, mais precisamente o 7 professional 64 adicionado 35 minutos depois @devair1010 Queria que nessa parte eu já pudesse substituir "Candidato A" pelo nome do candidato que eu cadastrar, e outra coisa que percebi que nesse seu código a votação ficou limitada em 6 votos
  15. @devair1010 eu uso o compilador falcon c++, já ouviu falar? é porque comecei a aprender nele e continuo usando
  16. @iHollyZinhO essa parte é onde tem a função de listar package Agenda.contato; import banco.Contato; import java.util.List; import javax.swing.table.DefaultTableModel; import Agenda.Agenda_Contato; import javax.swing.JFrame; import javax.swing.JOptionPane; /** * * @author Lenovo */ public class Contatos extends javax.swing.JFrame { /** * Creates new form Contatos */ public static void atualizarTabela(){ DefaultTableModel tTabela = (DefaultTableModel) jTable1.getModel(); tTabela.setNumRows(0); List<Contato> contatos = Agenda_Contato.getContatos(); for (int linha = 0; linha < contatos.size(); linha++){ Contato contato = contatos.get(linha); tTabela.addRow(new Object[]{1}); jTable1.setValueAt(contato.getCod(), linha, 0); jTable1.setValueAt(contato.getNome(), linha, 1); jTable1.setValueAt(contato.getTelefone(), linha, 2); jTable1.setValueAt(contato.getCelular(), linha, 3); jTable1.setValueAt(contato.getEmail(), linha, 4); } } public Contatos() { initComponents(); atualizarTabela(); } /** * 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() { btnCadastrar = new javax.swing.JButton(); btnAlterar = new javax.swing.JButton(); btnDeletar = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jToolBar1 = new javax.swing.JToolBar(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); btnCadastrar.setText("Cadastrar"); btnCadastrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCadastrarActionPerformed(evt); } }); btnAlterar.setText("Alterar"); btnAlterar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAlterarActionPerformed(evt); } }); btnDeletar.setText("Deletar"); btnDeletar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDeletarActionPerformed(evt); } }); jButton1.setText("Fechar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel1.setForeground(new java.awt.Color(204, 0, 0)); jLabel1.setText("Listas De Contatos"); jButton2.setText("Listar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jToolBar1.setRollover(true); jTable1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); jTable1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null} }, new String [] { "Codigo", "Nome", "Telefone", "Celular", "Email" } ) { Class[] types = new Class [] { java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(jTable1); 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(303, 303, 303) .addComponent(jLabel1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnCadastrar, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnAlterar, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnDeletar, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 696, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnCadastrar) .addComponent(btnAlterar) .addComponent(btnDeletar) .addComponent(jButton1)) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(13, 13, 13) .addComponent(jLabel1) .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(89, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void btnCadastrarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: JFrame frame = new CadastrarContato(); frame.setVisible(true); } private void btnAlterarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int linhaSelecionada = jTable1.getSelectedRow(); if(linhaSelecionada >=0){ JFrame janelaAlterar = new AlterarContato(linhaSelecionada); janelaAlterar.setVisible(true); }else{ JOptionPane.showMessageDialog(this, "Selecione um Contato", "Contato",JOptionPane.INFORMATION_MESSAGE ); } } private void btnDeletarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int linhaSelecionada = jTable1.getSelectedRow(); if(linhaSelecionada >=0){ int resposta = JOptionPane.showConfirmDialog(this, "Deseja deletar o Contato?"); if(resposta == JOptionPane.YES_NO_OPTION){ Contato contato = Agenda_Contato.getContatos().get(linhaSelecionada); Agenda_Contato.deletarContato(contato); atualizarTabela(); } }else{ JOptionPane.showMessageDialog(this, "Selecione um Contato","Contato",JOptionPane.INFORMATION_MESSAGE); } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: jTable1.setVisible(true); } /** * @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(Contatos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Contatos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Contatos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Contatos.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 Contatos().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton btnAlterar; private javax.swing.JButton btnCadastrar; private javax.swing.JButton btnDeletar; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private static javax.swing.JTable jTable1; private javax.swing.JToolBar jToolBar1; // End of variables declaration } adicionado 0 minutos depois @iHollyZinhO e essa parte é onde eu cadastro o contato package Agenda.contato; import Agenda.Agenda_Contato; import banco.Contato; /** * * @author Lenovo */ public class AlterarContato extends javax.swing.JFrame { /** * Creates new form CadastrarContato */ private Contato contato; private int linhaSelecionada; public AlterarContato() { initComponents(); } public AlterarContato(int linhaSelecionada){ initComponents(); this.linhaSelecionada = linhaSelecionada; contato = Agenda_Contato.getContatos().get(linhaSelecionada); txtCodigo.setText(String.valueOf(contato.getCod())); txtNome.setText(String.valueOf(contato.getNome())); txtTelefone.setText(String.valueOf(contato.getTelefone())); txtCelular.setText(String.valueOf(contato.getCelular())); txtEmail.setText(String.valueOf(contato.getEmail())); } /** * 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() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); txtCodigo = new javax.swing.JTextField(); txtNome = new javax.swing.JTextField(); txtTelefone = new javax.swing.JTextField(); txtCelular = new javax.swing.JTextField(); txtEmail = new javax.swing.JTextField(); btnCancelar = new javax.swing.JButton(); btnConfirmar = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel1.setText("Codigo: "); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel2.setText("Nome:"); jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel3.setText("Telefone: "); jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel4.setText("Celular:"); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel5.setText("E-mail:"); btnCancelar.setText("Cancelar"); btnCancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCancelarActionPerformed(evt); } }); btnConfirmar.setText("Confirmar"); btnConfirmar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConfirmarActionPerformed(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() .addContainerGap(32, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addComponent(btnConfirmar, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE) .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txtCodigo, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtNome, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtTelefone, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtCelular, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtEmail, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)) .addContainerGap(33, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(45, 45, 45) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(13, 13, 13) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnConfirmar) .addComponent(btnCancelar)) .addGap(19, 19, 19)) ); pack(); }// </editor-fold> private void btnConfirmarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int iCodigo = Integer.parseInt(txtCodigo.getText()); String iNome = txtNome.getText(); long iTelefone = Long.parseLong(txtTelefone.getText()); long iCelular = Long.parseLong(txtCelular.getText()); String iemail = txtEmail.getText(); Contato contato = new Contato(); contato.setCod(iCodigo); contato.setNome(iNome); contato.setTelefone(iTelefone); contato.setCelular(iCelular); contato.setEmail(iemail); Agenda_Contato.alterarContato(linhaSelecionada, contato); Contatos.atualizarTabela(); this.dispose(); } private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); } /** * @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(AlterarContato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(AlterarContato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(AlterarContato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(AlterarContato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AlterarContato().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton btnCancelar; private javax.swing.JButton btnConfirmar; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JTextField txtCelular; private javax.swing.JTextField txtCodigo; private javax.swing.JTextField txtEmail; private javax.swing.JTextField txtNome; private javax.swing.JTextField txtTelefone; // End of variables declaration }
  17. @devair1010 tentei compilar esse código e ainda apareceu a mesma mesma coisa de Candidato A, B e C, e depois quando mostra o resultado da eleição no nome do candidato tá aparecendo o endereço de memória
  18. @devair1010 sim, no printf no final do código, onde eu coloquei "apuração de votos"
  19. @devair1010 poderia me ajudar?
  20. Estou com um pequeno problema, criei esse código para simular uma eleição. Quero colocar para aparecer o nome dos candidatos que eu registar em candidato A, B e C mas não consigo fazer isso, o que preciso fazer? #include <stdio.h> #include <stdlib.h> #include <locale.h> struct tipo_novo{ int Votoc; char nome[10]; int qnat; }; int cadastro(tipo_novo Voto[], int aux) { printf("Informe o numero do candidato: "); scanf("%d",&Voto[aux].Votoc); fflush(stdin); printf("Informe o nome do candidato: "); scanf("%s",&Voto[aux].nome); fflush(stdin); } int Pesquisa(tipo_novo Voto[], int aux) { int i = 0; int pesq; printf("\nEntre com o codigo\n"); scanf("%d", &pesq); fflush(stdin); system("cls"); while ( i <= aux ) { if (Voto[i].Votoc == pesq) { printf("\nCodigo: %d \nNome: %s\n\n", Voto[i].Votoc, Voto[i].nome); ; } i++; } } main(){ setlocale(LC_ALL, "Portuguese"); tipo_novo Voto[100]; int aux = 0; int ContA = 0, ContB = 0, ContC = 0, ContBr = 0, ContN = 0, Votoc = 0, ContVoto = 0, opc; while (opc != 3){ printf("=================================="); printf("\n\n Escolha uma das opções: \n\n"); printf("================================== \n\n"); printf("1)Cadastrar candidato \n"); printf("2)Pesquisar candidato \n"); printf("3)Fim \n\n"); scanf("%d", &opc); if (opc ==1) { cadastro(Voto, aux); aux++; } if(opc ==2) Pesquisa(Voto, aux); } while (Votoc != 6) { system("cls"); printf("Escolha o candidato para votar: \n\n"); printf("1 - Voto para o candidato A \n\n"); printf("2 - Voto para o candidato B \n\n"); printf("3 - Voto para o candidato C \n\n"); printf("4 - Voto em Branco \n\n"); printf("5 - Voto Nulo \n\n"); printf("6 - Fim \n\n"); printf("Voto --> "); printf(""); scanf("%d", &Votoc); fflush(stdin); switch (Votoc) { case 1: ContA++; break; case 2: ContB++; break; case 3: ContC++; break; case 4: ContBr++; break; case 5: ContN++; break;} ContVoto++; } printf("======== Apuração de votos ========= \n"); printf("Candidato A = %d Votos \n", ContA); printf("Candidato B = %d Votos \n", ContB); printf("Candidato C = %d Votos \n\n", ContC); printf("Votos em branco = %d \n", ContBr); printf("Votos nulos = %d \n", ContN); printf("===================================== \n"); system("pause"); }
  21. Estou pegando uma matéria de programação na faculdade que é em java, programação orientada a objetos, tenho que fazer uma agenda de contatos com algumas funções como cadastrar, deletar, alterar, fechar e listar. Consegui fazer o resto das funções exceto a função de listar na qual não estou obtendo exito, no programa em que fiz logo quando crio o contato ele já vai para a lista automaticamente fazendo com que o botão de listar fique inutilizável, assim a lista de contatos fica aparecendo na tela mas queria que a lista aparecesse apenas quando eu apertasse o botão de listar, gostaria de saber se alguém poderia me ajudar com esse problema, segue a parte do código em que tá o arraylist package Agenda; import banco.Contato; import java.util.ArrayList; import java.util.List; public class Agenda_Contato { private static List<Contato> contatos = new ArrayList<Contato>(); public static List<Contato> getContatos() { return contatos; } public static void adicionarContato(Contato contato){ contatos.add(contato); } public static void alterarContato(int linha, Contato contato){ contatos.set(linha, contato); } public static void deletarContato(Contato contato){ contatos.remove(contato); } }
  22. @arfneto ainda tô aprendendo o básico sobre programação C, uso o falcou ou o dev. Não aprendi ainda sobre hexadecimal, queria saber se com esse código que fiz o que preciso fazer para que a função de alterar e salvar funcione pois são as únicas coisas que estão faltando
  23. @arfneto Eu quero gravar dessa maneira e poder alterar um registro na posição especifica do ponteiro, que é tô querendo é colocar o ponteiro em um registro especifico, estou usando struct pra pode fazer o arquivo, porque pra fazer modificação eu quero alterar e salvar arquivos especificos
  24. Gostaria de uma ajuda em relação a um código que fiz de uma agenda de contatos com funções de criar, alterar, salvar, excluir e modificar. Consegui adicionar as funções exceto a de salvar e modificar na qual já tentei de tudo e não obtive exito, alguém sabe o que preciso pra fazer essas funções funcionarem ou adicionar elas? #include <stdio.h> typedef struct { int codigo; char nome[10]; char end[30]; char tel[10]; int ativo; }Agenda; void cabecalho (char *titulo){ system("cls"); printf("\n\n--==[%s]==--\n\n", titulo); } main() { FILE *arq; Agenda pessoa; int opcao, pos; char resp; arq = fopen ("Agenda.dat", "a+b"); if(arq == NULL) printf("Erro ao tentar abrir o arquivo."); else{ do{ cabecalho("Menu Principal"); printf("1 - Cadastrar pessoa \n"); printf("2 - Alterar pessoa \n"); printf("3 - Excluir pessoa \n"); printf("4 - Consultar pessoa \n"); printf("5 - Listar \n"); printf("6 - Sair \n"); scanf("%d", &opcao); getchar(); switch(opcao){ case 1: cabecalho("Cadastrar Pessoa"); pessoa.ativo = 1; printf("Digite o codigo: \n"); scanf("%d", &pessoa.codigo); fflush(stdin); printf("Digite o nome:\n"); gets(pessoa.nome); fflush(stdin); printf("Digite o endereco:\n"); gets(pessoa.end); fflush(stdin); printf("Digite o telefone:\n"); gets(pessoa.tel); fflush(stdin); fwrite(&pessoa, sizeof(pessoa),1, arq); if(ferror(arq)) printf("Erro na gravação do arquivo."); else printf("Cliente cadastrado com sucesso."); break; case 2: cabecalho("Alterar Pessoa"); printf("Digite a codigo do cliente que deseja alterar."); scanf("%d", &pos); getchar(); fseek(arq, sizeof(Agenda)*(pos - 1), SEEK_SET); if (ferror(arq)) printf("Erro no posicionamento do cursor."); else{ fread(&pessoa, sizeof(Agenda), 1, arq); if(ferror(arq)) printf("\nErro na leitura do arquivo"); else{ printf("\nCodigo do cliente: %d", pessoa.codigo); printf("\nNome do cliente: %s", pessoa.nome); printf("\nEndereco do cliente: %s", pessoa.end); printf("\nTelefone do cliente: %s", pessoa.tel); } } printf("\nDigite o novo codigo do cliente:"); scanf("%d", &pessoa.codigo); getchar(); printf("\nDigite o novo nome do cliente:"); gets(pessoa.nome); printf("\nDigite o novo endereco do cliente:"); gets(pessoa.end); printf("\nDigite o novo telefone do cliente:"); gets(pessoa.tel); fseek(arq, sizeof(Agenda)*(pos - 1), SEEK_SET); fwrite(&pessoa, sizeof(Agenda),1,arq); break; case 3: cabecalho("Excluir pessoa"); printf("Digite o codigo que desejar excluir"); scanf("%d",&pos); getchar(); fseek(arq, sizeof(Agenda)*(pos - 1), SEEK_SET); if(ferror(arq)) printf("Erro no posionamento do cursor."); else{ fread(&pessoa, sizeof(Agenda), 1, arq); if(ferror(arq)) printf("Erro na leitura do arquivo."); else{ printf("\nCliente codigo: %d", pessoa.codigo); printf("\nCliente nome: %s", pessoa.nome); printf("\nCliente endereco: %s", pessoa.end); printf("\nCliente telefone: %s", pessoa.tel); printf("\nCliente ativo: %d", pessoa.ativo); } } do{ printf("\nConfirma exclusao? (s/n)"); resp = towlower(getchar()); }while (resp != 's' && resp != 'n' ); if(resp == 's'){ fseek(arq, sizeof(Agenda)*(pos - 1), SEEK_SET); pessoa.ativo = 0; fwrite(&pessoa, sizeof(Agenda), 1, arq); if(ferror(arq)) printf("Erro na exclusao do registro"); else printf("exclusao efetuada com sucesso"); }else printf("exclusao nao efetuada"); break; case 4: cabecalho("Consultar pessoa"); printf("\n Digite o codigo que deseja consultar: "); scanf("%d",&pos); getchar(); fseek(arq, sizeof(Agenda)*(pos - 1), SEEK_SET); if(ferror(arq)) printf("\nErro no posicionamento do cursor"); else{ fread(&pessoa, sizeof(Agenda), 1, arq); if(ferror(arq)) printf("\nErro na leitura do registro"); else{ printf("\nCliente codigo: %d", pessoa.codigo); printf("\nCliente nome: %s", pessoa.nome); printf("\nCliente endereco: %s", pessoa.end); printf("\nCliente telefone: %s", pessoa.tel); } } getchar(); break; case 5: cabecalho("Listar"); rewind(arq); if(ferror(arq)) printf("\nErro no posicionamento do cursor"); else{ while(!feof(arq)){ fread(&pessoa, sizeof(Agenda), 1, arq); if(ferror(arq)) printf("\nErro na leitura do registro"); else{ if (!feof(arq)){ if(pessoa.ativo){ printf("\nCliente codigo: %d", pessoa.codigo); printf("\nCliente nome: %s", pessoa.nome); printf("\nCliente endereco: %s", pessoa.end); printf("\nCliente telefone: %s\n", pessoa.tel); printf("\nCliente ativo: %d\n", pessoa.ativo); } } } } } getchar(); } }while(opcao !=6); } fclose(arq); return 0; }

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

LANÇAMENTO!

eletronica2025-popup.jpg


CLIQUE AQUI E BAIXE AGORA MESMO!