/* WARNING: THIS METHOD WILL BE REGENERATED. */
  private javax.swing.JMenuBar getTestingBrowserFrameJMenuBar() {
    if (ivjTestingBrowserFrameJMenuBar == null) {
      try {
        ivjTestingBrowserFrameJMenuBar = new javax.swing.JMenuBar();
        ivjTestingBrowserFrameJMenuBar.setName("TestingBrowserFrameJMenuBar");
        ivjTestingBrowserFrameJMenuBar.setBackground(java.awt.SystemColor.control);
        ivjTestingBrowserFrameJMenuBar.add(getFile());
        ivjTestingBrowserFrameJMenuBar.add(getTestMenu());
        ivjTestingBrowserFrameJMenuBar.add(getLoadBuildMenu());

        // user code begin {1}
        // user code end
      } catch (java.lang.Throwable ivjExc) {
        // user code begin {2}
        // user code end
        handleException(ivjExc);
      }
    }
    return ivjTestingBrowserFrameJMenuBar;
  }
  private void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    spinDays = new javax.swing.JSpinner();
    spinMonth = new javax.swing.JSpinner();
    spinYear = new javax.swing.JSpinner();
    jLabel2 = new javax.swing.JLabel();
    txtWeek = new javax.swing.JTextField(2);
    jLabel3 = new javax.swing.JLabel();
    txtDays = new javax.swing.JTextField(1);
    jLabel4 = new javax.swing.JLabel();
    btnLMP = new javax.swing.JButton();
    btnUSG = new javax.swing.JButton();
    btnClear = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    txtResult = new javax.swing.JTextArea();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenu3 = new javax.swing.JMenuItem();

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
    jLabel1.setText("Date");

    spinDays.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    spinDays.setName("spDay"); // NOI18N
    spinDays.setNextFocusableComponent(spinMonth);
    spinDays.addChangeListener(
        new javax.swing.event.ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jSpinner2StateChanged(evt);
          }
        });

    spinMonth.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    spinMonth.setName("spMonth"); // NOI18N
    spinMonth.setNextFocusableComponent(spinYear);
    spinMonth.addChangeListener(
        new javax.swing.event.ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jSpinner3StateChanged(evt);
          }
        });

    spinYear.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    spinYear.setName("spYear"); // NOI18N
    spinYear.addChangeListener(
        new javax.swing.event.ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jSpinner4StateChanged(evt);
          }
        });

    jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
    jLabel2.setText("Gestacional age");

    txtWeek.setColumns(2);
    txtWeek.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    txtWeek.setText("00");

    jLabel3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
    jLabel3.setText("weeks");

    txtDays.setColumns(1);
    txtDays.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    txtDays.setText("0");

    jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
    jLabel4.setText("days");

    btnLMP.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    btnLMP.setText("L.M.P.");
    btnLMP.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Calendar lpm = Calendar.getInstance();
            Calendar today = Calendar.getInstance();
            lpm.set(dtYear, dtMonth, dtDay);
            txtResult.setText("");
            if (lpm.getTime().after(today.getTime())) {
              txtResult.insert("Invalid L.P.M.", 0);
            } else {
              // defines gestacional ages
              gest.setDum(lpm.getTime());
              // show calcs
              ShowCalcs("L.P.M.");
            }
            ;
          }
        });

    btnUSG.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    btnUSG.setText("Exam");
    btnUSG.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Calendar dtExam = Calendar.getInstance();
            Calendar today = Calendar.getInstance();
            dtExam.set(dtYear, dtMonth, dtDay);
            txtResult.setText("");
            if (dtExam.getTime().after(today.getTime())) {
              txtResult.insert("Invalid Date", 0);
            } else {
              // defines gestacional ages
              try {
                if (txtWeek.getText().equals("")) {
                  txtWeek.setText("0");
                }
                if (txtDays.getText().equals("")) {
                  txtDays.setText("0");
                }
                int wk = Integer.parseInt(txtWeek.getText()),
                    dy = Integer.parseInt(txtDays.getText());
                gest.setDum(dtExam.getTime(), wk, dy);
                // show calcs
                ShowCalcs("US");
              } catch (NumberFormatException nfex) {
                JOptionPane.showMessageDialog(
                    null, nfex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
              } catch (Exception ex) {
                JOptionPane.showMessageDialog(
                    null, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
              }
            }
          }
        });

    btnClear.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    btnClear.setText("Clear");
    btnClear.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtResult.setText("");
          }
        });

    txtResult.setColumns(20);
    txtResult.setRows(5);
    txtResult.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
    jScrollPane1.setViewportView(txtResult);

    jMenuBar1.setName("mainMenuBar"); // NOI18N

    jMenu1.setText("File");

    jMenu3.setMnemonic('x');
    jMenu3.setText("Exit");
    jMenu3.setName("mnitExit"); // NOI18N
    jMenu3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exit();
          }
        });

    jMenu1.add(jMenu3);

    jMenuBar1.add(jMenu1);

    setJMenuBar(jMenuBar1);

    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)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        spinDays,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        77,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        spinMonth,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        77,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        spinYear,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        117,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel1)
                                            .addComponent(
                                                jLabel2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                194,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        txtWeek,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        66,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .RELATED)
                                                    .addComponent(jLabel3)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .UNRELATED)
                                                    .addComponent(
                                                        txtDays,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .RELATED)
                                                    .addComponent(jLabel4)))
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        btnLMP,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        81,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        btnUSG,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        81,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        btnClear,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        82,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(
                                        spinDays,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        66,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(
                                        spinMonth,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        66,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                spinYear,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                66,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                txtWeek,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                50,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3)
                            .addComponent(
                                txtDays,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                50,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                btnLMP,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                48,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                btnUSG,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                48,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                btnClear,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                48,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        225,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(18, Short.MAX_VALUE)));

    pack();
  }
Exemplo n.º 3
0
  public Whiteboard() {
    setTitle("Distributed Whiteboard");
    setResizable(false);

    btnIcon = new ImageIcon();
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(802, 607);

    JSplitPane splitPane = new JSplitPane();
    splitPane.setAutoscrolls(true);
    splitPane.setDividerSize(0);
    getContentPane().add(splitPane, BorderLayout.CENTER);

    Container drawingCanvas = new Container();
    drawingCanvas.setBackground(_bgColor);
    drawingCanvas.setForeground(_bgColor);
    splitPane.setRightComponent(drawingCanvas);

    canvas = new DrawingCanvas();
    canvas.setAutoscrolls(true);
    canvas.setBounds(0, 0, 679, 494);

    drawingCanvas.add(canvas);

    JPanel pnlTools = new JPanel();
    splitPane.setLeftComponent(pnlTools);
    GridBagLayout gbl_pnlTools = new GridBagLayout();
    gbl_pnlTools.columnWidths = new int[] {45, 30, 0, 0};
    gbl_pnlTools.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gbl_pnlTools.columnWeights = new double[] {1.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_pnlTools.rowWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
    pnlTools.setLayout(gbl_pnlTools);

    btnIcon = new ImageIcon("images/free_a.jpg");
    btnFreedraw = new JToggleButton(btnIcon);
    btnFreedraw.setToolTipText("Freedraw");
    btnIcon = new ImageIcon("images/free_b.jpg");
    btnFreedraw.setSelectedIcon(btnIcon);
    btnFreedraw.setActionCommand("Freedraw");
    btnFreedraw.addActionListener(this);
    btnFreedraw.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    GridBagConstraints gbc_tglbtnFreedraw = new GridBagConstraints();
    gbc_tglbtnFreedraw.insets = new Insets(0, 0, 5, 5);
    gbc_tglbtnFreedraw.gridx = 0;
    gbc_tglbtnFreedraw.gridy = 0;
    pnlTools.add(btnFreedraw, gbc_tglbtnFreedraw);

    btnIcon = new ImageIcon("images/line_a.jpg");
    btnLine = new JToggleButton(btnIcon);
    btnLine.setToolTipText("Draw line");
    btnIcon = new ImageIcon("images/line_b.jpg");
    btnLine.setSelectedIcon(btnIcon);
    btnLine.setActionCommand("Line");
    btnLine.addActionListener(this);
    btnLine.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    GridBagConstraints gbc_btnLine = new GridBagConstraints();
    gbc_btnLine.insets = new Insets(0, 0, 5, 5);
    gbc_btnLine.gridx = 1;
    gbc_btnLine.gridy = 0;
    pnlTools.add(btnLine, gbc_btnLine);

    btnIcon = new ImageIcon("images/circle_a.jpg");
    btnCircle = new JToggleButton(btnIcon);
    btnCircle.setToolTipText("Draw circle");
    btnIcon = new ImageIcon("images/circle_b.jpg");
    btnCircle.setSelectedIcon(btnIcon);
    btnCircle.setActionCommand("Circle");
    btnCircle.addActionListener(this);
    btnCircle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    GridBagConstraints gbc_btnCircle = new GridBagConstraints();
    gbc_btnCircle.insets = new Insets(0, 0, 5, 5);
    gbc_btnCircle.gridx = 0;
    gbc_btnCircle.gridy = 1;
    pnlTools.add(btnCircle, gbc_btnCircle);

    btnIcon = new ImageIcon("images/ellipse_a.jpg");
    btnOval = new JToggleButton(btnIcon);
    btnOval.setToolTipText("Draw ellipse");
    btnIcon = new ImageIcon("images/ellipse_b.jpg");
    btnOval.setSelectedIcon(btnIcon);
    btnOval.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    btnOval.setActionCommand("Oval");
    btnOval.addActionListener(this);
    GridBagConstraints gbc_btnOval = new GridBagConstraints();
    gbc_btnOval.insets = new Insets(0, 0, 5, 5);
    gbc_btnOval.gridx = 1;
    gbc_btnOval.gridy = 1;
    pnlTools.add(btnOval, gbc_btnOval);

    btnIcon = new ImageIcon("images/square_a.jpg");
    btnSquare = new JToggleButton(btnIcon);
    btnSquare.setToolTipText("Square");
    btnIcon = new ImageIcon("images/square_b.jpg");
    btnSquare.setSelectedIcon(btnIcon);
    btnSquare.setActionCommand("Square");
    btnSquare.addActionListener(this);
    btnSquare.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    GridBagConstraints gbc_btnSquare = new GridBagConstraints();
    gbc_btnSquare.insets = new Insets(0, 0, 5, 5);
    gbc_btnSquare.gridx = 0;
    gbc_btnSquare.gridy = 2;
    pnlTools.add(btnSquare, gbc_btnSquare);

    btnIcon = new ImageIcon("images/rectangle_a.jpg");
    btnRectangle = new JToggleButton(btnIcon);
    btnRectangle.setToolTipText("Draw rectangle");
    btnIcon = new ImageIcon("images/rectangle_b.jpg");
    btnRectangle.setSelectedIcon(btnIcon);
    btnRectangle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    btnRectangle.setActionCommand("Rectangle");
    btnRectangle.addActionListener(this);
    GridBagConstraints gbc_btnRectangle = new GridBagConstraints();
    gbc_btnRectangle.insets = new Insets(0, 0, 5, 5);
    gbc_btnRectangle.gridx = 1;
    gbc_btnRectangle.gridy = 2;
    pnlTools.add(btnRectangle, gbc_btnRectangle);

    btnIcon = new ImageIcon("images/text_a.jpg");
    btnText = new JToggleButton(btnIcon);
    btnText.setToolTipText("Insert text");
    btnIcon = new ImageIcon("images/text_b.jpg");
    btnText.setSelectedIcon(btnIcon);
    btnText.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    btnText.setActionCommand("Text");
    btnText.addActionListener(this);
    GridBagConstraints gbc_btnText = new GridBagConstraints();
    gbc_btnText.insets = new Insets(0, 0, 5, 5);
    gbc_btnText.gridx = 0;
    gbc_btnText.gridy = 3;
    pnlTools.add(btnText, gbc_btnText);

    btnIcon = new ImageIcon("images/fill_a.jpg");
    btnFill = new JToggleButton(btnIcon);
    btnFill.setToolTipText("Fill");
    btnIcon = new ImageIcon("images/fill_b.jpg");
    btnFill.setSelectedIcon(btnIcon);
    btnFill.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    btnFill.setActionCommand("Fill");
    btnFill.addActionListener(this);
    GridBagConstraints gbc_btnFill = new GridBagConstraints();
    gbc_btnFill.insets = new Insets(0, 0, 5, 5);
    gbc_btnFill.gridx = 1;
    gbc_btnFill.gridy = 3;
    pnlTools.add(btnFill, gbc_btnFill);

    btnIcon = new ImageIcon("images/erase_a.jpg");
    btnErase = new JToggleButton(btnIcon);
    btnErase.setToolTipText("Erase");
    btnIcon = new ImageIcon("images/erase_b.jpg");
    btnErase.setSelectedIcon(btnIcon);
    btnErase.setActionCommand("Erase");
    btnErase.addActionListener(this);
    btnErase.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
    GridBagConstraints gbc_btnErase = new GridBagConstraints();
    gbc_btnErase.insets = new Insets(0, 0, 5, 5);
    gbc_btnErase.gridx = 0;
    gbc_btnErase.gridy = 4;
    pnlTools.add(btnErase, gbc_btnErase);

    ButtonGroup group = new ButtonGroup();
    group.add(btnFreedraw);
    group.add(btnLine);
    group.add(btnCircle);
    group.add(btnOval);
    group.add(btnSquare);
    group.add(btnRectangle);
    group.add(btnText);
    group.add(btnErase);

    JPanel pnlPreviews = new JPanel();
    GridBagConstraints gbc_pnlPreviews = new GridBagConstraints();
    gbc_pnlPreviews.gridwidth = 3;
    gbc_pnlPreviews.fill = GridBagConstraints.BOTH;
    gbc_pnlPreviews.gridx = 0;
    gbc_pnlPreviews.gridy = 8;
    pnlTools.add(pnlPreviews, gbc_pnlPreviews);
    GridBagLayout gbl_pnlPreviews = new GridBagLayout();
    gbl_pnlPreviews.columnWidths = new int[] {0, 0};
    gbl_pnlPreviews.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0};
    gbl_pnlPreviews.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gbl_pnlPreviews.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    pnlPreviews.setLayout(gbl_pnlPreviews);

    JSeparator separator_2 = new JSeparator();
    GridBagConstraints gbc_separator_2 = new GridBagConstraints();
    gbc_separator_2.insets = new Insets(0, 0, 5, 0);
    gbc_separator_2.gridx = 0;
    gbc_separator_2.gridy = 1;
    pnlPreviews.add(separator_2, gbc_separator_2);

    JLabel label = new JLabel("");
    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.insets = new Insets(0, 0, 5, 0);
    gbc_label.gridx = 0;
    gbc_label.gridy = 2;
    pnlPreviews.add(label, gbc_label);

    lblPenSize = new JLabel("Pen Size");
    lblPenSize.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    GridBagConstraints gbc_lblPenSize = new GridBagConstraints();
    gbc_lblPenSize.insets = new Insets(0, 0, 5, 0);
    gbc_lblPenSize.gridx = 0;
    gbc_lblPenSize.gridy = 3;
    pnlPreviews.add(lblPenSize, gbc_lblPenSize);

    cboPenSize = new JComboBox<String>();
    cboPenSize.setModel(
        new DefaultComboBoxModel<String>(
            new String[] {"1", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20"}));
    cboPenSize.setSelectedIndex(1);
    cboPenSize.setToolTipText("Pen and Eraser Size");
    GridBagConstraints gbc_cboPenSize = new GridBagConstraints();
    gbc_cboPenSize.insets = new Insets(0, 0, 5, 0);
    gbc_cboPenSize.fill = GridBagConstraints.HORIZONTAL;
    gbc_cboPenSize.gridx = 0;
    gbc_cboPenSize.gridy = 4;
    pnlPreviews.add(cboPenSize, gbc_cboPenSize);
    cboPenSize.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ie) {
            _penWidth = Integer.parseInt(cboPenSize.getSelectedItem().toString());
            pen.setPen(_penWidth, pen.getPen().getEndCap(), pen.getPen().getLineJoin());
            canvas.setPen(pen);
            revalidate();
          }
        });

    pnlColorChooser = new JPanel();
    getContentPane().add(pnlColorChooser, BorderLayout.SOUTH);
    GridBagLayout gbl_pnlColorChooser = new GridBagLayout();
    gbl_pnlColorChooser.columnWidths = new int[] {0, 62, 0, 36, 0};
    gbl_pnlColorChooser.rowHeights = new int[] {0, 0, 0};
    gbl_pnlColorChooser.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_pnlColorChooser.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    pnlColorChooser.setLayout(gbl_pnlColorChooser);

    btnColor = new JButton("Pen Color");
    btnColor.setActionCommand("PenColor");
    btnColor.addActionListener(this);
    GridBagConstraints gbc_btnColor = new GridBagConstraints();
    gbc_btnColor.insets = new Insets(0, 0, 5, 5);
    gbc_btnColor.gridx = 0;
    gbc_btnColor.gridy = 0;
    pnlColorChooser.add(btnColor, gbc_btnColor);

    lblColor = new JLabel("");
    lblColor.setPreferredSize(new Dimension(79, 23));
    lblColor.setMinimumSize(new Dimension(79, 23));
    lblColor.setMaximumSize(new Dimension(79, 23));
    lblColor.setOpaque(true);
    lblColor.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, Color.BLACK));
    lblColor.setBackground(Color.BLACK);
    GridBagConstraints gbc_lblColor = new GridBagConstraints();
    gbc_lblColor.insets = new Insets(0, 0, 0, 5);
    gbc_lblColor.gridx = 0;
    gbc_lblColor.gridy = 1;
    pnlColorChooser.add(lblColor, gbc_lblColor);

    JLabel lblSelectedTool = new JLabel("Selected Tool:");
    lblSelectedTool.setFont(new Font("Tahoma", Font.ITALIC, 10));
    GridBagConstraints gbc_lblSelectedTool = new GridBagConstraints();
    gbc_lblSelectedTool.insets = new Insets(0, 0, 0, 5);
    gbc_lblSelectedTool.gridx = 2;
    gbc_lblSelectedTool.gridy = 1;
    pnlColorChooser.add(lblSelectedTool, gbc_lblSelectedTool);

    lblTool = new JLabel("");
    lblTool.setHorizontalAlignment(SwingConstants.LEFT);
    lblTool.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
    GridBagConstraints gbc_lblTool = new GridBagConstraints();
    gbc_lblTool.gridx = 3;
    gbc_lblTool.gridy = 1;
    pnlColorChooser.add(lblTool, gbc_lblTool);
    pnlColorChooser.setVisible(true);

    JMenuBar menuMainMenu = new JMenuBar();
    menuMainMenu.setName("");
    setJMenuBar(menuMainMenu);

    JMenu mnFile = new JMenu("File");
    mnFile.setActionCommand("File");
    menuMainMenu.add(mnFile);

    mntmNew = new JMenuItem("New");
    mntmNew.setMnemonic(KeyEvent.VK_N);
    mntmNew.setActionCommand("New");
    mntmNew.addActionListener(this);
    mnFile.add(mntmNew);

    mntmOpen = new JMenuItem("Open");
    mntmOpen.setMnemonic(KeyEvent.VK_O);
    mntmOpen.setActionCommand("Open");
    mntmOpen.addActionListener(this);
    mnFile.add(mntmOpen);

    JSeparator separator = new JSeparator();
    mnFile.add(separator);

    mntmSave = new JMenuItem("Save");
    mntmSave.setMnemonic(KeyEvent.VK_S);
    mntmSave.setActionCommand("Save");
    mntmSave.addActionListener(this);
    mnFile.add(mntmSave);

    mntmSaveAs = new JMenuItem("Save As");
    mntmSaveAs.setActionCommand("SaveAs");
    mntmSaveAs.addActionListener(this);
    mnFile.add(mntmSaveAs);

    JSeparator separator_1 = new JSeparator();
    mnFile.add(separator_1);

    mntmExit = new JMenuItem("Exit");
    mntmExit.setMnemonic(KeyEvent.VK_E);
    mntmExit.setActionCommand("Exit");
    mntmExit.addActionListener(this);
    mnFile.add(mntmExit);

    JMenu mnNetwork = new JMenu("Network");
    mnNetwork.setActionCommand("Network");
    menuMainMenu.add(mnNetwork);

    mntmConnect = new JMenuItem("Connect");
    mntmConnect.setMnemonic(KeyEvent.VK_C);
    mntmConnect.setActionCommand("Connect");
    mntmConnect.addActionListener(this);
    mnNetwork.add(mntmConnect);

    mntmDisconnect = new JMenuItem("Disconnect");
    mntmDisconnect.setMnemonic(KeyEvent.VK_D);
    mntmDisconnect.setActionCommand("Disconnect");
    mntmDisconnect.addActionListener(this);
    mntmDisconnect.setEnabled(false);
    mnNetwork.add(mntmDisconnect);

    JSeparator separator_3 = new JSeparator();
    mnNetwork.add(separator_3);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            closeOperation();
          }
        });
  }