Arcade Prehacks

Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 62
  1. #31
    Senior Member
    Join Date
    Feb 2010
    Location
    http://tinyurl.com/2atap49
    Posts
    2,328

    Re: My java thread thing

    Please don't smiley spam.
    Um... I used to be a moderator here...

  2. #32
    Senior Member
    Join Date
    Feb 2010
    Posts
    156

    Re: My java thread thing

    Can anyone please help? I have this simple thing but its screwing up on me.
    Inventory.class
    Code:
    import java.awt.event.KeyEvent;
    
    
    public class inventory{
    
    	public void keyPressed(KeyEvent e) {
    	int	key = e.getKeyCode();
    		if(key == KeyEvent.VK_I)
    			System.out.println("Key I pressed");
    	}
    
    	public void keyReleased(KeyEvent e) {
    		int key = e.getKeyCode();
    		if(key == KeyEvent.VK_I)
    			System.out.println("Key I released");
    	}
    	
    
    }
    Board(partially).class
    Code:
    	private class AL extends KeyAdapter {
    		public void keyReleased(KeyEvent e) {
    			c.keyReleased(e);
    			i.keyPressed(e);
    		}
    
    		public void keyPressed(KeyEvent e) {
    			c.keyPressed(e);
    			i.keyPressed(e);
    		}
    	}
    Error
    Code:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at Board$AL.keyPressed(Board.java:97)
    	at java.awt.Component.processKeyEvent(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at Board$AL.keyReleased(Board.java:92)
    	at java.awt.Component.processKeyEvent(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)

  3. #33
    router's Avatar
    Join Date
    Dec 2009
    Posts
    223

    Re: My java thread thing

    Did you initialize c and i?
    In the process of [insert status here]
    May post from time to time.

  4. #34
    Senior Member
    Join Date
    Feb 2010
    Posts
    156

    Re: My java thread thing

    Yes
    I don't like giving out source code because I'm afraid someones going to steal it from me
    when I use i it crashes. I got no errors on the i variable.
    Found a error but it didn't fix my problem.
    Code:
    public void keyReleased(KeyEvent e) {
             c.keyReleased(e);
             i.keyPressed(e);
          }
    i.keyPressed(e);
    should be
    i.keyReleased(e);

  5. #35
    Senior Member
    Join Date
    Feb 2010
    Posts
    156

    Re: My java thread thing

    Quote Originally Posted by gatorheads3
    Can anyone please help? I have this simple thing but its screwing up on me.
    Inventory.class
    Code:
    import java.awt.event.KeyEvent;
    
    
    public class inventory{
    
    	public void keyPressed(KeyEvent e) {
    	int	key = e.getKeyCode();
    		if(key == KeyEvent.VK_I)
    			System.out.println("Key I pressed");
    	}
    
    	public void keyReleased(KeyEvent e) {
    		int key = e.getKeyCode();
    		if(key == KeyEvent.VK_I)
    			System.out.println("Key I released");
    	}
    	
    
    }
    Board(partially).class
    Code:
    	private class AL extends KeyAdapter {
    		public void keyReleased(KeyEvent e) {
    			c.keyReleased(e);
    			i.keyPressed(e);
    		}
    
    		public void keyPressed(KeyEvent e) {
    			c.keyPressed(e);
    			i.keyPressed(e);
    		}
    	}
    Error
    Code:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at Board$AL.keyPressed(Board.java:97)
    	at java.awt.Component.processKeyEvent(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at Board$AL.keyReleased(Board.java:92)
    	at java.awt.Component.processKeyEvent(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Quote Originally Posted by gatorheads3
    Yes
    I don't like giving out source code because I'm afraid someones going to steal it from me
    when I use i it crashes. I got no errors on the i variable.
    Found a error but it didn't fix my problem.
    CODE: SELECT ALL
    public void keyReleased(KeyEvent e) {
    c.keyReleased(e);
    i.keyPressed(e);
    }

    i.keyPressed(e);
    should be
    i.keyReleased(e);
    [color=#FF0000]Problem solved[/color]
    THANKS TO THE [color=#FF40FF]AWESOME[/color] [color=#0000BF]ROUTER[/color]

  6. #36
    Senior Member
    Join Date
    Feb 2010
    Location
    http://tinyurl.com/2atap49
    Posts
    2,328

    Re: My java thread thing

    There's an edit button gator, don't double post.

    And gator, you're supposed to be banned. Get off now of risk a permaban.
    Um... I used to be a moderator here...

  7. #37
    Senior Member
    Join Date
    Feb 2010
    Posts
    156

    Re: My java thread thing

    Quote Originally Posted by SandSpur
    There's an edit button gator, don't double post.

    And gator, you're supposed to be banned. Get off now of risk a permaban.
    You never replied back o.0 I thought it would log me off and stop me from posting... sorry.

  8. #38
    Senior Member
    Join Date
    Feb 2010
    Location
    http://tinyurl.com/2atap49
    Posts
    2,328

    Re: My java thread thing

    It does log you off automatically, just Select did something wrong when banning you.
    Um... I used to be a moderator here...

  9. #39

    Join Date
    Feb 2011
    Posts
    44

    Re: My java thread thing


  10. #40
    Senior Member
    Join Date
    Feb 2010
    Posts
    156

    Re: My java thread thing


Page 4 of 7 FirstFirst ... 23456 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •