Anubhab's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 17 (0.02 per day)
- Joined:
- 01-March 11
- Profile Views:
- 190
- Last Active:
Nov 27 2012 01:57 AM- Currently:
- Offline
Previous Fields
- Country:
- IN
- OS Preference:
- Who Cares
- Favorite Browser:
- Who Cares
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- PC
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: How to introduce some features in a Java program?
Posted 4 Aug 2012
Thank you very much.
Can you tell me, what is the difference between Image, BufferedImage and ImageIcon? -
In Topic: How to introduce some features in a Java program?
Posted 4 Aug 2012
I have intorduced a long variable, "time", which takes the value from the getWhen() method. This is inside the overriden method keyReleased(). Now the overriden method keyPressed checks whether the the difference between current getWhen() and the previous getWhen() methods.
Here is the code I tried:
private class KeyHit extends KeyAdapter{ private long time; @Override public void keyPressed (KeyEvent ke) { try { if (ke.getWhen() - time < 5000) { //ke.consume(); ke = null; //System.out.println("Processing previous move"); } } catch (NullPointerException npe) { //System.out.println("Null pointer"); } int key = ke.getKeyCode(); switch (key) { case KeyEvent.VK_RIGHT : moveSprites (1); break; case KeyEvent.VK_LEFT : moveSprites (-1); break; case KeyEvent.VK_UP : moveSprites (-2); break; case KeyEvent.VK_DOWN : moveSprites (2); break; case KeyEvent.VK_SPACE : moveSprites (-3); default : break; } } @Override public void keyReleased (KeyEvent ke) { time = ke.getWhen(); int key = ke.getKeyCode(); switch (key) { case KeyEvent.VK_RIGHT : setSprites (1); break; case KeyEvent.VK_LEFT : setSprites (-1); break; default : break; } } }
(The class KeyHit is defined inside another class.)
Thnaks. -
In Topic: How to introduce some features in a Java program?
Posted 4 Aug 2012
Thank you.
But, I can not employ it. Can you, please, give me an example? -
In Topic: Steganography
Posted 4 Aug 2012
This is a nice tutorial. Thanks. -
In Topic: String, StringBuilder and StringBuffer i Java
Posted 8 Jul 2012
Can you please give me a few examples? Thanks.
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
Contact Information
- E-mail:
- Click here to e-mail me
Friends
Anubhab hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
Anubhab has no profile comments yet. Why not say hello?