I’ll walk you through some JOptionPane examples here, starting with a simple example and then increasing the level of difficulty as I go on.
AppleScript dialog icons FAQ: How do I put icons on my AppleScript dialogs?
I started to get into this a little bit in my earlier "How to customize AppleScript dialogs" tutorial, but in this article I thought I'd just dig into the AppleScript dialog icons details.
AppleScript dialog icons - The "with icon" syntax
In short, you add icons to your AppleScript dialog using the AppleScript "with icon" syntax. Here are a few simple examples.
First, the AppleScript dialog note icon:
Mac hidden window/dialog solution: One of the craziest things I see with the Mac OS X operating system from time to time is a game of "hide and seek" that you can get into with dialog windows in Mac applications. You'll hear people describe this problem something like this: "When I click on my Mac application window (like the main iTunes window), my Mac makes a 'dunk' noise (an error sound), like I'm doing something wrong by trying to click on the window.
Mac Unix shell + AppleScript FAQ: How can I display a dialog with AppleScript from the Unix command line shell? (Either from a command line shell like bash through the Mac OS X Terminal, or from a shell crontab job.)
The JOptionPane showOptionDialog is generally pretty straightforward, so without any introduction, here's the source code for a quick JOptionPane showOptionDialog example:
I thought I'd share a collection of JOptionPane showInputDialog examples today. I'll start with the easiest example first, then try to add a little complexity as we go along.
First up, here's a simple JOptionPane showInputDialog example where I display a dialog that prompts a user to enter their name:
With custom icon
It’s important to note that you can also customize the icon that is displayed when using a
showMessageDialog. In the following example, I specify that I want to display my own PNG image as an icon on the dialog by creating an
ImageIcon as an additional argument to the
The running program
JSheet effect is very nice, it works as advertised. My only problem with it currently is that it does something to distort the image when the
JSheet is displayed. You can see this problem in the image shown below, where the coffee cup image that sits on top of the caution image does not look very good:
I'm always looking for ways to make my Java Swing applications on Mac OS X look more and more like native Mac applications, and when a co-worker mentioned the name Quaqua, I decided to take a look at that library/framework one more time. I had looked at it before, but this time, looking at it with a new mindset, I noticed it offers a