By Mark Andrews
Even
before JFCTM/Swing 1.1.1 graduated
from beta status and became an officially released product, the
Swing Team was already hard at work on its next project: the JFC/Swing
portion of JDKTM 1.3, code-named
"Kestrel," which is currently scheduled for release during
the first quarter of 2000.
This article briefly summarizes the Swing upgrades that will be
incorporated into Kestrel, and supplies links to a pair of much
more detailed engineering documents that examine the upcoming changes
more closely.
The document detailing overall Swing improvements is titled "Swing
API Changes for Kestrel." The other document -- titled "Keyboard
Bindings in Swing" -- defines a new set of APIs that unify
the keyboard bindings and also offer other benefits, such as enabling
the sharing of keymaps and disconnecting bindings from UI-specific
actions.
Both these documents include generous amounts of source code illustrating
the changes they describe. To examine or download them, click the
appropriate button:
This article presents a very compressed summary of the Swing improvements
that are described more verbosely in the two documents linked to
the buttons. This article is divided into two main sections:
Swing Improvements Planned in Kestrel
This section presents a complete listing of Swing improvements
currently planned for incorporationi into Kestrel.
The JTree Class
- New property for configuring how many mouse clicks are needed
to expand/collapse a node.
- New methods for getting and setting lead paths and anchor paths.
- Change in the status of the hasFocus instance variable from
private to protected.
- New isAddedPath()
method to identify any paths that have been added to a selection.
- New expandSelectedPaths
property (with get and set methods).
- New removeDescendantSelectedPaths()
method.
- DefaultTreeSelectionModel.insureUniqueness()
method removed (replaced by an empty stub) due to obsolesence.
The JTable Class
- Column and row layout improvements.
- New SizeSequence class that efficiently maintains an ordered
list of sizes and corresponding positions of rows and columns.
The JSplitPane Class
- New resizeWeight
property.
- dividerLocation
property now bound.
- New adjustable border on the divider.
JFileChooser Class
- New method showing whether the AcceptAllFileFilter
property is being used.
- New support for removing the OK and Cancel buttons.
JButton, JCheckBox, and JRadioButton
- New method for specifying whether a button border should be
painted flat.
- New getGroup()
method added to the DefaultButtonModel.
The MDI Classes (JInternalFrame, et al)
- New JInternalFrame setLayer()method.
- New BasicInternalFrame uninstallListeners()
method.
- New doDefaultCloseAction()
method added to detect when the user performs a "Close"
action on an internal frame -- for example, by clicking a close
button.
- New setLayer(int)
override added so the beans introspector will recognize the results
of setLayer().
- New getNormalBounds()method
added to the JInternalFrame class.
- New setNormalBoundsForFrame()
method added to the DesktopManager class.
- New getFocusOwner()
method for the JInternalFrame class.
- New getInternalFrame()
method for the JInternalFrame class.
- Privacy status of MotifInternalFrameTitlePane changed from package-private
to public.
- New restoreSubcomponentFocus()
method for the JInternalFrame class.
JTabbedPane
- New toolTipTextAt
indexed property.
The Swing Text Package
- insertAtBoundry()
method replaced by insertAtBoundary()
and deprecated (due to a spelling correction in the name of the
method)
- LabelView2D replaced by new GlyphView class for the sake of
i18n compatibility.
- New GlyphView.GlyphPainter.getNextPositionFrom()
method provides a way to determine the next visually represented
model * location that one might place a caret.
- Default functionality of managing the DocumentEvent moved out
of CompositeView class and distributed among several other classes.
- New axis property
(with get and set methods) added to BoxView.
- New BoxView layoutChanged()
method.
- New FlowView class with ParagraphView extension.
- FormView localization: SUBMIT and RESET will be deprecated,
and the values they previously provided will now be obtained from
the UIManager properties:
FormView.submitButtonText
and FormView.resetButtonText .
- New support for serialization in the HTML package.
- New exposure of a group of methods to simplify the insertion
of arbitrary HTML into an existing HTML document.
- New ZoneView class to support zones that don't consume much
memory until actively viewed or edited.
- New AsyncBoxView class (for details, see the article titled
Concurrency
in the Swing Text Package).
- New getGraphics()
method added to View class.
Scrolling (JViewport, JScrollPane, et al)
- New JViewport scrollMode
property added to increase scrolling speed.
Printing
- New JComponent methods: printBorder(),
printComponent(),
printChildren().
Added for sake of consistency with the painting methods.
Input Verification
- New VerifierTest class designed to help clients support smooth
focus navigation through GUIs with text fields.
Borders
- New createEtchedBorder()
and LineBorder()
methods added to the Border class.
- MetalUtils.TableHeader
border will be moved from the plaf.metal.MetalUtils class
to plaf.metal.MetalBorders, and will be made public. This
change will provide it with access from the Proxy.
Actions
- New setAction()
and getAction()
methods added to AbstractButton.java.
- New
configurePropertiesFromAction()
and createActionPropertyChangeListener()
methods added to AbstractButton.java.
- New constructors added to the ActionEvent sources to allow for
creating a control directly with the supplied Action.
- Equivalent constructors added to:
- JCheckBox.java.
- JRadioButton.java.
- JToggleButton.java.
- JMenuItem.java.
- JMenu.java.
- JCheckBoxMenuItem.java.
- JRadioButtonMenuItem.java.
- JComboBox.java.
- JTextField.java.
- Kestrel will provide a new set of factory methods will allow
the to control what toolbars and menus create when an action is
added directly (using the add()
method). These new methods are:
- A new createActionComponent()
method for the JToolbar class.
- A new createActionComponent()
method for the JMenu class.
- A new createActionComponent()
method for the JPopupMenu class.
- Two new Action constants: ACCELERATOR_KEY, and MNEMONIC_KEY.
- New getKeys()
method added to the AbstractAction class.
JToolBar
- A new constructor has been added to the JToolBar class. The
constructor takes one String parameter: A name that is used as
the name of the title toolbar's window when it is undocked.
JMenu, JMenuBar, et al
- Protected status has been assigned to the JMenuBar getPopupMenuOrigin()
method.
- The BasicMenuUI's installComponents()
and uninstallComponents()
methods have be assigned protected status. These methods were
previously private.
- A new method named isPopupTrigger()
has been added to the JPopupMenu class.
JFrame
- An EXIT_ON_CLOSE constant has been added to JFrame. This constant
tells when the frame closes the application should exit.
Listener Lists
- A
getListeners() method has been added to each
of the following classes:
- Timer.java
- AbstractListModel.java
- DefaultBoundedRangeModel
- DefaultButtonModel
- DefaultComboBoxModel
- DefaultListSelectionModel
- DefaultSingleSelectionModel
- MutableComboBoxModel
- colorchooser/DefaultColorSelectionModel
- table/AbstractTableModel
- table/DefaultTableColumnModel
- tree/DefaultTreeModel
- tree/DefaultTreeSelectionModel
- text/AbstractDocument
- text/DefaultCaret
- text/StyleContext
- event/EventListenerList
New LazyValue Class Improves Loading Speed
- A new Kestrel class named LazyValue which can be used to delay
loading of the class for an instance that is being created, resulting
in a significant increase in loading speed. The cost is small:
a slight reduction in performance the first time createValue()
is called.
Keyboard Bindings in Kestrel
- A new document titled "Keyboard
Bindings in Swing" defines a new set of APIs that unifies
the keyboard bindings currently used in Swing and also helps to:
- Disconnect bindings from UI-specific actions.
- Enable keymap sharing.
- Make tables of bindings easier to read.
- Expose the complete list of actions a component supports.
Developers should be able to extend this list easily.
- Satisfy the need for a set of self-documenting keyboard-binding
APIs.
|