Multiple key pressing

I am trying write my program a game to respond to a 'left arrow key' press and an 'a' key press differently than a 'left arrow key and a key' press. is this possible?
[179 byte] By [IIIIIIlla] at [2007-9-28 14:17:46]
# 1
I'm assuming you are talking about detecting multiple keys pressed at the same time vs each one separately. http://forum.java.sun.com/thread.jsp?forum=31&thread=331880
bbrittaa at 2007-7-12 10:42:55 > top of Java-index,Other Topics,Java Game Development...
# 2
correct
IIIIIIlla at 2007-7-12 10:42:55 > top of Java-index,Other Topics,Java Game Development...
# 3
Follow the thread I gave. Come back if you have more questions.
bbrittaa at 2007-7-12 10:42:55 > top of Java-index,Other Topics,Java Game Development...
# 4
would that same concept work to inorder to get rid of the delay when you hold a key down?
IIIIIIlla at 2007-7-12 10:42:55 > top of Java-index,Other Topics,Java Game Development...
# 5

Here is an example of both multiple key press and repeat delay ignore. It is a terrible example of animation. Do not us this animation loop in a game. It will flicker far too much.import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class Test extends JFrame implements Runnable {

boolean upPressed=false, downPressed=false, leftPressed=false, rightPressed=false;

public Test() {

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

addKeyListener(new KeyAdapter() {

public void keyPressed(KeyEvent ke) {

switch (ke.getKeyCode()) {

case KeyEvent.VK_UP: upPressed = true; break;

case KeyEvent.VK_DOWN: downPressed = true; break;

case KeyEvent.VK_LEFT: leftPressed = true; break;

case KeyEvent.VK_RIGHT: rightPressed = true; break;

}

}

public void keyReleased(KeyEvent ke) {

switch (ke.getKeyCode()) {

case KeyEvent.VK_UP: upPressed = false; break;

case KeyEvent.VK_DOWN: downPressed = false; break;

case KeyEvent.VK_LEFT: leftPressed = false; break;

case KeyEvent.VK_RIGHT: rightPressed = false; break;

}

}

});

setSize(250,250);

setVisible(true);

Thread timer = new Thread(this);

timer.start();

}

public static void main(String[] args) {

new Test();

}

public void run() {

while (true) {

repaint();

try { Thread.sleep(30);} catch (Exception e) {}

}

}

public void paint(Graphics g) {

g.setColor(Color.white);

g.fillRect(0,0,getWidth(), getHeight());

g.setColor(Color.black);

g.drawString("Up",40,40);

if (upPressed) g.drawString("Pressed",100,40);

g.drawString("Down",40,60);

if (downPressed) g.drawString("Pressed",100,60);

g.drawString("Left",40,80);

if (leftPressed) g.drawString("Pressed",100,80);

g.drawString("Right",40,100);

if (rightPressed) g.drawString("Pressed",100,100);

}

}

bbrittaa at 2007-7-12 10:42:55 > top of Java-index,Other Topics,Java Game Development...