content: /*
   * 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 com.eugc;
  
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.Calendar;
  import java.util.Date;
  
  /**
   *
   * @author 520
   */
  public class MessageBox extends javax.swing.JFrame {
      
      private static String title;
  
      /**
       * Creates new form MessageBox
       * @param title
       */
      public MessageBox(String title) {
          this.title = title;
          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">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          jScrollPane1 = new javax.swing.JScrollPane();
          MsgBox = new javax.swing.JTextArea();
          jLabel1 = new javax.swing.JLabel();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
          setTitle(this.title);
          addWindowListener(new java.awt.event.WindowAdapter() {
              public void windowClosed(java.awt.event.WindowEvent evt) {
                  formWindowClosed(evt);
              }
          });
  
          MsgBox.setEditable(false);
          MsgBox.setColumns(20);
          MsgBox.setLineWrap(true);
          MsgBox.setRows(5);
          jScrollPane1.setViewportView(MsgBox);
  
          jLabel1.setText("Message Log:");
  
          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()
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 589, Short.MAX_VALUE)
                      .addGroup(layout.createSequentialGroup()
                          .addComponent(jLabel1)
                          .addGap(0, 0, Short.MAX_VALUE)))
                  .addContainerGap())
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(jLabel1)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE)
                  .addContainerGap())
          );
  
          pack();
      }// </editor-fold>//GEN-END:initComponents
  
      private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
          System.exit(0);
      }//GEN-LAST:event_formWindowClosed
  
      /**
       * @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(MessageBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(MessageBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(MessageBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(MessageBox.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 MessageBox(title).setVisible(true);
              }
          });
      }
      
      public void addLog(String msg){
          Date date = Calendar.getInstance().getTime();  
          DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");  
          String strDate = dateFormat.format(date);
          String msgText = "[" + strDate + "] - " + msg + "\n";
          MsgBox.append(msgText);
      }
      
      public final void introText(){
          String s = "NIEBot - Copyright \u00A9 520, 2021 \n\nThis program is licensed under the GNU General Public License (GPL) version 3. For license details, please read the LICENSE file, and for updates to the program, please check out the official GitHub repository at https://github.com/AFFT-520/NIEBot\n\n";
          MsgBox.append(s);
      }
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JTextArea MsgBox;
      private javax.swing.JLabel jLabel1;
      private javax.swing.JScrollPane jScrollPane1;
      // End of variables declaration//GEN-END:variables
  }
  