Example #1
0
  public void init() {
    GridBagConstraints gbc;
    GridBagLayout gbl = new GridBagLayout();

    resourcesLabel = new Label("Resources");
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(resourcesLabel, gbc);

    idLabel = new Label("Id", Label.RIGHT);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbl.setConstraints(idLabel, gbc);

    availableLabel = new Label("Available", Label.RIGHT);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbl.setConstraints(availableLabel, gbc);

    for (int i = 0; i < resourceCount; i++) {
      Label idLabel;
      Label availableLabel;
      // create the labels
      // add labels to the vectors
      // set constraints
      idLabel = new Label();
      idLabel.setAlignment(Label.RIGHT);
      resourceIdLabelVector.insertElementAt(idLabel, i);
      gbc = new GridBagConstraints();
      gbc.gridx = 1;
      gbc.gridy = 3 + i;
      gbl.setConstraints(idLabel, gbc);

      availableLabel = new Label();
      availableLabel.setAlignment(Label.RIGHT);
      resourceAvailableLabelVector.insertElementAt(availableLabel, i);
      gbc = new GridBagConstraints();
      gbc.gridx = 2;
      gbc.gridy = 3 + i;
      gbl.setConstraints(availableLabel, gbc);
    }

    setLayout(gbl);

    add(resourcesLabel);
    add(idLabel);
    add(availableLabel);
    for (int i = 0; i < resourceCount; i++) {
      Label idLabel;
      Label availableLabel;
      idLabel = (Label) resourceIdLabelVector.elementAt(i);
      availableLabel = (Label) resourceAvailableLabelVector.elementAt(i);
      add(idLabel);
      add(availableLabel);
    }
  }
Example #2
0
  public D(String title) {
    super(title);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    int frameWidth = 410;
    int frameHeight = 319;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2;
    setLocation(x, y);
    setResizable(false);
    Container cp = getContentPane();
    cp.setLayout(null);

    label1.setBounds(8, 8, 275, 76);
    label1.setText("Würfel");
    label1.setAlignment(Label.CENTER);
    label1.setFont(new Font("Dialog", Font.PLAIN, 60));
    cp.add(label1);
    l_1.setBounds(8, 88, 275, 145);
    l_1.setText("");
    l_1.setAlignment(Label.CENTER);
    l_1.setFont(new Font("Dialog", Font.PLAIN, 100));

    cp.add(l_1);
    b_1.setBounds(8, 248, 275, 25);
    b_1.setLabel("Würfeln");
    b_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            b_1_ActionPerformed(evt);
          }
        });
    cp.add(b_1);
    tf_von.setBounds(336, 80, 49, 25);
    cp.add(tf_von);
    tf_bis.setBounds(336, 120, 49, 25);
    cp.add(tf_bis);
    l_von.setBounds(296, 80, 35, 25);
    l_von.setText("Von:");
    cp.add(l_von);
    l_bis.setBounds(296, 120, 35, 25);
    l_bis.setText("Bis:");
    cp.add(l_bis);
    b_a.setBounds(296, 160, 89, 49);
    b_a.setLabel("Annehmen");
    b_a.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            b_a_ActionPerformed(evt);
          }
        });
    cp.add(b_a);

    setVisible(true);
  }
Example #3
0
 public void setTitle(String title) {
   if (null == label) {
     label = new Label(title);
     label.setAlignment(Label.CENTER);
     add(label, BorderLayout.NORTH);
   } else {
     label.setText(title);
   }
 }
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private java.awt.Label getLabel1() {
   if (ivjLabel1 == null) {
     try {
       ivjLabel1 = new java.awt.Label();
       ivjLabel1.setName("Label1");
       ivjLabel1.setFont(new java.awt.Font("serif", 3, 24));
       ivjLabel1.setAlignment(java.awt.Label.CENTER);
       ivjLabel1.setText("Name not found!");
       ivjLabel1.setForeground(java.awt.Color.red);
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjLabel1;
 }
  /** Constructor. */
  private HeaderPanel() {
    setBackground(BACKGROUND_COLOR);
    setLayout(cardLayout);

    add(functionCard, FUNCTION);
    add(messageCard, MESSAGE);

    functionCard.setBackground(BACKGROUND_COLOR);
    functionCard.setLayout(new BorderLayout());

    messageCard.setBackground(BACKGROUND_COLOR);
    messageCard.setLayout(new BorderLayout());

    label.setFont(new Font("Dialog", Font.BOLD, 12));
    label.setAlignment(Label.CENTER);
    label.setForeground(Color.black);

    messageCard.add(label, BorderLayout.CENTER);
  }
Example #6
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private java.awt.Label getLabel121() {
   if (ivjLabel121 == null) {
     try {
       ivjLabel121 = new java.awt.Label();
       ivjLabel121.setName("Label121");
       ivjLabel121.setAlignment(java.awt.Label.CENTER);
       ivjLabel121.setText("E.O. Stinson");
       ivjLabel121.setBackground(java.awt.Color.white);
       ivjLabel121.setBounds(7, 23, 384, 23);
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjLabel121;
 }
Example #7
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private java.awt.Label getLabel11() {
   if (ivjLabel11 == null) {
     try {
       ivjLabel11 = new java.awt.Label();
       ivjLabel11.setName("Label11");
       ivjLabel11.setAlignment(java.awt.Label.LEFT);
       ivjLabel11.setText("foo");
       ivjLabel11.setBackground(java.awt.Color.white);
       ivjLabel11.setBounds(26, 45, 362, 18);
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjLabel11;
 }
  /**
   * displays a simpel message like a JOptionPane. After OK is pressed the programm will exit with
   * errorcode 1
   *
   * @param titel the titel of the window
   * @param message the message that should displayed
   */
  public MsgFrame(String titel, String message) {
    super(new Frame(), true);
    this.setTitle(titel);
    setLayout(new BorderLayout());
    setBackground(Color.lightGray);

    // Label:
    Label msg = new Label(message);
    msg.setBackground(Color.lightGray);
    add("North", msg);
    msg.setAlignment(Label.CENTER);

    Panel panelButton = new Panel();

    // CloseButton
    Button closeButton = new Button("Close");
    closeButton.addActionListener(this);

    panelButton.add(closeButton);

    add("South", panelButton);

    // enable close button:
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            dispose();
            System.exit(1);
          }
        });
    pack();
    // find the middel of screen
    Dimension dimFrame = getSize();
    Dimension dimSystem = Toolkit.getDefaultToolkit().getScreenSize();
    int y = (dimSystem.height - dimFrame.height) / 2;
    int x = (dimSystem.width - dimFrame.width) / 2;
    setLocation(x, y);

    // to be compatible with early java versions
    // setVisible(true);
    show();
  }
Example #9
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private java.awt.Label getLabel2() {
   if (ivjLabel2 == null) {
     try {
       ivjLabel2 = new java.awt.Label();
       ivjLabel2.setName("Label2");
       ivjLabel2.setLocation(10, 22);
       ivjLabel2.setText("");
       ivjLabel2.setBackground(java.awt.SystemColor.control);
       ivjLabel2.setSize(70, 12);
       ivjLabel2.setForeground(java.awt.Color.black);
       ivjLabel2.setFont(new java.awt.Font("dialog", 2, 10));
       ivjLabel2.setAlignment(1);
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   ;
   return ivjLabel2;
 }
Example #10
0
  Login() {

    Panel p1 = new Panel();
    Panel p2 = new Panel();
    Label lid = new Label("id号");
    Label sip = new Label("服务器ip");
    lid.setAlignment(Label.CENTER);
    Label lpw = new Label("密码");
    lpw.setAlignment(Label.CENTER);
    sip.setAlignment(Label.CENTER);
    tid = new TextField();
    tpw = new TextField();
    tsip = new TextField();
    tsip.setText("127.0.0.1");
    Button blog = new Button("登陆");
    blog.addActionListener(this);
    Button bcl = new Button("取消");
    bcl.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
    setLayout(new BorderLayout());
    p1.setLayout(new GridLayout(3, 2));
    p1.add(lid);
    p1.add(tid);
    p1.add(lpw);
    p1.add(tpw);
    p1.add(sip);
    p1.add(tsip);
    p2.add(blog);
    p2.add(bcl);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    add(p1, BorderLayout.NORTH);
    add(p2, BorderLayout.SOUTH);
    setBounds(300, 300, 200, 130);
    this.setResizable(false);
    tpw.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
              login();
            }
          }
        });
    tsip.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
              login();
            }
          }
        });
    setTitle("登陆界面");
    setVisible(true);
  }
Example #11
0
  /**
   * Initializes a new instance of <code>Label</code> with the specified text and alignment.
   *
   * @param text The text of the label.
   * @param alignment The desired alignment for the text in this label, which must be one of <code>
   *     LEFT</code>, <code>CENTER</code>, or <code>RIGHT</code>.
   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
   */
  public Label(String text, int alignment) {
    setAlignment(alignment);
    setText(text);

    if (GraphicsEnvironment.isHeadless()) throw new HeadlessException();
  }
Example #12
0
  private void setup() {
    setLayout(null);
    this.setSize(1200, 800);
    setBackground(Color.DARK_GRAY);
    list.setFont(new Font("Arial", Font.PLAIN, 24));
    list.setBounds(52, 118, 429, 501);

    selecionado1 = new Label("");
    selecionado1.setForeground(Color.WHITE);
    selecionado1.setFont(new Font("Dialog", Font.PLAIN, 18));
    selecionado1.setBounds(560, 128, 611, 43);
    add(selecionado1);

    PreencheGenero();
    add(list);

    logout = new JButton("Logout");
    logout.setBounds(1074, 673, 97, 25);
    logout.addActionListener(this);
    logout.setVisible(true);
    add(logout);

    autor = new JRadioButton("Autor");
    autor.setForeground(Color.WHITE);
    autor.setFont(new Font("Tahoma", Font.PLAIN, 18));
    autor.setSelected(false);
    autor.setBackground(Color.DARK_GRAY);
    autor.setBounds(52, 56, 127, 25);
    autor.addActionListener(this);
    add(autor);

    titulo = new JRadioButton("Trabalho artístico");
    titulo.setForeground(Color.WHITE);
    titulo.setFont(new Font("Tahoma", Font.PLAIN, 18));
    titulo.setBackground(Color.DARK_GRAY);
    titulo.setSelected(false);
    titulo.setBounds(275, 56, 181, 25);
    titulo.addActionListener(this);
    add(titulo);

    genero = new JRadioButton("Gênero");
    genero.setForeground(Color.WHITE);
    genero.setFont(new Font("Tahoma", Font.PLAIN, 18));
    genero.setBackground(Color.DARK_GRAY);
    genero.setSelected(true);
    genero.setBounds(499, 58, 127, 25);
    genero.addActionListener(this);
    add(genero);

    selecionado2 = new Label("");
    selecionado2.setForeground(Color.WHITE);
    selecionado2.setFont(new Font("Dialog", Font.PLAIN, 18));
    selecionado2.setBounds(560, 197, 611, 43);
    add(selecionado2);

    selecionado3 = new Label("");
    selecionado3.setForeground(Color.WHITE);
    selecionado3.setFont(new Font("Dialog", Font.PLAIN, 18));
    selecionado3.setBounds(560, 268, 611, 55);
    add(selecionado3);

    label = new Label("Selecione um Filtro");
    label.setForeground(Color.WHITE);
    label.setFont(new Font("Dialog", Font.PLAIN, 18));
    label.setBounds(52, 10, 611, 43);
    add(label);

    adicionar = new JButton("Adicionar");
    adicionar.setBounds(956, 673, 97, 25);
    adicionar.addActionListener(this);
    add(adicionar);

    Label logado = new Label("Selecione um Filtro");
    logado.setAlignment(Label.RIGHT);
    logado.setForeground(Color.WHITE);
    logado.setFont(new Font("Dialog", Font.PLAIN, 18));
    logado.setBounds(722, 10, 449, 43);
    logado.setText("Olá, " + Main.user.getNome());
    add(logado);
  }
  /** Création de l'intérieur de la fenêtre */
  private void initConteneur() {
    // le fond
    fond = getToolkit().getImage("./images/preference/bomber_fond.gif");
    tracker = new MediaTracker(this);
    tracker.addImage(fond, 0);
    try {
      tracker.waitForID(0);
    } catch (Exception a) {
      System.out.println("Erreur lors chargement de l'image: initConteneur() Preference");
      a.printStackTrace();
    }

    // le layout manager
    GridBagLayout layout = new GridBagLayout();
    setLayout(layout);
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 10;
    c.weighty = 10;
    c.ipadx = 10;
    c.ipady = 10;
    c.fill = GridBagConstraints.BOTH;

    // label "Joueurs:"
    Label lbl_joueurs = new Label("Joueurs:");
    lbl_joueurs.setAlignment(Label.CENTER);
    lbl_joueurs.setFont(new Font("SansSerif", Font.BOLD, 16));
    lbl_joueurs.setBackground(Color.black);
    lbl_joueurs.setForeground(Color.red);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 6;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 10, 10);
    c.anchor = GridBagConstraints.SOUTH;
    layout.setConstraints(lbl_joueurs, c);
    add(lbl_joueurs);

    // choix de couleur du joueur ayant l'identifiant 0
    choix_couleur0 = new Choice();
    choix_couleur0.addItem("rouge");
    choix_couleur0.addItem("bleu");
    choix_couleur0.addItemListener(this);
    choix_couleur0.setBackground(Color.red);
    choix_couleur0.setForeground(Color.black);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.insets = new Insets(10, 10, 5, 20);
    c.anchor = GridBagConstraints.EAST;
    layout.setConstraints(choix_couleur0, c);
    add(choix_couleur0);

    // nom du joueur ayant l'identifiant 0
    txt_joueur0 = new TextField(noms[0]);
    c.gridx = 2;
    c.gridy = 1;
    c.gridwidth = 4;
    c.gridheight = 1;
    c.insets = new Insets(10, 10, 5, 20);
    c.anchor = GridBagConstraints.WEST;
    layout.setConstraints(txt_joueur0, c);
    add(txt_joueur0);

    // choix de couleur du joueur ayant l'identifiant 1
    choix_couleur1 = new Choice();
    choix_couleur1.addItem("bleu");
    choix_couleur1.addItem("rouge");
    choix_couleur1.addItemListener(this);
    choix_couleur1.setBackground(Color.blue);
    choix_couleur1.setForeground(Color.black);
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.insets = new Insets(10, 10, 20, 20);
    c.anchor = GridBagConstraints.EAST;
    layout.setConstraints(choix_couleur1, c);
    add(choix_couleur1);

    // nom du joueur ayant l'identifiant 1
    txt_joueur1 = new TextField(noms[1]);
    c.gridx = 2;
    c.gridy = 2;
    c.gridwidth = 4;
    c.gridheight = 1;
    c.insets = new Insets(10, 10, 30, 20);
    c.anchor = GridBagConstraints.WEST;
    layout.setConstraints(txt_joueur1, c);
    add(txt_joueur1);

    // label "Nombre De Vies:"
    Label lbl_nbvies = new Label("Nombre De Vies:");
    lbl_nbvies.setAlignment(Label.CENTER);
    lbl_nbvies.setFont(new Font("SansSerif", Font.BOLD, 14));
    lbl_nbvies.setBackground(Color.black);
    lbl_nbvies.setForeground(Color.yellow);
    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 5, 10);
    c.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(lbl_nbvies, c);
    add(lbl_nbvies);
    // un choix possible
    cbg_vies = new CheckboxGroup();
    Checkbox cb;
    for (int i = 1; i <= 5; i++) {
      if (i == nb_vies) cb = new Checkbox("" + i, cbg_vies, true);
      else cb = new Checkbox("" + i, cbg_vies, false);
      c.gridx = i;
      c.gridy = 4;
      c.gridwidth = 1;
      c.gridheight = 1;
      c.insets = new Insets(20, 10, 5, 10);
      c.anchor = GridBagConstraints.CENTER;
      layout.setConstraints(cb, c);
      add(cb);
    } // for

    // label "Nombre	De Victoires:"
    lbl_victoires = new Label();
    lbl_victoires.setAlignment(Label.CENTER);
    lbl_victoires.setFont(new Font("SansSerif", Font.BOLD, 14));
    lbl_victoires.setText("Nombre De Victoires: " + nb_victoires);
    lbl_victoires.setBackground(Color.black);
    lbl_victoires.setForeground(Color.green);
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 5, 10);
    c.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(lbl_victoires, c);
    add(lbl_victoires);

    // choix du nombre de victoires entre un 1 et 9
    sb_victoires = new Scrollbar(Scrollbar.HORIZONTAL, 1, 1, 1, 10);
    sb_victoires.setUnitIncrement(1);
    sb_victoires.setBlockIncrement(2);
    sb_victoires.addAdjustmentListener(this);
    sb_victoires.setValue(nb_victoires);
    c.gridx = 1;
    c.gridy = 6;
    c.gridwidth = 5;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 5, 10);
    c.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(sb_victoires, c);
    add(sb_victoires);

    // tirage aléatoire des niveaux
    cb_aleatoire = new Checkbox("Niveaux Aléatoires", aleatoire);
    cb_aleatoire.setFont(new Font("SansSerif", Font.BOLD, 14));
    cb_aleatoire.setBackground(Color.black);
    cb_aleatoire.setForeground(Color.magenta);
    c.gridx = 0;
    c.gridy = 8;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(20, 12, 5, 10);
    c.anchor = GridBagConstraints.EAST;
    layout.setConstraints(cb_aleatoire, c);
    add(cb_aleatoire);

    // label "FPS:" nombre de frames par seconde
    lbl_fps = new Label();
    lbl_fps.setAlignment(Label.CENTER);
    lbl_fps.setFont(new Font("SansSerif", Font.BOLD, 14));
    lbl_fps.setText("FPS: " + fps);
    lbl_fps.setBackground(Color.black);
    lbl_fps.setForeground(Color.orange);
    c.gridx = 0;
    c.gridy = 10;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 5, 10);
    c.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(lbl_fps, c);
    add(lbl_fps);

    // choix du nombre de frames par seconde
    sb_fps = new Scrollbar(Scrollbar.HORIZONTAL, 1, 1, 1, 51);
    sb_fps.setUnitIncrement(1);
    sb_fps.setBlockIncrement(10);
    sb_fps.addAdjustmentListener(this);
    sb_fps.setValue(fps);
    c.gridx = 1;
    c.gridy = 10;
    c.gridwidth = 5;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 5, 10);
    c.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(sb_fps, c);
    add(sb_fps);

    // bouton de confirmation
    button_ok = new Button("Ok");
    c.gridx = 0;
    c.gridy = 12;
    c.gridwidth = 6;
    c.gridheight = 1;
    c.insets = new Insets(20, 5, 20, 5);
    c.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(button_ok, c);
    add(button_ok);
    button_ok.addActionListener(this);
  } // initConteneur()
Example #14
0
 /**
  * Static Init
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   this.setBackground(Color.white);
   this.setName("splash");
   this.setUndecorated(true);
   //
   productLabel.setAlignment(Label.CENTER);
   message.setFont(new java.awt.Font("Serif", 3, 20)); //  italic bold 20 pt
   message.setForeground(SystemColor.activeCaption);
   message.setAlignment(Label.CENTER);
   contentPanel.setLayout(contentLayout);
   contentPanel.setName("splashContent");
   contentPanel.setBackground(Color.white);
   //
   productLabel.setFont(new java.awt.Font("Serif", 2, 10));
   productLabel.setForeground(Color.blue);
   productLabel.setText(Adempiere.getSubtitle());
   //	productLabel.setToolTipText(Adempiere.getURL());
   //
   contentPanel.add(
       cImage,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(10, 5, 0, 10),
           0,
           0));
   contentPanel.add(
       productLabel,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 5, 0, 10),
           0,
           0));
   contentPanel.add(
       message,
       new GridBagConstraints(
           1,
           2,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 10, 10),
           0,
           0));
   //
   this.add(aImage, BorderLayout.WEST);
   this.add(contentPanel, BorderLayout.EAST);
 } //	jbInit
Example #15
0
  /** Create the frame. */
  public GUICalendar() {
    setResizable(false);
    eventManager = new EventManager();

    this.initCalendar = eventManager.getCalendar();
    eventManager.addChangeListener(this);

    // load event.txt by default.
    try {
      load();
    } catch (IOException e1) {
      e1.printStackTrace();
    }
    // eventManager.eventList();

    Month = arrayOfMonths[initCalendar.get(Calendar.MONTH)];
    Date = initCalendar.get(Calendar.DAY_OF_MONTH);
    Year = initCalendar.get(Calendar.YEAR);

    // puts dates of this month into the array
    GregorianCalendar temp =
        new GregorianCalendar(initCalendar.get(Calendar.YEAR), initCalendar.get(Calendar.MONTH), 1);
    int[] arr = new int[42];

    int firstDayOfWeek = temp.get(Calendar.DAY_OF_WEEK) - 1;
    int lastDayOfMonth = temp.getActualMaximum(Calendar.DAY_OF_MONTH);
    for (int i = 0; i < arr.length; i++) {
      arr[i] = i + 1 + (firstDayOfWeek * -1);
    }

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 650, 320);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JPanel panel = new JPanel();
    panel.setBackground(new Color(255, 255, 255));
    contentPane.add(panel, BorderLayout.NORTH);

    JButton button = new JButton("<");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            eventManager.setCalendar(-1);
            // System.out.print(eventManager.getCalendar().get(Calendar.DAY_OF_MONTH));
          }
        });
    panel.add(button);

    JButton button_1 = new JButton(">");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            eventManager.setCalendar(1);
            // System.out.print(eventManager.getCalendar().get(Calendar.DAY_OF_MONTH));
          }
        });
    panel.add(button_1);

    JButton btnQuit = new JButton("QUIT");
    btnQuit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            try {
              quit();
            } catch (IOException e) {
              e.printStackTrace();
            }
          }
        });
    btnQuit.setFont(new Font("SansSerif", Font.PLAIN, 11));
    panel.add(btnQuit);

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(new Color(255, 255, 255));
    contentPane.add(panel_1, BorderLayout.WEST);
    panel_1.setLayout(new BorderLayout(0, 0));

    JButton btnNewButton = new JButton("CREATE");
    btnNewButton.setBorder(UIManager.getBorder("Button.border"));
    btnNewButton.setPreferredSize(new Dimension(71, 30));
    btnNewButton.setFont(new Font("SansSerif", Font.PLAIN, 11));
    btnNewButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            CreateDialog dialog =
                new CreateDialog(eventManager.getCalendar(), dayPanel, eventManager);
            dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
            dialog.setVisible(true);
          }
        });
    btnNewButton.setForeground(new Color(255, 255, 255));
    btnNewButton.setBackground(new Color(220, 20, 60));
    panel_1.add(btnNewButton, BorderLayout.NORTH);

    label = new Label(Month + " " + Year);
    label.setAlignment(Label.CENTER);
    panel_1.add(label, BorderLayout.CENTER);

    monthPanel = new MonthPanel(initCalendar, eventManager);
    panel_1.add(monthPanel, BorderLayout.SOUTH);

    String date =
        String.format("%02d", initCalendar.get(Calendar.MONTH) + 1)
            + "/"
            + String.format("%02d", initCalendar.get(Calendar.DAY_OF_MONTH))
            + "/"
            + initCalendar.get(Calendar.YEAR);
    ArrayList<String> eventList = eventManager.eventPrinter(date);
    dayPanel = new DayPanel(initCalendar, eventList);
    dayPanel.setBackground(new Color(255, 255, 255));
    dayPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    contentPane.add(dayPanel, BorderLayout.CENTER);
    setVisible(true);
  }