CodeSearch-Plugin
I've finally uploaded a first draft of my CodeSearch-plugin to the project website. It's full of bugs but if you'd like to take it for a spin, you can download it here.…
I've finally uploaded a first draft of my CodeSearch-plugin to the project website. It's full of bugs but if you'd like to take it for a spin, you can download it here.…
Remi and Richard are talking about properties again, refining their ideas. I figured I should organize my thoughts as well. FIrst off, how about some aggressive requirements: Properties should support arbitrary implementations! It should be possible to have properties backed by fields, HashMaps, databases, calculations, devices etcetera. Using such a…
I spend a lot of time at the command line, so a good terminal emulator is important to me. Unfortunately, the ones that get packaged with Linux aren't that great: Konsole Terrible text wrapping support, no-reflow and newlines get inserted when you cut & paste Slow **[Gnome Terminal](http://en.wikipedia.…
On my Ubuntu box IntelliJ began crashing on startup with an unhelpful stacktrace: chixdiglinux:intellij-idea-6$ /usr/lib/intellij-idea-5/bin/idea.sh java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2237) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2703) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:760)…
I wrote a test using the easy-to-use EasyMock Unit-testing API: package com.publicobject.pizzadelivery; import junit.framework.TestCase; import org.easymock.classextension.EasyMock; public class PizzaDeliveryPersonTest extends TestCase { private PizzaStore pizzaStore; private Customer customer; private Order order; private Address address; private DeliveryPerson deliveryPerson; @Override public void setUp() { pizzaStore = EasyMock.createMock(…
Remi Forax is leading some research on hacking in properties into the JVM. Richard Bair's latest post has inspired me to write about how I think observable properties could be implemented. I would like properties to be extensible, so that all the generic boilerplate (not just get/set) can be…
The following Java code does something slightly weird - it statically imports a symbol that is defined in the same file. Although it's a little unconventional, it should be perfectly legal: package com.publicobject.dinosaurs; import static com.publicobject.dinosaurs.Dinosaur.GeologicPeriod.CRETACEOUS; import static com.publicobject.dinosaurs.Dinosaur.GeologicPeriod.…
I'm thinking about developing an IntelliJ plugin that does Google Code Search. This will let me try out some new Glazed Lists features in a fun way. IntelliJ is good Google Code search is good What are some potential uses? Whenever I'm using a new API (like EasyMock or WebWork)…
I'm running Sun JDK 6 RC on Windows Vista RC 1, Build 5600. Here's what System.getProperties() reports... awt.toolkitsun.awt.windows.WToolkitfile.encodingwindows-1252file.encoding.pkgsun.iofile.separator\idea.launcher.bin.pathC:\Program Files\JetBrains\IntelliJ IDEA 6.0\binidea.launcher.port7533java.awt.graphicsenvsun.awt.Win32GraphicsEnvironmentjava.awt.printerjobsun.awt.windows.…
For the Glazed Lists project I'm thinking about developing a Swing search field that looks like the standard one on Windows Vista. I gathered some screenshots from Long Zheng's blog, which leads me to believe there isn't a 'standard' search field on Vista... Vista ClassicAero Glassca.odell.glazedlists.…
JSR 295 will create a spec to bind plain old Java Objects to Swing components. Its a great idea which will increase productivity for Swing developers. Ultimately the spec will include bindings from java.util.List to components like JTable and JList. This tiny subproblem is what I've spent the…
With Java's String class, there's a 2 arg constructor that takes bytes and charsetName: byte[] characters = { 83, 87, 65, 78, 75, 46, 67, 65 }; String myString = new [String(characters, "ISO 8859-1")](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[],%20java.…
Unit testing has spawned a new type of development, test driven development. In TDD, test coverage leads the way in development, and it's a great way to develop new functionality. Unfortunately performance tuning hasn't kept up with unit testing in terms of tools support and ubiquity. Usually when Java developers…
In Java, it's pretty straightfoward to take any abstract pathname (such as ~/Desktop/regina.jpg) and convert it to it's canonical pathname, /Users/jessewilson/Desktop/regina.jpg. Sometimes I find myself needing this function when writing simple shell scripts in Bash, and Google Groups showed me how. Save the following…
For years, we Javaers have been comparing Swing to VB, particularly with respect to ease of development. The conclusions usually involve Swing being much more difficult and much more powerful. I agree with this, but I also think Swing left out some critical APIs for way too long which made…
The next rev of Glazed Lists is out, 1.6.0. This is an interim release while I try to find time to rework how ListEvents are created, stored and managed. Hopefully things will get a lot more powerful for 2.0, and this paves the way. Plus James has…
There's been some discussion on the lists at work about SimpleDateFormat. Apparently it's not safe to be used by multiple threads simultaneously, despite the fact that the format() method doesn't appear to mutate the state of the object. It's a huge design flaw that has bitten many a developer in…
I'm preparing the latest release of Glazed Lists, and as with every release I'm going to post the Javadocs online. Posting the Javadocs on the public Internet is pretty easy and it provides some nice benefits: The project becomes Googleable. [http://google.com/search?q=BasicEventList](http://google.com/search?…
There's an ongoing battle between rich and thin applications. Rich client applications like iPhoto are powerful and productive. Thin client apps like Flickr are easy and connected. Lately, it seems like the industry is going thin, but I think eventually both application styles will converge. Internet applications with rich-client frontends…
Last night I ran software update on my Mac Book Pro, bringing me up to Mac OS X 10.4.6. And today? Corel Draw 11 crashes on startup! Thread 2: Crashed (0xb7fffabc, 0x82fc9d1f) 0x8387196c: /Applications/CorelDRAW 11/Required/Programs/MacUtilities.DLL.cfm/Contents/MacOS/MacUtilities.DLL [CFM] : + 0x896c 0x83870ea4:…
I'm usually a really big fan of the Mac OS X Software Update app. It's easy to use, automatic and mostly nonintrusive. But after applying today's update, my shiny new Mac Book Pro stopped booting!  Each time I rebooted, it beachballed on or right before…
In order to get a desired effect in the Glazed Lists issues browser, I created a border with rounded corners, a la Web 2.0. Implementing the painting logic was tedious, but not particularly difficult -- there's a lot of "magic-numbers" Java2D code to write, such as offsetting…
I just listened to super-smart guy Elliot Rusty Harold critique the Java Collections API on his recent Javapolis interview: In the Java Collections API, I really do not like the UnsupportedOperationsExceptions. I do not like that given a list I don't know whether I can actually add something to this…
Whenever I'm prototyping Swing code, there's lots to remember about getting a component on screen: invokeLater() for thread safety setDefaultCloseOperation() to clean up after myself pack() and setLocationRelativeTo() for a convenient frame To make this easier, I've created a Live Template for IDEA. Add this to your collection of live…
Today's IntelliJ blog makes mention of the Glazed Lists screencasts, and how they use IntelliJ. Fantastic! Some lovin' from our Swing-commanding friends at JetBrains is always welcome. We're gearing down towards a new Glazed Lists rev, with a whole bunch of new functionality and the bugs that come with it.…
I need to send some confidential documents to the immigration team at my new job. So I scan the documents on my girlfriend's HP Scanner, then use the 'email' function to send the documents to myself. The software asks my email address, I tell it. Life is good. But instead…
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…
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(…
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…
After buying something at buy.com, I was presented a link labelled, "get $25 back from your purchase". I clicked the link without reading the fine print that it accompanied: This click caused my my Visa number to be sent from [Buy.com](http://buy.com) to [greatfunonline.…
James just referred me to the Ant <classfileset>. It examines dependencies between your .class files and removes any of the ones you don't actually need at runtime. Why is this useful? Suppose you're building an app with some Jakarta libraries. Inevitably, you'll get the 2 classes you need,…
Regular mac windows have a grippy control in the bottom right hand corner that allows you to resize the window. Unfortunately, most Swing apps don't take this control into consideration, and it's painted right over their precious scrollbar buttons! Here's two versions of the same application, before and after fixing…
Now serving only the hottest in opensourceware:…
I was having a weird problem with a Java Swing app crashing and burning on my Mac, with this crazy exception: JavaAWT: NSException not handled by native method. Passing to Java. java.lang.RuntimeException: Non-Java exception raised, not handled! (Original problem: Error (1002) creating CGSWindow) at apple.awt.OSXOffScreenSurfaceData._copyNSImagePixels(…
We haven't finished our ambitious Quickr project yet, but I still wanted to download all my Flickr photos at full resolution for use in an iPhoto project. The solution was so simple it hurts. I needed: A [key](http://flickr.com/services/) for the Flickr web services API [Flickrj](http:…
In our app at work you can copy data to the clipboard from text fields, tables, graphs and probably more. The problem was that we needed 'cut', 'copy' and 'paste' actions in the Edit menu on the menu bar, and those actions needed to act upon different components when invoked…
Pop Quiz What does the following program print? public class FunkyArray { public static void main(String[] args) { System.out.println(new Object[] { , }.length); } }…
Here's a common Swing problem. You're a _XYZ_Listener and you've just received a fresh new _XYZ_Event. So you make some changes to XYZ, coloring it blue, doubling its value and removing its tartar sauce attributes. Unfortunately this all fails with an unpleasant error: _XYZ_ cannot be modified by…
Launchd is amazing. It's predictable, simple, easy and correct. When Apple makes an app like Launchd in 2005, it makes me wonder what the hell Sun, HP and IBM were doing while improving UNIX for the last 30 years. Regardless it's my new favourite thing and it's much better than…