Conway's Game of Life/Java/Swing: Difference between revisions

m
Fixed syntax highlighting.
(Added the Java swing based implementation to cut down on clutter on the main page. (as discussed on the main talk page))
 
m (Fixed syntax highlighting.)
 
(One intermediate revision by one other user not shown)
Line 3:
This swing based implementation will take user input, and can be interacted with using the mouse.
 
<syntaxhighlight lang="java">import java.awt.*;
<lang java>
import java.awt.*;
import java.awt.event.*;
import java.net.URI;
Line 200 ⟶ 199:
public void addPoint(MouseEvent me) {
int x = me.getPoint().x/10BLOCK_SIZE-1;
int y = me.getPoint().y/10BLOCK_SIZE-1;
if ((x >= 0) && (x < d_gameBoardSize.width) && (y >= 0) && (y < d_gameBoardSize.height)) {
addPoint(x,y);
Line 321 ⟶ 320:
}
}
}</syntaxhighlight>
}
</lang>
9,485

edits