The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
Help in actionevent
Discuss Help in actionevent in the Java Help forum on Dev Shed. Help in actionevent Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 12th, 2013, 03:14 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
Help in actionevent
can you help me what should i add to this program
i want to view the joptionpane when i pressed alt+f1
even if im focus in another window like browser please help
Code:
private static JFrame frame;
public static void main(String[] args) throws Exception {
frame = new JFrame();
frame.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isAltDown()) {
switch (e.getKeyCode()) {
case KeyEvent.VK_F1:
JOptionPane.showInputDialog("Queue");
break;
}
}
}
});
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
frame.setUndecorated(true);
frame.setVisible(true);
}
});
}
|

January 12th, 2013, 06:30 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
I don't know if you can steal events from another program using java.
|

January 13th, 2013, 11:37 PM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
|
any other way that you can help me with my problem sir ..
anyways thanks for the information ...
|

January 14th, 2013, 12:01 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
actually sir i get my idea in this code
so can you help me to use this code in my project above
Code:
public class RobotExp {
public static void main(String[] args) {
try {
Robot robot = new Robot();
// Creates the delay of 5 sec so that you can open notepad before
// Robot start writting
robot.delay(5000);
robot.keyPress(KeyEvent.VK_H);
robot.keyPress(KeyEvent.VK_I);
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyPress(KeyEvent.VK_B);
robot.keyPress(KeyEvent.VK_U);
robot.keyPress(KeyEvent.VK_D);
robot.keyPress(KeyEvent.VK_Y);
} catch (AWTException e) {
e.printStackTrace();
System.out.print(e);
}
}
}
advance thanks for those who help ..
|

January 14th, 2013, 06:28 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
The code you posted with calls to Robot class methods will write characters, possibility to another program.
What characters do you want to write?
|

January 17th, 2013, 03:14 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by NormR What characters do you want to write? |
actually sir i want to use the ALT + F1
when i pressed this key it show pop-up even im not focusing the program ... or even im using a browser when i pressed ALT +F1 it will show the pop-up ..
|

January 17th, 2013, 05:30 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
I don't know if you can steal events from another program using java.
|

January 18th, 2013, 03:30 AM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by NormR I don't know if you can steal events from another program using java. |
sir do you use system.in can you explain what is the use of system.in
|

January 18th, 2013, 06:01 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
Have you read the API doc for the System class and for the in field in that class?
Its explained there.
|

January 24th, 2013, 09:03 PM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 56
Time spent in forums: 15 h 12 m 50 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by NormR Have you read the API doc for the System class and for the in field in that class?
Its explained there. |
sir do you read about robot in java it something like i use it to trace the keyboard input .... if you have read this can you give me some example sir because i starting reading this book ..
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|