Summary: A simple Java JScrollPane source code example.
When you're first learning how to use Java Swing components, like a JScrollPane it can be a little hard to figure out how to get started. To that end I am trying to share several complete Java source code examples that demonstrate how to work with components like these.
I've been working on writing my own Java text editor on and off for several years now, and one feature I just added to this editor is the ability to view (or preview) HTML and CSS content. Using just the base Swing classes this turned out reasonably well -- I'm not looking to write a complete browser here -- so I thought I'd share some source code to show how this works.
Java Swing drag and drop FAQ: How do I get Java/Swing image drag and drop working on Mac OS X?
I've been working on several new Swing applications for Mac OS X recently, and most of these applications include features like image processing, copy and paste clipboard interaction, and in today's example, dealing with drag and drop events on the Mac.
A frequently asked Java question is, "How can I tell what version of Java is running my program?"
Answer: Just use this line of source code to determine the version of Java that is running your program:
Java AppleScript FAQ: How can I run a multiline AppleScript script from a Java application?
A Java AppleScript example
Here's an example of some Java code that runs multiple lines of Applescript, six to be precise:
Java Mac keystroke FAQ: How do I write Java KeyStroke code for Mac OS X systems?
When I switched from "Java programming on Windows" (or Linux) to "Java programming on a Mac", I quickly learned that I was going to have to change the way I bound my keystrokes for handling key-driven events (things like keystroke-driven popup menus, mnemonics, or accelerator keys). On Windows systems I used to write key-binding code like this: