User Profile
Collapse
-
That worked like a charm. Thanks. -
Can I have two .h files that #include each other?
I've got two classes, and each one has a pointer to another. However, I'm having trouble with one of them. Actor.h is acting like the other class doesn't exist.
[code="C++"]//---------------------------------------------------------------------------
// A map tile
//---------------------------------------------------------------------------
#ifndef TILE_H
#define TILE_H
#include... -
-
It does look like looking for cells "off the edge" is what is causing the null pointer exception. I do have one question though. Is context supposed to be context[x][y] or context[y][x]? Because you seem to use context[myX][myY] as well as context[myY][myX]. I recommend making your code use just the Cartesian X/Y version, as it makes the grid more intuitive.
As far as going "around the world" goes, consider the fact...Leave a comment:
-
That's a little hard for me to tell without the context, but it sounds like encapsulation to me, as abstract methods have no data to hide.Leave a comment:
-
Two bugs.
On line 15 (Your if-statement where you check to see if characters are the same), you have A.charAt(A.leng th())-i-1). You need to move the -i-1 part into the charAt() method, or you'll have a null pointer exception. So it'd be A.charAt(A.leng th()-i-1)).
The other bug is that you've got your if statement that determines which output to print inside your for-loop. Since your loop exits if it finds a mismatch, it'll...Leave a comment:
-
Odd... I tried it on Blogger and it worked. Perhaps it is just MySpace.Leave a comment:
-
It has been a little while, but I think this might do it...
<img src="whateveh" alt="whateveh" style="float: right;" />Leave a comment:
-
If obj is inside a method, won't it be set to null at the method's conclusion anyways? Then the garbage collector will get it.Leave a comment:
-
-
How does one break into Java programming?
Hey, I've been working with Java a bit, and I think I'm getting the basics, but I want to be able to use it effectively as a job. Are there any specific things that every Java programmer should know? Are there any specific things that really help? Or any technologies that complement Java?
I've wanted to "break into the business," but I'm a bit overwhelmed. I've looked at freelancing sites such as oDesk, but for every job... -
I use Eclipse, myself. It's both free and very helpful. It doesn't have the drag 'n drop GUI making capabilities (Like the Microsoft Visual XXXX series), so you have to write them manually, but it is still a quite excellent program.Leave a comment:
-
While I'm a bit of a newbie, as I best understand it C# is kinda like Microsoft's version of Java. They're very similar. You could go with C# for now and then do Java later. The change wouldn't be that difficult.Leave a comment:
-
As a disclaimer, I don't use netbeans. However, can't you just create some getter methods for your arrays in the class that they're in? Then you can use those setters to get the data from any class in the same directory.
i.e.
[code="java"]public int[] getMyData()
{
return arrayNameHere;
}
//Or for a single value
public int getMyData(int index)
{
if(index >= 0 &&...Leave a comment:
-
-
I took a quick look at it with the debugger, and it looks as though you don't ever assign a value to status in BankAccount.jav a. I think this may be the problem.
[code="java] private String setStatus(Strin g newStatus){
if (status.equals( OPEN))
{
this.status = OPEN;
}
if (status.equals( SUSPENDED))
{
this.status = SUSPENDED;...Leave a comment:
-
Ah... well, after some monkeying around and looking at examples on the web, I found the solution. I'm sorry, I probably should have posted it on this thread when I found it.
To fix it, all I had to do was replace line #52 with something like the following code:
[CODE="java"]
lab l = new lab();
frame.addKeyLis tener(l);
frame.add(l);[/CODE]Leave a comment:
-
Trouble getting Keyboard input with KeyListener
Hey, I'm trying to make a program that will recognize when certain keys are released, so that I can encorperate it into a game I'm making. Unfortunately, it doesn't seem to be working. When I run the program and press keys, nothing happens. Any ideas?
[code="java"]import java.awt.Dimens ion;
import java.awt.Graphi cs;
import java.awt.Graphi cs2D;
import java.awt.Image;
import java.awt.event. KeyEvent;... -
I'm no expert with applets 'n ActionListeners , but I think you need to change
[code="java]public class test1 extends Applet[/code]
to
[code="java]public class test1 extends Applet implements ActionListener[/code]
Kinda hard to say more until you explain what your applet is supposed to do.Leave a comment:
-
Problem painting an image
Hey, I've got some code that is supposed to paint part of an image on a JPanel. Unfortunately, when I run it, I get a nullPointer Exception.
[code="java"]public void paintMap()
{
Graphics g = this.getGraphic s(); //Create a new Graphics object.
Graphics2D g2d = (Graphics2D) g; //Cast it to a Graphics2D object (Has more options)
Image spaceImages = Toolkit.getDefa ultToolkit().ge tImage ( "stars.png"...
No activity results to display
Show More
Leave a comment: