Java 8 (1.8.11 at the time of the writing) is the latest Java version. It was released in March this year and contain various major updates, including the long-waited lambda support. This blog described how to update to JDK 8 on Mac OS and also to check the lambda support with a simple app.
In this lesson, we will make the Board class check the game progress and stop the game once someone has won. I will then introduce the concept of Java Arrays. We will add code to constantly check whether three game balls of the same color has lined up and to mark those winning game balls.
In the last lesson (Lesson 2), we created the Tic-Tac-Toe Board and GameBall classes. We also added GameBall objects to the Board object. In this lesson, we will add a Player class such that a Player object interacts with GameBall objects in a meaningful way.
In this lesson, we will create a Tic-Tac-Toe game board and add game pieces to it.
If you are familiar with Scratch and would like to learn more on programming. Java with Greenfoot is a great choice.
In this lesson, we will test the water by looking at a sample Greenfoot project called “wombats”.
At the prompt, type sudo update-alternatives –config java The current available java installs would be displayed SelectionÂ Â Â Command ———————————————– *Â 1Â Â Â Â Â Â Â Â Â Â /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2Â Â Â Â Â Â Â Â Â Â /usr/lib/jvm/jre-1.4.2-gcj/bin/java To get out of the prompt without make changes, hit Ctrl+C To add a new jdk, I downloaded the jdk-6u-linux-i586.bin from the Oracle Java site. Unzip it chmod 755 jdk-6u27-linux-i586.bin ./jdk-6u27-linux-i586.bin … Read more
This blog entry shows one how to create a special widget using InkScape and NetBeans Visual Library. This is part of my effort to create a Java-based implementation of MIT’s Scratch, which is implemented in Squeak Smalltalk.
Step 1 Create JScratch Block Graphics:
First I created the image using Inkscape (steps to follow), import the image to IDE, then create two LayerWidgets, one transparent, and another opaque. Add the image to the background LayerWidget, adn the Swing component to the front LayerWidget. Finally, use the BorderFactory.createEmptyBorder function to limit the size of the swing component at the front layer.
To create the Scratch blocks, I used InkScape, the Open Source SVG editor. Here are the steps I took to create the graphic: