Put the knife down and take a green herb, dude.
One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com
Using 89% of the same design the blog had in 2001.
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.
MarkUpDown is the best Markdown editor for professionals on Windows 10.
It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.
Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor.
Stop looking. MarkUpDown is the app you're looking for.
|Saturday, May 24, 2008|
I've been a little neglectful keeping on top of Java 6, but my recent trip to the Java Tutorial, which has in my experience been one of the best "how to" programming sites on the net, shows me that the marketing guys have infiltrated this once idealistically perfect site.
Here's what I saw.
How to Use Text Areas (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components):
The TextAreaDemo example introduces an editable text area with a special feature — a word completion function. As the user types in words, the program suggests hints to complete the word whenever the program's vocabulary contains a word that starts with what has been typed.
That's exactly what I needed. I'd been looking at some solutions with more functionality, where you start typing a word and a number of possibilities appears in some sort of select-list below, including the Netbeans editor and a few examples from weblogs. Each was more overhead than I wanted, and just short of writing some simplistic autocomplete code, I stumbled over this.
So where's the marketing? How about the stuff that's Java 6 only, like the incredible overkill of the Java 6 only GroupLayout? Sure, you can add GroupLayout to your 1.5 and possibly 1.4 application, but why do I need this for a form with a single label and single text area?
Let's look at the code. Here's the layout jive necessary with GroupLayout.
GroupLayout layout = new GroupLayout(getContentPane());
Now here's what I need to get the same form, give or take, with layout code that'll work with every version of Java since Swing was released as an add-on jar. (Why bother? Mac OS X 10.4 has Java 1.5, not 6, and no GroupLayout by default. Sounds like a decent reason to me.)
BorderLayout layout = new BorderLayout();
That's right, the code becomes more readable and compatible. Mr Pibb + Red Vines = Crazy Delicious!
Maybe I'm an old-school idealist, but I don't believe in including a single extra line of code, much less a major code concept, in a tutorial than is absolutely necessary. Tutorial code should be designed to be written by hand, and should encourage its users to make small changes to see how those changes influence what happens. With GroupLayout, it's very difficult to add another few GUI widgets, difficult enough that the Tutorial itself tells us so on its page regarding how to use GroupLayout. Don't miss the Netbeans pimp in the following quote.
Note: This lesson covers writing layout code by hand, which can be challenging. If you are not interested in learning all the details of layout management, you might prefer to use the GroupLayout layout manager combined with a builder tool to lay out your GUI. One such builder tool is the NetBeans IDE. Otherwise, if you want to code by hand and do not want to use GroupLayout, then GridBagLayout is recommended as the next most flexible and powerful layout manager.
That last sentence is particularly bad marketing speak. See how they ignore the fact that saying "if you want to code by hand" is a superset of "do not want to use GroupLayout," the latter left in solely to deaden the [admittedly small] shock of what they just told you -- GroupLayout is for IDEs, not text editors. And the pseudo-objective tone of "One such builder tool is the NetBeans IDE," is borderline obnoxious.
For older school programmers, that paragraph would read, "GroupLayout was created to help support GUI RAD in Netbeans, and works best in concert with that IDE. GridBagLayout is the most flexible and powerful layout manager created with hand-coding GUIs in mind." Alternately, for even older school folk, the text would be, "GroupLayout is not for hand-coded GUIs. Use GridBagLayout or BorderLayout instead." And a comment in the TextAreaDemo example saying, "This code intended for use in Netbeans," or something similar explaining why the horribly unwieldy layout manager was used, if it has to be there, would have been nice.
Tutorials should present simplest case information that allow an informed programmer to learn a new trick in a simplest case, clean room environment, and then have the tools to figure out how to best integrate that into his or her work flow and environment. Pimping a specific Java IDE has absolutely nothing -- no, I hear your argument, and trust me. They have nothing to do with one another -- to do with learning to use JTextArea. Learning how to introduce JTextAreas using Netbeans is Netbeans' business. Doing it in Eclipse is Eclipse's business, etc.
I don't care to see the IDE wars inserted into my tutorials. It's painful to see that Sun now prefers the opposite.
posted by ruffin at 5/24/2008 10:47:00 PM
All posts can be accessed here:
Just the last year o' posts: