/**
   * 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() {

    mainPanel = new javax.swing.JPanel();
    pnButton = new javax.swing.JPanel();
    btnVertex = new javax.swing.JButton();
    btnEdge = new javax.swing.JButton();
    btnStart = new javax.swing.JButton();
    btnEnd = new javax.swing.JButton();
    btnStep = new javax.swing.JButton();
    btnSolve = new javax.swing.JButton();
    btnClear = new javax.swing.JButton();
    /*
    pnGraph = new javax.swing.JPanel();
    */ this.pnGraph = new jGraphPanel();
    jTextStatus = new javax.swing.JTextField();
    jRandomCheck = new javax.swing.JCheckBox();
    /*
    pnHeap = new javax.swing.JPanel();
    */ this.pnHeap = new jHeapPanel();
    jTextHeap = new javax.swing.JLabel();
    pnSolution = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jSolution = new javax.swing.JTextArea();
    menuBar = new javax.swing.JMenuBar();
    javax.swing.JMenu fileMenu = new javax.swing.JMenu();
    openMenuItem = new javax.swing.JMenuItem();
    saveMenuItem = new javax.swing.JMenuItem();
    jSeparator = new javax.swing.JPopupMenu.Separator();
    javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
    javax.swing.JMenu helpMenu = new javax.swing.JMenu();
    javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
    jOpenFileChooser = new javax.swing.JFileChooser();
    jSaveFileChooser = new javax.swing.JFileChooser();

    mainPanel.setMinimumSize(new java.awt.Dimension(715, 600));
    mainPanel.setName("mainPanel"); // NOI18N
    mainPanel.setPreferredSize(new java.awt.Dimension(715, 600));

    pnButton.setMinimumSize(new java.awt.Dimension(90, 300));
    pnButton.setName("pnButton"); // NOI18N
    pnButton.setPreferredSize(new java.awt.Dimension(90, 300));

    org.jdesktop.application.ResourceMap resourceMap =
        org.jdesktop.application.Application.getInstance(dijkstra.DijkstraApp.class)
            .getContext()
            .getResourceMap(DijkstraView.class);
    btnVertex.setText(resourceMap.getString("btnVertex.text")); // NOI18N
    btnVertex.setToolTipText(resourceMap.getString("btnVertex.toolTipText")); // NOI18N
    btnVertex.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnVertex.setMinimumSize(new java.awt.Dimension(70, 30));
    btnVertex.setName("btnVertex"); // NOI18N
    btnVertex.setPreferredSize(new java.awt.Dimension(70, 30));
    btnVertex.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnVertexMouseClicked(evt);
          }
        });

    btnEdge.setText(resourceMap.getString("btnEdge.text")); // NOI18N
    btnEdge.setToolTipText(resourceMap.getString("btnEdge.toolTipText")); // NOI18N
    btnEdge.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnEdge.setMinimumSize(new java.awt.Dimension(70, 30));
    btnEdge.setName("btnEdge"); // NOI18N
    btnEdge.setPreferredSize(new java.awt.Dimension(70, 30));
    btnEdge.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnEdgeMouseClicked(evt);
          }
        });

    btnStart.setText(resourceMap.getString("btnStart.text")); // NOI18N
    btnStart.setToolTipText(resourceMap.getString("btnStart.toolTipText")); // NOI18N
    btnStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnStart.setMinimumSize(new java.awt.Dimension(70, 30));
    btnStart.setName("btnStart"); // NOI18N
    btnStart.setPreferredSize(new java.awt.Dimension(70, 30));
    btnStart.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnStartMouseClicked(evt);
          }
        });

    btnEnd.setText(resourceMap.getString("btnEnd.text")); // NOI18N
    btnEnd.setToolTipText(resourceMap.getString("btnEnd.toolTipText")); // NOI18N
    btnEnd.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnEnd.setMinimumSize(new java.awt.Dimension(70, 30));
    btnEnd.setName("btnEnd"); // NOI18N
    btnEnd.setPreferredSize(new java.awt.Dimension(70, 30));
    btnEnd.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnEndMouseClicked(evt);
          }
        });

    btnStep.setText(resourceMap.getString("btnStep.text")); // NOI18N
    btnStep.setToolTipText(resourceMap.getString("btnStep.toolTipText")); // NOI18N
    btnStep.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnStep.setMinimumSize(new java.awt.Dimension(70, 30));
    btnStep.setName("btnStep"); // NOI18N
    btnStep.setPreferredSize(new java.awt.Dimension(70, 30));
    btnStep.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnStepMouseClicked(evt);
          }
        });

    btnSolve.setText(resourceMap.getString("btnSolve.text")); // NOI18N
    btnSolve.setToolTipText(resourceMap.getString("btnSolve.toolTipText")); // NOI18N
    btnSolve.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnSolve.setMinimumSize(new java.awt.Dimension(70, 30));
    btnSolve.setName("btnSolve"); // NOI18N
    btnSolve.setPreferredSize(new java.awt.Dimension(70, 30));
    btnSolve.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnSolveMouseClicked(evt);
          }
        });

    btnClear.setText(resourceMap.getString("btnClear.text")); // NOI18N
    btnClear.setToolTipText(resourceMap.getString("btnClear.toolTipText")); // NOI18N
    btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnClear.setMaximumSize(new java.awt.Dimension(50, 50));
    btnClear.setMinimumSize(new java.awt.Dimension(70, 30));
    btnClear.setName("btnClear"); // NOI18N
    btnClear.setPreferredSize(new java.awt.Dimension(70, 30));
    btnClear.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            btnClearMouseClicked(evt);
          }
        });

    javax.swing.GroupLayout pnButtonLayout = new javax.swing.GroupLayout(pnButton);
    pnButton.setLayout(pnButtonLayout);
    pnButtonLayout.setHorizontalGroup(
        pnButtonLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                pnButtonLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        pnButtonLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                pnButtonLayout
                                    .createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(
                                        btnVertex,
                                        javax.swing.GroupLayout.Alignment.CENTER,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        70,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(
                                        btnEdge,
                                        javax.swing.GroupLayout.Alignment.CENTER,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        70,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(
                                        btnStart,
                                        javax.swing.GroupLayout.Alignment.CENTER,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        70,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        btnEnd,
                                        javax.swing.GroupLayout.Alignment.CENTER,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        70,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        btnSolve,
                                        javax.swing.GroupLayout.Alignment.CENTER,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        70,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        btnStep,
                                        javax.swing.GroupLayout.Alignment.CENTER,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        70,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                btnClear,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                70,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pnButtonLayout.linkSize(
        javax.swing.SwingConstants.HORIZONTAL,
        new java.awt.Component[] {
          btnClear, btnEdge, btnEnd, btnSolve, btnStart, btnStep, btnVertex
        });

    pnButtonLayout.setVerticalGroup(
        pnButtonLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                pnButtonLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        btnVertex, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        btnEdge, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        btnStart, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(btnEnd, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        btnSolve, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        btnStep, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        btnClear, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
                    .addGap(13, 13, 13)));

    btnVertex
        .getAccessibleContext()
        .setAccessibleDescription(
            resourceMap.getString("btnNode.AccessibleContext.accessibleDescription")); // NOI18N

    pnGraph.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            null,
            resourceMap.getString("pnGraph.border.title"),
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            resourceMap.getFont("pnGraph.border.titleFont"))); // NOI18N
    pnGraph.setToolTipText(resourceMap.getString("pnGraph.toolTipText")); // NOI18N
    pnGraph.setFont(resourceMap.getFont("pnGraph.font")); // NOI18N
    pnGraph.setMinimumSize(new java.awt.Dimension(600, 300));
    pnGraph.setName("pnGraph"); // NOI18N
    pnGraph.setPreferredSize(new java.awt.Dimension(600, 300));
    pnGraph.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseReleased(java.awt.event.MouseEvent evt) {
            pnGraphMouseReleased(evt);
          }
        });
    pnGraph.addMouseMotionListener(
        new java.awt.event.MouseMotionAdapter() {
          public void mouseMoved(java.awt.event.MouseEvent evt) {
            pnGraphMouseMoved(evt);
          }
        });

    jTextStatus.setEditable(false);
    jTextStatus.setFont(resourceMap.getFont("jTextStatus.font")); // NOI18N
    jTextStatus.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    jTextStatus.setText(resourceMap.getString("jTextStatus.text")); // NOI18N
    jTextStatus.setAutoscrolls(false);
    jTextStatus.setBorder(null);
    jTextStatus.setName("jTextStatus"); // NOI18N

    jRandomCheck.setFont(resourceMap.getFont("jRandomCheck.font")); // NOI18N
    jRandomCheck.setSelected(true);
    jRandomCheck.setText(resourceMap.getString("jRandomCheck.text")); // NOI18N
    jRandomCheck.setToolTipText(resourceMap.getString("jRandomCheck.toolTipText")); // NOI18N
    jRandomCheck.setEnabled(false);
    jRandomCheck.setName("jRandomCheck"); // NOI18N

    javax.swing.GroupLayout pnGraphLayout = new javax.swing.GroupLayout(pnGraph);
    pnGraph.setLayout(pnGraphLayout);
    pnGraphLayout.setHorizontalGroup(
        pnGraphLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                pnGraphLayout
                    .createSequentialGroup()
                    .addContainerGap(327, Short.MAX_VALUE)
                    .addGroup(
                        pnGraphLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                pnGraphLayout
                                    .createSequentialGroup()
                                    .addComponent(jRandomCheck)
                                    .addContainerGap())
                            .addComponent(
                                jTextStatus,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                261,
                                javax.swing.GroupLayout.PREFERRED_SIZE))));
    pnGraphLayout.setVerticalGroup(
        pnGraphLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                pnGraphLayout
                    .createSequentialGroup()
                    .addComponent(
                        jTextStatus,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 225, Short.MAX_VALUE)
                    .addComponent(jRandomCheck)
                    .addContainerGap()));

    pnHeap.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            null,
            resourceMap.getString("pnHeap.border.title"),
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            resourceMap.getFont("pnHeap.border.titleFont"))); // NOI18N
    pnHeap.setToolTipText(resourceMap.getString("pnHeap.toolTipText")); // NOI18N
    pnHeap.setFont(resourceMap.getFont("pnHeap.font")); // NOI18N
    pnHeap.setMinimumSize(new java.awt.Dimension(400, 250));
    pnHeap.setName("pnHeap"); // NOI18N
    pnHeap.setPreferredSize(new java.awt.Dimension(400, 250));

    jTextHeap.setFont(resourceMap.getFont("jTextHeap.font")); // NOI18N
    jTextHeap.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jTextHeap.setText(resourceMap.getString("jTextHeap.text")); // NOI18N
    jTextHeap.setName("jTextHeap"); // NOI18N

    javax.swing.GroupLayout pnHeapLayout = new javax.swing.GroupLayout(pnHeap);
    pnHeap.setLayout(pnHeapLayout);
    pnHeapLayout.setHorizontalGroup(
        pnHeapLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                pnHeapLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jTextHeap, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE)
                    .addContainerGap()));
    pnHeapLayout.setVerticalGroup(
        pnHeapLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                pnHeapLayout
                    .createSequentialGroup()
                    .addComponent(
                        jTextHeap,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        16,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(204, Short.MAX_VALUE)));

    jTextHeap
        .getAccessibleContext()
        .setAccessibleName(
            resourceMap.getString("jTextHeap.AccessibleContext.accessibleName")); // NOI18N

    pnSolution.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            null,
            resourceMap.getString("pnSolution.border.title"),
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            resourceMap.getFont("pnSolution.border.titleFont"))); // NOI18N
    pnSolution.setToolTipText(resourceMap.getString("pnSolution.toolTipText")); // NOI18N
    pnSolution.setMinimumSize(new java.awt.Dimension(290, 250));
    pnSolution.setName("pnSolution"); // NOI18N
    pnSolution.setPreferredSize(new java.awt.Dimension(290, 250));

    jScrollPane1.setName("jScrollPane1"); // NOI18N

    jSolution.setColumns(20);
    jSolution.setEditable(false);
    jSolution.setFont(resourceMap.getFont("jSolution.font")); // NOI18N
    jSolution.setLineWrap(true);
    jSolution.setRows(4);
    jSolution.setToolTipText(resourceMap.getString("jSolution.toolTipText")); // NOI18N
    jSolution.setWrapStyleWord(true);
    jSolution.setBorder(null);
    jSolution.setEnabled(false);
    jSolution.setFocusable(false);
    jSolution.setName("jSolution"); // NOI18N
    jScrollPane1.setViewportView(jSolution);

    javax.swing.GroupLayout pnSolutionLayout = new javax.swing.GroupLayout(pnSolution);
    pnSolution.setLayout(pnSolutionLayout);
    pnSolutionLayout.setHorizontalGroup(
        pnSolutionLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                jScrollPane1,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                278,
                Short.MAX_VALUE));
    pnSolutionLayout.setVerticalGroup(
        pnSolutionLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE));

    javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
    mainPanel.setLayout(mainPanelLayout);
    mainPanelLayout.setHorizontalGroup(
        mainPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                mainPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        mainPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                mainPanelLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        pnButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        pnGraph,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE))
                            .addGroup(
                                mainPanelLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        pnHeap,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        pnSolution,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(9, 9, 9)));
    mainPanelLayout.setVerticalGroup(
        mainPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                mainPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        mainPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                pnButton,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                pnGraph,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        mainPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                pnHeap,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                pnSolution,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(15, 15, 15)));

    menuBar.setName("menuBar"); // NOI18N

    fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
    fileMenu.setName("fileMenu"); // NOI18N

    openMenuItem.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
    openMenuItem.setText(resourceMap.getString("openMenuItem.text")); // NOI18N
    openMenuItem.setToolTipText(resourceMap.getString("openMenuItem.toolTipText")); // NOI18N
    openMenuItem.setActionCommand(resourceMap.getString("openMenuItem.actionCommand")); // NOI18N
    openMenuItem.setName("openMenuItem"); // NOI18N
    openMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            openMenuItemActionPerformed(evt);
          }
        });
    fileMenu.add(openMenuItem);

    saveMenuItem.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
    saveMenuItem.setText(resourceMap.getString("saveMenuItem.text")); // NOI18N
    saveMenuItem.setToolTipText(resourceMap.getString("saveMenuItem.toolTipText")); // NOI18N
    saveMenuItem.setName("saveMenuItem"); // NOI18N
    saveMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveMenuItemActionPerformed(evt);
          }
        });
    fileMenu.add(saveMenuItem);

    jSeparator.setName("jSeparator"); // NOI18N
    fileMenu.add(jSeparator);

    javax.swing.ActionMap actionMap =
        org.jdesktop.application.Application.getInstance(dijkstra.DijkstraApp.class)
            .getContext()
            .getActionMap(DijkstraView.class, this);
    exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
    exitMenuItem.setName("exitMenuItem"); // NOI18N
    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

    helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
    helpMenu.setName("helpMenu"); // NOI18N

    aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
    aboutMenuItem.setName("aboutMenuItem"); // NOI18N
    helpMenu.add(aboutMenuItem);

    menuBar.add(helpMenu);

    jOpenFileChooser.setFileFilter(new AppFilter());
    jOpenFileChooser.setName("jOpenFileChooser"); // NOI18N

    jSaveFileChooser.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);
    jSaveFileChooser.setFileFilter(new AppFilter());
    jSaveFileChooser.setName("jSaveFileChooser"); // NOI18N

    setComponent(mainPanel);
    setMenuBar(menuBar);
  } // </editor-fold>//GEN-END:initComponents
Example #2
0
  public NumbrixGUI() throws ParseException { // Board gameBoard) throws ParseException{

    // Board
    this.gameBoard = new Board();

    // Container
    setTitle(TITLE);
    setSize(WIDTH, HEIGHT);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    // About Frame
    jFrameAbout = new javax.swing.JFrame();
    jFrameAbout.setResizable(false);
    jFrameAbout.setPreferredSize(new Dimension(500, 300));

    jTextAreaAbout = new javax.swing.JTextArea();
    jTextAreaAbout.setBackground(new java.awt.Color(240, 240, 240));
    jTextAreaAbout.setColumns(20);
    jTextAreaAbout.setRows(10);
    jTextAreaAbout.setText(
        "\t\tNumbrix Version 1\n\nClass Project for Artificial Intelligence course.\nUniversity of Florida\nCISE\n\n\n\n\nby Rainer Ledesma\nhttp://www.cise.ufl.edu/~rledesma/\n");
    jTextAreaAbout.setFont(new java.awt.Font("Agency FB", 1, 20)); // NOI18N
    jTextAreaAbout.setEditable(false);
    jTextAreaAbout.setPreferredSize(new Dimension(500, 300));

    javax.swing.GroupLayout jFrameAboutLayout =
        new javax.swing.GroupLayout(jFrameAbout.getContentPane());
    jFrameAbout.getContentPane().setLayout(jFrameAboutLayout);
    jFrameAboutLayout.setHorizontalGroup(
        jFrameAboutLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jFrameAboutLayout
                    .createSequentialGroup()
                    .addGap(11, 11, 11)
                    .addComponent(
                        jTextAreaAbout,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jFrameAboutLayout.setVerticalGroup(
        jFrameAboutLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jFrameAboutLayout
                    .createSequentialGroup()
                    .addGap(0, 16, Short.MAX_VALUE)
                    .addComponent(
                        jTextAreaAbout,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        267,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 17, Short.MAX_VALUE)));
    //

    // Instructions Frame
    jFrameInstructions = new javax.swing.JFrame();
    jFrameInstructions.setResizable(false);
    jFrameInstructions.setPreferredSize(new Dimension(500, 300));

    jTextAreaInstructions = new javax.swing.JTextArea();
    jTextAreaInstructions.setBackground(new java.awt.Color(240, 240, 240));
    jTextAreaInstructions.setColumns(20);
    jTextAreaInstructions.setRows(10);
    jTextAreaInstructions.setText(
        "\t\tNumbrix\n"
            + "The object of Numbrix is to fill the board with sequence of consecutive \n"
            + "numbers from 1 to the maximun cell count. The numbers must fillow a \n"
            + "horizontal or vertical path (no diagonals)\n");
    jTextAreaInstructions.setFont(new java.awt.Font("Agency FB", 1, 20)); // NOI18N
    jTextAreaInstructions.setEditable(false);
    jTextAreaInstructions.setPreferredSize(new Dimension(500, 300));

    javax.swing.GroupLayout jFrameInstructionsLayout =
        new javax.swing.GroupLayout(jFrameInstructions.getContentPane());
    jFrameInstructions.getContentPane().setLayout(jFrameInstructionsLayout);
    jFrameInstructionsLayout.setHorizontalGroup(
        jFrameInstructionsLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jFrameInstructionsLayout
                    .createSequentialGroup()
                    .addGap(11, 11, 11)
                    .addComponent(
                        jTextAreaInstructions,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jFrameInstructionsLayout.setVerticalGroup(
        jFrameInstructionsLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jFrameInstructionsLayout
                    .createSequentialGroup()
                    .addGap(0, 16, Short.MAX_VALUE)
                    .addComponent(
                        jTextAreaInstructions,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        267,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 17, Short.MAX_VALUE)));
    //

    // File Chooser
    jFrameFileChooser = new javax.swing.JFrame();
    jFileChooser = new javax.swing.JFileChooser();
    jFileChooser.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            try {
              jFileChooserActionPerformed(evt);
            } catch (Exception ex) {
              JOptionPane.showMessageDialog(frame, "File Exception");
            }
          }
        });

    javax.swing.GroupLayout jFrameFileChooserLayout =
        new javax.swing.GroupLayout(jFrameFileChooser.getContentPane());
    jFrameFileChooser.getContentPane().setLayout(jFrameFileChooserLayout);
    jFrameFileChooserLayout.setHorizontalGroup(
        jFrameFileChooserLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 618, Short.MAX_VALUE)
            .addGroup(
                jFrameFileChooserLayout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(
                        jFrameFileChooserLayout
                            .createSequentialGroup()
                            .addGap(18, 18, 18)
                            .addComponent(
                                jFileChooser,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addGap(18, 18, 18))));
    jFrameFileChooserLayout.setVerticalGroup(
        jFrameFileChooserLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 456, Short.MAX_VALUE)
            .addGroup(
                jFrameFileChooserLayout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(
                        jFrameFileChooserLayout
                            .createSequentialGroup()
                            .addGap(27, 27, 27)
                            .addComponent(
                                jFileChooser,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addGap(32, 32, 32))));
    //

    // SidePanel
    jPanelSideBar = new javax.swing.JPanel();
    jButtonRESET = new javax.swing.JButton();
    jButtonSOLVE = new javax.swing.JButton();
    jButtonNEWGAME = new javax.swing.JButton();
    jLabelTIMER = new javax.swing.JLabel();
    jButtonPAUSE = new javax.swing.JButton();

    jButtonRESET.setText("RESET");
    jButtonRESET.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonRESETActionPerformed(evt);
          }
        });
    jButtonSOLVE.setText("SOLVE");
    jButtonSOLVE.setEnabled(false);
    jButtonSOLVE.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            try {
              jButtonSOLVEActionPerformed(evt);
            } catch (IOException ex) {
              Logger.getLogger(NumbrixGUI.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        });
    jButtonNEWGAME.setText("NEW GAME");
    jButtonNEWGAME.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonNEWGAMEActionPerformed(evt);
          }
        });
    jLabelTIMER.setText("TIMER");
    jLabelTIMER.setFont(new java.awt.Font("Agency FB", 1, 18));
    jButtonPAUSE.setText("PAUSE");
    jButtonPAUSE.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonPAUSEActionPerformed(evt);
          }
        });
    jLabelClock = new javax.swing.JLabel();
    jLabelClock.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N
    jLabelClock.setText("10 : 99 : 60");

    javax.swing.GroupLayout jPanelSideBarLayout = new javax.swing.GroupLayout(jPanelSideBar);
    jPanelSideBar.setLayout(jPanelSideBarLayout);
    jPanelSideBarLayout.setHorizontalGroup(
        jPanelSideBarLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanelSideBarLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanelSideBarLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jButtonRESET,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                jButtonSOLVE,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                jButtonNEWGAME,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                136,
                                Short.MAX_VALUE)
                            .addComponent(
                                jButtonPAUSE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addGroup(
                                jPanelSideBarLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                        jPanelSideBarLayout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabelTIMER)
                                            .addComponent(
                                                jLabelClock,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                97,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(0, 0, Short.MAX_VALUE)))
                    .addContainerGap()));
    jPanelSideBarLayout.setVerticalGroup(
        jPanelSideBarLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanelSideBarLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabelTIMER)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jLabelClock,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        32,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jButtonPAUSE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 229, Short.MAX_VALUE)
                    .addComponent(jButtonNEWGAME)
                    .addGap(18, 18, 18)
                    .addComponent(jButtonRESET)
                    .addGap(18, 18, 18)
                    .addComponent(jButtonSOLVE)
                    .addContainerGap()));
    ////////

    // Menu
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItemNewGame = new javax.swing.JMenuItem();
    jMenuItemExit = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    jMenuItemInstructions = new javax.swing.JMenuItem();
    jMenuItemAbout = new javax.swing.JMenuItem();

    jMenu1.setText("File");
    jMenu2.setText("Edit");

    jMenuItemNewGame.setText("New Game");
    jMenuItemExit.setText("Exit");
    jMenuItemInstructions.setText("Instructions");
    jMenuItemAbout.setText("About Numbrix");

    jMenuBar1.add(jMenu1);
    jMenuBar1.add(jMenu2);
    jMenu1.add(jMenuItemNewGame);
    jMenu1.add(jMenuItemExit);
    jMenu2.add(jMenuItemInstructions);
    jMenu2.add(jMenuItemAbout);

    setJMenuBar(jMenuBar1);

    jMenuItemNewGame.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemNewGameActionPerformed(evt);
          }
        });
    jMenuItemExit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemExitActionPerformed(evt);
          }
        });
    jMenuItemInstructions.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemInstructionsActionPerformed(evt);
          }
        });
    jMenuItemAbout.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemAboutActionPerformed(evt);
          }
        });
    //

    // SolvedBoardPanel
    jPanelSolvedBoard = new javax.swing.JPanel();
    jPanelSolvedBoard.setBackground(new java.awt.Color(255, 255, 255));

    // Solved Board Frame
    jFrameSolvedBoard = new javax.swing.JFrame();
    jFrameSolvedBoard.setTitle("Numbrix Solution");
    javax.swing.GroupLayout jFrameSolvedBoardLayout =
        new javax.swing.GroupLayout(jFrameSolvedBoard.getContentPane());
    jFrameSolvedBoard.getContentPane().setLayout(jFrameSolvedBoardLayout);
    jFrameSolvedBoardLayout.setHorizontalGroup(
        jFrameSolvedBoardLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
            .addGroup(
                jFrameSolvedBoardLayout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(
                        jPanelSolvedBoard,
                        javax.swing.GroupLayout.Alignment.TRAILING,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        400,
                        Short.MAX_VALUE)));
    jFrameSolvedBoardLayout.setVerticalGroup(
        jFrameSolvedBoardLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
            .addGroup(
                jFrameSolvedBoardLayout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(
                        jPanelSolvedBoard,
                        javax.swing.GroupLayout.Alignment.TRAILING,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        300,
                        Short.MAX_VALUE)));

    // BoardPanel
    boardPanel = new javax.swing.JPanel();
    boardPanel.setBackground(new java.awt.Color(255, 255, 255));
    // Clock
    gameTimer = new GameTimer(jLabelClock);
    this.gameTimer.start();
    this.gameTimer.run();

    // Initialize
    // init();

    // Container Layout
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        boardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
                    .addGap(18, 18, 18)
                    .addComponent(
                        jPanelSideBar,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                boardPanel,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                jPanelSideBar,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap()));
  }