A Java Robot class mouse and keyboard/keystroke example

Java Robot class FAQ: Can you show me an example of how to use the Java Robot class?

Answer: Um, yeah, sure ... I say that a little jokingly. Okay, what really happened is that while developing this Java Robot example code on my Mac, I had to reboot it about 10 times. When you use the Java Robot class, you're poking your head out into the native operating system, and if you mess up with your GUI events -- at least on a Mac OS X system -- a lot of bad things can happen.

Apple's new Magic Mouse

Apple made some new iMac announcements today, and the most interesting one for me is their new "Magic Mouse".

I've written here before that Apple has driven me crazy with some of their mouse designs. In fact, I currently use a Dell USB mouse instead of my wireless Mighty Mouse (yes, a cabled mouse instead of a wireless mouse), because I can't get the little track ball on the Mighty Mouse clean enough to scroll consistently.

But getting rid of the trackball altogether and replacing it with their multitouch technology? That might be a really clever idea.

Java - get the number of mouse buttons

Java mouse buttons FAQ: How do I determine the number of mouse buttons in a Java application?

I'm working on a Java Swing application, and I'd like to be able to determine the number of mouse buttons on the current system (Mac, Linux, Windows).

How to increase the JScrollPane scrolling speed for mousewheel users

Java Swing FAQ: How do I increase the JScrollPane scrolling speed when using the mouse wheel?

Once you put a component (JTextArea, JEditorPane, JTable) into a JScrollPane in a Java Swing application, you'll quickly see that the default scrolling speed when trying to vertically scroll the viewport with the mousewheel is very slow. To make your scroll pane faster, i.e., more like a native Mac or Windows application, you'll want to increase this default mousewheel vertical scrolling speed.

Apple Mighty Mouse clicks but won’t track

Mac Mighty Mouse FAQ: Help, my Apple wireless Mighty Mouse clicks but won't track properly; what's going on?

I’ve had a lot of problems with batteries with my Apple Bluetooth (wireless) Mighty Mouse, including this “tracking” problem, but fortunately everything just came to a happy conclusion.

JTable popup menu example

JTable popup menu introduction

Here's a copy of a class file I created to demonstrate how to put a popup menu (JPopupMenu) on a JTable in a Java application. Actually, the intent of this particular class was to see if I could get the popup menu to work on the header cell of a JTable, but that ended up being a no-brainer.