The Java Tutorials' Weblog
Multimedia Tutorials
Do you believe that a visual demonstration blows minds better than words?Don't you think it is time that we add a touch of multimedia to our Java guides, tutorials and any other Java documentation?
Below is a small demonstration of the procedure to validate the JRE in your system. This demo represents the validation procedure found in the Java Upgrade Guide.
Of course we are not going to replace all of the content with multimedia examples, but only to supplement the existing content. We might include small bits and pieces of such presentations, including screencasts, in the tutorials and/or guides to demonstrate tasks or illustrate concepts. We need your feedback/comments/suggestions before we implement the same.
What do you think? As a novice or a budding Java programmer do you think these presentations would enhance your understanding of the subject in a better way?
- Jacob Royal
Posted at 11:56AM Jul 03, 2008 by The Java Tutorial Team | Comments[4]
Java FX Resources
Have you heard? The Java Platform is now defined to include the Java SE Platform and the Java FX Platform. To accommodate this we have opened up the Java Tutorials Community Portal to include discussions and tutorials on JavaFX.To kick this off, I have posted a list of JavaFX resources in the forum.
And I also posted Scott's "Animation, the Easy Way!" mini tutorial in the wiki.
-- Sharon Zakhour
Posted at 03:05PM Jun 27, 2008 by The Java Tutorial Team | Comments[0]
Core Java Technologies Tech Tips
It's a mouthful, but are you familiar with the Core Java Technologies Tech Tips?These blog entries are created by engineers and are intended to show the latest and the greatest in technical detail. As I peruse the list, a few that jump out at me are:
- Using Generics with Wildcards and Extends
- Sorting Strings (with particular emphasis on international alphabets)
- Placing Components on Tabs
-- Sharon Zakhour
Posted at 01:56PM Jun 24, 2008 by The Java Tutorial Team | Comments[1]
Thumbnail Tooltip Demo
Frequent contributor to the tutorial forum, Collin Fagan, has created a new demo that combines bits of other tutorial demos plus some interesting new functionality.ThumbnailTooltipDemo features a tabbed pane containing three tabs. The first tab shows a tree, the second a table, and the third contains a grid of images. What's interesting here is that when you hover the mouse over one of the tabs, you see a pictorial tooltip representing the contents of that tab. The tooltip is dynamically generated, so if the appearance of the pane changes, by highlighting text, for example, that change is reflected in the tooltip.
You can see the forum thread or check out the wiki page with the source code.
Very cool, Collin!
-- Sharon Zakhour
Posted at 11:29PM Jun 19, 2008 by The Java Tutorial Team | Comments[0]
Java Tutorials Translations
We occasionally receive requests from people who would like to translate the tutorials into other languages and to provide it back to the community. While the published book, The Java Tutorial, is available in a few other languages such as simplified Chinese and German, this does not fill the enormous language gap.Much to my chagrin, I am a mono-linguist. We do have a few writers on staff fluent in other languages (Russian, French and Hindi, to name a few), but we just don't have time to translate our work.
But we would love to see the tutorials made available in many languages! In fact, on the new Community Portal there is a place on the wiki specifically dedicated to posting translations. So far, it's empty, but we hope to see contributions over time.
There is a thread on this subject on the forum. I would be curious to see what language you would most like to see in a translation.
-- Sharon Zakhour
Posted at 09:52AM Jun 12, 2008 by The Java Tutorial Team | Comments[5]
1.4 Version of the Java Tutorials
Some of you don't have the luxury of using the newer releases of the JDK and we are occasionally asked for an older version -- particularly release 1.4 of the JDK. Before we moved to the Sun Download Center, we did have a page that contained some, but not all, of the older versions of the tutorial.I went to my pile of old published tutorials and extracted the 1.4 version from the cd included with the Second Edition of The Swing Tutorial. I've made it available through the Java Tutorials Community Portal: tutorial_1.4.zip.
Enjoy!
-- Sharon Zakhour
Posted at 11:34AM Jun 04, 2008 by The Java Tutorial Team | Comments[0]
HTML Component
The rapid growth of HTML as a basic application platform makes displaying web content a topical question for many developers and designers, whether this content is various web sites or static HTML pages. Therefore, the need has arisen to create a reusable HTML component that can be repeatedly used by different applications and modified according to current business needs. The Java™ platform enables all functionalities to create such cross-platform encapsulation.The HTML component provides a web viewer and full browsing functionality through its API. In particular, it supports events handling, for example, load progress, or URL traversed. The current implementation of the HTML component supports so called "street HTML", an HTML syntax which does not meet all requirements of the HTML specification, however, it is recognized by major world known browsers. Moreover, the component is implemented as lightweight in order to avoid allocating native resources in the operating system's windowing toolkit, and easy integrating with Java and JavaFX graphics libraries. The HTML component is based on WebKit, an open source web browser engine, which supports HTML4, CSS, JavaScript, DOM, SVG.
When designing an embedded browser instance, the following features are typically considered:
- Accessing certain domains
- Accessing the local file system
- Loading a URL
- Moving forward or backward in the browser's history
- Printing web page
- Reloading the current web page
- Stopping loading the web page in progress
- Support for JavaScript and plugins
The following structure depicts the internal architecture of the embedded browser.
Figure 1. The HTML component architecture
The JWebPane component provides basic web page browsing functionality. It renders web pages and provides basic user interaction, such as navigating links, and submitting HTML forms. The JWebPane component displays one web page at a time. The PolicyDelegate is intended for implementing a browser policy. Implementations may use arbitrary logic to enable or reject sensitive operations such as loading web pages, opening new browser windows or running scripts on pages. An implementation may thus act as a list-based URL filter or a popup blocker. A single PolicyDelegate may be associated with a JWebPane object. It then receives notifications from the JWebPane about changes to the browser state that are about to happen. The PolicyDelegate may either accept or reject these changes. The LoadStateListener tracks the state of a page load.
At the moment the project is 70% complete. The JWebPane component implemented as a lightweight component extending the JComponent class, which enables easy embedding into an application UI context. Moreover, the JWebPane component may contain several web frames with the specified icon, title, and URL. The following browsing features are available:
- Loading control — load, stop, and reload functions.
- Listeners handling. — typical function enabling a developer to get, add, and remove listeners.
- JavaScript support
- Page loading started
- HTTP server redirection processed
- Icon for the page received
- Page title received
- Page content loaded completely
- An image contained in the page loaded
- Page and all its resources loaded completely
- Loading Failed
Figure 2. The HTML component embedded into the JavaFX application Click the image to view it at its natural size.
The following new features are scheduled to be implemented by August'08:
- Viewing the History, including Back and Forward functions.
- Notifications of external resources loading
- Progress status
- Viewing page source
JWebPane component in the Artem Ananiev's Blog.
-- Alla Redko
Posted at 02:54PM May 30, 2008 by The Java Tutorial Team | Comments[3]
Preparing for Java Programming Language Certification
When we updated the core Java Tutorial to JDK 6, we included a page designed to help those who are studying for Java Programming Language Certification. This study guide calls out which portions of the tutorial are relevant to the testing objectives -- it is by no means comprehensive. Nor does it discuss the test and what to expect.We still sometimes receive questions on the tutorial feedback alias asking how to prepare for the Java Programmer Certification test. The book strongly recommended by our Java instructors and course developers is the Complete Java 2 Certification Study Guide by Philip Heller.
You can follow this thread on the Java Tutorials Community forum.
-- Sharon Zakhour
Posted at 07:48AM May 20, 2008 by The Java Tutorial Team | Comments[3]
DefaultTreeModel -- Adding, Removing and Updating Nodes
Many moons ago I had a discussion with Collin Fagan (Java Tutorial contributor and all around helpful guy) about the fact that I had seen some requests for a tutorial on how to add, remove and update nodes in a DefaultTreeModel.Collin wasted no time creating such an example. Unfortunately, resources being what they are, I wasn't able to get engineering cycles for reviewing the example. Because we generally don't include material that hasn't been reviewed by engineering, it was backburnered.
Meanwhile, Collin posted his example and some accompanying text, The Secret Life of a DefaultTreeModel on JavaLobby.
Collin has now posted his example on the JavaTutorials forum!
When you compile and run the example (it will run under JDK 5) it brings up a panel containing a tree with a root node. When you open the root node you'll see three child nodes. At this point you can right-click any of the nodes (control-click on a Mac) and you can add 50 children to the current selection, remove the current selection, or modify the text on the current selection.
Thanks for this very useful example, Collin!
-- Sharon Zakhour
Posted at 02:46PM May 16, 2008 by The Java Tutorial Team | Comments[0]
JTable: Freezing a column while scrolling the others
Have you ever needed to create a table that is too wide for the view so it requires a horitzonal scrollbar? OK, that's pretty routine. But have you then wanted one (or more) of the columns to remain fixed when you scroll the other columns?Over on the javatutorials portal Collin Fagan has posted an example that shows how to do just that. Check out Row Labels/Frozen Columns. (You'll have to scroll down through several posts to see it.)
Thanks Collin!
-- Sharon Zakhour
Posted at 02:51PM May 13, 2008 by The Java Tutorial Team | Comments[2]
Tutorial Examples and Model View Controller (MVC) Design
On the Java Tutorials Community Portal forum, developer Arjan Vermeij recently posted an update to an old Swing demo -- SliderDemo3. (Actually, he first posted his demo some time ago on a different java.net forum, but I asked him to post it on our forum.)I'm sure many of you are familiar with Model-View-Controller (MVC) design. If you aren't, the purpose of MVC design is to separate the data and logic from the GUI, or the display, of an application. In fact, Arjan has written an article on this very subject: A Generic MVC Model in Java if you would like more information.
For program design, this just makes good sense.
However, Arjan points out that we don't use MVC design in our tutorial examples. He has taken SliderDemo3 and re-designed it using MVC architecture. He illustrates the point of MVC design by extending the GUI of the example without affecting the rest of the code. It's nicely done.
I posted some commentary about his example in the slider-demo-3 thread. I won't repeat the whole entry here, but this is one of those trade offs we look at when working on the tutorial. To create tutorial examples with perfect design principles, we would have to bloat examples that are designed to illustrate a specific piece of information. Sometimes, we just don't want to do that.
However, I do think there is room for more sophisticated "real world" examples and we haven't addressed that need as well as we might. It's an issue I don't see being resolved in the near future, with resources being what they are.
This is why the Java Community Portal is a needed resource. People like Arjan can share and leverage this sort of information.
To follow (or contribute to) the discussion, check out the slider-demo-3 thread.
-- Sharon Zakhour
Posted at 08:06PM May 08, 2008 by The Java Tutorial Team | Comments[0]
JTable Examples
Earlier this week I announced the Java Tutorials Community Portal. On the portal there is a forum where you can enjoy tutorial-related chat. To kick things off, I started a thread asking what you would like to see added to theJTable tutorial. I want to thank Collin Fagan (aka aberrant) who has been posting some JTable examples.
Please check it out!
-- Sharon Zakhour
Posted at 12:38PM May 07, 2008 by The Java Tutorial Team | Comments[0]
Announcing the Java Tutorials Community Portal
You are most likely aware of the java.net community the place for Java information and collaboration. The Java Tutorials now have a presence on java.net The Java Tutorials Community Portal.This is the place to talk about the tutorials how you use them, how you extend them (or would like to), new tutorials you would like to see or even contribute. You can share ideas, curriculum, code examples (either new or modified from existing examples).
To participate on the wiki and the forum you need to register on java.net (it's free). That's all you need to do.
Hope to see you there!
-- Sharon Zakhour
Posted at 08:18AM May 05, 2008 by The Java Tutorial Team | Comments[0]
SwingSet3
If you program your GUI using Swing, you are probably familiar with the SwingSet2 demo that is bundled with the JDK. SwingSet2 was created for release 1.3 of the JDK. Are you aware that SwingSet3, for use with release Java SE 6 update 10, is now available on java.net?
This new version, written by Swing expert, Amy Fowler, boasts a slick GUI showcasing the Nimbus look and feel. This demo is visually beautiful and extensible, but what I really love is the new feature that allows you to view the code used to create and display the selected component. One half of a split pane displays the selected component and the other half shows the code. For some complex components, such as JTable and JButton, a combo box allows you to choose exactly what snippet of code produces a particular effect.
You can obtain SwingSet3 from swingset3.dev.java.net.
(If, like me, are you a Mac OS X user, you need to be running the latest version of JDK 6 from Apple that runs only under Leopard.)
Check it out!
-- Sharon Zakhour
Posted at 02:51PM Apr 22, 2008 by The Java Tutorial Team | Comments[2]
Books about Java
Most of you are aware that the Java Tutorial is available as a published book, but sometimes we are asked what portion of the website is included in the published book. The answer to that can be found on the tutorial's main page, but sometimes people miss the information.If you look at the tutorial's main page, you will see the section titled Trails Covering the Basics. Everything listed in that section is included in the printed book.
I should add that, as of the last report I received from Addison Wesley, there are German, Japanese and "simplified" Chinese translations of the book available.
Once you've mastered the basics of Java, what other books are recommended?
My favorite book that takes you to the next level is Effective Java by Joshua Bloch. (I see there is a 2nd edition in the works.) Josh has been a contributor to the Java Tutorials (he wrote the Collections lesson). Effective Java is an excellent resource for the Java programmer, full of nuggets you might not find anywhere else. The first section is a useful discussion of garbage collection. I highly recommend it.
Another book I like for those who write Swing applications is Swing Hacks: Tips and Tools for Killer GUIs by Joshua Marinacci. Josh is a former member of the Swing team and he really knows how to exploit the features of Swing. This book contains many nuggets on how to do exactly that. For the basics, I recommend our own Swing tutorial (the online version reflects release 6 though the most recent printed version reflects release 1.4), but then you should check out Josh's book to take it to the next level.
-- Sharon Zakhour
Posted at 08:00AM Apr 16, 2008 by The Java Tutorial Team | Comments[2]
Thursday Jul 03, 2008