Interfaces vs. Classes

Tuesday, November 14th, 2006

Apparently XOM and JDOM aren’t the only projects to consider interfaces to be more trouble than they’re worth. I just noticed that JAXB 2.0 now uses singles classes for its generated files rather than separate interfaces and implementation classes like version 1.0 did. Given that these are generated code that should not be directly modified or extended by the programmer, this seems an obvious choice.

Estimated Complexity

Monday, November 13th, 2006

From the Apache Harmony bug tracker:

Unknown Novice Moderate Advanced Guru Needs James Gosling

AWT on the Event Dispatch Thread?

Friday, November 10th, 2006

Last night I was teaching my Intro Java class about Swing windows, and specifically discussing the event dispatch thread. I dutifully warned everyone that all creation and update of Swing components had to happen on this thread, usually by calling SwingUtilties.invokeLater(). Then one of my students asked a question that stumped me:

Is the same true for AWT components?
(more…)

Frame Z-order in Java?

Thursday, July 13th, 2006

I must be missing something obvious. Is there a method anywhere in the AWT (preferably in Java 1.4 but maybe 1.5) that allows me to determine the z-order, relative or absolute, of free-standing windows such as frames and dialogs? Specifically I need to know which of several dozen frames is on top among that group. To make this trickier:

  1. There may be other frames and dialogs that do not count. For instance, if the preferences dialog is really on top, I still need to know which of my application’s document windows is on top among the document windows.
  2. I need to know this even when the application is in the background, so that the top window may not be active.

Surely there’s a function for this somewhere? If not, it’s a pretty glaring hole. Do I really have to write code to watch each and every operation that can move a frame to the front, and track the front window manually?

Copying files from one JAR to another using ANT

Friday, July 7th, 2006

To avoid needless duplication of source files in two different repositories, I would like to write an Ant build.xml file that copies files from one .jar file to another. I don’t want to copy everything in the source jar, just certain selected files.
(more…)