Results 1 to 8 of 8
- 05-16-2010, 05:02 AM #1
Member
- Join Date
- May 2010
- Posts
- 27
- Rep Power
- 0
Detect keypresses without consol or GUI
I want to make a bot for someone that will monitor a chatroom and bans any newcommers. All of the bots that I've made before have been fine having a limited number of loops -- if they got out of hand, then I'd just let them run their course until the loop expired.
This one I want to run for an untold amount of time, and it's a bit of a pain to have to shut off your computer every time you want to end it (because it will control the mouse in order to ban people, and because it will run without a GUI or a consol)
So to solve that, I figured hotkeys would be a great idea. Except one problem: everywhere I look, people say you need a GUI to detect keypresses...
If anyone can help, that'd be great. I just need a function that will detect if a key is pressed, like a keylistener. Can be a specific key or any key. Doesn't matter.
- 05-16-2010, 05:08 AM #2
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
well, you can simply run your app with a GUI but set its JFrame as
Java Code:this.setVisible(false);
If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-16-2010, 05:32 AM #3
Member
- Join Date
- May 2010
- Posts
- 27
- Rep Power
- 0
The problem is that I'm not quite sure how to run the main and a GUI at the same time :/
I tried to make a start button for a spam bot with a GUI, and it started the GUI and everything, but I wasn't sure what to do after that, so I made an infinite loop that pressing the start button exits. Didn't work. I haven't been able to get on a computer with a compiler since, so I haven't been able to play around with it.
If it's easier to have some other sort of input, that would work too. I've though about it a little, and I might set it so the program turns off it the mouse is at 0,0 (because you don't need to move the cursor to detect pixels)
Would that be more efficient?
By the way, thanks for the speedy reply :)
- 05-16-2010, 05:38 AM #4
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
To create GUI you need to know Swing...
I recommend read this JFrame tutorials firstIf my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-16-2010, 05:43 AM #5
Member
- Join Date
- May 2010
- Posts
- 27
- Rep Power
- 0
Do I still need to learn swing if I took a copy of JBuilder off a school computer?
- 05-16-2010, 05:50 AM #6
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
to adapt your code correctly you need to know swing. At least its basic things...
You can use NetBeans for this but it is another story and should be another thread then :)If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-16-2010, 05:51 AM #7
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
- 05-16-2010, 05:56 AM #8
Member
- Join Date
- May 2010
- Posts
- 27
- Rep Power
- 0
Similar Threads
-
get keypresses from SVGForm with only SVGLabels
By erik6048 in forum CLDC and MIDPReplies: 1Last Post: 02-23-2010, 08:13 AM -
Detect new file entry
By rdemon in forum Advanced JavaReplies: 4Last Post: 01-08-2010, 02:24 AM -
Unable to detect OS name
By neetu.jainvi@gmail.com in forum Advanced JavaReplies: 1Last Post: 12-09-2009, 04:56 PM -
Help - Swing Timers, Two Keypresses
By Gheta in forum AWT / SwingReplies: 2Last Post: 07-29-2009, 09:23 PM -
Detect loading of ImageIcon from URL?
By barkster in forum Java AppletsReplies: 1Last Post: 01-29-2008, 07:04 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks