Package org.drools.examples.conway

Examples of org.drools.examples.conway.Cell


        } );

        addMouseMotionListener( new MouseMotionAdapter() {

            public void mouseDragged(final MouseEvent e) {
                final Cell cell = getCellAtPoint( e.getX(),
                                                  e.getY() );
                if ( cell != null ) {
                    cellGrid.updateCell( cell, CellState.LIVE  );
                    repaint();
                }
View Full Code Here


        } );
    }

    private void toggleCellAt(final int x,
                              final int y) {
        final Cell cell = getCellAtPoint( x,
                                    y );
       
        if ( cell != null ) {
            if ( cell.getCellState() == CellState.LIVE ) {
                this.cellGrid.updateCell( cell, CellState.DEAD );
            } else {
                this.cellGrid.updateCell( cell, CellState.LIVE );
            }
            repaint();
View Full Code Here

        }
    }

    private Cell getCellAtPoint(final int x,
                                final int y) {
        Cell cell = null;

        final int column = x / this.cellSize;
        final int row = y / this.cellSize;
        final int numberOfColumns = this.cellGrid.getNumberOfColumns();
        final int numberOfRows = this.cellGrid.getNumberOfRows();
View Full Code Here

                     null );

        // draw populated cells
        for ( int row = 0; row < numberOfRows; row++ ) {
            for ( int column = 0; column < numberOfColumns; column++ ) {
                final Cell cell = this.cellGrid.getCellAt( row,
                                                column );
                if ( cell.getCellState() == CellState.LIVE ) {
                    g.drawImage( this.liveCellImage,
                                 column * this.cellSize,
                                 row * this.cellSize,
                                 this );
                }
View Full Code Here

        } );

        addMouseMotionListener( new MouseMotionAdapter() {

            public void mouseDragged(final MouseEvent e) {
                final Cell cell = getCellAtPoint( e.getX(),
                                                  e.getY() );
                if ( cell != null ) {
                    cellGrid.updateCell( cell, CellState.LIVE  );
                    repaint();
                }
View Full Code Here

        } );
    }

    private void toggleCellAt(final int x,
                              final int y) {
        final Cell cell = getCellAtPoint( x,
                                    y );
       
        if ( cell != null ) {
            if ( cell.getCellState() == CellState.LIVE ) {
                this.cellGrid.updateCell( cell, CellState.DEAD );
            } else {
                this.cellGrid.updateCell( cell, CellState.LIVE );
            }
            repaint();
View Full Code Here

        }
    }

    private Cell getCellAtPoint(final int x,
                                final int y) {
        Cell cell = null;

        final int column = x / this.cellSize;
        final int row = y / this.cellSize;
        final int numberOfColumns = this.cellGrid.getNumberOfColumns();
        final int numberOfRows = this.cellGrid.getNumberOfRows();
View Full Code Here

                     null );

        // draw populated cells
        for ( int row = 0; row < numberOfRows; row++ ) {
            for ( int column = 0; column < numberOfColumns; column++ ) {
                final Cell cell = this.cellGrid.getCellAt( row,
                                                column );
                if ( cell.getCellState() == CellState.LIVE ) {
                    g.drawImage( this.liveCellImage,
                                 column * this.cellSize,
                                 row * this.cellSize,
                                 this );
                }
View Full Code Here

TOP

Related Classes of org.drools.examples.conway.Cell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.