An odd thing happened recently. I have been working on a simulation that produces graphical and text updates as it progresses. That involves drawing a picture of the system and updating some textual elements of the user interface.
Things seemed to work fine when the simulation was run with “normal” inputs. However, when supplied with a set of parameters to produce a much simpler simulation, the user interface essentially locked up.
Most programs written for graphical user interfaces still provide a way to operate with the keyboard, requiring minimal mouse usage. The thought is that expert users will want to speed through their work keeping their fingers on the keyboard rather than devote an entire hands worth of fingers to controlling the mouse. I’ve been learning JavaFX, the eventual replacement for the Swing UI framework on Java, and wanted to explore how shortcut functionality had changed. There were a few tutorials on keyboard shortcuts for menu-driven programs, but nothing I could find on their use with button-based interfaces. That’s what I cover here.
Since JavaFX is the future of the user interface for Java, I’ve started trying to learn it. Since I’m also learning Clojure, I’m doing the work in that language.
One of the things I’ve been looking into is how the interface responds to resizing. If you have all of your controls in a nice layout, that is usually taken care of for you. But how do you handle things if the interface is not made up of standard components, something like a graphical game interface for example?
Many of the programs I write need a way to enter and edit a two-dimensional grid of data in the user interface. Such a grid doesn’t need to be a full-fledged spreadsheet, just provide flexible data entry and editing. Alas, there doesn’t seem to be such a thing and I haven’t created one that I’m satisfied with.
Sometimes you have a resource like an icon or image that almost work, but not quite. For example, there was a question on StackOverflow about how to re-size an existing icon to fit in the smaller location at the lower right corner of a
JScrollPane. The original poster was close. Here’s the code I came up with that actually worked.