Here’s a little Kotlin example that uses Java Swing, including a JFrame, JScrollPane, and JTextArea:
I’m working on a little app for my Scala & functional programming book I currently call “Future Board.” It works a little like Flipboard in getting news headlines from different sources, but it uses Scala Futures and a few other functional programming techniques.
One of my gripes with both MacOS and Ubuntu is that it’s harder than it needs to be to grab a window corner or edge to resize it. IMHO, designers are choosing form over function.
Every time I go back to writing GUI programs, I find that I want to document my UI layout code, especially when I use something like a JGoodies layout in a Java/Swing application. I just took a look around and found some ASCII drawing programs, which may help me create the documentation I’m looking for, i.e., an ASCII drawing I can put in my Java/Scala comments, above my UI layout code. I created this particular drawing with asciiflow.com.
Is Swing dead? I don’t know. I’ve written several Swing apps that I use every day, but I can’t speak for the rest of the world.
What I can say is that I really like Scala Swing. How I wish it was available ten years ago ... you’ll never know.
But getting to the point, after working with Scala Swing a little bit, I decided to see if I could write a web browser with it. The short answer is that here’s what the browser looks like:
Summary: The Mediator Design Pattern is demonstrated in a Java example (a Java Mediator Pattern example).
Java Swing FAQ: How can I tell if my Java/Swing code is running on the Event Dispatch Thread (EDT)?
Mac task scheduling FAQ: Is there a simple way to schedule a task/job on a Mac OS X system to run on a certain date and time? (For Linux/Unix users: Like running a Unix job with the crontab facility, but in a GUI?)
In an earlier article I detailed how to run Unix jobs on a Mac system in this Mac OS X crontab (launchd) tutorial. But today I was looking for an easier way to run Mac programs at certain times, or to schedule email reminders to be sent to myself, preferably using a Mac GUI client.