Layne Lund

Ranch Hand
+ Follow
since Dec 06, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Layne Lund

Here is a great tutorial that gives step-by-step instructions to create your first Java application. Let us know if you run into any problems and we will be glad to answer your questions.

Layne
11 years ago
Thanks. I figured it out. I'm using Netbeans and it took me to the line in the setUp() method when I double clicked on the JUnit output. No wonder I was confused by that.

Layne
11 years ago
What kind of array are you using? If you have declared an array of ints (int[]), then you CANNOT use null as a value. The null value is only valid for object references. I think this is why you are confused. There is no way to "empty" an array of primitive values (such as int, char, etc.).

Layne
11 years ago


The above code produces output such as



What could cause a NullPointerException? allowedFile is a File object, and as you can see it is NOT null. Besides, if it was, the AllowedProperty constructor throws a NullPointerException with a custom message:

Any ideas why I get a NPE?
11 years ago
For complicated graphics, you should look into Java3D or OpenGL bindings for Java (such as jogl). These libraries provide a lot more tools that you can use other than the simple graphics in the Swing library. I'm willing to bet that most of the C++ samples you see online use OpenGL, so if you use OpenGL in Java, it will probably be easier to translate them over.

I hope this helps.

Layne
11 years ago
Let's say you have data in this table as follows:


The query you gave (select a_id, a.description,a.year distinct) will return both of these rows since the ordered triple for each of this rows is different (i.e. at least one column has a different value). "distinct" will only eliminate rows when all three columns have the exact same value. If you want just one row with the id of 3, which of these two rows should be returned?

I apologize that I don't have any suggestions how to solve your problem. I just wanted to help clairfy how "distinct" works in a SQL query.

Layne

Originally posted by Wayne Styles:
Hi
java.lang.NoSuchMethodError: main
Exception in thread "main"



How are you compiling and running this program? From my experience, if you got this message, then your code DOES compile. However, it cannot run because (as the error says) there is no method named "main". You need to create sucha method with the correct signature as marc describes above. Let us know if you need more help.

Layne
11 years ago

Originally posted by colin shuker:
I guess you would extend Applet, if you just wanted to paint directly
to screen, not sure if you can JPanels when extending Applet



Applet is part of the old AWT API. You would use Panel instead of JPanel if you wanted to go this route. However, I think using Swing (all the GUI classes that start with J) is the prefered method in more recent versions of Java.

Layne
12 years ago
How does the user input this integer? Are you creating a console interface or a GUI? All the above will work fine if you are using plain text. However, if you are doing a GUI, you might want to look into using JFormattedTextField.

Layne
12 years ago

Originally posted by Keenan Staffieri:
ok, ty, sorry for all question, but im noob and needed assurace



That's exactly what this forum is for. Please come back with more questions.

Layne
12 years ago
That's a good question. I don't recall one, either. It would be nice to see a book promotion for something about games programming in Java.

Layne
12 years ago
First of all, how much programming experience do you have? What kind of game do you want to make? Games can vary from very simple ones like tic-tac-toe or connect four to more complicated games like chess, go, or Quake. In either case, you need to start by learning a programming language, if you haven't already. From there you can learn about graphics, sound, and all the other details that go into creating a game.

Sorry that I don't have anything more specific than this. Perhaps it will help if you explain what kind of background you have. That will give us a good idea of how to help you go from there.

Layne
12 years ago
Why do you need someone to implement this for you? What kind of list should it iterate over? Do you have some particular project in mind where you need this?

The existence of this class is primarily useful along with the List interface. Notice that it has methods that return ListIterator. If you call any of these methods, you don't have to worry about who the concrete class is that implements this interface. You only need to know that this class certainly implements all the methods required by the ListIterator documentation.

So in the end, if you are using the standard Collections API, you don't need to worry about writing your own class to implement this interface. One exists already. However, if you are writing your own class to implement the List interface, then you probably need to create a companion class that implements ListIterator as well. I don't think someone will just do this for you.

Layne
12 years ago
What is your question?
First of all, you should take a look at this tutorial about Strings and StringBuffers. This should give you a good introduction to the tools available to solve this task. You should also familiarize yourself with the Java API docs. This will give you a handy reference to the classes and methods available from the standard Java API. It is certainly worth your time to learn how to navigate this. For now, you should start by finding the classes in the java.lang package since that is where String and StringBuffer are located.

Layne
12 years ago