// @topic T11722 2D Graphics demo 01
// @brief class <tt>ViewSimulation</tt> extends <tt>JFrame</tt>
/*
 * ViewSimulation.java
 *
 * Created on Mar 26, 2013, 10:00:02 AM
 */

package shopsimulation;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;

public class ViewSimulation extends javax.swing.JFrame {

    boolean debugFlag = false;
    /** Creates new form ViewSimulation */
    public ViewSimulation() {
        initComponents();
    }

    @Override
    public void paint( Graphics gr )
    {
        super.paint( gr );
        if ( debugFlag == true ) {
            debugFlag = false;
            return;
        } else {
            debugFlag = true;
        }
        Graphics2D gr2d = ( Graphics2D ) gr;
        gr2d.draw( new Rectangle2D.Float( 40, 40, 75, 90 ) );
        gr2d.draw( new Line2D.Float( 40, 40, 40+75, 40+90 ) );
    }
    /** 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() {

        pnlBottom = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout pnlBottomLayout = new javax.swing.GroupLayout(pnlBottom);
        pnlBottom.setLayout(pnlBottomLayout);
        pnlBottomLayout.setHorizontalGroup(
            pnlBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        pnlBottomLayout.setVerticalGroup(
            pnlBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 55, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlBottom, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(245, Short.MAX_VALUE)
                .addComponent(pnlBottom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                ViewSimulation window = new ViewSimulation();
                window.setVisible(true);

                // create and start new thread:
                ThreadPainter thp = new ThreadPainter( window );
                Thread th = new Thread( thp );
                th.start();

            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel pnlBottom;
    // End of variables declaration//GEN-END:variables

}