NiceSTEP Java Components
One small step for Java, one nice step for your Java applications.
Revised February 24, 2006
NiceStep is an attempt to bring the look and feel of N*XTSTEP, GNUStep, and WindowMaker to Java applications. It is a set of Java Beans and common dialogs that are designed to replace the components in the package java.awt. I was unhappy with the way the standard java.awt components look and behave in Linux, and I have been using WindowMaker for several years now and have always liked its look and feel, so making Java components with that look and feel was a natural idea. In addition to giving these components a new look they also add new features.
NiceSTEP was rated in the Top 25% Jars at http://www.jars.com.
NiceSTEP was named Component Of The Week by IBM's DeveloperWorks site.
NiceSTEP has been included in a study of Evolution of Understandibility in Open Source Projects done at Politecnico di Torino in Italy. The paper will be found at http://softeng.polito.it/andrea/publications/metrics-underst.pdf.
NiceTextArea deprecated, replaced with NiceScrollPane and NiceJTextArea
I finally gave up trying to make NiceTextArea a good text editing component with word wrap, tabs, etc. I also found the bugs in NiceScrollPane that had been eluding me. As a result, NiceSTEP Editor has been rewritten and for the first time is actually a useable text editor. Other uses of NiceTextArea in the samples have been replaced, and everything is working nicely.
With NiceScrollPane working NiceSTEP can now use all of the Swing components that would normally be placed on a JScrollPane. This lets us write database applications and spreadsheets with JTable, formatted text editors and web browsers with the various JTextComponent classes, use tree controls, make fancier list boxes, and more.
Use NiceSTEP CD Burner To Make VCDs!
I have been using VCDEasy on Windows for some time now and wanted to have something similar for Linux so I added VCD function to CD Burner. Like VCDEasy it is a front end for vcdimager and cdrdao. Unlike it, it does not scan MPEG files and does not let you create Super VCDs. DVD recording is cheap enough now that the Super VCD format is not all that interesting.
A VCD is a CD with a movie on it in MPEG-1 format that you can play on many DVD players. The quality is not as good as a DVD, but because they are burned onto ordinary CDs they are cheap to make and there is a lot of good free software to help you create them. For example, I used to make VCD copies of all my Betamax movies so I could still play them when my last Betamax machine bit the dust. See vcdhelp.com for more details on VCDs.
The main window of the Slide Projector program. This program allows you to view GIF, JPG, BMP, and PNG files, move them to another directory, and create and save slideshows. This window shows NiceListBoxes, NiceToolbarButtons, NiceLabels (with 3D border), NicePulldownButton (selecting images), and the NiceCanvas (used to preview the image).
For comparison have a look at an old version of SlideProjector made with java.awt components. Not only are these components drab and ugly in Linux, they don't work very well either.
Three screenshots of the famous SwingSet demo program which Sun provides with Swing. I have changed the code to mix Swing components with NiceSTEP components (especially NiceScrollPane) with pleasing results:
The options dialog for Slide Projector. This shows the NiceCheckbox (used for both radio buttons and checkboxes) and the NiceBorderLine. A NiceCanvas displays the icon. Notice that SlideProjector lets you specify a NeXT style app menu or a conventional one, and you can turn balloon help (Tooltips) on and off. A NiceChoice is used to select the sequence of the image files (by name, by name in dictionary sequence, and by file size).
The standard file dialog for NiceSTEP. It is very much like the N*XT file dialog, except for the buttons. A real N*XT dialog would have buttons to navigate to the home directory and the floppy drive, and the buttons would be picture buttons instead of text. Pictures are not my strong point, and I felt these buttons were more useful than the ones a real N*XT dialog would have. This dialog makes use of the NiceDirectoryNavigator and NiceDialogBanner.
The standard directory selector for NiceSTEP. This is very much like the N*XT dialog for selecting directories, except for the buttons.
The Windows version of the standard directory selector. Windows users don't have a nice file system with only one root directory like Linux has, so they need a way to change drive letters. The text field in the NiceDirectoryNavigator shows up automatically on OS's that don't use the forward slash for a file separator. It is hidden for users of POSIX style systems. Note that this is an old screenshot and that the scrollbars actually look nicer than this.
The image viewing window for Slide Projector. Notice the use and location of the NiceScrollbars.
The standard question dialog for NiceSTEP. This displays a label with a prompt and allows the user to enter a one line answer.
The standard alert dialog for NiceSTEP. This dialog displays a message in a NiceLabel (word wrapped to multiple lines) plus as many buttons as you like. The label of the selected button is returned (or "None" if none was selected.) The rightmost button displays the "return" symbol and is always the default button.
The app menu for NiceSTEP. This looks and works a lot better with this release. As you can see here, submenus can be torn off just like the real thing. This is the basic "canonical menu" supported by NiceCanonicalMenu.
The NiceSTEP Editor is the second sample application for NiceSTEP Components. It has a basic text editor component with the scroll bars done right. The rest of it needs work; it won't make you want to give up emacs. Search and replace and cut, copy and pasting of blocks of text is supported.
The beautiful palette icons created by Simon Johnston. Now you can use NiceSTEP with any visual development environment and it will look like it belongs. I used Visual Age for Java for Linux for this image. Note that these icons are 32x32, and may not display in IDEs that only support 16x16 icons. I have created a set of 16x16 icons based on Simon's original work that will display in most IDEs, but they are regrettably not as nice as the full size icons shown here.
An example of what NiceSTEP components looked like in the Visual Composition Editor of Visual Age for Java. Note that the controls look exactly like they will look in the finished app.
The JAR file nicestep.jar is the binary version of NiceSTEP and can be downloaded from the SourceForge Page for this project. You will also need some other JAR files to run the sample programs:
ibmftp.jar contains IBM's open source FTP bean. IBM only provides source through CVS and no compiled binaries so I'm providing the binaries here. java_ydec.zip is the yEnc decoder utility written by Alex Rass. This is a newer and faster version than is currently available at http://www.yenc.org . The older version will not work with NiceSTEP yEnc Decoder. This file contains source code, the compiled .class file, and javadoc. You can use the file as is in the classpath when you run the utility.
To run NiceSTEP CD Burner you need to install mkisofs and cdrecord, which come with recent Linux distributions. (In SuSE they are listed under "Programs that don't need X"). There are also versions of these programs that work under Windows, but while you can use NiceSTEP CD Burner under Windows with these programs it opens a DOS window when running them so it is less satisfactory than when running under Linux.
To use NiceSTEP CD Burner to create VCDs you need to install vcdimager and cdrdao. Both of these utilities come with most Linux distributions and there are also versions that run under Windows. However, if you are interested in making VCDs under Windows you would be better off to use VCDEasy, which has more features than CD Burner does.
For Windows you will need to download a version of the Java Runtime Environment from http://java.sun.com. Use JDK 1.3 or better.
For Slide Projector put nicestep.jar in your classpath and run java using nicestep.slideproj.Main as the class:
java -cp nicestep.jar nicestep.slideproj.Main
java -cp nicestep.jar nicestep.editor.EditorMain
java -cp nicestep.jar:ibmftp.jar nicestep.ftp.FTP
NiceSTEP Java Tar
java -cp nicestep.jar:activation.jar:javatar.jar nicestep.jtar.NiceSTEPJTar
You will need to visit http://java.sun.com to get activation.jar (the Java Beans Activation Framework) and http://www.trustice.com to get the Jar for Java Tar. There is also a GUI tool for Java Tar based on Swing available at that site which is not required to use NiceSTEP Java Tar but which is worth a look.
NiceSTEP CD Burner:
java -cp nicestep.jar nicestep.cdburner.CDBurner
cdrecord and mkisofs (and optionally vcdimager and cdrdao) must be in the path for this to work.
NiceSTEP yEnc Decoder
java -cp nicestep.jar:java_ydec.zip nicestep.yenc.YEncDecoder
NiceSTEP Address Book Browser
java -cp nicestep.jar nicestep.address.Browser
On Linux I have tested all programs with IBM's Java runtime 1.3, which is available at http://www.ibm.com/java/jdk/download/index.html. Sun/Blackdown 1.4 seems to work well, but I'd avoid 1.3 because it messes up the app menus. You can get Sun JDKs at http://java.sun.com . I would recommend trying what you already have installed and if that doesn't work go with IBM's JDK, which is what I have found to be the most robust JVM for Linux. (It may well be the best for Windows too but the difference is less noticeable).
The rules for selecting a JVM are generally, "Newer is better than older and IBM is more stable than Sun." Your mileage may vary.
I have tried using the open source JVM Kaffe with NiceSTEP and am sorry to report it doesn't work very well. I can't recommend that you use it in its present state, at least for applications requiring a GUI.
These programs should also work on a Macintosh, but I haven't tested them there. I found some good instructions on setting up another Java application on a Macintosh here. I would get the latest Java runtime available. You will need JDK 1.3 or better.
You can get download the source code for NiceSTEP from my SourceForge Page. Both zip and .tar.gz formats are available.
The source code for the IBM open source FTP bean is at: http://oss.software.ibm.com/developerworks/opensource/ftp/index.html?dwzone=opensource . It is only available through CVS at this time, no tarballs or zip files.
The source code for Java Tar is available at http://www.trustice.com .
A tutorial book is available for download on the SourceForge Page. It is available as a gzipped Postscript file which can be viewed with gv or printed under Linux and a PDF file which can be viewed with Adobe Acrobat.
The Tutorial does not yet cover the use of NiceCanonicalMenu but reading the Javadoc on that class and all the interfaces in package nicestep.menu.interfaces should get you started.
For the adventurous, my latest code will be found at:
Usually I don't put anything in CVS that won't compile or has serious problems.
Mailing lists, bug tracking, and more at http://sourceforge.net/projects/nicestep.
Bugs and Issues
"It is better to light a single flame thrower than to curse the darkness."
(...from a button I bought at a Science Fiction convention).
This page used to list various JVM quirks I had found. JVMs on Linux have improved quite a bit since I started this project so the JVM quirks I used to list have been fixed. The best advice I can give is:
- Use the latest JRE you can get.
- In general, IBM JRE's have fewer bugs than Sun's, but the gap is closing. The latest Sun, 1.4, seems to work very well.
- Kaffe is regretably not adequate to run NiceSTEP; there are still a lot of bugs in the AWT side of it.
The ISpell service does not work under Windows, even though you can get a version of the ispell utility that runs under Windows. The ISpell service cannot read standard output or standard error coming out of that version of the utility, but it works OK under Linux. Now that NiceTextArea has been deprecated the spell checking GUI does not work quite as well, and that will be fixed eventually.
Some people have suggested that NiceSTEP should be written as a pluggable look and feel for Swing. The problem I have with this is that Swing tends to look like Windows 95 no matter what plaf is in use. Moving a scrollbar to the left side of a scrolling window may not even be possible with a plaf. There is also the question of what to do with inner frames and app menus. There are also licensing issues. Every PLAF I've seen so far seems to make extensive use of code written by Sun. This would complicate releasing a PLAF under the GPL.
The best reason to avoid making NiceSTEP a pluggable look and feel is that someone else is already working on a PLAF with the N*XT look and feel. (See the Links page.) It would make more sense to help with that project than to do the same work with NiceSTEP.
What I have done is make NiceSTEP as compatible as possible with Swing so that you can write applications that use both together.
Another correspondent suggested changing the licensing from the GPL to the LGPL. I do not plan to do this. My reasons for preferring the GPL over the LGPL are the same as RMS has. If you are using NiceSTEP to do projects that will not be distributed outside of your company (as some people are doing) then the GPL will not affect your use of NiceSTEP at all. However my goal in writing NiceSTEP is to make it easy for others to write Java apps for Linux and to get them distributed as widely as possible, with source code. Only the full GPL serves that purpose.
NiceSTEP should contain a complete set of components now. Some may get some polishing or bug fixing in the future. I also plan to make NiceSTEP more consistent in look and feel with GNUstep and to clean up the generated code produced by Visual Age for Java to make the code for NiceSTEP easier to read and maintain.
I have some ideas for other projects, but I don't promise I'll ever do them. NiceSTEP Editor now combines NiceSTEP with Swing, which was one of my goals. A NiceSTEP spreadsheet is a possibility, as is a utility to post binaries to newsgroups using yEnc encoding.
I'm trying to create a set of applications that look good and have features missing from other similar applications.
NiceSTEP Address Book Browser
Connect to any directory that supports LDAP, search for strings in the Common Name field, make a list of entries and then export them in LDIF format. After that, you can import the LDIF file into the address book of GNUMail.app or another LDAP directory. I use this at work to get addresses from the Lotus Notes address book so I can use GNUMail.app as a replacement for the Notes client, which is not available under Linux.
Here is a screenshot.
NiceSTEP yEnc Decoder
This utility will enable you to decode Usenet postings in the increasingly popular yEnc format. Most utilities for this purpose seem to run from the command line, but the NiceSTEP utility has an attractive and unique user interface with drag and drop.
Here is a screenshot.
Slide Projector came about because I was not satisfied with image viewing applications available in Linux. XV was the only one I really found to be useable, and it lacked a slideshow facility. Most others were too sluggish because they took a long time to create thumbnail images. XV does this fast enough to be useable on my Pentium, but I didn't like cleaning up the .xvpics directories it kept creating for the thumbnails.
I had tried to use display from Image Magick and xli to do slideshows and found them to be very limited. Neither one would resize an image to fit on the screen, for example, or display pictures in random order. Slide Projector does these things and also performs well on my old Pentium. I am using the NiceCanonicalMenu, which lets you open and manage multiple Slide Projector windows. You can move and copy files between windows using drag and drop, and you can drag files to the slideshow list and also resequence them in the list by dragging.
This application was created solely to test the NiceTextArea component, now deprecated. The latest version uses NiceScrollPane and NiceJTextArea instead, and is much more robust. It also uses the canonical menu and the NiceSTEP application framework, and demonstrates how the menu automatically supports Edit and Find functionality when controls that need them get the focus. You should consider this an example of how to use the menu and application framework; it isn't really good enough to be anyone's favorite editor.
Here is a shot of the spell checking facility in use.
I had only tried one graphical FTP utility under Linux, and it had the annoying habit of vanishing from the screen at odd times. No doubt there are more I could have tried, but I kind of liked the idea of an FTP utility that navigates through directories the way N*XT does. The FTP function is provided by IBM's open source FTP bean. The icons on the toolbar have a nice retro ambience. If the FTP server logs you off after a period of inactivity you can log back in by pushing the Reconnect button on the toolbar. It will return you to the place you were before you were disconnected.
New with this release you can use drag and drop to upload and download files.
NiceSTEP CD Burner
Here's another application that at first glance does not seem to be needed. It does not actually burn CD's. Instead it is a front end to the Linux utilities mkisofs and cdrecord . There are probably ten other programs that do the same thing, so why this one? It turns out that none of the others will do the following:
- Print a nice jewel case liner. (Correction: there is a program called cdlabelgen that uses Postscript to print jewel case labels. However it doesn't work with my printer very well; the bottom of the page gets chopped off.)
- Print a nice CD label.
- Check filenames that will be burned onto a data CD in Joliet mode to see if they are longer than 64 characters (the maximum for Joliet) and then prompt the user to rename them. Joliet mode supports long filenames under Windows and is readable by Linux too, so it's the format I use most.
The jewel case liners should be printed on thin card stock for best appearance. The liners are nothing fancy but they actually look better than the ones created by the Windows program that came with my drive.
If you have ever used mkisofs or cdrecord you will have no trouble using this front end. If you have never burned a CD under Linux then you must read the CD Writing HOWTO by Winifried Trumper. Don't be discouraged if you have an IDE CD-RW and find out that you have to rebuild the kernel to use it. I got through it; you will too. (Most current Linux distros have the needed features already compiled into the kernel plus detailed instructions on burning CDs from Linux, but read the Trumper article too.)
You can control where the CD label prints on the page using the "Options" dialog. This dialog also gives you the option of printing a Test page where the current location of the label can be printed using ordinary paper. Tick marks every 1/10th inch are also printed to make it easy to choose the settings needed to make the label print in the right place. After the plain paper tests look good you can turn off the test option and print on real CD labels.
You don't need to burn a CD to create CD stick-on labels with this program. I have been using it to create labels for VCDs that I create in Windows, and it has been a real time saver.
- The Main Window: Data View Compare the appearance of NiceTextFields in this screenshot to the TextFields in the other two screenshots, which are older.
- The Main Window: Audio View To avoid encouraging people to burn CDs containing copyrighted songs using this utility the example shows burning a CD containing piano and keyboard tunes played by my friend's three daughters, none of whom have a recording contract yet. This screenshot was made before I added the icon to print CD labels.
- The Main Window: Message View Messages from the mkisofs and cdrecord commands are listed here so you can scroll through them. This is also an older screenshot.
This application can only burn CDs on systems that will run cdrecord and mkisofs. However, you can print labels and jewel case liners on any system. There are versions of mkisofs and cdrecord that work under Windows, but they open DOS windows when NiceSTEP CD Burner runs them.
This application makes use of some code from Burn It! by Jesper Pedersen.
New with this release, NiceSTEP CD Burner can also be used as a GUI frontend to vcdimager and cdrdao to create Video CDs (VCDs).
This is an all-Java implementation of the Unix tar and zip commands, so it can run on any platform. The Zip and GZip functions are provided by Java itself, and the Tar function is based on a command line tar utility written by Timothy Gerard Endres which is required to run this program. You can download his program with code at http://www.trustice.com . His code automatically converts line endings from the MS-DOS carriage-return linefeed pair to the Unix newline and back as needed, and it needs the Java Beans Activation Framework to know which files to do this with. A copy of activation.jar may be included with his code, or else you can download it from http://java.sun.com . He has also provided a GUI for extracting from tar files that is based on Swing as a separate download. You don't need it to run this utility but you may find it worth checking out.
What NiceSTEP Java Tar provides is the ability to work with Zip files as well as tar and tar.gz files, and the ability to create archives as well as extract from them. You can select an entire diredtory to archive, including subdirectories, or you can select several files in the same directory and create an archive from them. You can extract all of an archive or select multiple files within one for extracting.
This utility does pretty much everything the popular WinZip utility in Windows does. It does not provide the full function of the Unix tar command however, because file ownership is not stored in the archive correctly. Using this utility everything in the archive will be owned by the person who created the archive, and when extracting from an archive all extracted files will be owned by the person doing the extract. Still, you should find this utility useful for packaging source code for distribution, or for archiving a local copy of your website so you can send it to your web server using scp.
Send comments to James Simmons.
NEXTSTEP and OPENSTEP are trademarks of Apple Computer, Inc. Java is a trademark of Sun Microsystems, Inc. This project is in no way affiliated with Apple Computers, nicestep.com, or Systema niceSteP.