Letters to the Editor (3/20/99)

news
Apr 1, 19998 mins

In this installment of Letters to the Editor, Eugene Podgorbunskikh answers a question about his Java Tip 69, 'Press Escape to close your Java dialog windows'; John Neffenger fields several questions about his VolanoMark tests; and a reader points to an XML alternative approach

Java Tip 69: ‘Press Escape to close your Java dialog windows’ by Eugene Podgorbunskikh

Reader questions whether Escape should also call performEscapeAction()

Eugene,

I’m a firm believer in keyboard shortcuts and have implemented similar esc=close dialog functionality.

Unfortunately your code has an inconsistency. If your response to Enter is to call a particular function (such as performEnterAction()), your response to Escape should be to call performEscapeAction() rather than to just call setVisible(false) .

Trevor Squires

Trevor, You are right. In the real world you probably want to have a function different from setVisible to handle the Escape key event. In fact, in my applets I have function performEscapeAction() instead of setVisible(). In EscapeDialog this function only calls setVisible(false). I used setVisible() in the article because I didn’t want to clutter it with additional information that wouldn’t contribute to explaining the main idea. Hiding a dialog is a natural response to pressing the Escape key. On the other hand, there is no universal response to pressing the Enter key, which is usually equivalent to clicking on the OK button. Eugene Podgorbunskikh

JavaWorld’s Java Tips

Praise for Java Tips, and all they stand for

JavaWorld,

I have found your Java Tips page to be VERY useful and informative. Whenever I have a problem to solve, I first go to your tips page to see if you’ve already got the answer. I like the way you describe the tips and provide good, useful sample code.

Thanks!

Kyle Kraft

Kyle, Thank you for the compliment. Find new Java Tips with each monthly issue of JavaWorld, or comb through the Java Tip index to find the tip most relevant to your interests. The JavaWorld eds.

Cover Story: ‘The Volano Report: Which Java platform is fastest, most scalable?’ by John Neffenger

Read

John Neffenger explains how to reduce the size of the thread stack in Windows NT 4.0

John,

I am currently running Java 2 on Windows NT 4.0. Is it possible to reduce the size of the thread stack any further or is the published value the optimum?

What are the possible dangers from making this modification?

Peter Anderson

Hi Peter, Yes, you can reduce it below 256 KB if you like. You can determine whether your application exceeds the stack size by running representative tests. The following Microsoft links may help:

John Neffenger

Updated Volano Report with Sun’s JDK 1.2 for Solaris production release

John,

The VM tested for Solaris Intel was the early access version. Sun has released the final version since you ran your tests. Could you publish the results of your test for this VM, please?

Eugene Lublinsky

Eugene, The results of Sun’s final release of JDK 1.2 on Solaris can be found at: The Volano Report: https://www.volano.com/report.html John Neffenger

Reader asks about JDK 1.1 vs. Java 2 VolanoMark testing

John,

I would suggest that you continue to test the Sun 1.1.X line. I represented Calico at a meeting of Java Fund partners where we discussed with Sun how we would move forward with VM versioning in the future. All of us who develop server products agreed we would not be adopting Java 2 for as much as another year, given we can’t take the risk of leaving behind years of testing legacy on our products. The migration of server products to Java 2 will be a slow one for shipping production software.

John James

John, From what I can tell, Sun has done a good job on compatibility between JDK 1.1 and Java 2. In particular, the performance and scalability improvements in Java 2 are worth any such risks for our VolanoChat customers. We have been testing the beta versions of the new Solaris JVM in Java 2 for over six months, so I’m pretty confident in its stability for our products. John Neffenger

JavaBeans: ‘XML JavaBeans, Part 2: Convert your JavaBeans to XML documents’ by Mark Johnson

Reader points XML fans to alternative approach

Mark,

For a different approach using “generic XML” based on SAX rather than DOM you might have a look at:

https://www.dtro.e-technik.tu-darmstadt.de/mnl/MyJavaTree/doc/README.xmlbean.html

Michael Lipp

Media Programming: ‘Image processing with Java 2D’ by Bill Day and Jonathan Knudsen

Read

Reader wonders about Java 2D performance, or lack thereof

Jonathan and Bill,

I wondered if you have tried doing any large scale (as in amount) rendering with Java 2D? We are in the process of developing a replacement toolkit for our previous generation of Java tools, which relied upon a C++ rendering engine. This new toolkit is build on top of Java 2D; however, we get poor performance compared with our old toolkit.

I wonder what you think about:

  1. The performance of Java 2D
  2. Where you think Sun is going with the current implementation (it seems to suit a device with a pixel-addressable display rather than an accelerated graphics platform)

We had planned to do a whole bunch of marketing stuff to launch our new products at the end of April, but we keep looking at the performance and think that we will get massacred. HotSpot doesn’t help much, and 1.2.1 doesn’t have anything new.

Graeme Wallace

Graeme, As you say, I don’t think Sun is interested in hardware acceleration. The basic goal of Java is to be as platform unspecific as possible, while achieving good graphics performance usually means getting very specific about the hardware. I will say, however, that the big push (in Java 2D at least) was to get the API right for Java 2. Supposedly, now that the API is settled, the maintenance releases will just be full of bug fixes and performance enhancements. I can’t speak for performance, but I did notice several important bug fixes in 1.2.1. I know the Java 2D team is concerned about performance, and in fact they’re quite proud of it in some cases. You should probably put some pressure on them about it — I suspect that if they know you have a product you’re delaying because it’s too slow, they will put some effort into helping you. I suggest writing to Jim Graham directly to see what he has to say. Jonathan Knudsen

Java Tip 70: ‘Create objects from jar files!’ by John D. Mitchell

Read

John D. Mitchell answers reader’s ‘casting’ question

John,

I have tried casting the objects to “Class” objects and then calling newInstance() on them, but that does not seem to work. The getResource() line does not seem to work quite right. I have tried to cast the object in the hashtable to a byte array, then a byte array to an object, object to a class, and then call newInstance(). But that does not work either.

Michael Dorio

Michael, Casting is not how you create objects in Java. You have to use one of the underlying object creation methods. As just a plain old “new” operation doesn’t take a byte array (like the one returned by getReource()), you need to use newInstance() on the class object returned by the defineClass() method of a “class loader.” (Check out java.lang.ClassLoader.) John D. Mitchell