Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 30 Sep 2005
Offline Last Active Jan 23 2012 03:15 PM

Topics I've Started

I cannot get Java to properly recognize my key releases

20 January 2012 - 09:53 PM

I am aware that there is a bug, a 12 or 13 year old bug, that exists on Linux and probably other Unix based systems, that certain ways of detecting when a key is pressed or released do not function the way one would expect. I am also aware there are a few ways around this and I have gone so far to attempt to implement this solution that can be viewed here: http://stackoverflow.../4679195/596359

The problem is that this does not seem to fix anything. The first question someone will ask I believe I can anticipate. I placed this code in a ".java" file named "RepeatingKeyEventsFixer.java". This file is in "../src/com/example/". To use it in my code I have put the following lines at the beginning of my main() method:

RepeatingKeyEventsFixer repeatingkeyeventsfixer = new RepeatingKeyEventsFixer();

Still, when I press down a key, it tells me it's being pressed down and held, but it will also say it is being released with just about the same frequency. Does anyone have any idea what I may have done wrong? I have also posted this on StackExchange with poor results. I'll post the link here in case the way I phrased things there could help any more: http://stackoverflow.../8948238/596359

The following code is the code I am using to test if a key has been released or not. I appreciate the time any takes to consider my question.

addKeyListener(new KeyAdapter() {
	public void keyPressed(KeyEvent e){
	public void keyReleased(KeyEvent g){
private void processKeyReleased(KeyEvent g){
	int keyCode = g.getKeyCode();
	if(!isPaused && !gameOver){
		if(keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT){

[java] Java: getResourceAsStream() returning null

14 October 2011 - 11:40 AM

BufferedImage = ImageIO.read(getClass().getResourceAsStream("/Images/player.gif"));

The file getResourceAsStream is looking at definitely exists (it's a variable in the actual code, but I figure simpler to write it out here), but for whatever reason, "is" is null on the next line. I'm guessing there's something I don't understand about how this works, but anything I've read so far on the matter hasn't been at all helpful, so I would be thankful for anyone who can explain to me what's going on.

I'm sure it's not an issue of where the file is located. My classes are in /src in the DreamGame folder, and as you can see, Images is in the Images folder.

Neural Network help. Sorry!

13 May 2010 - 02:36 PM

So, not having been able to find help anywhere else, I come here looking to ask something about NNs when I see the thread complaining about all the NN threads recently. Haha, Oh well. Here's one more then. I have question about inputting data. The data is layed out in a text file just like this: 4.4,0.4,1.1,3.2,flower-name 5.5,1.2,7.7,6.3,flower-name 4.5,6.2,4.4,1.9,flower-name etc. ... Each line is a data point. Now, the backprop function accepts one int. I realize, unfortunately, that the answer is probably different in each case, but I'll at least start by asking: Would I enter each of the numbers in on the line separately? Like loop through backprop 4 times for each line (I almost positive that's not how it'd be done, but like I said, just trying to figure this all out), or do I average them all together or something? I'm already normalizing the values by the way, by dividing the number by the highest number in each column. Also, what about the flower-name? Surely that has to be taken into account somehow. Anyway, thanks, and I'll post more details if necessary (and I'm sure it will be)

"Can't Create A GL Rendering Context" Error

05 February 2010 - 10:51 AM

So, I just started trying to learn OpenGL, and the tutorial I'm following has me creating a simple window with a solid black background. When I try to run it, I get the error "Can't Create A GL Rendering Context." I did a search and it would seem this has to do with your video driver. Because it's such a simple thing to do though, I'd imagine it has to do with my coding, or maybe because I have integrated graphics? Since the code is basically just copied from the tutorial, it doesn't seem like that'd be the issue. If it helps, i'm using NeHe's tutorial.

Java won't recognize function

17 November 2009 - 09:50 AM

delOrder[count] = getData(infantCircle.deleteNode(infantCircle.getNode(k)));
This should be all you need. All of the functions accept Node as their parameter and return a Node also. The error I get says it "cannot find symbol" at getData(), and it's probably because for some reason it doesn't think it's getting a Node as a parameter. Help would be appreciated. Thanks!