This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Matt Cartwright

Ranch Hand
+ Follow
since Aug 25, 2008
Matt likes ...
Linux VI Editor
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matt Cartwright

welcome to the ranch

what about writing the classic "hello world!" program, then write a class HelloWorld and instantiate it from another one (your controller)?
Then write a class HelloNatalie that inherits HelloWorld, have a look at shadowing and overloading...
Write an interface Animal and classes like Cat and Dog, create collections of animals (lists, arrays etc) of animals, give them attributes like 'likes milk', use iterators in loops to make them all meow and bark, select only those that like milk etc.

Have a closer look at Java AWT and Swing graphic APIs and create a new window (JFrame) with some area to host your game, the board (JPanel or Canvas).
Draw a circle on that board. Have look at the APIs default passive rendering (paintComponent()) and learn a bit about active rendering.
Introduce a timer and have that circle moving from left to right. When you can do that, make it bounce back from the left and right (boundary detection).
Then introduce angles and have that circle bounce back from top and bottom of your board, make it disappear when going over left and right boundaries...
Have a closer look at KeyListener and/or KeyAdapter and draw two rectangles, one left one right on your board.
Control them with your keyboard (up and down with boundary detection at top and bottom) and make the circle bounce back from the rectangles (collision detection).

Enjoy playing Pong!

Don't start with making it look nice until it does what you think it should be doing. Once it works, learn how to load images etc. Introduce a high score list, store that in a text file or embedded database.... Make your game configurable.
Then have a great idea, get the basic shapes moving (circles and rectangles), make boundary checking and collisions work, make it look nice and earn a lot of money
2 years ago
that is correct,

is called by the timer and in the Sprite's move() method we do the boundary checking after adding the deltas from key events..

there were key events (q &e) defined for the saucer, that's what I implemented....
just take it as an example and use it for your laser cannon.
The saucer isn't visible in the beginning of the game and scrolls from left (off) to right off.
So the minX for it would need to be adjusted for that.
Why not have a counter incremented in in actionPerformed() that triggers the appearance of the saucer?
I think you got the idea...

2 years ago
hmm, the saucer works on my machine

maybe you should get some IDE and structure your code???
2 years ago
the ${WLS_HOME} (${WL_HOME}/wlserver or ${WL_HOME}/whatever) can be overridden in the GUI installer or in a silent response file.
So that doesn't matter.
Rather looks like that JAVA_HOME is not set!
It fails with \bin\java not found.

5 years ago
and your changes should go in because that is sourced by all lifecycle scripts.
When using NodeManager make sure it is configured to use scripts.
5 years ago
JAVA_OPTIONS="$JAVA_OPTIONS -Dfile.encoding=utf8"
should go in your file because that is sourced by all other lifecycle scripts.
When using NodeManager, make sure it is configured to use scripts.
5 years ago
I'm working w/ WLS since 4.51 and am not aware of any such tool.
Never missed it because normally I create the domains from scripts in WLST.
Everything you can access from the console and all configuration loaded is available in Management Beans.
Make sure you have the right version of docs as some of the MBean paths are changing w/ versions.

5 years ago

Michael Rippee wrote:Thanks for the great example. something I'm working on is referencing and calling methods from other classes, and this is a great example of that.

You're welcome.

Michael Rippee wrote:I don't know. I'm guessing it's just API.

Sorry, wrong guess.

What is the super class of com.coderanch.examples.sni.NumberedObject?

And what does it implement?

6 years ago
Sai, you're right, the original method definition works alright
6 years ago

Sai Hegde wrote:The process method signature needs to be changed to this.

got it wrong first, but yes that works....

6 years ago
There are no methods on java.util.Properties to handle comments.
They are simply ignored when reading the file.

A comment (one per file) can only be added when using store(...) or storeToXML(...).

You would need to implement a class that reads the file line by line and stores these
lines in the correct order.
The NvPs the need to go into some HashTable...

I think you get the picture.


6 years ago
alrighty, let's talk some more code

Let's say we want to know for each instance of a class how many instances have been initialized.
So we count them. To get there , we implement a NumberedObject that encapsulates a counter
and an instance number.

Then we create two instance of this class and invoke (call) two of their methods:

Hey, we did not code any getClass() method in our NumberedObject, where the heck is that coming form?

6 years ago