The Cleaning Power of Podcasts

Power Book The Cluster Print/scan center

After listening to a few podcasts I figured out that (1) I like podcasts, (2) It is hard to program or read while listening to them, and (3) it is a good time to catch up on cleaning. As you can see from the pictures of my home office, it is not spotless. But for the last two or three years you could not turn around in here. If I wanted to print something, I’d have to move a bunch of stuff into my lap to give the paper room to come out. Using the scanner meant the digging out the scanner and holding it in my lap. If I wanted to show someone something on my computer, I had to unplug it and move it out of the room; no-one else could get in here.

Over the last three years, I had probably six aborted attempts to clean this room that never got farther than cleaning under the printer desk. After 4 days of listening to podcasts and cleaning, you can actually see most of the carpet in here. I can print and scan without a massive juggling act. By the way, If you are wondering why I have expensive modular cube furniture and a *very expensive* office chair in my *home office*, it’s one of the few perks of staying with a start-up until the bitter end.

Which podcasts? I like Adam Curry’s Daily Source Code and OtakuGeneration so far.

NetBeans 5 Beta: Initial Thoughts

I downloaded the new Beta. The menu is in the right place now on OS X (in 4.1 you put it there but the tools menu misbehaved) and seems to work correctly. The source code window looks a lot better than I remember, guess they anti-alias now.

The real pleasant surprise is the preferences (options) dialog. You no longer have to dig through a ton of tree items to find the place to change the default font, or key-bindings. The old options dialog is still available for masochists. Switching back and forth between the two caused an extra dialog to show up that would not go away. That seems to have corrupted my preferences. Trashed the beta and unzipped the archive again to get a fresh copy. Problem solved. Yeah, it’s a Beta.

(Continued)

Giving JTree Fitts

Swing ignores most human-computer interaction theories. A case is point is JTree (or even JList) and Fitts’ law. If you have programmed rich clients in Java, you’ve probably run across the annoying fact that putting an empty string in JTree or JList makes that item hard, if not impossible, to select.
(Continued)

Six Dumb Responses

Marcus Ranum wrote The Six Dumbest Ideas in Computer Security.
I should preface this by says I’m not a security expert. I’m a person who believes
there are no experts in security. Here are my thoughts…
(Continued)

Tiger Trees

Or maybe I should call this “Unified Dark Trees” if you’ve read John Gruber’s The iTunes 5 Announcement From the Perspective of an Anthropomorphized Brushed Metal User Interface Theme (warning: foul language). Anywho, in a previous post, I was creating an iTunes 5 like interface for an application I’m writing. This post is about the tree control. In the last post, we fixed the colors. In this post we override BasicTreeUI to paint the entire row with selection. Below is a screenshot with Swing Ocean as the backing LAF.

Screenshot

(Continued)

Tiger Style

The screenshot below is from the application I was talking about in my last post. I got bored fighting with StyledDocument and worked on the overall look of the app. Its not a complete emulation of Mac OS Tiger’s LAF by any stretch of the imagination, but I like the way it looks and I intend to make it better. This is a work in progress.

Project screenshot

First, don’t get the wrong idea. I’m not implementing this as a look and feel. It’s just a couple of custom UI classes and overriding some default properties. The point of this is to make an attractive application whose interface is patterned after iTunes 5.0. This is first application I’ve built in long time using NetBean’s Visual Builder (the 4.1 builder, not Matisse).

I put MattBorders on a few of the controls. I’ve never really used MattBorder (or many custom borders at all) before, but in playing around with NetBean’s GUI Editor I found that MattBorder does mostly what I need for this interface. Lets take the tree, splitter, and text pane as an example. First set the divider size to 1 on the splitter. Now, if we had used LineBorder on the tree’s scrollpane, we would have too many lines. With MattBorder you can pass in an Insets to control which sides get a border (a black 1 pixel border in our case). This style also does not put a border on the edges that go up to the edge of the window. Note: The divider still has a dot in the center that I haven’t dealt with yet.

The header and footer are JPanels for which I created a custom UI. I won’t post the code here, it doesn’t really matter. There are many implementations of gradient panels on the net or we could use synth. The important thing is the window design with this style. The brushed metal style created a texture that spanned the entire window and drawing it was slow on older machines. This gradient is less complex that the gradient in the Swing Ocean theme. But you can’t just use the gradient UI with every panel. If the middle content area was a form with labels and text fields then this look would not work very well. I wouldn’t use it for dialogs.

There is a toolbar on the the header with floating disabled and transparent (not opaque). The JSeperators space things out — be sure to set their height to zero otherwise they draw lines. The search component is a blog for another day.

The “Article Title” header is a JPanel with the same gradient UI just with different colors. The “Article Title” itself is a JTextField with the border removed, not opaque, foreground changed to white, and bigger font. The combo box is set not opaque, that really only matters with Apple’s Aqua Look And Feel.

For the tree, we changed the background color. This creates a problem with cell renders still being white. I had created a custom cell renderer before hand to display the icons. Inside the cell renderer I change the foreground for the selected cell to white. Trying to change the background of the cell in the same place doesn’t work. Trying to set the cell renderer to transparent doesn’t work. Instead use something like the following…

        DefaultTreeCellRenderer ren = new CTreeRenderer();
        tree.setCellRenderer(ren);
        tree.setBackground(new Color(0xE7EDF6));
        ren.setBackgroundNonSelectionColor(tree.getBackground());
        ren.setBackgroundSelectionColor(new Color(0x3F7EDC));
        ren.setBorderSelectionColor(ren.getBorderSelectionColor());
        tree.setRootVisible(false);
        tree.setShowsRootHandles(true);

This looks pretty neat until you select a cell. In iTunes the entire row is highlighted and the highlight is a gradient. I don’t care about a gradient highlight personally, but I’d like the highlight to extend to width of the window. This likely means overriding the UI of the tree to pick the slack (see Tiger Trees) since the cell doesn’t actually take up the entire width of the window. That also means we probably couldn’t use synth to do it (even if I wanted too).

The “Document Title” area is a JPanel with the gradient UI again. The thumb button in iTunes is an extra widget to resize the splitter for people that have trouble getting their mouse on the one pixel divider. I haven’t implemented this yet (blog for another day). But the button itself is a PNG and the button set to not draw the content area or the border.

The name of the application is likely to change. I imagine the name I used in the screenshot is already used by some other application. And when I finish the application, it will likely be open source. More Later.

StyledDocument Blues

I had a idea for a neat little application. It should have been simple since Java has a widget for editing styled text. But I’ve been spinning my wheels dealing with various aspects of the StyledDocument interface and it’s horde of companions. My first clue should have been StyledEditorKit reads and writes plain text by default and the second clue should have been the length of time HTMLDocument takes to load and third clue should have been HTMLEditorKit hasn’t been updated to HTML 4 or XHTML.

I need to store text with formatting, but I need to control which formatting is stored (some formatting is done on the fly). So the default HTML and RTF kits are out the window. I’d like to export to HTML but I don’t want to live there.

The problem is there isn’t much documentation on using custom Documents with these controls or even how Style is used with controls. This guy has more complete rant about these components. I’ll need to a lot more research of this if I’m going to continue or just give up a write a new control.

On the plus side, I’ve almost finished a iTunes-like search control. I just don’t have anything to search yet.

*Update:*
Christian Kaufhold (referred above as “this guy”) also has information on his site about mapping elements to views.