|
Java TCP Sockets and Swing Tutorial
This tutorial is aimed for programmers with at least a little experience with Java.
|
|
MVC meets Swing
The designers of the Swing user interface components of the Java Foundation Classes (JFC) designed each component around a pattern called Model/View/Controller (MVC). The result is a user interface toolkit of almost unmatched flexibility. This month we'll explore Swing's underpinnings and build our own user interface components.
|
|
JFC: An in-depth look at Sun's successor to AWT
At last Sun is responding to complaints of the inadequacy of the Abstract Windowing Toolkit (AWT). The Java Foundation Classes (JFC) provide developers with a rich UI toolkit, making world-class user interface development with Java a reality. This article looks at JFC in depth, compares JFC with Microsoft's Application Foundation Classes (AFC), and reviews several recent JFC-specific conference sessions
|
|
Multithreaded Swing Applications
Swing components are not inherently thread safe, and as a general rule, after Swing components have been made visible on the screen, you can only safely modify their data from the event thread. If you modify Swing component data from any thread other than the event dispatching thread, you must take precautions to ensure data integrity. An exception to this rule is the setText method on a JTextComponent or any of its subclasses, or any Swing component method whose documentation explicitly states it is thread safe.
|
|
CONCURRENCY IN SWING TEXT
Concurrency in GUIs has often been a subject of controversy. JFCTM/Swing, while not entirely thread-safe, does offer some support for concurrency in key areas. This support simplifies the programming of simple tasks, while leaving the door open for the creation of more complex applications.
|
|
Threads and Swing
This article about multithreading in Swing was archived in April 1998. A month later, we published another article, "Using a Swing Worker Thread", expanding on the subject. For a better understanding of how multithreading works in Swing, we recommend that you read both articles.
|
|
Using a Swing Worker Thread
This article gives examples of using the SwingWorker class. The purpose of SwingWorker is to implement a background thread that you can use to perform time-consuming operations without affecting the performance of your program's GUI. For basic information about SwingWorker, see Threads and Swing.
|
|
The Last Word in Swing Threads
This is not an article in any particular series, but it is the third article that The Swing Connection has published on the use of threads in Swing.
|
|
SwingWorker Update Fixes Subtle Bug
An updated version of SwingWorker (which we'll call SwingWorker 3) is now available.
|
|
Create a scrollable virtual desktop in Swing
The JScrollableDesktopPane class builds upon the Swing component classes JDesktopPane, JScrollPane, JToolBar, and JMenu to provide a virtual desktop environment replete with dynamic scroll bars, dynamic menus, and dynamic button shortcuts. JScrollableDesktopPane interfaces seamlessly with current JDesktopPane implementations, allowing you to easily enhance existing Java Multiple Document Interface (MDI) applications.
|
|
Implement a J2EE-aware application console in Swing
Learn the fundamentals of Swing while creating a command console to control complex enterprise applications. A console provides a window into a system's operation and allows operators to configure, monitor, and control the system in real time. This article shows how to construct a generic console from Swing components that uses the Java Messaging Service (JMS) to interact with one or more application subsystems.
|
|
Java Tip 119: Don't know much about file history?
Many file processing applications have a history mechanism that tracks the last processed files. Typically these filenames are appended to the bottom of a File menu in the order you have processed them. This tip provides a class that encapsulates all the code you need to add such a file history mechanism to your own application. Discover the key "hot spots" to link the mechanism into the JFrame used to build the heart of your application. The code is based on Swing, as provided with JDK 1.2 or JDK 1.3.
|
|
Java Tip 116: Set your table options -- at runtime!
Enhance the display and usability of JTable
The JTable class offers rich functionality for grid-like data display. This Java tip addresses common display issues related to dynamically changing such things as scroll bars, column width, and row height.
|
|
Conquer Swing deficiencies in MDI development
You can easily overcome some notable Swing deficiencies when creating Multiple Document Interface (MDI) applications. In particular, this article shows you how to simply add scrolling and a standard windows menu to your MDI apps.
|
|
Embed Java code into your native apps
Embedding Java code into a Unix application developed in C or C++ can create problems related to GUIs or threads synchronization. In this article, Thierry Manfé implements a solution that relies on a good understanding of the Unix APIs and robust software architecture
|
Java Tip 109: Display images using JEditorPane
To display HTML in a JEditorPane, you would normally specify a URL that sets the document base of the HTMLDocument. However, if the HTML text is not stored in a file locally or on the Web, you cannot set the HTMLDocument document base. That becomes a problem when the tag uses a relative path to specify the image location, but it can be overcome by modifying JEditorPane and its associated classes.
|
|
Browse user interfaces for Jini services
The ServiceUI specification developed by the Jini.org community defines a suggested procedure for attaching user interfaces to Jini services. In this article, Jeffrey Peden -- a new contributor to the Jiniology column -- introduces you to a simple ServiceUI-based example service. Then he shows you how to build an application for browsing and launching user interfaces for Jini services.
|
|
Speed up file searching in JFileChooser
Traditionally, users choose files by scrolling the file chooser's list with their mice. You can speed that process by enhancing JFileChooser with a type-ahead method: the user just types the first few characters of a filename to select the desired file. This article shows you how to do just that. Plus, you'll learn how to register listeners on a compound component's descendants to extend JFileChooser's functionality.
|
|
Become a programming Picasso with JHotDraw
Design patterns and frameworks have a mutually beneficial relationship. A well-known example of this is JHotDraw, a highly customizable GUI framework that simplifies developing drawing applications. This article explains the JHotDraw framework and general framework principles in terms of several important design patterns. You'll develop a class diagram editor that demonstrates JHotDraw's usage and capabilities.
|
|
Java Tip 104: Make a splash with Swing
Creating splash screens in Java by using AWT and Swing is well documented in the current literature. However, the existing solutions are not fully featured in that documentation and do not explain all the intricacies of threading in Swing. This tip presents a splash-screen component on which the user can click to make it disappear. In addition, the component will also have a timer controlling the splash screen so that it will automatically disappear after a set period of time.
|
|
Make bad users behave by using JFC documents -- revisited
Upon reading the insertString() method I was a little surprised to see that it checked only the offset at which characters were being inserted, not the length of the document. I did a quick cut and paste and compiled the code. Sure enough: If you place the insertion point anywhere but at the end of the text you can insert more than limit characters up until the insertion point reaches limit.
|
|
Build a better mouse trap
What is the difference between the mouseClicked() and mousePressed() methods of the MouseListener interface?
|
|
JFC actions
Currently, the JFC provides the Action interface as a mechanism to detach GUI logic from the user interface code. By taking the JFC Action interface and applying the Command pattern, we can further separate logic from the GUI. This article, authored by Tony Sintes, will step you through an extension of the JFC Action that incorporates Java interfaces and the Command pattern. The approach outlined here enables you to easily develop portable GUI features
|
|
Add snap to a recurring GUI device
This article presents the design of a rubber band class hierarchy that you can reuse and extend. With these classes a programmer can add rubber bands to any GUI. Furthermore, the article shows how these classes can provide surprising functionality.
|
|
Java 2 introduces print capability to the Swing Forum
This installment of Java Step By Step focuses on adding print functionality to a Swing application. Michael begins by covering the fundamentals of the new Java 2 printing system and its mechanisms. He then steps through the addition of background print functionality to the Swing Forum.
|
|
Start customizing Swing's editor pane -- patch the Swing HTMLEditorKit
Swing's JEditorPane allows you to quickly and easily produce simple browsers or hyperlinked help facilities, but there's a hitch -- the mouse doesn't change when you're over a hyperlink. Swing expert Marc Loy shows you how to fix this minor annoyance with a small amount of code. In the process, he gives you the tools to start customizing the editor pane to do more for you than any browser or help system out there.
|
|
It don't mean a thing if it ain't got that Swing: A comparative review of four JFC/Swing books
Java Foundation Classes (JFC) and its crown jewel, Swing, are close to becoming ripe-to-pick Java APIs that will revolutionize Java GUI design and implementation. An initial wave of books focusing on these topics is hitting the shores of your local (and not-so-local) bookstores. Our lonely Robinson Crusoe book reviewer combed the beaches in a quest for stranded treasures -- and left the rest to the crabs and seagulls.
|
|
Developers say Sun should keep its Swing package promise for JDK 1.2
When JavaWorld followed the suggestion of several readers to run a poll in early August asking "Where would you like to see Swing packaged for use with JDK 1.2?" we thought it would generate lots of attention. But the number of votes and comments we've received over the past two weeks exceeded even our less-than-modest expectations. The packaging of Swing -- the broad set of GUI components at the heart of Sun's Java Foundation Classes software (JFC) -- is definitely a hot topic among Java developers.
|
|
Swing's house-hunting days may be over
Developers may be having trouble keeping up with the location of Swing, Sun's GUI toolkit. When Sun saw the results of a recent JavaWorld reader poll on this topic, the company decided to rethink its strategy yet again. Read this breaking news article for the latest info on where Swing will live (yes, it has moved yet again!) and find out how to tell Sun what you think of these new plans.
|
|
Focus on Swing
The Java Foundation Classes (JFCs) include an extensible focus manager for Swing components, which provides more flexibility in managing focus changes than the focus manager previously available for AWT components. This article explores several different techniques for managing focus traversal with Swing components. It is relevant for novice as well as advanced Java programmers.
|
|
Add an undo/redo function to your Java apps with Swing
Users make mistakes, and as developers it's important that we help them recover gracefully from mistakes by including support for undo in our user interfaces. The new undo/redo mechanism available in Swing allows us to do just that. This article describes how to add undo/redo capabilities to Java applications. It explains the design of an undo/redo mechanism by introducing the Command pattern and Swing's support for the pattern. In addition, the author provides an overview of Swing's undo mechanism and a sample applet that demonstrates the concept.
|
|
Get ready to Swing (1.0)
One of the most important features of Swing 1.0, a lightweight set of components due out later this month, is its pluggable look-and-feel architecture -- a feature that lets you choose a preset look and feel, or craft your own custom appearance and behavior for controls. In this overview, we'll preview Swing's pre-defined look-and-feel schemes and take a quick look at what's included in this hot new component set before it makes its public debut.
|
|
JFC vs. AFC: Which GUI toolkit should you use?
Last month JavaWorld published two news articles discussing Sun's Java Foundation Classes (JFC) and Microsoft's Application Foundation Classes (AFC). This month we take a more technically detailed look at JFC and AFC. This article analyzes the two GUI toolkits with focus on the issues of architectural structure, usability, efficiency, flexibility, extensibility, and portability.
|
|
JFC and AFC debate creates confusion, demands choices
Sun, Netscape, IBM, and others have produced JFC -- Java Foundation Classes -- while Microsoft produced AFC -- Application Foundation Classes. JFC is soon to be defined as part of core Java. The world's largest software firm will once again be the odd man out when it comes to Java, requiring developers to worry about issues that should to be solved. Read on for an in-depth look at how the packages stack up (with pros and cons summaraized) -- and insights and advice from some experienced developers, who describe how they view their choices.
|
|
JFC: An in-depth look at Sun's successor to AWT
JFC and AFC debate creates confusion, demands choices
At last Sun is responding to complaints of the inadequacy of the Abstract Windowing Toolkit (AWT). The Java Foundation Classes (JFC) provide developers with a rich UI toolkit, making world-class user interface development with Java a reality. This article looks at JFC in depth, compares JFC with Microsoft's Application Foundation Classes (AFC), and reviews several recent JFC-specific conference sessions
|