Atom Feed SITE FEED   ADD TO GOOGLE READER

Undecorated Icon JButtons

If you want your JButton to have no decoration across the standard look and feels, there's two things you need to do:
JButton myButton = new JButton(myIcon);
myButton.setBorder(BorderFactory.createEmptyBorder());
myButton.setContentAreaFilled(false);


setBorder prevents the Aqua look and feel from drawing a glassy aqua button
We need setContentAreaFilled to prevent the XP look and feel from drawing a plastic luna button

It's unfortunate that the two look and feels don't use the same API to accomplish the same result.

Burned by wildcard imports and SwingWorker

The following code uses com.publicobject.swing.SwingWorker from the Java tutorial:
package com.publicobject.demo;

import com.publicobject.swing.*;
import javax.swing.*;

public class HelloWorldWorker extends SwingWorker {
private final JLabel label;
public HelloWorldWorker(JLabel label) {
this.label = label;
}
public Object construct() {
return "Hello World";
}
public void finished() {
label.setText((String)get());
}
}


It compiles fine under Java 5. But in Java 6, it doesn't even compile! The problem is that the two imports conflict - there's my SwingWorker, and the one Mustang provides in its javax.swing package. If you're using SwingWorker, you should fully qualify your imports now so when Java 6 comes, you're ready.

CorelDraw 11 for Mac is dead

I get the feeling that a recent software update for Mac OS X 10.4 has broken compatibility with CorelDraw 11, causing Corel Draw 11 to crash on startup. My Mac OS X crash reporter message looks like this:
Exception:  EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0 com.apple.CoreFoundation 0x9073d2c0 CFStringGetCStringPtr + 408
1 CdrPrn.DLL 0x050f8374 GetDefaultPrinterName__11WPrnPrinterFP7CStringP7CStringP7CString + 116
2 CdrPrn.DLL 0x050dfa68 _ct__11WPrnJobInfoFP12WPrnDocument + 216
3 CdrPrn.DLL 0x0510545c _ct__12WPrnSettingsFv + 236
4 CdrPrn.DLL 0x050ce448 _ct__12WPrnDocumentFP18WPrnEngineInstance + 88
5 CdrPrn.DLL 0x050d9a44 AddDocument__18WPrnEngineInstanceFv + 52
6 CdrPrn.DLL 0x050d79c0 CreateNewDocument__18WPrnEngineInstanceFPP12IPrnDocument + 128
7 Draw.DLL 0x0497a2f8 InitDocument__8CDrawDocFv + 568
8 Draw.DLL 0x04979e5c OnNewDocument__8CDrawDocFv + 124
9 MacPort.DLL 0x0052c5c8 OpenDocumentFile__17CMultiDocTemplateFPCci + 264
10 Draw.DLL 0x048b219c OnNew__5CDrawFv + 268
11 Draw.DLL 0x04916600 ExecuteUsersOpenMethod__5CDrawFv + 880
12 Draw.DLL 0x049142d0 InitInstance__5CDrawFv + 3104
13 Draw.DLL 0x04964b28 StartApp + 216
14 Corel Draw App 0x000c0a80 WinMain__FP11HINSTANCE__P11HINSTANCE__Pci + 176
15 Corel Draw App 0x000c0ba0 main + 192


In debugging the problem, I tried everything google had to offer:
  • Pressing shift while the app starts up to "overwrite my workspace with the factory default"
  • Deleting the preferences files in /Users/jessewilson/Library/CorelDRAW 11 Preferences and com.corel.DRAW.plist

    I also tried some other strategies which all failed:
  • Logging in as a brand new Mac OS X user to get a fresh set of preferences
  • Rebooting my Mac
  • Downloading the latest update to Corel Draw 11. 693

    So what are my options?
  • Spend $2000 on an Intel Mac, $400 on a Windows emulator, and $400 for the latest Corel Draw for Windows
  • Try to find a copy of Corel Draw 10 for Mac on Amazon or ebay, cross my fingers and install that one
  • Hope some Internet surfer posts the fix in my blog comments!