Home Fóruns Java Java

Visualizando 5 respostas da discussão
  • Autor
    Posts
    • #130699
      Ariel Araújo
      Participante

      Comecei o curso de java porem to tendo problemas, fiz o codigo como no video, tirei a classe principal, porem o programa não inicia, ja procurei na internet o por que de não da certo, e não achei

    • #130780
      Tutora Jessica
      Moderador

      Ola Ariel, você salvou o projeto?
      Nos envie aqui seu codigo para analise.

    • #130827
      Ariel Araújo
      Participante

      /*
      * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
      * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
      */
      package cursoemvideo.olamundo;

      /**
      *
      * @author Ariel
      */
      public class OlaMundoJava extends javax.swing.JFrame {

      /**
      * Creates new form OlaMundoJava
      */
      public OlaMundoJava() {
      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() {

      lblMensagem = new javax.swing.JLabel();
      btnClick = new javax.swing.JButton();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

      lblMensagem.setBackground(new java.awt.Color(255, 51, 0));
      lblMensagem.setFont(new java.awt.Font(“Dialog”, 0, 14)); // NOI18N
      lblMensagem.setForeground(new java.awt.Color(255, 51, 0));
      lblMensagem.setText(“Aqui vai aparecer a mensagem!”);

      btnClick.setFont(new java.awt.Font(“Dialog”, 0, 14)); // NOI18N
      btnClick.setForeground(new java.awt.Color(255, 255, 0));
      btnClick.setText(“Clique em mim!”);

      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(72, 72, 72)
      .addComponent(lblMensagem))
      .addGroup(layout.createSequentialGroup()
      .addGap(112, 112, 112)
      .addComponent(btnClick)))
      .addContainerGap(82, Short.MAX_VALUE))
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
      .addGap(90, 90, 90)
      .addComponent(lblMensagem)
      .addGap(18, 18, 18)
      .addComponent(btnClick, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addContainerGap(72, Short.MAX_VALUE))
      );

      pack();
      }// </editor-fold>

      /**
      * @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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(OlaMundoJava.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
      }
      //</editor-fold>

      //</editor-fold>

      /* Create and display the form */
      java.awt.EventQueue.invokeLater(() -> {
      new OlaMundoJava().setVisible(true);
      });
      }

      // Variables declaration – do not modify
      private javax.swing.JButton btnClick;
      private javax.swing.JLabel lblMensagem;
      // End of variables declaration
      }

      • Esta resposta foi modificada 3 meses, 1 semana atrás por Ariel Araújo. Razão: Tinha alguns codigos escondidos
    • #130846
      Tutora Jessica
      Moderador

      Ola Ariel, em qual aula e modulo você esta?

    • #130880
      Ariel Araújo
      Participante

      Estou na aula 5, introdução ao javafx e swing

    • #130882
      Ariel Araújo
      Participante

      Ja consegui resolver meu problema, muito obrigado

Visualizando 5 respostas da discussão
  • Você deve fazer login para responder a este tópico.