Hey all,
I'm crafting a fairly large application in Java. It needs to run on both Mac OS X and Windows, and probably on Linux as well, so I'm using Swing rather than doing it in Cocoa Java (or just Cocoa). Anyway, I need a group box, probably better known to this crowd as an NSBox... I can use EtchedBorder or whatnot to get a box that groups things, but it's a far cry from Panther's spiffy sunken effect -- and, petty or not, I want that effect.
My plan was initially to use some Mac-specific library inline, and then just wimp out for other platforms, something like this:
Code:
if (System.getProperty("os.name").startsWith("Mac OS X") {
myWindow.add(new com.apple.spiffy.controls.NSBox());
}
The problem is, I don't know if this will cause the application to complain if I try to run it on Windows -- Java doesn't support conditional compilation per se, so that reference is still in the code at runtime on Windows... so my first question is, can I do that?
My second question may supercede the first: how can I get a group box/NSBox control into a native Swing application? I thought I had worked it out; JTabbedPanes have the same appearance, so I added an empty JTabbedPane to the window and it seemed to work -- but as soon as I added controls to it, it grew an empty tab at the top, which certainly wasn't going to cut it. I'm willing to resort to third-party libraries if I have to...
Can anyone help?