OSDN Git Service

2005-02-15 Mark Wielaard <mark@klomp.org>
authorgraydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Feb 2005 20:03:29 +0000 (20:03 +0000)
committergraydon <graydon@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Feb 2005 20:03:29 +0000 (20:03 +0000)
* java/awt/BasicStroke.java (hashCode): Check for null dash.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/peer/gtk/GtkArg.java,
gnu/java/awt/peer/gtk/GtkArgList.java:
Removed.

2005-02-15  Craig Black  <craig.black@aonix.com>

* gnu/java/awt/peer/gtk/GtkCheckboxMenuItem.java
(postMenuActionEvent): Implement to notify ItemListeners.
* java/awt/CheckboxMenuItem.java
(dispatchEventImpl): Update state on ItemEvent.
* java/awt/MenuItem.java
(processActionEvent): Retarget event source.

2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>

* gnu/java/awt/color/ClutProfileConverter.java,
gnu/java/awt/peer/ClasspathTextLayoutPeer.java,
gnu/java/awt/peer/gtk/GdkFontPeer.java,
gnu/java/awt/peer/gtk/GdkGlyphVector.java,
gnu/java/awt/peer/gtk/GdkGraphics2D.java,
gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
gnu/java/awt/peer/gtk/GdkRobotPeer.java,
gnu/java/awt/peer/gtk/GdkTextLayout.java,
gnu/java/awt/peer/gtk/GtkButtonPeer.java,
gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
gnu/java/awt/peer/gtk/GtkChoicePeer.java,
gnu/java/awt/peer/gtk/GtkComponentPeer.java,
gnu/java/awt/peer/gtk/GtkContainerPeer.java,
gnu/java/awt/peer/gtk/GtkDialogPeer.java,
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
gnu/java/awt/peer/gtk/GtkFontPeer.java,
gnu/java/awt/peer/gtk/GtkFramePeer.java,
gnu/java/awt/peer/gtk/GtkLabelPeer.java,
gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,
gnu/java/awt/peer/gtk/GtkToolkit.java,
gnu/java/awt/peer/gtk/GtkWindowPeer.java,
javax/swing/JPopupMenu.java,
javax/swing/JSpinner.java,
javax/swing/SortingFocusTraversalPolicy.java,
javax/swing/SwingUtilities.java,
javax/swing/plaf/basic/BasicComboBoxEditor.java,
javax/swing/plaf/basic/BasicComboBoxRenderer.java,
javax/swing/tree/DefaultMutableTreeNode.java:
Removed unused imports and expanded starred
imports.

2005-02-15  Mark Wielaard  <mark@klomp.org>

* java/awt/AWTKeyStroke.java (getAWTKeyStroke(String)): Throw
IllegalArgumentException when the given String is null.

* javax/swing/KeyStroke.java (getKeyStroke(String)): Return null
when given keystoke sequence cannot be parsed.

* javax/swing/JRootPane.java (setJMenuBar): Remove current menubar
if one is installed. Only install the given menubar is not null.

* javax/swing/JViewport.java (getViewSize): Return an empty
Dimension when the view isn't set or preferred component size when
no viewSize is set.

* javax/swing/ViewportLayout.java (preferredLayoutSize): Return an
empty Dimension when there is no view set.
(minimumLayoutSize): Likewise.
(layoutContainer): Don't try to layout when there is no view.

2005-02-15  Anthony Green  <green@redhat.com>

* jni/gtk-peer/gtk_jawt.c (classpath_jawt_get_drawable,
classpath_jawt_lock, classpath_jawt_unlock): New functions.
* jawt.c (_Jv_JAWT_Lock, _Jv_JAWT_Unlock): New functions.
(_Jv_GetDrawingSurface): Set visualID.
(_Jv_FreeDrawingSurfaceInfo): Clear visualID.
(JAWT_GetAWT): Set Lock and Unlock.
* include/jawt_md.h (struct _JAWT_X11DrawingSurfaceInfo): Add visualID.
* include/jawt.h (JAWT_VERSION_1_4, JAWT_LOCK_ERROR,
JAWT_LOCK_CLIP_CHANGED, JAWT_LOCK_BOUNDS_CHANGED,
JAWT_LOCK_SURFACE_CHANGED): New macros.
(struct _JAWT): Add Lock and Unlock.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* jawt.c: New file.
* include/jawt.h: Likewise.
* include/jawt_md.h: Likewise.
* include/Makefile.am (tool_include__HEADERS): Add jawt.h and
jawt_md.h files.
* jni/classpath/classpath_jawt.h: Likewise.
* jni/gtk-peer/gtk_jawt.c: Likewise.
* Makefile.am: Build libjawt.so.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/peer/gtk/GdkGraphics2D.java:
Merged file header with classpath CVS head.
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
Merged code formatting with classpath CVS head.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c:
Removed debug code.
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
Handle special JNI strings with 2 '\0' at the end.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
Merged file header with classpath CVS head.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
Merged code formatting with classpath CVS head.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (create):
Use GTK's built-in file system backend.  Use GTK_RESPONSE_ACCEPT.
(handle_response): Use GTK_RESPONSE_ACCEPT.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* Makefile.am: Fix library build breakage.
* Makefile.in: Regenerate.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTabbedPane.java
(Page.setDisplayedMnemonicIndex): Handle empty menmonic.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/tree/DefaultMutableTreeNode.java:
Reworked Javadocs all over.
(getPathToRoot): Fixed direction of result array initialization.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
 Fix includes for cairo 0.3.0 snappshot.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
Merged file header from classpath CVS HEAD.

2005-02-15  Craig Black  <craig.black@aonix.com>

* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
(copyState): Pass a JNI global reference to signal handler.
(realize_cb): Use and free JNI global reference.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
(create): Pass a JNI global reference to signal handler.
(selection_changed): Match declaration.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
(dispose): Do not remove entries from state tables until after widget is
destroyed.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/Container.javai (paramString):
If layoutMgr is null just return result of super.paramString().
* java/awt/Scrollbar.java: Reformatted.
* java/awt/im/InputContext.java (static):
Removed redundant initializations.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/ImageIcon.java,
javax/swing/UIManager.java,
javax/swing/text/EditorKit.java,
javax/swing/text/Segment.java:
More whitespace cleanups.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/EmbeddedWindow.java,
gnu/java/awt/image/ImageDecoder.java,
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
java/awt/DefaultKeyboardFocusManager.java,
java/awt/Frame.java,
java/awt/image/RGBImageFilter.java,
javax/swing/AbstractButton.java,
javax/swing/ActionMap.java,
javax/swing/ComponentInputMap.java,
javax/swing/DefaultDesktopManager.java,
javax/swing/ImageIcon.java,
javax/swing/InputMap.java,
javax/swing/JButton.java,
javax/swing/JCheckBox.java,
javax/swing/JCheckBoxMenuItem.java,
javax/swing/JEditorPane.java,
javax/swing/JMenu.java,
javax/swing/JMenuItem.java,
javax/swing/JOptionPane.java,
javax/swing/JRootPane.java,
javax/swing/JTable.java,
javax/swing/MenuSelectionManager.java,
javax/swing/RepaintManager.java,
javax/swing/ScrollPaneLayout.java,
javax/swing/SortingFocusTraversalPolicy.java,
javax/swing/UIManager.java,
javax/swing/ViewportLayout.java,
javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java,
javax/swing/plaf/basic/BasicInternalFrameUI.java,
javax/swing/plaf/basic/BasicLabelUI.java,
javax/swing/plaf/basic/BasicListUI.java,
javax/swing/plaf/basic/BasicMenuItemUI.java,
javax/swing/plaf/basic/BasicMenuUI.java,
javax/swing/plaf/basic/BasicOptionPaneUI.java,
javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java,
javax/swing/plaf/basic/BasicRootPaneUI.java,
javax/swing/plaf/basic/BasicScrollPaneUI.java,
javax/swing/plaf/basic/BasicSplitPaneDivider.java,
javax/swing/plaf/basic/BasicTextUI.java,
javax/swing/table/TableColumnModel.java,
javax/swing/text/AbstractDocument.java,
javax/swing/text/EditorKit.java,
javax/swing/text/Position.java,
javax/swing/text/Segment.java,
javax/swing/text/StyledEditorKit.java,
javax/swing/text/ViewFactory.java:
Cleanup whitespace differences to classpath CVS HEAD.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
(finalize): Call finish from here.
(produce): Not from here.
* Makefile.am (gtk_c_source_files):
Remove jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c.
* Makefile.in: Regenerate.
* gnu/java/awt/peer/gtk/GdkGraphics2D.java
(cairoSetFont):
(cairoDrawGdkTextLayout):
(cairoDrawString):
(getPeerTextMetrics):
(getPeerFontMetrics): Remove.
(setFont): Don't call cairoSetFont.
(cairoDrawGlyphVector): Accept font peer argument.
(drawGlyphVector): Pass font peer to cairoDrawGlyphVector.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
(ensure_metrics_cairo):
(gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont):
(gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString):
(gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics):
(gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics):
(metrics_cairo):
(metrics_surface): Remove.
(gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector):
Pass and install font peer.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* Makefile.am: Create "split library" structure.
* Makefile.in: Regenerate.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:
Release GDK lock during upcalls.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Remove.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics):
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics): New methods.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c: Remove.
* gnu/java/awt/peer/gtk/GdkFontPeer.java
(getGlyphVector):
(getFontMetrics):
(getTextMetrics): New native methods.
* gnu/java/awt/peer/gtk/GdkFontMetrics.java: Remove native parts.
* gnu/java/awt/peer/gtk/GdkGlyphVector.java: Likewise.
* Makefile.am: Remove native entries for GdkFontMetrics, GdkGlyphVector.
* Makefile.in: Regenerate.

2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>

* javax/swing/SwingUtilities.java:
(getAccessibleAt(java.awt.Component, java.awt.Point)):
Implemented and documented.
(getAccessibleChild(java.awt.Component, int)): Likewise.
(getAccessibleChildrenCount(java.awt.Component)): Likewise.
(getAccessibleIndexInParent(java.awt.Component)): Likewise.
(getAccessibleStateSet(java.awt.Component)): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/SwingUtilities.java
(getFontMetrics): Removed.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/Container.java
(paramString): Implemented.
* javax/swing/AbstractButton.java
(paramString): Implemented.
* javax/swing/JComponent.java
(paramString): Implemented.
* javax/swing/JMenu.java
(paramString): Implemented.
* javax/swing/JMenuBar.java
(paramString): Implemented.
* javax/swing/JMenuItem.java
(paramString): Implemented.
* javax/swing/JPopupMenu.java
(paramString): Implemented.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JMenu.java
(uiClassID): Removed.
(JMenu): Set invoker on popup menu.
(getUIClassID): Return id directly.
(getItemCount): Simply return getMenuComponentCount().
Fixed javadoc.
(isTopLevelMenu): Simplified.
* javax/swing/JMenuItem.java
(uiClassID): Removed.
(getUIClassID): Return id directly.
* javax/swing/JPopupMenu.java
(uiClassID): Removed.
(JPopupMenu): Always initialize correctly.
(getSubElements): Only return components implementing MenuElement
interface.
(HeavyWeightPopup.hide): Removed.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/image/ReplicateScaleFilter.java
(replicatePixels): Made private.
* javax/swing/colorchooser/DefaultRGBChooserPanel.java
(DefaultRGBChooserPanel): Made package private.
* javax/swing/colorchooser/DefaultSwatchChooserPanel.java
(RecentSwatchPanel): Likewise.
* javax/swing/event/MouseInputAdapter.java: Reformatted.
(MouseInputAdapter): Made abstract.
* javax/swing/tree/DefaultMutableTreeNode.java
(random): Removed.
(growTree): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/dnd/DropTarget.java (addDropTargetListener):
Clarified comments.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JComponent.java (getComponentGraphics):
Removed accidently commited code.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* java/awt/dnd/DropTarget.java
(addDropTargetListener): Despite documentation, do not throw.
* javax/swing/JComponent.java: Set a default DropTarget.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/AbstractAction.java
(ENABLED_PROPERTY): Removed.
(setEnabled): Replaced constant with real string.
* javax/swing/AbstractButton.java
(createActionPropertyChangeListener.propertyChange): Likewise.
* javax/swing/JComboBox.java
(DEFAULT_MAXIMUM_ROW_COUNT): Made private.
(EDITABLE_CHANGED_PROPERTY): Removed.
(MAXIMUM_ROW_COUNT_CHANGED_PROPERTY):Likewise.
(ENABLED_CHANGED_PROPERTY):Likewise.
(RENDERER_CHANGED_PROPERTY):Likewise.
(EDITOR_CHANGED_PROPERTY):Likewise.
(MODEL_CHANGED_PROPERTY):Likewise.
(uiClassID):Likewise.
(getUIClassID): Replaced constant with real string.
(setModel):Likewise.
(setEditable):Likewise.
(setMaximumRowCount):Likewise.
(setRenderer):Likewise.
(setEditor):Likewise.
(setEnabled):Likewise.
* javax/swing/JLabel.java
(DISABLED_ICON_CHANGED_PROPERTY): Removed.
(DISPLAYED_MNEMONIC_CHANGED_PROPERTY): Likewise.
(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY): Likewise.
(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY): Likewise.
(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY): Likewise.
(ICON_CHANGED_PROPERTY): Likewise.
(ICON_TEXT_GAP_CHANGED_PROPERTY): Likewise.
(LABEL_FOR_CHANGED_PROPERTY): Likewise.
(TEXT_CHANGED_PROPERTY): Likewise.
(VERTICAL_ALIGNMENT_CHANGED_PROPERTY): Likewise.
(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY): Likewise.
(setText): Replaced constant with real string.
(setIcon): Likewise.
(setDisabledIcon): Likewise.
(setDisplayedMnemonic): Likewise.
(setIconTextGap): Likewise.
(setVerticalAlignment): Likewise.
(setHorizontalAlignment): Likewise.
(setVerticalTextPosition): Likewise.
(setHorizontalTextPosition): Likewise.
(setLabelFor): Replaced constant with real string.
Fire property change event after property got changed.
* javax/swing/JList.java
(CELL_RENDERER_PROPERTY_CHANGED): Likewise.
(FIXED_CELL_HEIGHT_PROPERTY_CHANGED): Likewise.
(FIXED_CELL_WIDTH_PROPERTY_CHANGED): Likewise.
(LAYOUT_ORIENTATION_PROPERTY_CHANGED): Likewise.
(MODEL_PROPERTY_CHANGED): Likewise.
(PROTOTYPE_CELL_VALUE_PROPERTY_CHANGED): Likewise.
(SELECTION_BACKGROUND_PROPERTY_CHANGED): Likewise.
(SELECTION_FOREGROUND_PROPERTY_CHANGED): Likewise.
(SELECTION_MODEL_PROPERTY_CHANGED): Likewise.
(setFixedCellWidth): Reimplemented.
(setFixedCellHeight): Exit if new value is identical.
Replaced constant with real string.
(setSelectionBackground): Likewise.
(setSelectionForeground): Likewise.
(setPrototypeCellValue): Likewise.
(setCellRenderer): Replaced constant with real string.
(setModel): Likewise.
(setSelectionModel): Likewise.
* javax/swing/JMenuBar.java
(BORDER_PAINTED_CHANGED_PROPERTY): Removed.
(MODEL_CHANGED_PROPERTY): Likewise.
(MARGIN_CHANGED_PROPERTY): Likewise.
(setBorderPainted): Reimplemented.
(setMargin): Likewise.
(setSelectionModel): Replaced constant with real string.
* javax/swing/JPopupMenu.java
(LABEL_CHANGED_PROPERTY): Removed.
(VISIBLE_CHANGED_PROPERTY): Likewise.
(borderPainted): Likewise.
(setLabel): Replaced constant with real string.
(setVisible): Exit if new value is identical.
Replaced constant with real string.
* javax/swing/JProgressBar.java
(BORDER_PAINTED_CHANGED_PROPERTY): Removed.
(ORIENTATION_CHANGED_PROPERTY): Likewise.
(STRING_CHANGED_PROPERTY): Likewise.
(STRING_PAINTED_CHANGED_PROPERTY): Likewise.
(INDETERMINATE_CHANGED_PROPERTY): Likewise.
(setOrientation): Replaced constant with real string.
(setStringPainted): Likewise.
(setString): Likewise.
(setBorderPainted): Likewise.
(setIndeterminate): Likewise.
* javax/swing/JScrollBar.java
(BLOCK_INCREMENT_CHANGED_PROPERTY): Removed.
(MODEL_CHANGED_PROPERTY): Likewise.
(ORIENTATION_CHANGED_PROPERTY): Likewise.
(setOrientation): Replaced constant with real string.
(setModel): Likewise.
(setUnitIncrement): Likewise.
(setBlockIncrement): Likewise.
* javax/swing/JScrollPane.java
(COLUMN_HEADER_CHANGED_PROPERTY): Removed.
(COMPONENT_ORIENTATION_CHANGED_PROPERTY): Likewise.
(HORIZONTAL_SCROLLBAR_CHANGED_PROPERTY): Likewise.
(HORIZONTAL_SCROLLBAR_POLICY_CHANGED_PROPERTY): Likewise.
(LAYOUT_CHANGED_PROPERTY): Likewise.
(ROW_HEADER_CHANGED_PROPERTY): Likewise.
(VERTICAL_SCROLLBAR_CHANGED_PROPERTY): Likewise.
(VERTICAL_SCROLLBAR_POLICY_CHANGED_PROPERTY): Likewise.
(VIEWPORT_CHANGED_PROPERTY): Likewise.
(VIEWPORT_BORDER_CHANGED_PROPERTY): Likewise.
(WHEEL_SCROLLING_ENABLED_CHANGED_PROPERTY): Likewise.
(setComponentOrientation): Replaced constant with real string.
(setColumnHeader): Likewise.
(setHorizontalScrollBar): Likewise.
(setHorizontalScrollBarPolicy): Likewise.
(setRowHeader): Likewise.
(setVerticalScrollBar): Likewise.
(setVerticalScrollBarPolicy): Likewise.
(setWheelScrollingEnabled): Likewise.
(setViewport): Likewise.
(setViewportBorder): Likewise.
* javax/swing/JSlider.java
(INVERTED_CHANGED_PROPERTY): Removed.
(LABEL_TABLE_CHANGED_PROPERTY): Likewise.
(MAJOR_TICK_SPACING_CHANGED_PROPERTY): Likewise.
(MINOR_TICK_SPACING_CHANGED_PROPERTY): Likewise.
(MODEL_CHANGED_PROPERTY): Likewise.
(ORIENTATION_CHANGED_PROPERTY): Likewise.
(PAINT_LABELS_CHANGED_PROPERTY): Likewise.
(PAINT_TICKS_CHANGED_PROPERTY): Likewise.
(setModel): Replaced constant with real string.
(setOrientation): Likewise.
(setLabelTable): Likewise.
(setInverted): Likewise.
(setMajorTickSpacing): Likewise.
(setMinorTickSpacing): Likewise.
(setPaintTicks): Likewise.
(setPaintLabels): Likewise.
* javax/swing/JTabbedPane.java
(MODEL_CHANGED_PROPERTY): Removed.
(TAB_PLACEMENT_CHANGED_PROPERTY): Likewise.
(TAB_LAYOUT_POLICY_CHANGED_PROPERTY): Likewise.
(setModel): Replaced constant with real string.
(setTabPlacement): Likewise.
(setTabLayoutPolicy): Likewise.
* javax/swing/JToolBar.java
(ORIENTATION_CHANGED_PROPERTY): Removed.
(FLOATABLE_CHANGED_PROPERTY): Likewise.
(BORDER_PAINTED_CHANGED_PROPERTY): Likewise.
(MARGIN_CHANGED_PROPERTY): Likewise.
(ROLLOVER_CHANGED_PROPERTY): Likewise.
(setRollover): Replaced constant with real string.
(setMargin): Likewise.
(setBorderPainted): Likewise.
(setFloatable): Likewise.
(setOrientation): Likewise.
* javax/swing/plaf/basic/BasicComboBoxUI.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicComboPopup.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicMenuBarUI.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicProgressBarUI.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicScrollBarUI.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicSliderUI.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(PropertyChangeHandler.propertyChange): Likewise.
* javax/swing/plaf/basic/BasicToolBarUI.java
(PropertyChangeHandler.propertyChange): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultButtonModel.java
(changeState): Made private.
* javax/swing/DefaultDesktopManager.java
(setWasIcon): Fixed second argument to be java.lang.Boolean.
* javax/swing/JLayeredPane.java
(layerToRange): Made private.
(incrLayer): Likewise.
(decrLayer): Likewise.
* javax/swing/JTable.java
(dragEnabled): Likewise.
(preferredViewportSize): Renamed from preferredScrollableViewportSize.
* javax/swing/KeyStroke.java
(Keystroke): Made private.
* javax/swing/TransferHandler.java
(COMMAND_COPY): Likewise.
(COMMAND_CUT): Likewise.
(COMMAND_PASTE): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTextField.java
(postActionEvent): Use text in field when actionCommand is null.
(getActionCommand): Removed.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/AbstractSet.java: Removed.
* Makefile.am: Removed javax/swing/AbstractSet.java.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/Window.java
(AccessibleWindow.getAccessibleStateSet): Fixed method name.
* java/awt/dnd/DnDConstants.java
(DnDConstants): New private constructor.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultCellRenderer.java: Removed.
* Makefile.am: Removed javax/swing/DefaultCellRenderer.java.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/AbstractButton.java
(fireItemStateChanged): Made protected.
(fireActionPerformed): Likewise.
(fireStateChanged): Likewise.
* javax/swing/DefaultButtonModel.java
(fireItemStateChanged): Likewise.
(fireActionPerformed): Likewise.
(fireStateChanged): Likewise.
* javax/swing/JApplet.java
(JApplet): Removed.
(frameInit): Likewise.
(setRootPane): Made protected.
(createRootPane): Likewise.
* javax/swing/JComponent.java
(getClientProperty): Likewise.
(putClientProperty): Likewise.
* javax/swing/JEditorPane.java
(getContentType): Likewise.
(setContentType): Likewise.
* javax/swing/JFrame.java
(setRootPane): Likewise.
(createRootPane): Likewise.
* javax/swing/JInternalFrame.java
(getFocusCycleRootAncestor): Made final. Added @since tag.
(isFocusCycleRoot): Likewise.
(getWarningString): Made final.
* javax/swing/JScrollBar.java
(changeListener): Removed.
(changeEvent): Likewise.
(createChangeListener): Likewise.
(fireStateChanged): Likewise.
(addChangeListener): Likewise.
(removeChangeListener): Likewise.
(getChangeListeners): Likewise.
* javax/swing/JScrollPane.java
(createViewport): Made protected.
* javax/swing/JViewport.java
(addImpl): Likewise.
(setBorder): New method.
* javax/swing/JWindow.java
(setRootPane): Made protected.
(createRootPane): Likewise.
* javax/swing/plaf/basic/BasicButtonUI.java
(installListeners): Likewise.
(uninstallListeners): Likewise.
* javax/swing/plaf/basic/BasicProgressBarUI.java
(incrementAnimationIndex): Likewise.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(createLayoutManager): Likewise.
* javax/swing/table/DefaultTableCellRenderer.java
(firePropertyChange): Likewise.
* javax/swing/table/JTableHeader.java
(AccessibleJTableHeaderEntry.AccessibleJTableHeaderEntry):
New constructor.
* javax/swing/text/PlainDocument.java
(reindex): Made private.
* javax/swing/text/PlainView.java
(drawLine): Made protected.
(getTabSize): Likewise.
* javax/swing/text/View.java
(setSize): Removed.
(preferenceChanged): New method.
(getBreakWeight): Likewise.
(breakView): Likewise.
(getViewIndex): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JScrollPane.java
(ScrollBar): Made class protected.
* javax/swing/JSpinner.java
(JSpinner): Added @since tag.
(listenerList): Removed.
* javax/swing/JTable.java
(setValueAt): New method.
(getColumn): Likewise.
* javax/swing/JWindow.java
(rootPaneCheckingEnabled): Renamed from checking.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/basic/BasicTextUI.java
(RootView.modelToView): Made it public and return a java.awt.Shape.
Handle null subview.
(uninstall): Set textComponent to null when its not possible used
anymore.
* javax/swing/text/View.java
(setParent): Use better argument name.
(getContainer): Get parent via getParent().
(getViewFactory): Likewise.
(getAttributes): Get element via getElement().
(getStartOffset): Likewise.
(getEndOffset): Likewise.
(getResizeWeight): New method.
(getMaximumSpan): Likewise.
(getMinimumSpan): Likewise.
(setSize): Likewise.
(getGraphics): Likewise.

2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>

* java/awt/Checkbox.java:
(AccessibleAWTCheckbox()): Added public constructor
to call superclass.
* java/awt/Choice.java:
(AccessibleAWTChoice): Added class documentation.
(AccessibleAWTChoice()): Added public constructor
to call superclass.
(AccessibleAWTChoice.getAccessibleAction()): Documented.
(AccessibleAWTChoice.getAccessibleRole()): Documented,
and changed role to COMBO_BOX.
(AccessibleAWTChoice.getAccessibleActionCount()): Documented.
(AccessibleAWTChoice.getAccessibleActionDescription(int)): Documented.
(AccessibleAWTChoice.doAccessibleAction(int)): Documented.

2005-02-15  Graydon Hoare  <graydon@redhat.com>
    Michael Koch  <konqueror@gmx.de>

* javax/swing/LayoutFocusTraversalPolicy.java,
javax/swing/SortingFocusTraversalPolicy.java:
New classes.
* Makefile.am: Added new classes.
* Makefike.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DebugGraphics.java: Mostly implemented.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/SwingUtilities.java
(findFocusOwner): New method.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/DefaultEditorKit.java
(read): Added '\n' after each line.
* javax/swing/text/PlainView.java
(modelToView): Update metrics.
(drawLine): Use offsets from element.
(paint): Update metrics. Draw all lines.

2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>

* java/awt/Checkbox.java:
(AccessibleAWTCheckbox): Added class documentation
* java/awt/Scrollbar.java:
(AccessibleAWTScrollBar): typo corrected and docs added
(AccessibleAWTScrollBar.getAccessibleRole()): documented
(AccessibleAWTScrollBar.getAccessibleStateSet()): likewise
(AccessibleAWTScrollBar.getAccessibleValue()): likewise
(AccessibleAWTScrollBar.getCurrentAccessibleValue()): likewise
(AccessibleAWTScrollBar.setCurrentAccessibleValue(int)): likewise
(AccessibleAWTScrollBar.getMinimumAccessibleValue()): likewise
(AccessibleAWTScrollBar.getMaximumAccessibleValue()): likewise
(getAccessibleContext()): name of accessible class corrected

2005-02-15  Mark Wielaard  <mark@klomp.org>

* java/awt/BasicStroke.java (hashCode): Implement.
(equals): Document.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/print/PrinterJob.java
(pageDialog): Throws java.awt.HeadlessException.
(printDialog): Likewise.

2005-02-15  Mark Wielaard  <mark@klomp.org>

* jni/gtk-peer/gtkpeer.h (gdk_env): Fix prototype.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTable.java
(getValueAt): New method.
* javax/swing/table/JTableHeader.java
(columnAtPoint): New method.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTextField.java
(actions): New field.
(static): Initalize actions field.
(getActions): New method.

2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>

* java/awt/Checkbox.java:
(AccessibleAWTCheckbox): name capitalization corrected
and serialization UID added.
(AccessibleAWTCheckbox.itemStateChanged(java.awt.event.ItemEvent)):
documented.
(AccessibleAWTCheckbox.getAccessibleAction()): likewise
(AccessibleAWTCheckbox.getAccessibleValue()): likewise
(AccessibleAWTCheckbox.getAccessibleActionCount()): likewise
(AccessibleAWTCheckbox.getAccessibleActionDescription(int)): likewise
(AccessibleAWTCheckbox.doAccessibleAction(int)): likewise
(AccessibleAWTCheckbox.getCurrentAccessibleValue()): likewise
(AccessibleAWTCheckbox.setCurrentAccessibleValue(int)): likewise
(AccessibleAWTCheckbox.getMinimumAccessibleValue()): likewise
(AccessibleAWTCheckbox.getMaximumAccessibleValue()): likewise
(AccessibleAWTCheckbox.getAccessibleRole()): likewise
(AccessibleAWTCheckbox.getAccessibleStateSet()): implemented and
documented
(getAccessibleContext()): name of accessible class corrected

2005-02-15  Sven de Marothy  <sven@physto.se>

* java/awt/geom/doc-files/Area-1.png,
java/awt/geom/doc-files/Ellipse-1.png,
java/awt/geom/doc-files/GeneralPath-1.png:
New files.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (env_union):
Use union to avoid type-punning warning.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultListSelectionModel.java
(clone): New method.

2005-02-15  Mark Wielaard  <mark@klomp.org>

Reported by Martin Platter <motse@complang.tuwien.ac.at>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
(Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile):
Correct method signature of gtkSetFilename.

2005-02-15  Arnaud Vandyck  <avdyk@gnu.org>

* javax/swing/text/StringContent.java: New file.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* Makefile.am: Added javax/swing/text/StringContent.java.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/ClasspathToolkit.java:
Import statements reworked.
(imageCache): Made it of type java.util.HashMap.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/imageio/stream/MemoryCacheImageInputStream.java:
Reworked import statements.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:
Rewrite uses of extern variable to be function calls.
* jni/gtk-peer/gtkpeer.h (gdk_env): Change declaration to
function, from extern variable.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
(gdk_env): Remove variable, add new function.
(java_vm): Add new variable.
(Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit): Initialize
java_vm rather than old gdk_env variable.

2005-02-15 David Gilbert <david.gilbert@object-refinery.com>

* javax/swing/DefaultListModel.java
(add): fire correct event,
(addElement): corrected interval indices in event,
(clear): corrected upper bound for interval, only fire event if
list is not empty,
(setSize): fire appropriate event.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* gnu/awt/xlib/XEventLoop.java: Add non-blocking event mode.
* gnu/awt/xlib/XToolkit.java: Likewise.
* gnu/gcj/xlib/XAnyEvent.java: Likewise.
* gnu/gcj/xlib/natXAnyEvent.cc: Likewise.
* gnu/java/awt/ClasspathToolkit.java: Likewise.
* gnu/java/awt/peer/gtk/GtkToolkit.java: Likewise.
* java/awt/EventQueue.java (getNextEvent):
Adjust event loop to switch to native mode after 100ms.
* javax/swing/Timer.java (drainEvents): Reuse Runnable.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
(Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose):
Wake up event thread.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
(Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue):
Adjust event loop to switch to java mode after 100ms.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* jni.cc (_Jv_JNI_RegisterNatives): Re-add sync, which was
accidentally removed in last change.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
gnu/java/awt/peer/gtk/GtkMainThread.java: Removed.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* include/jni.h (_Jv_JNIEnv::bottom_locals): New field.
* include/jvm.h (_Jv_FreeJNIEnv): Declare.
* java/lang/natThread.cc (finalize_native): Call _Jv_FreeJNIEnv.
* jni.cc: Reuse bottom frame between calls, avoid clearing
frame when no local references are made.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/UIDefaults.java (UIDefaults):
Fixed typo in javadoc (Thanks to Thomas Zander for reporting)
Fixed HTML entity and removed a redundant comma.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/DefaultEditorKit.java
(deinstall): Removed.
(install): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/UIDefaults.java (put): Handle value of null.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/Robot.java,
java/awt/Scrollbar.java,
java/awt/print/PrinterJob.java,
javax/swing/JTable.java,
javax/swing/text/AbstractDocument.java:
Reworked import statements.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JEditorPane.java
(read): Implemented.
(write): Likewise.
* javax/swing/text/DefaultEditorKit.java
(page): Renamed from page_url. Made private.
(editorKit): Renamed from kit. Made private.
(ctype): Removed.
(JEditorPane): All constructors reimplemented.
(getContentType): Use content type from editor kit.
(getEditorKit): Return editorKit.
(getEditorKitForContentType):Likewise.
(getPage): Return page.
(setContentType): Reimplemented.
(setEditorKit): Likewise.
(setEditorKitForContentType): Removed wrong implementation.
(setPage): Implemented.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
(nativeSetIconImageFromData): Re-add native implementation.

2005-02-15  David Gilbert  <david.gilbert@object-refinery.com>

* javax/swing/table/DefaultTableModel.java
(DefaultTableModel()): Added Javadocs.
(DefaultTableModel(int, int)): Fixed implementation.
(DefaultTableModel(Vector, int)): Throw IllegalArgumentException
for negative rowCount.
(DefaultTableModel(Object[], int)): Added Javadocs.
(DefaultTableModel(Vector, Vector)): Likewise.
(DefaultTableModel(Object[][], Object[])): Likewise.
(getDataVector): Likewise.
(setDataVector(Vector, Vector)): Likewise.
(setDataVector(Object[][], Object[])): Likewise.
(newDataAvailable): Likewise.
(newRowsAdded): Likewise.
(rowsRemoved): Likewise.
(setColumnIdentifiers(Vector)): Allow for null argument.
(setColumnIdentifiers(Object[])): Added Javadocs.
(setNumRows): Likewise.
(setRowCount): Adds new rows if necessary, and sends more specific
TableModelEvent.
(setColumnCount): Allow for null columnIdentifiers.
(addColumn(Object)): Added Javadocs.
(addColumn(Object, Vector)): Handle null columnData.
(addColumn(Object, Object[])): Handle columnData with more or less
entries than rows in the table.
(addRow(Vector)): Fire appropriate event.
(addRow(Object[])): Added Javadocs.
(insertRow(int, Vector)): Fire appropriate event.
(insertRow(int, Object[])): Added Javadocs.
(moveRow): Reimplemented.
(removeRow(int)): Fire appropriate event.
(getColumnCount): Allow for null columnIdentifiers.
(getColumnName): Now returns empty string when column index is too
large.
(isCellEditable): Added Javadocs.
(getValueAt): Likewise.
(setValueAt): Fire more specific event.
(convertToVector): Added Javadocs.
* javax/swing/table/TableModel.java
Added Javadocs.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* libgcj.spec.in (lib): Add -l-javax-imageio.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* gnu/java/awt/peer/gtk/GtkComponentPeer.java: Replace direct
references to event queue q with method call q().
* gnu/java/awt/peer/gtk/GtkDialogPeer.java: Likewise.
* gnu/java/awt/peer/gtk/GtkFramePeer.java: Likewise.
* gnu/java/awt/peer/gtk/GtkScrollbarPeer.java: Likewise.
* gnu/java/awt/peer/gtk/GtkTextComponentPeer.java: Likewise.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java: Likewise.
* gnu/java/awt/peer/gtk/GtkGenericPeer.java: Likewise.
(q): New method.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* gnu/java/awt/ClasspathToolkit.java
(registerImageIOSpis): New method.
* gnu/java/awt/image/ImageDecoder.java
(imageDecoder): New constructor using InputStream
(startProduction): Handle existing InputStream.
* gnu/java/awt/peer/gtk/GdkGraphics2D.java
(findSimpleIntegerArray): Make public and static.
(updateBufferedImage): Set each pixel, in a loop.
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
Implement ImageIO SPI classes.
(createBufferedImage): Rewrite in terms of SPI classes.
* gnu/java/awt/peer/gtk/GtkToolkit.java
(registerImageIOSpis): New method.
* java/lang/reflect/natMethod.cc
(_Jv_CallAnyMethodA): Borrow a patch from aph, applied to trunk,
which lets JNI call interface methods properly.
* javax/imageio/ImageIO.java
(WriterFormatFilter.filter): Fix copy-and-paste typos.
(WriterMIMETypeFilter.filter): Likewise.
(ImageReaderIterator): Pass extension argument through to SPI.
(getReadersByFilter): Likewise.
(getWritersByFilter): Likewise.
(getImageReadersByFormatName): Likewise.
(getImageReadersByMIMEType): Likewise.
(getImageReadersBySuffix): Likewise.
(getImageWritersByFormatName): Likewise.
(getImageWritersByMIMEType): Likewise.
(getImageWritersBySuffix): Likewise.
(read): Implement.
(write): Implement.
* javax/imageio/ImageReader.java
(progressListeners): Initialize.
(setInput): Implement.
* javax/imageio/ImageWriter.java
(progressListeners): Initialize.
(warningListeners): Likewise.
(warningLocales): Likewise.
(setOutput): Test "isInstance" rather than class equality.
* javax/imageio/spi/IIORegistry.java
(static): Add reader and writer SPIs.
(IIORegistry): Call ClasspathToolkit.registerImageIOSpis.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
(query_formats): New function.
(save_to_stream): Likewise.
(Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage): Likewise.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c (mouseWheel):
Call XFlush.
(keyPress): Likewise.
(keyRelease): Likewise.

2005-02-15  Olga Rodimina  <rodimina@redhat.com>

* javax/swing/JTable.java
(columnAtPoint): New Method. Implemented.
(rowAtPoint): Likewise.
(countSelections): Fixed few small count errors.
(getSelections): Likewise.
(setSelectionMode): Set selection mode for column
selection model in addition to row selection model.
* javax/swing/plaf/basic/BasicTableUI.java:
(getRowForPoint): Removed. Replaced by
JTable.rowAtPoint().
(getColForPoint): Removed. Replaced by
JTable.columnAtPoint().
(updateSelection): Updated to call JTable.columnAtPoint
and JTable.rowAtPoint.
* javax/swing/table/DefaultTableColumnModel.java:
(getSelectedColumns): Implemented.
(getSelectedColumnCount): Implemented.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* Makefile.am
(jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c)
(gnu/java/awt/peer/gtk/GtkMainThread.java) : Remove.
* Makefile.in: Regenerate.
* gnu/awt/xlib/XEventLoop.java: Fix to match thread model.
* gnu/awt/xlib/XFramePeer.java: Likewise.
* gnu/awt/xlib/XToolkit.java: Likewise.
* gnu/gcj/xlib/XAnyEvent.java: Likewise.
* gnu/gcj/xlib/natXAnyEvent.cc: Likewise.
* gnu/java/awt/ClasspathToolkit.java
(nativeQueueEmpty)
(wakeNativeQueue)
(iterateNativeQueue): New methods.
* gnu/java/awt/peer/gtk/GtkMainThread.java: Remove.
* gnu/java/awt/peer/gtk/GtkToolkit.java
(gtkInit): Absorb from defunct GtkMainThread class.
(static): Run gtkInit in static startup block.
(GtkToolkit): Remove construction of GtkMainThread and queue.
(getSystemEventQueueImpl): Construct queue when requested.
(nativeQueueEmpty)
(wakeNativeQueue)
(iterateNativeQueue): New methods.
* java/awt/Component.java (removeNotify): Remove race.
* java/awt/EventDispatchThread.java
(EventDispatchThread): Don't start on construction.
(run): Remove isInterrupted check.
* java/awt/EventQueue.java (shutdown): New flag.
(isShutdown): New method checking J2SE shutdown condition.
(setShutdown): New method.
(getNextEvent): Restructure to use ClasspathToolkit.
(postEvent): Activate new thread on posting, wake thread on
post of possible shutdown condition event.
* java/awt/Frame.java
(Frame): Call noteFrame in all constructors.
(fireDummyEvent): New helper method.
(addNotify): Fire a dummy event to wake up queue.
(removeNotify): Fire a dummy event to wake up queue.
(noteFrame): New method.
(weakFrames): New static field.
(getFrames): Implement.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c:
Remove.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:
Move everything from GtkMainThread into this file
(Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue)
(Java_gnu_java_awt_peer_gtk_GtkToolkit_wakeNativeQueue)
(Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty):
New functions to implement single-threaded queue semantics.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/metal/MetalLookAndFeel.java
(getControlTextFont): New method.
(getMenuTextFont): Likewise.
(getSubTextFont): Likewise.
(getSystemTextFont): Likewise.
(getUserTextFont): Likewise.
(getWindowTitleFont): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/AbstractDocument.java
(documentFilter): New field.
(getDocumentFilter): New method.
(setDocumentFilter): Likewise.
(dump): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTree.java
(DynamicUtilTreeNode.hasChildren): Clarify javadoc.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/AbstractDocument.java
(AbstractElement.getLength): Fixed off-by-one error.
(AbstractElement.children): Made abstract.
(AbstractElement.getAllowsChildren): Likewise.
(AbstractElement.getElement): Likewise.
(AbstractElement.dumpElement): New private method.
(AbstractElement.dump): New method.
(BranchElememt.getName): Fixed implementation.
(BranchElememt.toString): Likewise.
(BranchElememt.getElement): Fixed arguments.
(LeafElement.getName): Fixed implementation.
(LeafElement.toString): Likewise.
* javax/swing/text/GapContent.java
(GapContent): Put default content into buffer.
* javax/swing/text/PlainDocument.java
(reindex): Use empty attribute sets instead of null.
(createDefaultRoot): Reimplemented.
(insertUpdate): Call super method.
(removeUpdate): Likewise.
(getParagraphElement): Implemented.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/ClasspathToolkit.java
(createRobot): Throws java.awt.AWTException.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c:
Added '__attribute__((unused))' to all unused method arguments.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultBoundedRangeModel.java
(fireValueChanged): Fixed off-by-one error.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* Makefile.am (gtk_c_source_files): Add GdkRobotPeer.c.
(gtk_awt_peer_sources): Add GdkScreenGraphicsDevice.java and
GdkRobotPeer.java.
(lib_gnu_java_awt_peer_gtk_la_CFLAGS): Add X flags.
(lib_gnu_java_awt_peer_gtk_la_LDFLAGS): Add XTest flags.
* gnu/awt/xlib/XToolkit.java (createRobot): New method.
* gnu/java/awt/ClasspathToolkit.java (createRobot): New method.
* gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
(getDefaultScreenDevice): Implement.
* gnu/java/awt/peer/gtk/GdkRobotPeer.java: New file.
* gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java: Likewise.
* gnu/java/awt/peer/gtk/GtkToolkit.java (createRobot): New method.
* java/awt/Robot.java: Implement.
* java/awt/peer/RobotPeer.java: Rename parameters.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c: New file.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
(awt_keycode_to_keysym): Make non-static.
* jni/gtk-peer/gtkpeer.h (AWT_BUTTON1_MASK, AWT_BUTTON2_MASK,
AWT_BUTTON3_MASK): Declare constants.
(awt_keycode_to_keysym): Declare.

* Makefile.am (AM_MAKEFLAGS): Set KEYS variable.
* testsuite/libjava.mauve/mauve.exp (test_mauve): If KEYS exists
and is non-empty pass its value to "make check".
(test_mauve_sim): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/imageio/IIOParam.java
(setSourceBands): New method.
(setSourceSubsampling): Likewise.
* javax/imageio/ImageReadParam.java
(setDestination): Likewise.
(setDestinationBands): Likewise.
(setSourceProgressivePasses): Likewise.
* javax/imageio/metadata/IIOInvalidTreeException.java
(serialVersionUID): New static field.
* javax/imageio/metadata/IIOMetadataNode.java
(IIOMetadataNode): Don't explicitely implement org.w3c.dom.Node.
(parent): Dont initailize with default value explicitely.
(Object): Likewise.
(removeAttribute): Doesn't throws org.w3c.dom.DOMException.
(removeAttributeNode): Likewise.
(removeAttributeNS): Likewise.
(setAttribute): Likewise.
(setAttributeNode): Likewise.
(setAttributeNodeNS): Likewise.
(setAttributeNS): Likewise.
(appendChild): Likewise.
(getNodeValue): Likewise.
(insertBefore): Likewise.
(removeChild): Likewise.
(replaceChild): Likewise.
(setPrefix): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/LookAndFeel.java
(getDesktopPropertyValue): New method.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTree.java
(hasChildren): New instance field.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JComponent.java
(getToolTipText): New method.
(getTitledBorderText): Likewise.
(getAccessibleKeyBinding): Likewise.
(getVerifyInputWhenFocusTarget): Likewise.
(setVerifyInputWhenFocusTarget): Likewise.
(verifyInputWhenFocusTarget): New instance field.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultListSelectionModel.java
(fireValueChanged): New method.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultBoundedRangeModel.java:
Fixed javadocs all over.
(fireStateChanged): Simplified.
* javax/swing/BoundedRangeModel.java:
Reformatted.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JRootPane.java
(setMenuBar): Added @deprecated tag.
(getMenuBar): Likewise.
* javax/swing/JTable.java
(sizeColumnsToFit): Likewise.

2005-02-15  Paul Jenner  <psj.home@ntlworld.com>

* javax/swing/ImageIcon.java (setImage): Implemented.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTable.java:
Removed unused imports.

2005-02-15  Olga Rodimina  <rodimina@redhat.com>

(prepareRenderer): Get column's index in dataModel instead
of column's view index.
(getColumnCount): return count of the columns in ColumnModel,
not in dataModel.
(removeColumn): Implemented.
(moveColumm): Likewise.
(setRowHeight): throw IllegalArgumentException if height is
less then 1.
* javax/swing/table/DefaultTableColumnModel.java: Add javadocs.
(DefaultTableColumnModel):Add call to createSelectionModel().
(addColumn): Fire columnAdded event to registered listeners.
(removeColumn): Fire columnRemoved event to registered listeners.
(moveColumn): Fire columnMoved event to registered listeners.
(setColumnMargin): Fire ColumnMarginChanged event to registered listeners.
(getColumnIndex): Changed parameter name.
(setColumnSelectionAllowed): Likewise.
(fireColumnAdded): Implemented.
(fireColumnRemoved): Likewise.
(fireColumnMoved): Likewise.
(fireColumnMarginChanged): Likewise.
(getListeners): Changed parameter name.
(propertyChange): Implemented.
(valueChanged): Changed parameter name.
(createSelectionModel): Implemented.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/peer/gtk/GtkToolkit.java:
Explicitely import used classes.
(getLocalGraphicsEnvironment): Simplify.
* java/awt/Window.java (Window):
Enable code to get the default GraphicsConfiguration.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/metal/DefaultMetalTheme.java
(CONTROL_TEXT_FONT): New static field.
(MENU_TEXT_FONT): Likewise.
(SUB_TEXT_FONT): Likewise.
(SYSTEM_TEXT_FONT): Likewise.
(USER_TEXT_FONT): Likewise.
(WINDOW_TITLE_FONT): Likewise.
(getControlTextFont): New method.
(getMenuTextFont): Likewise.
(getSubTextFont): Likewise.
(getSystemTextFont): Likewise.
(getUserTextFont): Likewise.
(getWindowTitleFont): Likewise.
* javax/swing/plaf/metal/MetalTheme.java
(BLACK): Initialize with Color.BLACK.
(WHITE): Initialize with Color.WHITE.
(getInactiveControlTextColor): Return getControlDisabled().
(getMenuDisabledForeground): Return getSecondary3().
(getControlTextFont): New abstract method.
(getMenuTextFont): Likewise.
(getSubTextFont): Likewise.
(getSystemTextFont): Likewise.
(getUserTextFont): Likewise.
(getWindowTitleFont): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JFormattedTextField.java
(getFocusLostBehavior): Fixed typo in method name.
(setFocusLostBehavior): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/TransferHandler.java:
Reworked import statements.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/Button.java,
java/awt/Canvas.java,
java/awt/Checkbox.java,
java/awt/CheckboxMenuItem.java,
java/awt/Choice.java,
java/awt/Dialog.java,
java/awt/Frame.java,
java/awt/Label.java,
java/awt/List.java,
java/awt/Menu.java,
java/awt/MenuBar.java,
java/awt/MenuItem.java,
java/awt/PopupMenu.java,
java/awt/ScrollPane.java,
java/awt/Scrollbar.java,
java/awt/TextArea.java,
java/awt/Window.java (getAccessibleContext): Clean up comments.
Reformat.
* java/awt/Button.java,
java/awt/Checkbox.java,
java/awt/Choice.java,
java/awt/Menu.java,
java/awt/PopupMenu.java,
java/awt/TextArea.java (getAccessibleContext): Only create new
accessible once.
* java/awt/TextComponent.java (getAccessibleContext): Implement.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/Button.java,
javax/swing/JApplet.java,
javax/swing/JFormattedTextField.java,
javax/swing/JWindow.java,
javax/swing/JTree.java,
javax/swing/plaf/basic/BasicEditorPaneUI.java,
javax/swing/plaf/basic/BasicTextPaneUI.java,
javax/swing/plaf/basic/BasicTreeUI.java:
Reworked import statements.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* Makefile.am: Put javax.imageio into its own library and link it
against lib-org-w3c-dom.la to fix bootstrapping.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/TextAction.java
(getTextComponent): Simplified. Added Javadoc.
(augmentList): Implemented. Added Javadoc.
(getFocusedComponent): Added javadoc.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/Scrollbar.java (AccessibleAWTScrollbar,
getAccessibleContext): Implement.
* java/awt/ScrollPane.java (AccessibleAWTScrollPane,
getAccessibleContext): Implement.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/Dialog.java (AccessibleAWTFrame, getAccessibleContext):
Implement.
* java/awt/Frame.java (AccessibleAWTFrame, getAccessibleContext):
Implement.
* java/awt/Window.java (getAccessibleContext): Fix comment.
Remove extra import.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/Window.java (AccessibleAWTWindow): Implement.
(isActive, isFocused, getAccessibleContext): Implement.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/MenuItem.java (getAccessibleContext): Implement.
* java/awt/MenuComponent.java (accessibleContext): Make package
visible.
* java/awt/CheckboxMenuItem.java (getAccessibleContext,
AccessibleAWTCheckboxMenuItem): Implement.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/List.java: Implement AccessibleAWTList,
AccessibleAWTListChild.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* java/awt/Choice.java: Add implements declaration for
Accessible.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* javax/imageio/metadata/IIOInvalidTreeException.java: Use Node
instead of Object.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* javax/imageio/metadata/IIOMetadataNode.java: Add Node to
implemented interface list.

2005-02-15  Jerry Quinn  <jlquinn@optonline.net>

* javax/imageio/metadata/IIOMetadataNode.java: Implement.
* javax/imageio/metadata/IIOAttr.java: New class.
* javax/imageio/metadata/IIONamedNodeMap.java: New class.
* javax/imageio/metadata/IIONodeList.java: New class.
* Makefile.am: Added new files.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/AbstractAction.java,
javax/swing/AbstractCellEditor.java,
javax/swing/AbstractListModel.java,
javax/swing/DefaultBoundedRangeModel.java,
javax/swing/DefaultButtonModel.java,
javax/swing/DefaultCellEditor.java,
javax/swing/DefaultComboBoxModel.java,
javax/swing/DefaultDesktopManager.java,
javax/swing/JMenu.java,
javax/swing/JSlider.java,
javax/swing/KeyStroke.java,
javax/swing/OverlayLayout.java,
javax/swing/ScrollPaneLayout.java,
javax/swing/SizeRequirements.java,
javax/swing/ViewportLayout.java:
Made serialVersionUID private.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/peer/gtk/GtkComponentPeer.java:
Reformatted.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/peer/gtk/GdkGraphics2D.java: More reformatting.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* gnu/java/awt/peer/gtk/GdkGraphics2D.java: Reformatted.

2005-02-15  Jeroen Frijters  <jeroen@frijters.net>

* java/awt/EventDispatchThread.java,
java/awt/Toolkit.java:
Don't catch java.lang.ThreadDeath.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/PasswordView.java
(drawEchoCharacter): Added javadoc.
(drawSelectedText): Likewise.
(drawUnselectedText): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JRootPane.java
(windowDecorationStyle): New field.
(setMenuBar): New method.
(getMenuBar): Likewise.
(getWindowDecorationStyle): Likewise.
(setWindowDecorationStyle): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultListSelectionModel.java
(leadAnchorNotificationEnabled): Made protected.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/InternalFrameFocusTraversalPolicy.java: New file.
* Makefile.am: Added InternalFrameFocusTraversalPolicy.java.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JFormattedTextField.java: Implemented.
* javax/swing/JWindow.java
(JWindow): New constructors.
(initWindow): Renamed from initFrame.
* javax/swing/UIDefaults.java
(ActiveValue): Made interface static.
(LazyValue): Likewise.
* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
(TitlePaneLayout.TitlePaneLayout): New constructor.
* javax/swing/plaf/basic/BasicSliderUI.java
(ChangeHandler): Made public.
(FocusHandler): Likewise.
(PropertyChangeHandler): Likewise.
(ScrollListener): Likewise.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(FocusHandler): Likewise.
(MouseHandler): Likewise.
* javax/swing/plaf/basic/BasicTextPaneUI.java
(BasicTextPaneUI): Extend BasicEditorPaneUI.
* javax/swing/plaf/basic/BasicToolBarUI.java
(BasicToolBarUI): Simplified. Reworked javadoc.
(canDock): Simplified. Make public.
(DockingListener): Made public.
* javax/swing/text/JTextComponent.java
(navigationFilter): New field.
(getNavigationFilter): New method.
(setNavigationFilter): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/metal/MetalTheme.java
(getControlTextColor): Return getControlInfo().
(getHighlightedTextColor): Return getControlTextColor().

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/basic/BasicButtonListener.java
(BasicButtonListener): New constructor.
* javax/swing/plaf/basic/BasicButtonUI.java
(createButtonListener): Usw new BasicButtonListener constructor.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/imageio/event/package.html,
javax/imageio/metadata/package.html: New files.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/image/MemoryImageSource.java: Reformatted.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/tree/TreeCellEditor.java: Refomatted.

2005-02-15  Jeroen Frijters  <jeroen@frijters.net>

* java/awt/color/ICC_Profile.java
(finalize): Removed pointless field assignments.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/basic/BasicEditorPaneUI.java: New file.
* Makefile.am: Added javax/swing/plaf/basic/BasicEditorPaneUI.java.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/DefaultStyledDocument.java: New file.
* Makefile.am: Added javax/swing/text/DefaultStyledDocument.java.
* Makefile.in: Regenerated.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JFileChooser.java
(showDialog): Return CANCEL_OPTION for now.
(showOpenDialog): Likewise.
(showSaveDialog): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JApplet.java
(HIDE_ON_CLOSE): Removed.
(EXIT_ON_CLOSE): Likewise.
(DISPOSE_ON_CLOSE): Likewise.
(DO_NOTHING_ON_CLOSE): Likewise.
(close_action): Likewise.
(getDefaultCloseOperation): Likewise.
(setDefaultCloseOperation): Likewise.
(processWindowEvent): Likewise.
(getPreferredSize): Simplified.
* javax/swing/JInternalFrame.java
(setDefaultCloseOperation): Fixed throwing exception on wrong argument
value.
* javax/swing/JWindow.java
(HIDE_ON_CLOSE): Removed.
(EXIT_ON_CLOSE): Likewise.
(DISPOSE_ON_CLOSE): Likewise.
(DO_NOTHING_ON_CLOSE): Likewise.
(close_action): Likewise.
(processKeyEvent): Likewise.
(setDefaultCloseOperation): Likewise.
(getPreferredSize): Simplified.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTextField.java
(getPreferredSize): Re-implemented.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JLabel.java
(setDisplayedMnemonic): Use only upper case characters.
(setDisplayedMnemonicIndex): Handle index == -1 and fire
PropertyChangeEvent after property got set to the new index.

2005-02-15  Robert Schuster <thebohemian@gmx.net>

* javax/swing/JComboBox.java:
(JComboBox): Removed selection of the
first item in the model.

2005-02-15  Robert Schuster <thebohemian@gmx.net>

* javax/swing/JComboBox.java
added support for no item being selected
(JComboBox): select first or nothing depending on element count
(setModel): cleaned up unneeded "this." usage, added more
docs, made exception behavior match that of the JDK
(setLighWeightPopupEnabled): removed unneeded "this." usage
(setEditable): dito
(setMaximumRowCount): dito
(setRenderer): dito
(setPrototypeDisplayValue): dito
(getSelectedItem): simplified, added more user doc
(setSelectedIndex): corrected exception behavior, added more user doc
(getSelectedIndex): fixed hardcoded dependency on DefaultComboBoxModel,
added performance warning to user doc
(addItem): fixed exception behavior, added user doc
(insertItemAt): dito
(removeItem): dito
(removeItemAt): dito
(removeAll): fixed exception behavior, added user doc, added support
for model not being instance of DefaultComboBoxModel
(getSelectedItemObjects): simplified
(getItemCount): fixed dependency on DefaultComboBoxModel
(getItemAt): fixed dependency on MutableComboBoxModel
* javax/swing/DefaultComboBoxModel.java:
(setSelectedItem): updates selected item only if new
value is null or known (match JDK behavior)
* javax/swing/plaf/basic/BasicComboBoxUI.java:
(paintCurrentValue): renders "" if no item is selected

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/plaf/metal/MetalTheme.java,
javax/swing/plaf/metal/DefaultMetalTheme.java:
New files.
* javax/swing/plaf/metal/MetalLookAndFeel.java
* Makefile.am: Added the new files.
* Makefile.in: Regenerated.

2005-02-15  Olga Rodimina  <rodimina@redhat.com>

* javax/swing/JTable.java
(editorComp): New field.
(JTable): Initialize local variables and call updateUI
(selectionBackground): Make protected.
(selectionForeground): Likewise.
(initializeLocalVars): Create default editors and renderers,
initialize editingColumn, editingRow variables.
(createDefaultEditors): New Method.
(createDefaultRenderers): Likewise.
(createDefaultListSelectionModel): Removed
(createDefaultSelectionModel): New Method.
(createDefaultTableHeader): Likewise
(removeColumn): Likewise.
(getEditingColumn): Likewise.
(setEditingColumn): Likewise.
(getEditingRow): Likewise.
(setEditingRow): Likewise.
(getEditorComponent): Likewise.
(isEditing): Likewise.
(setDefaultEditor): Likewise.
(addColumnSelectionInterval): Likewise.
(addRowSelectionInterval): Likewise.
(setColumnSelectionInterval): Likewise.
(setRowSelectionInterval): Likewise.
(removeColumnSelectionInterval): Likewise.
(removeRowSelectionInterval): Likewise.
  (isColumnSelected): Likewise.
(isRowSelected): Likewise.
(isCellSelected): Likewise.
(selectAll): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTable.java
(addColumn): New method.
(getColumnClass): Likewise.
(getColumnName): Likewise.

2005-02-15  Paul Jenner  <psj.home@ntlworld.com>

* javax/swing/TransferHandler.java
(createTransferable): Made protected.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTable.java,
javax/swing/plaf/basic/BasicTableHeaderUI.java,
javax/swing/plaf/basic/BasicTableUI.java:
Use fixed get/setIntercellSpacing() methods.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTable.java
(getIntercellSpacing): Fixed typo in method name.
(setIntercellSpacing): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/text/JTextComponent.java
(focusAccelerator): New variable.
(getFocusAccelerator): New method.
(setFocusAccelerator): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JComponent.java
(setTransferHandler): Made public. Fire property change event.
* javax/swing/TransferHandler.java: Implemented.
* javax/swing/text/JTextComponent.java
(DefaultTransferHandler): New inner class.
(defaultTransferHandler): New variable.
(copy): New method.
(cut): Likewise.
(paste): Likewise.
(doTransferAction): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTree.java
(collapsePath): New method.
(collapseRow): Likewise.
(expandPath): Likewise.
(expandRow): Likewise.
(checkExpandParents): Likewise.
(doExpandParents): Likewise.
(setExpandedState): Likewise.
(makeVisible): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JPasswordField.java: Updated javadocs.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JLayeredPane.java
(getLayer): Fixed return type, made public.
(getPosition): Use new getLayer().
(SetPosition): Likewise.
(getIndexOf): Likewise.
(remove): Likewise.
* javax/swing/JInternalFrame.java
(getLayer): Use new JLayeredPane.getLayer().

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/table/TableColumn.java: Added/fixed javadocs over all.
(setHeaderValue): Simplified. Do nothing when old value == new value.

2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>

* gnu/java/awt/peer/gtk/GdkGraphics.java (setClip): Protect
against null clip region.
* gnu/java/awt/peer/gtk/GtkFramePeer.java (create): Call
gtkWindowSetResizable.
(postConfigureEvent): Only revalidate if frame size has changed.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java (postConfigureEvent):
Only revalidate if frame size has changed.
* java/awt/Component.java (reshape): Only repaint and post
component events if component is showing.
* java/awt/Container.java (addImpl): Only post container event if
container is showing.
(remove): Likewise.
* java/awt/Window.java (setLocationRelativeTo): Implement.
(setBoundsCallback): Only post component events if component is
showing.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (clearRect):
Protect against null graphics structure.  Flush gdk event queue.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/imageio/ImageReader.java,
javax/imageio/ImageTranscoder.java,
javax/imageio/ImageWriter.java,
javax/imageio/spi/ImageInputStreamSpi.java,
javax/imageio/spi/ImageOutputStreamSpi.java,
javax/imageio/spi/ServiceRegistry.java,
javax/imageio/stream/ImageInputStream.java,
javax/imageio/stream/ImageOutputStream.java: Updated.
* javax/imageio/IIOException.java,
javax/imageio/IIOImage.java,
javax/imageio/IIOParam.java,
javax/imageio/IIOParamController.java,
javax/imageio/ImageIO.java,
javax/imageio/ImageReadParam.java,
javax/imageio/ImageTypeSpecifier.java,
javax/imageio/ImageWriteParam.java,
javax/imageio/spi/IIORegistry.java,
javax/imageio/spi/ImageReaderSpi.java,
javax/imageio/spi/ImageWriterSpi.java,
javax/imageio/stream/FileCacheImageInputStream.java,
javax/imageio/stream/FileCacheImageOutputStream.java,
javax/imageio/stream/FileImageInputStream.java,
javax/imageio/stream/FileImageOutputStream.java,
javax/imageio/stream/ImageInputStreamImpl.java,
javax/imageio/stream/ImageOutputStreamImpl.java,
javax/imageio/stream/MemoryCacheImageInputStream.java,
javax/imageio/stream/MemoryCacheImageOutputStream.java,
javax/imageio/event/IIOReadProgressListener.java,
javax/imageio/event/IIOReadUpdateListener.java,
javax/imageio/event/IIOReadWarningListener.java,
javax/imageio/event/IIOWriteProgressListener.java,
javax/imageio/event/IIOWriteWarningListener.java,
javax/imageio/metadata/IIOMetadata.java,
javax/imageio/metadata/IIOMetadataController.java,
javax/imageio/metadata/IIOMetadataFormat.java,
javax/imageio/metadata/IIOInvalidTreeException.java,
javax/imageio/metadata/IIOMetadataFormatImpl.java,
javax/imageio/metadata/IIOMetadataNode.java: New files.
* Makefile.am (javax_source_files): Added new files
* Makefile.in: Regenerated.

2005-02-15  Graydon Hoare  <graydon@redhat.com>

* gnu/java/awt/peer/gtk/GdkGraphics2D.java:
Rework painting into BufferedImages
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
Construct BufferedImage with alpha only when alpha is
present in colormodel.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
Rework painting into client-side jint arrays.
* jni/gtk-peer/gtkcairopeer.h:
Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/DefaultListCellRenderer.java
(serialVersionUID): Made private.
(getListCellRendererComponent): Set horizontal alignment.
* javax/swing/JLabel.java
(setVerticalAlignment): Re-implemented.
(setHorizontalAlignment): Do nothing if old value = new value.
* javax/swing/JList.java
(setCellRenderer): Likewise.
(setModel): Re-implemented.
(setSelectionModel): Likewise.

2005-02-15  David Gilbert <david.gilbert@object-refinery.com>

* java/awt/Component.java,
java/awt/geom/Rectangle2D.java:
Javadoc fixes.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/AbstractListModel.java
(fireContentsChanged): Simplified.
(fireIntervalAdded): Likewise.
(fireIntervalRemoved): Likewise.
* javax/swing/DefaultSingleSelectionModel.java:
Reformatted.
(fireStateChanged): Simplified.
* javax/swing/JPopupMenu.java
(setSelectionModel): Set property.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/print/Book.java: Reformatted.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* java/awt/geom/Area.java
(QuadSegment.curveArea): Remove unused variables.
(CubicSegment.curveArea): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JTree.java
(ANCHOR_SELECTION_PATH_PROPERTY): Added @since tag.
(LEAD_SELECTION_PATH_PROPERTY): Likewise.
(EXPANDS_SELECTED_PATHS_PROPERTY): Likewise.
(EXPANDED): New constant.
(COLLAPSED): Likewise.
(nodeStates): New field.
(cellEditor): New method.
(cellRenderer): Likewise.
(selectionModel): Likewise.
(treeModel): Likewise.
(scrollPathToVisible): Likewise.
(scrollRowToVisible): Likewise.
(isCollapsed): Likewise.
(isExpanded): Likewise.
(clearToggledPaths): Likewise.
(getDescendantToggledPaths): Likewise.
(hasBeenExpanded): Likewise.
(isVisible): Likewise.
(isPathEditable): Likewise.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JLayeredPane.java: Reformatted.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/tree/DefaultMutableTreeNode.java:
Completely Revised.
* javax/swing/tree/MutableTreeNode.java:
Reformatted.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JFormattedTextField.java
(setDocument): Call setDocument of super class. Don't fire property
change event.

2005-02-15  Sven de Marothy  <sven@physto.se>

* java/awt/image/IndexColorModel.java:
Add FIXME with respect to alpha handling.
(getAlpha): Default to returning opaque pixels.
* java/awt/image/MultiPixelPackedSampleModel.java
(MultiPixelPackedSampleModel): Corrected parameters, order of
bit shifts and masks, stride length off by one.

2005-02-15  Michael Koch  <konqueror@gmx.de>

* javax/swing/JList.java, javax/swing/JTree.java:
Added much new methods and fixed much methods setting bound properties.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95115 138bc75d-0d04-0410-961f-82ee72b054a4

244 files changed:
libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/gnu/awt/xlib/XEventLoop.java
libjava/gnu/awt/xlib/XFramePeer.java
libjava/gnu/awt/xlib/XToolkit.java
libjava/gnu/gcj/xlib/XAnyEvent.java
libjava/gnu/gcj/xlib/natXAnyEvent.cc
libjava/gnu/java/awt/ClasspathToolkit.java
libjava/gnu/java/awt/EmbeddedWindow.java
libjava/gnu/java/awt/color/ClutProfileConverter.java
libjava/gnu/java/awt/image/ImageDecoder.java
libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java
libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java
libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java
libjava/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
libjava/gnu/java/awt/peer/gtk/GdkRobotPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java [moved from libjava/javax/swing/AbstractSet.java with 60% similarity]
libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java
libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
libjava/gnu/java/awt/peer/gtk/GtkMainThread.java [deleted file]
libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
libjava/include/jvm.h
libjava/java/awt/AWTKeyStroke.java
libjava/java/awt/BasicStroke.java
libjava/java/awt/Button.java
libjava/java/awt/Canvas.java
libjava/java/awt/Checkbox.java
libjava/java/awt/CheckboxMenuItem.java
libjava/java/awt/Choice.java
libjava/java/awt/Component.java
libjava/java/awt/Container.java
libjava/java/awt/DefaultKeyboardFocusManager.java
libjava/java/awt/Dialog.java
libjava/java/awt/EventDispatchThread.java
libjava/java/awt/EventQueue.java
libjava/java/awt/Frame.java
libjava/java/awt/Label.java
libjava/java/awt/List.java
libjava/java/awt/Menu.java
libjava/java/awt/MenuBar.java
libjava/java/awt/MenuComponent.java
libjava/java/awt/MenuItem.java
libjava/java/awt/PopupMenu.java
libjava/java/awt/Robot.java
libjava/java/awt/ScrollPane.java
libjava/java/awt/Scrollbar.java
libjava/java/awt/TextArea.java
libjava/java/awt/TextComponent.java
libjava/java/awt/Toolkit.java
libjava/java/awt/Window.java
libjava/java/awt/color/ICC_Profile.java
libjava/java/awt/dnd/DnDConstants.java
libjava/java/awt/dnd/DropTarget.java
libjava/java/awt/geom/Area.java
libjava/java/awt/geom/Rectangle2D.java
libjava/java/awt/im/InputContext.java
libjava/java/awt/image/IndexColorModel.java
libjava/java/awt/image/MemoryImageSource.java
libjava/java/awt/image/MultiPixelPackedSampleModel.java
libjava/java/awt/image/RGBImageFilter.java
libjava/java/awt/image/ReplicateScaleFilter.java
libjava/java/awt/peer/RobotPeer.java
libjava/java/awt/print/Book.java
libjava/java/awt/print/PrinterJob.java
libjava/javax/swing/AbstractAction.java
libjava/javax/swing/AbstractButton.java
libjava/javax/swing/AbstractCellEditor.java
libjava/javax/swing/AbstractListModel.java
libjava/javax/swing/ActionMap.java
libjava/javax/swing/BoundedRangeModel.java
libjava/javax/swing/ComponentInputMap.java
libjava/javax/swing/DebugGraphics.java
libjava/javax/swing/DefaultBoundedRangeModel.java
libjava/javax/swing/DefaultButtonModel.java
libjava/javax/swing/DefaultCellEditor.java
libjava/javax/swing/DefaultComboBoxModel.java
libjava/javax/swing/DefaultDesktopManager.java
libjava/javax/swing/DefaultListCellRenderer.java
libjava/javax/swing/DefaultListModel.java
libjava/javax/swing/DefaultListSelectionModel.java
libjava/javax/swing/DefaultSingleSelectionModel.java
libjava/javax/swing/ImageIcon.java
libjava/javax/swing/InputMap.java
libjava/javax/swing/InternalFrameFocusTraversalPolicy.java [moved from libjava/gnu/java/awt/peer/gtk/GtkArg.java with 79% similarity]
libjava/javax/swing/JApplet.java
libjava/javax/swing/JButton.java
libjava/javax/swing/JCheckBox.java
libjava/javax/swing/JCheckBoxMenuItem.java
libjava/javax/swing/JComboBox.java
libjava/javax/swing/JComponent.java
libjava/javax/swing/JEditorPane.java
libjava/javax/swing/JFileChooser.java
libjava/javax/swing/JFormattedTextField.java
libjava/javax/swing/JFrame.java
libjava/javax/swing/JInternalFrame.java
libjava/javax/swing/JLabel.java
libjava/javax/swing/JLayeredPane.java
libjava/javax/swing/JList.java
libjava/javax/swing/JMenu.java
libjava/javax/swing/JMenuBar.java
libjava/javax/swing/JMenuItem.java
libjava/javax/swing/JOptionPane.java
libjava/javax/swing/JPasswordField.java
libjava/javax/swing/JPopupMenu.java
libjava/javax/swing/JProgressBar.java
libjava/javax/swing/JRootPane.java
libjava/javax/swing/JScrollBar.java
libjava/javax/swing/JScrollPane.java
libjava/javax/swing/JSlider.java
libjava/javax/swing/JSpinner.java
libjava/javax/swing/JTabbedPane.java
libjava/javax/swing/JTable.java
libjava/javax/swing/JTextField.java
libjava/javax/swing/JToolBar.java
libjava/javax/swing/JTree.java
libjava/javax/swing/JViewport.java
libjava/javax/swing/JWindow.java
libjava/javax/swing/KeyStroke.java
libjava/javax/swing/LayoutFocusTraversalPolicy.java [moved from libjava/javax/swing/DefaultCellRenderer.java with 64% similarity]
libjava/javax/swing/LookAndFeel.java
libjava/javax/swing/MenuSelectionManager.java
libjava/javax/swing/OverlayLayout.java
libjava/javax/swing/RepaintManager.java
libjava/javax/swing/ScrollPaneLayout.java
libjava/javax/swing/SizeRequirements.java
libjava/javax/swing/SortingFocusTraversalPolicy.java [new file with mode: 0644]
libjava/javax/swing/SwingUtilities.java
libjava/javax/swing/Timer.java
libjava/javax/swing/TransferHandler.java
libjava/javax/swing/UIDefaults.java
libjava/javax/swing/UIManager.java
libjava/javax/swing/ViewportLayout.java
libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java
libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
libjava/javax/swing/event/MouseInputAdapter.java
libjava/javax/swing/plaf/basic/BasicButtonListener.java
libjava/javax/swing/plaf/basic/BasicButtonUI.java
libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
libjava/javax/swing/plaf/basic/BasicComboBoxEditor.java
libjava/javax/swing/plaf/basic/BasicComboBoxRenderer.java
libjava/javax/swing/plaf/basic/BasicComboBoxUI.java
libjava/javax/swing/plaf/basic/BasicComboPopup.java
libjava/javax/swing/plaf/basic/BasicEditorPaneUI.java [moved from libjava/gnu/java/awt/peer/gtk/GtkArgList.java with 69% similarity]
libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
libjava/javax/swing/plaf/basic/BasicInternalFrameUI.java
libjava/javax/swing/plaf/basic/BasicLabelUI.java
libjava/javax/swing/plaf/basic/BasicListUI.java
libjava/javax/swing/plaf/basic/BasicMenuBarUI.java
libjava/javax/swing/plaf/basic/BasicMenuItemUI.java
libjava/javax/swing/plaf/basic/BasicMenuUI.java
libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
libjava/javax/swing/plaf/basic/BasicProgressBarUI.java
libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
libjava/javax/swing/plaf/basic/BasicRootPaneUI.java
libjava/javax/swing/plaf/basic/BasicScrollBarUI.java
libjava/javax/swing/plaf/basic/BasicScrollPaneUI.java
libjava/javax/swing/plaf/basic/BasicSliderUI.java
libjava/javax/swing/plaf/basic/BasicSplitPaneDivider.java
libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java
libjava/javax/swing/plaf/basic/BasicTableHeaderUI.java
libjava/javax/swing/plaf/basic/BasicTableUI.java
libjava/javax/swing/plaf/basic/BasicTextPaneUI.java
libjava/javax/swing/plaf/basic/BasicTextUI.java
libjava/javax/swing/plaf/basic/BasicToolBarUI.java
libjava/javax/swing/plaf/basic/BasicTreeUI.java
libjava/javax/swing/plaf/metal/DefaultMetalTheme.java [new file with mode: 0644]
libjava/javax/swing/plaf/metal/MetalLookAndFeel.java
libjava/javax/swing/plaf/metal/MetalTheme.java [new file with mode: 0644]
libjava/javax/swing/table/DefaultTableCellRenderer.java
libjava/javax/swing/table/DefaultTableColumnModel.java
libjava/javax/swing/table/DefaultTableModel.java
libjava/javax/swing/table/JTableHeader.java
libjava/javax/swing/table/TableColumn.java
libjava/javax/swing/table/TableColumnModel.java
libjava/javax/swing/table/TableModel.java
libjava/javax/swing/text/AbstractDocument.java
libjava/javax/swing/text/DefaultEditorKit.java
libjava/javax/swing/text/DefaultStyledDocument.java [new file with mode: 0644]
libjava/javax/swing/text/EditorKit.java
libjava/javax/swing/text/GapContent.java
libjava/javax/swing/text/JTextComponent.java
libjava/javax/swing/text/PasswordView.java
libjava/javax/swing/text/PlainDocument.java
libjava/javax/swing/text/PlainView.java
libjava/javax/swing/text/Position.java
libjava/javax/swing/text/Segment.java
libjava/javax/swing/text/StringContent.java [new file with mode: 0644]
libjava/javax/swing/text/StyledEditorKit.java
libjava/javax/swing/text/TextAction.java
libjava/javax/swing/text/View.java
libjava/javax/swing/text/ViewFactory.java
libjava/javax/swing/tree/DefaultMutableTreeNode.java
libjava/javax/swing/tree/MutableTreeNode.java
libjava/javax/swing/tree/TreeCellEditor.java
libjava/jni/gtk-peer/gdkfont.h
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c [deleted file]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c [deleted file]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c [deleted file]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
libjava/jni/gtk-peer/gtkcairopeer.h
libjava/jni/gtk-peer/gtkpeer.h

index f15fb27..03571dc 100644 (file)
+2005-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * java/awt/BasicStroke.java (hashCode): Check for null dash.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/peer/gtk/GtkArg.java,
+       gnu/java/awt/peer/gtk/GtkArgList.java:
+       Removed.
+
+2005-02-15  Craig Black  <craig.black@aonix.com>
+
+       * gnu/java/awt/peer/gtk/GtkCheckboxMenuItem.java
+       (postMenuActionEvent): Implement to notify ItemListeners.
+       * java/awt/CheckboxMenuItem.java
+       (dispatchEventImpl): Update state on ItemEvent.
+       * java/awt/MenuItem.java
+       (processActionEvent): Retarget event source.
+
+2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+       * gnu/java/awt/color/ClutProfileConverter.java,
+       gnu/java/awt/peer/ClasspathTextLayoutPeer.java,
+       gnu/java/awt/peer/gtk/GdkFontPeer.java,
+       gnu/java/awt/peer/gtk/GdkGlyphVector.java,
+       gnu/java/awt/peer/gtk/GdkGraphics2D.java,
+       gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
+       gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
+       gnu/java/awt/peer/gtk/GdkRobotPeer.java,
+       gnu/java/awt/peer/gtk/GdkTextLayout.java,
+       gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+       gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
+       gnu/java/awt/peer/gtk/GtkChoicePeer.java,
+       gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+       gnu/java/awt/peer/gtk/GtkContainerPeer.java,
+       gnu/java/awt/peer/gtk/GtkDialogPeer.java,
+       gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
+       gnu/java/awt/peer/gtk/GtkFontPeer.java,
+       gnu/java/awt/peer/gtk/GtkFramePeer.java,
+       gnu/java/awt/peer/gtk/GtkLabelPeer.java,
+       gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
+       gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
+       gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
+       gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,
+       gnu/java/awt/peer/gtk/GtkToolkit.java,
+       gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+       javax/swing/JPopupMenu.java,
+       javax/swing/JSpinner.java,
+       javax/swing/SortingFocusTraversalPolicy.java,
+       javax/swing/SwingUtilities.java,
+       javax/swing/plaf/basic/BasicComboBoxEditor.java,
+       javax/swing/plaf/basic/BasicComboBoxRenderer.java,
+       javax/swing/tree/DefaultMutableTreeNode.java:
+       Removed unused imports and expanded starred
+       imports.
+
+2005-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * java/awt/AWTKeyStroke.java (getAWTKeyStroke(String)): Throw
+       IllegalArgumentException when the given String is null.
+
+       * javax/swing/KeyStroke.java (getKeyStroke(String)): Return null
+       when given keystoke sequence cannot be parsed.
+
+       * javax/swing/JRootPane.java (setJMenuBar): Remove current menubar
+       if one is installed. Only install the given menubar is not null.
+
+       * javax/swing/JViewport.java (getViewSize): Return an empty
+       Dimension when the view isn't set or preferred component size when
+       no viewSize is set.
+
+       * javax/swing/ViewportLayout.java (preferredLayoutSize): Return an
+       empty Dimension when there is no view set.
+       (minimumLayoutSize): Likewise.
+       (layoutContainer): Don't try to layout when there is no view.
+
+2005-02-15  Anthony Green  <green@redhat.com>
+
+       * jni/gtk-peer/gtk_jawt.c (classpath_jawt_get_drawable,
+       classpath_jawt_lock, classpath_jawt_unlock): New functions.
+       * jawt.c (_Jv_JAWT_Lock, _Jv_JAWT_Unlock): New functions.
+       (_Jv_GetDrawingSurface): Set visualID.
+       (_Jv_FreeDrawingSurfaceInfo): Clear visualID.
+       (JAWT_GetAWT): Set Lock and Unlock.
+       * include/jawt_md.h (struct _JAWT_X11DrawingSurfaceInfo): Add visualID.
+       * include/jawt.h (JAWT_VERSION_1_4, JAWT_LOCK_ERROR,
+       JAWT_LOCK_CLIP_CHANGED, JAWT_LOCK_BOUNDS_CHANGED,
+       JAWT_LOCK_SURFACE_CHANGED): New macros.
+       (struct _JAWT): Add Lock and Unlock.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * jawt.c: New file.
+       * include/jawt.h: Likewise.
+       * include/jawt_md.h: Likewise.
+       * include/Makefile.am (tool_include__HEADERS): Add jawt.h and
+       jawt_md.h files.
+       * jni/classpath/classpath_jawt.h: Likewise.
+       * jni/gtk-peer/gtk_jawt.c: Likewise.
+       * Makefile.am: Build libjawt.so.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/peer/gtk/GdkGraphics2D.java:
+       Merged file header with classpath CVS head.
+       * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
+       Merged code formatting with classpath CVS head.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c:
+       Removed debug code.
+       (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
+       Handle special JNI strings with 2 '\0' at the end.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
+       Merged file header with classpath CVS head.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
+       Merged code formatting with classpath CVS head.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (create):
+       Use GTK's built-in file system backend.  Use GTK_RESPONSE_ACCEPT.
+       (handle_response): Use GTK_RESPONSE_ACCEPT.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * Makefile.am: Fix library build breakage.
+       * Makefile.in: Regenerate.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTabbedPane.java
+       (Page.setDisplayedMnemonicIndex): Handle empty menmonic.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/tree/DefaultMutableTreeNode.java:
+       Reworked Javadocs all over.
+       (getPathToRoot): Fixed direction of result array initialization.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
+        Fix includes for cairo 0.3.0 snappshot.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
+       Merged file header from classpath CVS HEAD.
+
+2005-02-15  Craig Black  <craig.black@aonix.com>
+
+       * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+       (copyState): Pass a JNI global reference to signal handler.
+       (realize_cb): Use and free JNI global reference.
+       * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+       (create): Pass a JNI global reference to signal handler.
+       (selection_changed): Match declaration.
+       * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+       (dispose): Do not remove entries from state tables until after widget is
+       destroyed.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/Container.javai (paramString):
+       If layoutMgr is null just return result of super.paramString().
+       * java/awt/Scrollbar.java: Reformatted.
+       * java/awt/im/InputContext.java (static):
+       Removed redundant initializations.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/ImageIcon.java,
+       javax/swing/UIManager.java,
+       javax/swing/text/EditorKit.java,
+       javax/swing/text/Segment.java:
+       More whitespace cleanups.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/EmbeddedWindow.java,
+       gnu/java/awt/image/ImageDecoder.java,
+       gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
+       java/awt/DefaultKeyboardFocusManager.java,
+       java/awt/Frame.java,
+       java/awt/image/RGBImageFilter.java,
+       javax/swing/AbstractButton.java,
+       javax/swing/ActionMap.java,
+       javax/swing/ComponentInputMap.java,
+       javax/swing/DefaultDesktopManager.java,
+       javax/swing/ImageIcon.java,
+       javax/swing/InputMap.java,
+       javax/swing/JButton.java,
+       javax/swing/JCheckBox.java,
+       javax/swing/JCheckBoxMenuItem.java,
+       javax/swing/JEditorPane.java,
+       javax/swing/JMenu.java,
+       javax/swing/JMenuItem.java,
+       javax/swing/JOptionPane.java,
+       javax/swing/JRootPane.java,
+       javax/swing/JTable.java,
+       javax/swing/MenuSelectionManager.java,
+       javax/swing/RepaintManager.java,
+       javax/swing/ScrollPaneLayout.java,
+       javax/swing/SortingFocusTraversalPolicy.java,
+       javax/swing/UIManager.java,
+       javax/swing/ViewportLayout.java,
+       javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java,
+       javax/swing/plaf/basic/BasicInternalFrameUI.java,
+       javax/swing/plaf/basic/BasicLabelUI.java,
+       javax/swing/plaf/basic/BasicListUI.java,
+       javax/swing/plaf/basic/BasicMenuItemUI.java,
+       javax/swing/plaf/basic/BasicMenuUI.java,
+       javax/swing/plaf/basic/BasicOptionPaneUI.java,
+       javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java,
+       javax/swing/plaf/basic/BasicRootPaneUI.java,
+       javax/swing/plaf/basic/BasicScrollPaneUI.java,
+       javax/swing/plaf/basic/BasicSplitPaneDivider.java,
+       javax/swing/plaf/basic/BasicTextUI.java,
+       javax/swing/table/TableColumnModel.java,
+       javax/swing/text/AbstractDocument.java,
+       javax/swing/text/EditorKit.java,
+       javax/swing/text/Position.java,
+       javax/swing/text/Segment.java,
+       javax/swing/text/StyledEditorKit.java,
+       javax/swing/text/ViewFactory.java:
+       Cleanup whitespace differences to classpath CVS HEAD.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
+       (finalize): Call finish from here.
+       (produce): Not from here.
+       * Makefile.am (gtk_c_source_files): 
+       Remove jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c.
+       * Makefile.in: Regenerate.
+       * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+       (cairoSetFont):
+       (cairoDrawGdkTextLayout):
+       (cairoDrawString): 
+       (getPeerTextMetrics):
+       (getPeerFontMetrics): Remove.
+       (setFont): Don't call cairoSetFont.
+       (cairoDrawGlyphVector): Accept font peer argument.
+       (drawGlyphVector): Pass font peer to cairoDrawGlyphVector.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c    
+       (ensure_metrics_cairo):
+       (gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont):
+       (gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString):
+       (gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics):
+       (gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics):
+       (metrics_cairo):
+       (metrics_surface): Remove.
+       (gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector):
+       Pass and install font peer.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * Makefile.am: Create "split library" structure.
+       * Makefile.in: Regenerate.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:
+       Release GDK lock during upcalls.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Remove.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+       (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
+       (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics): 
+       (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics): New methods.   
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c: Remove.  
+       * gnu/java/awt/peer/gtk/GdkFontPeer.java
+       (getGlyphVector):
+       (getFontMetrics):
+       (getTextMetrics): New native methods.
+       * gnu/java/awt/peer/gtk/GdkFontMetrics.java: Remove native parts.
+       * gnu/java/awt/peer/gtk/GdkGlyphVector.java: Likewise.
+       * Makefile.am: Remove native entries for GdkFontMetrics, GdkGlyphVector.
+       * Makefile.in: Regenerate.
+
+2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+       * javax/swing/SwingUtilities.java:
+       (getAccessibleAt(java.awt.Component, java.awt.Point)):
+       Implemented and documented.
+       (getAccessibleChild(java.awt.Component, int)): Likewise.
+       (getAccessibleChildrenCount(java.awt.Component)): Likewise.
+       (getAccessibleIndexInParent(java.awt.Component)): Likewise.
+       (getAccessibleStateSet(java.awt.Component)): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/SwingUtilities.java
+       (getFontMetrics): Removed.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/Container.java
+       (paramString): Implemented.
+       * javax/swing/AbstractButton.java
+       (paramString): Implemented.
+       * javax/swing/JComponent.java
+       (paramString): Implemented.
+       * javax/swing/JMenu.java
+       (paramString): Implemented.
+       * javax/swing/JMenuBar.java
+       (paramString): Implemented.
+       * javax/swing/JMenuItem.java
+       (paramString): Implemented.
+       * javax/swing/JPopupMenu.java
+       (paramString): Implemented.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JMenu.java
+       (uiClassID): Removed.
+       (JMenu): Set invoker on popup menu.
+       (getUIClassID): Return id directly.
+       (getItemCount): Simply return getMenuComponentCount().
+       Fixed javadoc.
+       (isTopLevelMenu): Simplified.
+       * javax/swing/JMenuItem.java
+       (uiClassID): Removed.
+       (getUIClassID): Return id directly.
+       * javax/swing/JPopupMenu.java
+       (uiClassID): Removed.
+       (JPopupMenu): Always initialize correctly.
+       (getSubElements): Only return components implementing MenuElement
+       interface.
+       (HeavyWeightPopup.hide): Removed.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/image/ReplicateScaleFilter.java
+       (replicatePixels): Made private.
+       * javax/swing/colorchooser/DefaultRGBChooserPanel.java
+       (DefaultRGBChooserPanel): Made package private.
+       * javax/swing/colorchooser/DefaultSwatchChooserPanel.java
+       (RecentSwatchPanel): Likewise.
+       * javax/swing/event/MouseInputAdapter.java: Reformatted.
+       (MouseInputAdapter): Made abstract.
+       * javax/swing/tree/DefaultMutableTreeNode.java
+       (random): Removed.
+       (growTree): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/dnd/DropTarget.java (addDropTargetListener):
+       Clarified comments.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JComponent.java (getComponentGraphics):
+       Removed accidently commited code.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * java/awt/dnd/DropTarget.java
+       (addDropTargetListener): Despite documentation, do not throw.
+       * javax/swing/JComponent.java: Set a default DropTarget.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/AbstractAction.java
+       (ENABLED_PROPERTY): Removed.
+       (setEnabled): Replaced constant with real string.
+       * javax/swing/AbstractButton.java
+       (createActionPropertyChangeListener.propertyChange): Likewise.
+       * javax/swing/JComboBox.java
+       (DEFAULT_MAXIMUM_ROW_COUNT): Made private.
+       (EDITABLE_CHANGED_PROPERTY): Removed.
+       (MAXIMUM_ROW_COUNT_CHANGED_PROPERTY):Likewise.
+       (ENABLED_CHANGED_PROPERTY):Likewise.
+       (RENDERER_CHANGED_PROPERTY):Likewise.
+       (EDITOR_CHANGED_PROPERTY):Likewise.
+       (MODEL_CHANGED_PROPERTY):Likewise.
+       (uiClassID):Likewise.
+       (getUIClassID): Replaced constant with real string.
+       (setModel):Likewise.
+       (setEditable):Likewise.
+       (setMaximumRowCount):Likewise.
+       (setRenderer):Likewise.
+       (setEditor):Likewise.
+       (setEnabled):Likewise.
+       * javax/swing/JLabel.java
+       (DISABLED_ICON_CHANGED_PROPERTY): Removed.
+       (DISPLAYED_MNEMONIC_CHANGED_PROPERTY): Likewise.
+       (DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY): Likewise.
+       (HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY): Likewise.
+       (HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY): Likewise.
+       (ICON_CHANGED_PROPERTY): Likewise.
+       (ICON_TEXT_GAP_CHANGED_PROPERTY): Likewise.
+       (LABEL_FOR_CHANGED_PROPERTY): Likewise.
+       (TEXT_CHANGED_PROPERTY): Likewise.
+       (VERTICAL_ALIGNMENT_CHANGED_PROPERTY): Likewise.
+       (VERTICAL_TEXT_POSITION_CHANGED_PROPERTY): Likewise.
+       (setText): Replaced constant with real string.
+       (setIcon): Likewise.
+       (setDisabledIcon): Likewise.
+       (setDisplayedMnemonic): Likewise.
+       (setIconTextGap): Likewise.
+       (setVerticalAlignment): Likewise.
+       (setHorizontalAlignment): Likewise.
+       (setVerticalTextPosition): Likewise.
+       (setHorizontalTextPosition): Likewise.
+       (setLabelFor): Replaced constant with real string.
+       Fire property change event after property got changed.
+       * javax/swing/JList.java
+       (CELL_RENDERER_PROPERTY_CHANGED): Likewise.
+       (FIXED_CELL_HEIGHT_PROPERTY_CHANGED): Likewise.
+       (FIXED_CELL_WIDTH_PROPERTY_CHANGED): Likewise.
+       (LAYOUT_ORIENTATION_PROPERTY_CHANGED): Likewise.
+       (MODEL_PROPERTY_CHANGED): Likewise.
+       (PROTOTYPE_CELL_VALUE_PROPERTY_CHANGED): Likewise.
+       (SELECTION_BACKGROUND_PROPERTY_CHANGED): Likewise.
+       (SELECTION_FOREGROUND_PROPERTY_CHANGED): Likewise.
+       (SELECTION_MODEL_PROPERTY_CHANGED): Likewise.
+       (setFixedCellWidth): Reimplemented.
+       (setFixedCellHeight): Exit if new value is identical.
+       Replaced constant with real string.
+       (setSelectionBackground): Likewise.
+       (setSelectionForeground): Likewise.
+       (setPrototypeCellValue): Likewise.
+       (setCellRenderer): Replaced constant with real string.
+       (setModel): Likewise.
+       (setSelectionModel): Likewise.
+       * javax/swing/JMenuBar.java
+       (BORDER_PAINTED_CHANGED_PROPERTY): Removed.
+       (MODEL_CHANGED_PROPERTY): Likewise.
+       (MARGIN_CHANGED_PROPERTY): Likewise.
+       (setBorderPainted): Reimplemented.
+       (setMargin): Likewise.
+       (setSelectionModel): Replaced constant with real string.
+       * javax/swing/JPopupMenu.java
+       (LABEL_CHANGED_PROPERTY): Removed.
+       (VISIBLE_CHANGED_PROPERTY): Likewise.
+       (borderPainted): Likewise.
+       (setLabel): Replaced constant with real string.
+       (setVisible): Exit if new value is identical.
+       Replaced constant with real string.
+       * javax/swing/JProgressBar.java
+       (BORDER_PAINTED_CHANGED_PROPERTY): Removed.
+       (ORIENTATION_CHANGED_PROPERTY): Likewise.
+       (STRING_CHANGED_PROPERTY): Likewise.
+       (STRING_PAINTED_CHANGED_PROPERTY): Likewise.
+       (INDETERMINATE_CHANGED_PROPERTY): Likewise.
+       (setOrientation): Replaced constant with real string.
+       (setStringPainted): Likewise.
+       (setString): Likewise.
+       (setBorderPainted): Likewise.
+       (setIndeterminate): Likewise.
+       * javax/swing/JScrollBar.java
+       (BLOCK_INCREMENT_CHANGED_PROPERTY): Removed.
+       (MODEL_CHANGED_PROPERTY): Likewise.
+       (ORIENTATION_CHANGED_PROPERTY): Likewise.
+       (setOrientation): Replaced constant with real string.
+       (setModel): Likewise.
+       (setUnitIncrement): Likewise.
+       (setBlockIncrement): Likewise.
+       * javax/swing/JScrollPane.java
+       (COLUMN_HEADER_CHANGED_PROPERTY): Removed.
+       (COMPONENT_ORIENTATION_CHANGED_PROPERTY): Likewise.
+       (HORIZONTAL_SCROLLBAR_CHANGED_PROPERTY): Likewise.
+       (HORIZONTAL_SCROLLBAR_POLICY_CHANGED_PROPERTY): Likewise.
+       (LAYOUT_CHANGED_PROPERTY): Likewise.
+       (ROW_HEADER_CHANGED_PROPERTY): Likewise.
+       (VERTICAL_SCROLLBAR_CHANGED_PROPERTY): Likewise.
+       (VERTICAL_SCROLLBAR_POLICY_CHANGED_PROPERTY): Likewise.
+       (VIEWPORT_CHANGED_PROPERTY): Likewise.
+       (VIEWPORT_BORDER_CHANGED_PROPERTY): Likewise.
+       (WHEEL_SCROLLING_ENABLED_CHANGED_PROPERTY): Likewise.
+       (setComponentOrientation): Replaced constant with real string.
+       (setColumnHeader): Likewise.
+       (setHorizontalScrollBar): Likewise.
+       (setHorizontalScrollBarPolicy): Likewise.
+       (setRowHeader): Likewise.
+       (setVerticalScrollBar): Likewise.
+       (setVerticalScrollBarPolicy): Likewise.
+       (setWheelScrollingEnabled): Likewise.
+       (setViewport): Likewise.
+       (setViewportBorder): Likewise.
+       * javax/swing/JSlider.java
+       (INVERTED_CHANGED_PROPERTY): Removed.
+       (LABEL_TABLE_CHANGED_PROPERTY): Likewise.
+       (MAJOR_TICK_SPACING_CHANGED_PROPERTY): Likewise.
+       (MINOR_TICK_SPACING_CHANGED_PROPERTY): Likewise.
+       (MODEL_CHANGED_PROPERTY): Likewise.
+       (ORIENTATION_CHANGED_PROPERTY): Likewise.
+       (PAINT_LABELS_CHANGED_PROPERTY): Likewise.
+       (PAINT_TICKS_CHANGED_PROPERTY): Likewise.
+       (setModel): Replaced constant with real string.
+       (setOrientation): Likewise.
+       (setLabelTable): Likewise.
+       (setInverted): Likewise.
+       (setMajorTickSpacing): Likewise.
+       (setMinorTickSpacing): Likewise.
+       (setPaintTicks): Likewise.
+       (setPaintLabels): Likewise.
+       * javax/swing/JTabbedPane.java
+       (MODEL_CHANGED_PROPERTY): Removed.
+       (TAB_PLACEMENT_CHANGED_PROPERTY): Likewise.
+       (TAB_LAYOUT_POLICY_CHANGED_PROPERTY): Likewise.
+       (setModel): Replaced constant with real string.
+       (setTabPlacement): Likewise.
+       (setTabLayoutPolicy): Likewise.
+       * javax/swing/JToolBar.java
+       (ORIENTATION_CHANGED_PROPERTY): Removed.
+       (FLOATABLE_CHANGED_PROPERTY): Likewise.
+       (BORDER_PAINTED_CHANGED_PROPERTY): Likewise.
+       (MARGIN_CHANGED_PROPERTY): Likewise.
+       (ROLLOVER_CHANGED_PROPERTY): Likewise.
+       (setRollover): Replaced constant with real string.
+       (setMargin): Likewise.
+       (setBorderPainted): Likewise.
+       (setFloatable): Likewise.
+       (setOrientation): Likewise.
+       * javax/swing/plaf/basic/BasicComboBoxUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicComboPopup.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicMenuBarUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicProgressBarUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicScrollBarUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicSliderUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+       * javax/swing/plaf/basic/BasicToolBarUI.java
+       (PropertyChangeHandler.propertyChange): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultButtonModel.java
+       (changeState): Made private.
+       * javax/swing/DefaultDesktopManager.java
+       (setWasIcon): Fixed second argument to be java.lang.Boolean.
+       * javax/swing/JLayeredPane.java
+       (layerToRange): Made private.
+       (incrLayer): Likewise.
+       (decrLayer): Likewise.
+       * javax/swing/JTable.java
+       (dragEnabled): Likewise.
+       (preferredViewportSize): Renamed from preferredScrollableViewportSize.
+       * javax/swing/KeyStroke.java
+       (Keystroke): Made private.
+       * javax/swing/TransferHandler.java
+       (COMMAND_COPY): Likewise.
+       (COMMAND_CUT): Likewise.
+       (COMMAND_PASTE): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTextField.java
+       (postActionEvent): Use text in field when actionCommand is null.
+       (getActionCommand): Removed.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/AbstractSet.java: Removed.
+       * Makefile.am: Removed javax/swing/AbstractSet.java.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/Window.java
+       (AccessibleWindow.getAccessibleStateSet): Fixed method name.
+       * java/awt/dnd/DnDConstants.java
+       (DnDConstants): New private constructor.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultCellRenderer.java: Removed.
+       * Makefile.am: Removed javax/swing/DefaultCellRenderer.java.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/AbstractButton.java
+       (fireItemStateChanged): Made protected.
+       (fireActionPerformed): Likewise.
+       (fireStateChanged): Likewise.
+       * javax/swing/DefaultButtonModel.java
+       (fireItemStateChanged): Likewise.
+       (fireActionPerformed): Likewise.
+       (fireStateChanged): Likewise.
+       * javax/swing/JApplet.java
+       (JApplet): Removed.
+       (frameInit): Likewise.
+       (setRootPane): Made protected.
+       (createRootPane): Likewise.
+       * javax/swing/JComponent.java
+       (getClientProperty): Likewise.
+       (putClientProperty): Likewise.
+       * javax/swing/JEditorPane.java
+       (getContentType): Likewise.
+       (setContentType): Likewise.
+       * javax/swing/JFrame.java
+       (setRootPane): Likewise.
+       (createRootPane): Likewise.
+       * javax/swing/JInternalFrame.java
+       (getFocusCycleRootAncestor): Made final. Added @since tag.
+       (isFocusCycleRoot): Likewise.
+       (getWarningString): Made final.
+       * javax/swing/JScrollBar.java
+       (changeListener): Removed.
+       (changeEvent): Likewise.
+       (createChangeListener): Likewise.
+       (fireStateChanged): Likewise.
+       (addChangeListener): Likewise.
+       (removeChangeListener): Likewise.
+       (getChangeListeners): Likewise.
+       * javax/swing/JScrollPane.java
+       (createViewport): Made protected.
+       * javax/swing/JViewport.java
+       (addImpl): Likewise.
+       (setBorder): New method.
+       * javax/swing/JWindow.java
+       (setRootPane): Made protected.
+       (createRootPane): Likewise.
+       * javax/swing/plaf/basic/BasicButtonUI.java
+       (installListeners): Likewise.
+       (uninstallListeners): Likewise.
+       * javax/swing/plaf/basic/BasicProgressBarUI.java
+       (incrementAnimationIndex): Likewise.
+       * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+       (createLayoutManager): Likewise.
+       * javax/swing/table/DefaultTableCellRenderer.java
+       (firePropertyChange): Likewise.
+       * javax/swing/table/JTableHeader.java
+       (AccessibleJTableHeaderEntry.AccessibleJTableHeaderEntry):
+       New constructor.
+       * javax/swing/text/PlainDocument.java
+       (reindex): Made private.
+       * javax/swing/text/PlainView.java
+       (drawLine): Made protected.
+       (getTabSize): Likewise.
+       * javax/swing/text/View.java
+       (setSize): Removed.
+       (preferenceChanged): New method.
+       (getBreakWeight): Likewise.
+       (breakView): Likewise.
+       (getViewIndex): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JScrollPane.java
+       (ScrollBar): Made class protected.
+       * javax/swing/JSpinner.java
+       (JSpinner): Added @since tag.
+       (listenerList): Removed.
+       * javax/swing/JTable.java
+       (setValueAt): New method.
+       (getColumn): Likewise.
+       * javax/swing/JWindow.java
+       (rootPaneCheckingEnabled): Renamed from checking.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/basic/BasicTextUI.java
+       (RootView.modelToView): Made it public and return a java.awt.Shape.
+       Handle null subview.
+       (uninstall): Set textComponent to null when its not possible used
+       anymore.
+       * javax/swing/text/View.java
+       (setParent): Use better argument name.
+       (getContainer): Get parent via getParent().
+       (getViewFactory): Likewise.
+       (getAttributes): Get element via getElement().
+       (getStartOffset): Likewise.
+       (getEndOffset): Likewise.
+       (getResizeWeight): New method.
+       (getMaximumSpan): Likewise.
+       (getMinimumSpan): Likewise.
+       (setSize): Likewise.
+       (getGraphics): Likewise.
+
+2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+       * java/awt/Checkbox.java:
+       (AccessibleAWTCheckbox()): Added public constructor
+       to call superclass.
+       * java/awt/Choice.java:
+       (AccessibleAWTChoice): Added class documentation.
+       (AccessibleAWTChoice()): Added public constructor
+       to call superclass.
+       (AccessibleAWTChoice.getAccessibleAction()): Documented.
+       (AccessibleAWTChoice.getAccessibleRole()): Documented,
+       and changed role to COMBO_BOX.
+       (AccessibleAWTChoice.getAccessibleActionCount()): Documented.
+       (AccessibleAWTChoice.getAccessibleActionDescription(int)): Documented.
+       (AccessibleAWTChoice.doAccessibleAction(int)): Documented.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+           Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/LayoutFocusTraversalPolicy.java,
+       javax/swing/SortingFocusTraversalPolicy.java:
+       New classes.
+       * Makefile.am: Added new classes.
+       * Makefike.in: Regenerated.
+
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DebugGraphics.java: Mostly implemented.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/SwingUtilities.java
+       (findFocusOwner): New method.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/DefaultEditorKit.java
+       (read): Added '\n' after each line.
+       * javax/swing/text/PlainView.java
+       (modelToView): Update metrics.
+       (drawLine): Use offsets from element.
+       (paint): Update metrics. Draw all lines.
+
+2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+       * java/awt/Checkbox.java:
+       (AccessibleAWTCheckbox): Added class documentation
+       * java/awt/Scrollbar.java:
+       (AccessibleAWTScrollBar): typo corrected and docs added
+       (AccessibleAWTScrollBar.getAccessibleRole()): documented
+       (AccessibleAWTScrollBar.getAccessibleStateSet()): likewise
+       (AccessibleAWTScrollBar.getAccessibleValue()): likewise
+       (AccessibleAWTScrollBar.getCurrentAccessibleValue()): likewise
+       (AccessibleAWTScrollBar.setCurrentAccessibleValue(int)): likewise
+       (AccessibleAWTScrollBar.getMinimumAccessibleValue()): likewise
+       (AccessibleAWTScrollBar.getMaximumAccessibleValue()): likewise
+       (getAccessibleContext()): name of accessible class corrected
+
+2005-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * java/awt/BasicStroke.java (hashCode): Implement.
+       (equals): Document.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/print/PrinterJob.java
+       (pageDialog): Throws java.awt.HeadlessException.
+       (printDialog): Likewise.
+
+2005-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * jni/gtk-peer/gtkpeer.h (gdk_env): Fix prototype.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTable.java
+       (getValueAt): New method.
+       * javax/swing/table/JTableHeader.java
+       (columnAtPoint): New method.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTextField.java
+       (actions): New field.
+       (static): Initalize actions field.
+       (getActions): New method.
+
+2005-02-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+       * java/awt/Checkbox.java:
+       (AccessibleAWTCheckbox): name capitalization corrected
+       and serialization UID added.
+       (AccessibleAWTCheckbox.itemStateChanged(java.awt.event.ItemEvent)):
+       documented.
+       (AccessibleAWTCheckbox.getAccessibleAction()): likewise
+       (AccessibleAWTCheckbox.getAccessibleValue()): likewise
+       (AccessibleAWTCheckbox.getAccessibleActionCount()): likewise
+       (AccessibleAWTCheckbox.getAccessibleActionDescription(int)): likewise
+       (AccessibleAWTCheckbox.doAccessibleAction(int)): likewise
+       (AccessibleAWTCheckbox.getCurrentAccessibleValue()): likewise
+       (AccessibleAWTCheckbox.setCurrentAccessibleValue(int)): likewise
+       (AccessibleAWTCheckbox.getMinimumAccessibleValue()): likewise
+       (AccessibleAWTCheckbox.getMaximumAccessibleValue()): likewise
+       (AccessibleAWTCheckbox.getAccessibleRole()): likewise
+       (AccessibleAWTCheckbox.getAccessibleStateSet()): implemented and
+       documented
+       (getAccessibleContext()): name of accessible class corrected
+
+2005-02-15  Sven de Marothy  <sven@physto.se>
+
+       * java/awt/geom/doc-files/Area-1.png,
+       java/awt/geom/doc-files/Ellipse-1.png,
+       java/awt/geom/doc-files/GeneralPath-1.png:
+       New files.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (env_union):
+       Use union to avoid type-punning warning.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultListSelectionModel.java
+       (clone): New method.
+
+2005-02-15  Mark Wielaard  <mark@klomp.org>
+
+       Reported by Martin Platter <motse@complang.tuwien.ac.at>
+       * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+       (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile):
+       Correct method signature of gtkSetFilename.
+
+2005-02-15  Arnaud Vandyck  <avdyk@gnu.org>
+
+       * javax/swing/text/StringContent.java: New file.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * Makefile.am: Added javax/swing/text/StringContent.java.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/ClasspathToolkit.java:
+       Import statements reworked.
+       (imageCache): Made it of type java.util.HashMap.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/imageio/stream/MemoryCacheImageInputStream.java:
+       Reworked import statements.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:
+       Rewrite uses of extern variable to be function calls.
+       * jni/gtk-peer/gtkpeer.h (gdk_env): Change declaration to 
+       function, from extern variable.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c 
+       (gdk_env): Remove variable, add new function.
+       (java_vm): Add new variable.
+       (Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit): Initialize
+       java_vm rather than old gdk_env variable.
+
+2005-02-15 David Gilbert <david.gilbert@object-refinery.com>
+
+       * javax/swing/DefaultListModel.java
+       (add): fire correct event,
+       (addElement): corrected interval indices in event,
+       (clear): corrected upper bound for interval, only fire event if
+       list is not empty,
+       (setSize): fire appropriate event.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * gnu/awt/xlib/XEventLoop.java: Add non-blocking event mode.
+       * gnu/awt/xlib/XToolkit.java: Likewise.
+       * gnu/gcj/xlib/XAnyEvent.java: Likewise.
+       * gnu/gcj/xlib/natXAnyEvent.cc: Likewise.
+       * gnu/java/awt/ClasspathToolkit.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkToolkit.java: Likewise.
+       * java/awt/EventQueue.java (getNextEvent): 
+       Adjust event loop to switch to native mode after 100ms.
+       * javax/swing/Timer.java (drainEvents): Reuse Runnable.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+       (Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose): 
+       Wake up event thread.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+       (Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue):
+       Adjust event loop to switch to java mode after 100ms.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * jni.cc (_Jv_JNI_RegisterNatives): Re-add sync, which was
+       accidentally removed in last change.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
+       gnu/java/awt/peer/gtk/GtkMainThread.java: Removed.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * include/jni.h (_Jv_JNIEnv::bottom_locals): New field.
+       * include/jvm.h (_Jv_FreeJNIEnv): Declare.
+       * java/lang/natThread.cc (finalize_native): Call _Jv_FreeJNIEnv.
+       * jni.cc: Reuse bottom frame between calls, avoid clearing
+       frame when no local references are made.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/UIDefaults.java (UIDefaults):
+       Fixed typo in javadoc (Thanks to Thomas Zander for reporting)
+       Fixed HTML entity and removed a redundant comma.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/DefaultEditorKit.java
+       (deinstall): Removed.
+       (install): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/UIDefaults.java (put): Handle value of null.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/Robot.java,
+       java/awt/Scrollbar.java,
+       java/awt/print/PrinterJob.java,
+       javax/swing/JTable.java,
+       javax/swing/text/AbstractDocument.java:
+       Reworked import statements.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JEditorPane.java
+       (read): Implemented.
+       (write): Likewise.
+       * javax/swing/text/DefaultEditorKit.java
+       (page): Renamed from page_url. Made private.
+       (editorKit): Renamed from kit. Made private.
+       (ctype): Removed.
+       (JEditorPane): All constructors reimplemented.
+       (getContentType): Use content type from editor kit.
+       (getEditorKit): Return editorKit.
+       (getEditorKitForContentType):Likewise.
+       (getPage): Return page.
+       (setContentType): Reimplemented.
+       (setEditorKit): Likewise.
+       (setEditorKitForContentType): Removed wrong implementation.
+       (setPage): Implemented.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+       (nativeSetIconImageFromData): Re-add native implementation.
+
+2005-02-15  David Gilbert  <david.gilbert@object-refinery.com>
+
+       * javax/swing/table/DefaultTableModel.java
+       (DefaultTableModel()): Added Javadocs.
+       (DefaultTableModel(int, int)): Fixed implementation.
+       (DefaultTableModel(Vector, int)): Throw IllegalArgumentException
+       for negative rowCount.
+       (DefaultTableModel(Object[], int)): Added Javadocs.
+       (DefaultTableModel(Vector, Vector)): Likewise.
+       (DefaultTableModel(Object[][], Object[])): Likewise.
+       (getDataVector): Likewise.
+       (setDataVector(Vector, Vector)): Likewise.
+       (setDataVector(Object[][], Object[])): Likewise.
+       (newDataAvailable): Likewise.
+       (newRowsAdded): Likewise.
+       (rowsRemoved): Likewise.
+       (setColumnIdentifiers(Vector)): Allow for null argument.
+       (setColumnIdentifiers(Object[])): Added Javadocs.
+       (setNumRows): Likewise.
+       (setRowCount): Adds new rows if necessary, and sends more specific
+       TableModelEvent.
+       (setColumnCount): Allow for null columnIdentifiers.
+       (addColumn(Object)): Added Javadocs.
+       (addColumn(Object, Vector)): Handle null columnData.
+       (addColumn(Object, Object[])): Handle columnData with more or less
+       entries than rows in the table.
+       (addRow(Vector)): Fire appropriate event.
+       (addRow(Object[])): Added Javadocs.
+       (insertRow(int, Vector)): Fire appropriate event.
+       (insertRow(int, Object[])): Added Javadocs.
+       (moveRow): Reimplemented.
+       (removeRow(int)): Fire appropriate event.
+       (getColumnCount): Allow for null columnIdentifiers.
+       (getColumnName): Now returns empty string when column index is too
+       large.
+       (isCellEditable): Added Javadocs.
+       (getValueAt): Likewise.
+       (setValueAt): Fire more specific event.
+       (convertToVector): Added Javadocs.
+       * javax/swing/table/TableModel.java
+       Added Javadocs.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * libgcj.spec.in (lib): Add -l-javax-imageio.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * gnu/java/awt/peer/gtk/GtkComponentPeer.java: Replace direct
+       references to event queue q with method call q().
+       * gnu/java/awt/peer/gtk/GtkDialogPeer.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkFramePeer.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkScrollbarPeer.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkTextComponentPeer.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkWindowPeer.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkGenericPeer.java: Likewise.
+       (q): New method.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * gnu/java/awt/ClasspathToolkit.java 
+       (registerImageIOSpis): New method.
+       * gnu/java/awt/image/ImageDecoder.java 
+       (imageDecoder): New constructor using InputStream
+       (startProduction): Handle existing InputStream.
+       * gnu/java/awt/peer/gtk/GdkGraphics2D.java 
+       (findSimpleIntegerArray): Make public and static.
+       (updateBufferedImage): Set each pixel, in a loop.
+       * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java: 
+       Implement ImageIO SPI classes.
+       (createBufferedImage): Rewrite in terms of SPI classes.
+       * gnu/java/awt/peer/gtk/GtkToolkit.java
+       (registerImageIOSpis): New method.
+       * java/lang/reflect/natMethod.cc 
+       (_Jv_CallAnyMethodA): Borrow a patch from aph, applied to trunk, 
+       which lets JNI call interface methods properly.
+       * javax/imageio/ImageIO.java 
+       (WriterFormatFilter.filter): Fix copy-and-paste typos.
+       (WriterMIMETypeFilter.filter): Likewise.
+       (ImageReaderIterator): Pass extension argument through to SPI.
+       (getReadersByFilter): Likewise.
+       (getWritersByFilter): Likewise.
+       (getImageReadersByFormatName): Likewise.
+       (getImageReadersByMIMEType): Likewise.
+       (getImageReadersBySuffix): Likewise.
+       (getImageWritersByFormatName): Likewise.
+       (getImageWritersByMIMEType): Likewise.
+       (getImageWritersBySuffix): Likewise.
+       (read): Implement.
+       (write): Implement.
+       * javax/imageio/ImageReader.java 
+       (progressListeners): Initialize.
+       (setInput): Implement.
+       * javax/imageio/ImageWriter.java
+       (progressListeners): Initialize.
+       (warningListeners): Likewise.
+       (warningLocales): Likewise.
+       (setOutput): Test "isInstance" rather than class equality.
+       * javax/imageio/spi/IIORegistry.java
+       (static): Add reader and writer SPIs.
+       (IIORegistry): Call ClasspathToolkit.registerImageIOSpis.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+       (query_formats): New function.
+       (save_to_stream): Likewise.
+       (Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage): Likewise.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c (mouseWheel):
+       Call XFlush.
+       (keyPress): Likewise.
+       (keyRelease): Likewise.
+
+2005-02-15  Olga Rodimina  <rodimina@redhat.com>
+
+       * javax/swing/JTable.java
+       (columnAtPoint): New Method. Implemented.
+       (rowAtPoint): Likewise.
+       (countSelections): Fixed few small count errors.
+       (getSelections): Likewise.
+       (setSelectionMode): Set selection mode for column 
+       selection model in addition to row selection model.
+       * javax/swing/plaf/basic/BasicTableUI.java:
+       (getRowForPoint): Removed. Replaced by
+       JTable.rowAtPoint().
+       (getColForPoint): Removed. Replaced by 
+       JTable.columnAtPoint().
+       (updateSelection): Updated to call JTable.columnAtPoint 
+       and JTable.rowAtPoint.
+       * javax/swing/table/DefaultTableColumnModel.java:
+       (getSelectedColumns): Implemented.
+       (getSelectedColumnCount): Implemented.          
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * Makefile.am 
+       (jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c)
+       (gnu/java/awt/peer/gtk/GtkMainThread.java) : Remove.
+       * Makefile.in: Regenerate.
+       * gnu/awt/xlib/XEventLoop.java: Fix to match thread model.
+       * gnu/awt/xlib/XFramePeer.java: Likewise.
+       * gnu/awt/xlib/XToolkit.java: Likewise.
+       * gnu/gcj/xlib/XAnyEvent.java: Likewise.
+       * gnu/gcj/xlib/natXAnyEvent.cc: Likewise.
+       * gnu/java/awt/ClasspathToolkit.java 
+       (nativeQueueEmpty)
+       (wakeNativeQueue)
+       (iterateNativeQueue): New methods.
+       * gnu/java/awt/peer/gtk/GtkMainThread.java: Remove.
+       * gnu/java/awt/peer/gtk/GtkToolkit.java
+       (gtkInit): Absorb from defunct GtkMainThread class.
+       (static): Run gtkInit in static startup block.
+       (GtkToolkit): Remove construction of GtkMainThread and queue.
+       (getSystemEventQueueImpl): Construct queue when requested.
+       (nativeQueueEmpty)
+       (wakeNativeQueue)
+       (iterateNativeQueue): New methods.
+       * java/awt/Component.java (removeNotify): Remove race.
+       * java/awt/EventDispatchThread.java 
+       (EventDispatchThread): Don't start on construction.
+       (run): Remove isInterrupted check.
+       * java/awt/EventQueue.java (shutdown): New flag.
+       (isShutdown): New method checking J2SE shutdown condition.
+       (setShutdown): New method.
+       (getNextEvent): Restructure to use ClasspathToolkit.
+       (postEvent): Activate new thread on posting, wake thread on
+       post of possible shutdown condition event.
+       * java/awt/Frame.java 
+       (Frame): Call noteFrame in all constructors.
+       (fireDummyEvent): New helper method.
+       (addNotify): Fire a dummy event to wake up queue.
+       (removeNotify): Fire a dummy event to wake up queue.
+       (noteFrame): New method.
+       (weakFrames): New static field.
+       (getFrames): Implement.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c: 
+       Remove.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:
+       Move everything from GtkMainThread into this file
+       (Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue)
+       (Java_gnu_java_awt_peer_gtk_GtkToolkit_wakeNativeQueue)
+       (Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty):
+       New functions to implement single-threaded queue semantics.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/metal/MetalLookAndFeel.java
+       (getControlTextFont): New method.
+       (getMenuTextFont): Likewise.
+       (getSubTextFont): Likewise.
+       (getSystemTextFont): Likewise.
+       (getUserTextFont): Likewise.
+       (getWindowTitleFont): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/AbstractDocument.java
+       (documentFilter): New field.
+       (getDocumentFilter): New method.
+       (setDocumentFilter): Likewise.
+       (dump): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTree.java
+       (DynamicUtilTreeNode.hasChildren): Clarify javadoc.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/AbstractDocument.java
+       (AbstractElement.getLength): Fixed off-by-one error.
+       (AbstractElement.children): Made abstract.
+       (AbstractElement.getAllowsChildren): Likewise.
+       (AbstractElement.getElement): Likewise.
+       (AbstractElement.dumpElement): New private method.
+       (AbstractElement.dump): New method.
+       (BranchElememt.getName): Fixed implementation.
+       (BranchElememt.toString): Likewise.
+       (BranchElememt.getElement): Fixed arguments.
+       (LeafElement.getName): Fixed implementation.
+       (LeafElement.toString): Likewise.
+       * javax/swing/text/GapContent.java
+       (GapContent): Put default content into buffer.
+       * javax/swing/text/PlainDocument.java
+       (reindex): Use empty attribute sets instead of null.
+       (createDefaultRoot): Reimplemented.
+       (insertUpdate): Call super method.
+       (removeUpdate): Likewise.
+       (getParagraphElement): Implemented.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/ClasspathToolkit.java
+       (createRobot): Throws java.awt.AWTException.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c:
+       Added '__attribute__((unused))' to all unused method arguments.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultBoundedRangeModel.java
+       (fireValueChanged): Fixed off-by-one error.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * Makefile.am (gtk_c_source_files): Add GdkRobotPeer.c.
+       (gtk_awt_peer_sources): Add GdkScreenGraphicsDevice.java and
+       GdkRobotPeer.java.
+       (lib_gnu_java_awt_peer_gtk_la_CFLAGS): Add X flags.
+       (lib_gnu_java_awt_peer_gtk_la_LDFLAGS): Add XTest flags.
+       * gnu/awt/xlib/XToolkit.java (createRobot): New method.
+       * gnu/java/awt/ClasspathToolkit.java (createRobot): New method.
+       * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+       (getDefaultScreenDevice): Implement.
+       * gnu/java/awt/peer/gtk/GdkRobotPeer.java: New file.
+       * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java: Likewise.
+       * gnu/java/awt/peer/gtk/GtkToolkit.java (createRobot): New method.
+       * java/awt/Robot.java: Implement.
+       * java/awt/peer/RobotPeer.java: Rename parameters.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c: New file.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+       (awt_keycode_to_keysym): Make non-static.
+       * jni/gtk-peer/gtkpeer.h (AWT_BUTTON1_MASK, AWT_BUTTON2_MASK,
+       AWT_BUTTON3_MASK): Declare constants.
+       (awt_keycode_to_keysym): Declare.
+
+       * Makefile.am (AM_MAKEFLAGS): Set KEYS variable.
+       * testsuite/libjava.mauve/mauve.exp (test_mauve): If KEYS exists
+       and is non-empty pass its value to "make check".
+       (test_mauve_sim): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/imageio/IIOParam.java
+       (setSourceBands): New method.
+       (setSourceSubsampling): Likewise.
+       * javax/imageio/ImageReadParam.java
+       (setDestination): Likewise.
+       (setDestinationBands): Likewise.
+       (setSourceProgressivePasses): Likewise.
+       * javax/imageio/metadata/IIOInvalidTreeException.java
+       (serialVersionUID): New static field.
+       * javax/imageio/metadata/IIOMetadataNode.java
+       (IIOMetadataNode): Don't explicitely implement org.w3c.dom.Node.
+       (parent): Dont initailize with default value explicitely.
+       (Object): Likewise.
+       (removeAttribute): Doesn't throws org.w3c.dom.DOMException.
+       (removeAttributeNode): Likewise.
+       (removeAttributeNS): Likewise.
+       (setAttribute): Likewise.
+       (setAttributeNode): Likewise.
+       (setAttributeNodeNS): Likewise.
+       (setAttributeNS): Likewise.
+       (appendChild): Likewise.
+       (getNodeValue): Likewise.
+       (insertBefore): Likewise.
+       (removeChild): Likewise.
+       (replaceChild): Likewise.
+       (setPrefix): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/LookAndFeel.java
+       (getDesktopPropertyValue): New method.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTree.java
+       (hasChildren): New instance field.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JComponent.java
+       (getToolTipText): New method.
+       (getTitledBorderText): Likewise.
+       (getAccessibleKeyBinding): Likewise.
+       (getVerifyInputWhenFocusTarget): Likewise.
+       (setVerifyInputWhenFocusTarget): Likewise.
+       (verifyInputWhenFocusTarget): New instance field.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultListSelectionModel.java
+       (fireValueChanged): New method.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultBoundedRangeModel.java:
+       Fixed javadocs all over.
+       (fireStateChanged): Simplified.
+       * javax/swing/BoundedRangeModel.java:
+       Reformatted.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JRootPane.java
+       (setMenuBar): Added @deprecated tag.
+       (getMenuBar): Likewise.
+       * javax/swing/JTable.java
+       (sizeColumnsToFit): Likewise.
+
+2005-02-15  Paul Jenner  <psj.home@ntlworld.com>
+
+       * javax/swing/ImageIcon.java (setImage): Implemented.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTable.java:
+       Removed unused imports.
+
+2005-02-15  Olga Rodimina  <rodimina@redhat.com>
+
+       (prepareRenderer): Get column's index in dataModel instead
+       of column's view index.
+       (getColumnCount): return count of the columns in ColumnModel,
+       not in dataModel.
+       (removeColumn): Implemented.
+       (moveColumm): Likewise.
+       (setRowHeight): throw IllegalArgumentException if height is 
+       less then 1.
+       * javax/swing/table/DefaultTableColumnModel.java: Add javadocs.
+       (DefaultTableColumnModel):Add call to createSelectionModel().
+       (addColumn): Fire columnAdded event to registered listeners.
+       (removeColumn): Fire columnRemoved event to registered listeners.
+       (moveColumn): Fire columnMoved event to registered listeners.
+       (setColumnMargin): Fire ColumnMarginChanged event to registered listeners.
+       (getColumnIndex): Changed parameter name.
+       (setColumnSelectionAllowed): Likewise.
+       (fireColumnAdded): Implemented.
+       (fireColumnRemoved): Likewise.
+       (fireColumnMoved): Likewise.
+       (fireColumnMarginChanged): Likewise.
+       (getListeners): Changed parameter name.
+       (propertyChange): Implemented.
+       (valueChanged): Changed parameter name. 
+       (createSelectionModel): Implemented.    
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/peer/gtk/GtkToolkit.java:
+       Explicitely import used classes.
+       (getLocalGraphicsEnvironment): Simplify.
+       * java/awt/Window.java (Window):
+       Enable code to get the default GraphicsConfiguration.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/metal/DefaultMetalTheme.java
+       (CONTROL_TEXT_FONT): New static field.
+       (MENU_TEXT_FONT): Likewise.
+       (SUB_TEXT_FONT): Likewise.
+       (SYSTEM_TEXT_FONT): Likewise.
+       (USER_TEXT_FONT): Likewise.
+       (WINDOW_TITLE_FONT): Likewise.
+       (getControlTextFont): New method.
+       (getMenuTextFont): Likewise.
+       (getSubTextFont): Likewise.
+       (getSystemTextFont): Likewise.
+       (getUserTextFont): Likewise.
+       (getWindowTitleFont): Likewise.
+       * javax/swing/plaf/metal/MetalTheme.java
+       (BLACK): Initialize with Color.BLACK.
+       (WHITE): Initialize with Color.WHITE.
+       (getInactiveControlTextColor): Return getControlDisabled().
+       (getMenuDisabledForeground): Return getSecondary3().
+       (getControlTextFont): New abstract method.
+       (getMenuTextFont): Likewise.
+       (getSubTextFont): Likewise.
+       (getSystemTextFont): Likewise.
+       (getUserTextFont): Likewise.
+       (getWindowTitleFont): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JFormattedTextField.java
+       (getFocusLostBehavior): Fixed typo in method name.
+       (setFocusLostBehavior): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/TransferHandler.java:
+       Reworked import statements.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/Button.java,
+       java/awt/Canvas.java,
+       java/awt/Checkbox.java,
+       java/awt/CheckboxMenuItem.java,
+       java/awt/Choice.java,
+       java/awt/Dialog.java,
+       java/awt/Frame.java,
+       java/awt/Label.java,
+       java/awt/List.java,
+       java/awt/Menu.java,
+       java/awt/MenuBar.java,
+       java/awt/MenuItem.java,
+       java/awt/PopupMenu.java,
+       java/awt/ScrollPane.java,
+       java/awt/Scrollbar.java,
+       java/awt/TextArea.java,
+       java/awt/Window.java (getAccessibleContext): Clean up comments.
+       Reformat.
+       * java/awt/Button.java,
+       java/awt/Checkbox.java,
+       java/awt/Choice.java,
+       java/awt/Menu.java,
+       java/awt/PopupMenu.java,
+       java/awt/TextArea.java (getAccessibleContext): Only create new
+       accessible once.
+       * java/awt/TextComponent.java (getAccessibleContext): Implement.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/Button.java,
+       javax/swing/JApplet.java,
+       javax/swing/JFormattedTextField.java,
+       javax/swing/JWindow.java,
+       javax/swing/JTree.java,
+       javax/swing/plaf/basic/BasicEditorPaneUI.java,
+       javax/swing/plaf/basic/BasicTextPaneUI.java,
+       javax/swing/plaf/basic/BasicTreeUI.java:
+       Reworked import statements.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * Makefile.am: Put javax.imageio into its own library and link it
+       against lib-org-w3c-dom.la to fix bootstrapping.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/TextAction.java
+       (getTextComponent): Simplified. Added Javadoc.
+       (augmentList): Implemented. Added Javadoc.
+       (getFocusedComponent): Added javadoc.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/Scrollbar.java (AccessibleAWTScrollbar,
+       getAccessibleContext): Implement.
+       * java/awt/ScrollPane.java (AccessibleAWTScrollPane,
+       getAccessibleContext): Implement.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/Dialog.java (AccessibleAWTFrame, getAccessibleContext):
+       Implement.
+       * java/awt/Frame.java (AccessibleAWTFrame, getAccessibleContext):
+       Implement.
+       * java/awt/Window.java (getAccessibleContext): Fix comment.
+       Remove extra import.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/Window.java (AccessibleAWTWindow): Implement.
+       (isActive, isFocused, getAccessibleContext): Implement.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/MenuItem.java (getAccessibleContext): Implement.
+       * java/awt/MenuComponent.java (accessibleContext): Make package
+       visible.
+       * java/awt/CheckboxMenuItem.java (getAccessibleContext,
+       AccessibleAWTCheckboxMenuItem): Implement.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/List.java: Implement AccessibleAWTList,
+       AccessibleAWTListChild.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * java/awt/Choice.java: Add implements declaration for
+       Accessible.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * javax/imageio/metadata/IIOInvalidTreeException.java: Use Node
+       instead of Object.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * javax/imageio/metadata/IIOMetadataNode.java: Add Node to
+       implemented interface list.
+
+2005-02-15  Jerry Quinn  <jlquinn@optonline.net>
+
+       * javax/imageio/metadata/IIOMetadataNode.java: Implement.
+       * javax/imageio/metadata/IIOAttr.java: New class.
+       * javax/imageio/metadata/IIONamedNodeMap.java: New class.
+       * javax/imageio/metadata/IIONodeList.java: New class.
+       * Makefile.am: Added new files.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/AbstractAction.java,
+       javax/swing/AbstractCellEditor.java,
+       javax/swing/AbstractListModel.java,
+       javax/swing/DefaultBoundedRangeModel.java,
+       javax/swing/DefaultButtonModel.java,
+       javax/swing/DefaultCellEditor.java,
+       javax/swing/DefaultComboBoxModel.java,
+       javax/swing/DefaultDesktopManager.java,
+       javax/swing/JMenu.java,
+       javax/swing/JSlider.java,
+       javax/swing/KeyStroke.java,
+       javax/swing/OverlayLayout.java,
+       javax/swing/ScrollPaneLayout.java,
+       javax/swing/SizeRequirements.java,
+       javax/swing/ViewportLayout.java:
+       Made serialVersionUID private.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/peer/gtk/GtkComponentPeer.java:
+       Reformatted.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/peer/gtk/GdkGraphics2D.java: More reformatting.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * gnu/java/awt/peer/gtk/GdkGraphics2D.java: Reformatted.
+
+2005-02-15  Jeroen Frijters  <jeroen@frijters.net>
+
+       * java/awt/EventDispatchThread.java,
+       java/awt/Toolkit.java:
+       Don't catch java.lang.ThreadDeath.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/PasswordView.java
+       (drawEchoCharacter): Added javadoc.
+       (drawSelectedText): Likewise.
+       (drawUnselectedText): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JRootPane.java
+       (windowDecorationStyle): New field.
+       (setMenuBar): New method.
+       (getMenuBar): Likewise.
+       (getWindowDecorationStyle): Likewise.
+       (setWindowDecorationStyle): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultListSelectionModel.java
+       (leadAnchorNotificationEnabled): Made protected.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/InternalFrameFocusTraversalPolicy.java: New file.
+       * Makefile.am: Added InternalFrameFocusTraversalPolicy.java.
+       * Makefile.in: Regenerated.
+
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JFormattedTextField.java: Implemented.
+       * javax/swing/JWindow.java
+       (JWindow): New constructors.
+       (initWindow): Renamed from initFrame.
+       * javax/swing/UIDefaults.java
+       (ActiveValue): Made interface static.
+       (LazyValue): Likewise.
+       * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+       (TitlePaneLayout.TitlePaneLayout): New constructor.
+       * javax/swing/plaf/basic/BasicSliderUI.java
+       (ChangeHandler): Made public.
+       (FocusHandler): Likewise.
+       (PropertyChangeHandler): Likewise.
+       (ScrollListener): Likewise.
+       * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+       (FocusHandler): Likewise.
+       (MouseHandler): Likewise.
+       * javax/swing/plaf/basic/BasicTextPaneUI.java
+       (BasicTextPaneUI): Extend BasicEditorPaneUI.
+       * javax/swing/plaf/basic/BasicToolBarUI.java
+       (BasicToolBarUI): Simplified. Reworked javadoc.
+       (canDock): Simplified. Make public.
+       (DockingListener): Made public.
+       * javax/swing/text/JTextComponent.java
+       (navigationFilter): New field.
+       (getNavigationFilter): New method.
+       (setNavigationFilter): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/metal/MetalTheme.java
+       (getControlTextColor): Return getControlInfo().
+       (getHighlightedTextColor): Return getControlTextColor().
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/basic/BasicButtonListener.java
+       (BasicButtonListener): New constructor.
+       * javax/swing/plaf/basic/BasicButtonUI.java
+       (createButtonListener): Usw new BasicButtonListener constructor.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/imageio/event/package.html,
+       javax/imageio/metadata/package.html: New files.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/image/MemoryImageSource.java: Reformatted.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/tree/TreeCellEditor.java: Refomatted.
+
+2005-02-15  Jeroen Frijters  <jeroen@frijters.net>
+
+       * java/awt/color/ICC_Profile.java
+       (finalize): Removed pointless field assignments.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/basic/BasicEditorPaneUI.java: New file.
+       * Makefile.am: Added javax/swing/plaf/basic/BasicEditorPaneUI.java.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/DefaultStyledDocument.java: New file.
+       * Makefile.am: Added javax/swing/text/DefaultStyledDocument.java.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JFileChooser.java
+       (showDialog): Return CANCEL_OPTION for now.
+       (showOpenDialog): Likewise.
+       (showSaveDialog): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JApplet.java
+       (HIDE_ON_CLOSE): Removed.
+       (EXIT_ON_CLOSE): Likewise.
+       (DISPOSE_ON_CLOSE): Likewise.
+       (DO_NOTHING_ON_CLOSE): Likewise.
+       (close_action): Likewise.
+       (getDefaultCloseOperation): Likewise.
+       (setDefaultCloseOperation): Likewise.
+       (processWindowEvent): Likewise.
+       (getPreferredSize): Simplified.
+       * javax/swing/JInternalFrame.java
+       (setDefaultCloseOperation): Fixed throwing exception on wrong argument
+       value.
+       * javax/swing/JWindow.java
+       (HIDE_ON_CLOSE): Removed.
+       (EXIT_ON_CLOSE): Likewise.
+       (DISPOSE_ON_CLOSE): Likewise.
+       (DO_NOTHING_ON_CLOSE): Likewise.
+       (close_action): Likewise.
+       (processKeyEvent): Likewise.
+       (setDefaultCloseOperation): Likewise.
+       (getPreferredSize): Simplified.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTextField.java
+       (getPreferredSize): Re-implemented.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JLabel.java
+       (setDisplayedMnemonic): Use only upper case characters.
+       (setDisplayedMnemonicIndex): Handle index == -1 and fire
+       PropertyChangeEvent after property got set to the new index.
+
+2005-02-15  Robert Schuster <thebohemian@gmx.net>
+
+       * javax/swing/JComboBox.java:
+       (JComboBox): Removed selection of the
+       first item in the model.
+
+2005-02-15  Robert Schuster <thebohemian@gmx.net>
+
+       * javax/swing/JComboBox.java
+       added support for no item being selected
+       (JComboBox): select first or nothing depending on element count
+       (setModel): cleaned up unneeded "this." usage, added more
+       docs, made exception behavior match that of the JDK
+       (setLighWeightPopupEnabled): removed unneeded "this." usage
+       (setEditable): dito
+       (setMaximumRowCount): dito
+       (setRenderer): dito
+       (setPrototypeDisplayValue): dito
+       (getSelectedItem): simplified, added more user doc
+       (setSelectedIndex): corrected exception behavior, added more user doc
+       (getSelectedIndex): fixed hardcoded dependency on DefaultComboBoxModel,
+       added performance warning to user doc
+       (addItem): fixed exception behavior, added user doc
+       (insertItemAt): dito
+       (removeItem): dito
+       (removeItemAt): dito
+       (removeAll): fixed exception behavior, added user doc, added support
+       for model not being instance of DefaultComboBoxModel
+       (getSelectedItemObjects): simplified
+       (getItemCount): fixed dependency on DefaultComboBoxModel
+       (getItemAt): fixed dependency on MutableComboBoxModel
+       * javax/swing/DefaultComboBoxModel.java:
+       (setSelectedItem): updates selected item only if new
+       value is null or known (match JDK behavior)
+       * javax/swing/plaf/basic/BasicComboBoxUI.java:
+       (paintCurrentValue): renders "" if no item is selected
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/plaf/metal/MetalTheme.java,
+       javax/swing/plaf/metal/DefaultMetalTheme.java:
+       New files.
+       * javax/swing/plaf/metal/MetalLookAndFeel.java
+       * Makefile.am: Added the new files.
+       * Makefile.in: Regenerated.
+
+2005-02-15  Olga Rodimina  <rodimina@redhat.com>
+
+       * javax/swing/JTable.java
+       (editorComp): New field.
+       (JTable): Initialize local variables and call updateUI
+       (selectionBackground): Make protected.
+       (selectionForeground): Likewise.
+       (initializeLocalVars): Create default editors and renderers,
+       initialize editingColumn, editingRow variables.
+       (createDefaultEditors): New Method.
+       (createDefaultRenderers): Likewise.
+       (createDefaultListSelectionModel): Removed
+       (createDefaultSelectionModel): New Method.
+       (createDefaultTableHeader): Likewise
+       (removeColumn): Likewise.
+       (getEditingColumn): Likewise.
+       (setEditingColumn): Likewise.
+       (getEditingRow): Likewise.
+       (setEditingRow): Likewise.
+       (getEditorComponent): Likewise.
+       (isEditing): Likewise.
+       (setDefaultEditor): Likewise.
+       (addColumnSelectionInterval): Likewise.
+       (addRowSelectionInterval): Likewise.
+       (setColumnSelectionInterval): Likewise.
+       (setRowSelectionInterval): Likewise.
+       (removeColumnSelectionInterval): Likewise.
+       (removeRowSelectionInterval): Likewise.
+       (isColumnSelected): Likewise.
+       (isRowSelected): Likewise.
+       (isCellSelected): Likewise.
+       (selectAll): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTable.java
+       (addColumn): New method.
+       (getColumnClass): Likewise.
+       (getColumnName): Likewise.
+
+2005-02-15  Paul Jenner  <psj.home@ntlworld.com>
+
+       * javax/swing/TransferHandler.java
+       (createTransferable): Made protected.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTable.java,
+       javax/swing/plaf/basic/BasicTableHeaderUI.java,
+       javax/swing/plaf/basic/BasicTableUI.java:
+       Use fixed get/setIntercellSpacing() methods.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTable.java
+       (getIntercellSpacing): Fixed typo in method name.
+       (setIntercellSpacing): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/text/JTextComponent.java
+       (focusAccelerator): New variable.
+       (getFocusAccelerator): New method.
+       (setFocusAccelerator): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JComponent.java
+       (setTransferHandler): Made public. Fire property change event.
+       * javax/swing/TransferHandler.java: Implemented.
+       * javax/swing/text/JTextComponent.java
+       (DefaultTransferHandler): New inner class.
+       (defaultTransferHandler): New variable.
+       (copy): New method.
+       (cut): Likewise.
+       (paste): Likewise.
+       (doTransferAction): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTree.java
+       (collapsePath): New method.
+       (collapseRow): Likewise.
+       (expandPath): Likewise.
+       (expandRow): Likewise.
+       (checkExpandParents): Likewise.
+       (doExpandParents): Likewise.
+       (setExpandedState): Likewise.
+       (makeVisible): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JPasswordField.java: Updated javadocs.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JLayeredPane.java
+       (getLayer): Fixed return type, made public.
+       (getPosition): Use new getLayer().
+       (SetPosition): Likewise.
+       (getIndexOf): Likewise.
+       (remove): Likewise.
+       * javax/swing/JInternalFrame.java
+       (getLayer): Use new JLayeredPane.getLayer().
+
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/table/TableColumn.java: Added/fixed javadocs over all.
+       (setHeaderValue): Simplified. Do nothing when old value == new value.
+
+2005-02-15  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * gnu/java/awt/peer/gtk/GdkGraphics.java (setClip): Protect
+       against null clip region.
+       * gnu/java/awt/peer/gtk/GtkFramePeer.java (create): Call
+       gtkWindowSetResizable.
+       (postConfigureEvent): Only revalidate if frame size has changed.
+       * gnu/java/awt/peer/gtk/GtkWindowPeer.java (postConfigureEvent):
+       Only revalidate if frame size has changed.
+       * java/awt/Component.java (reshape): Only repaint and post
+       component events if component is showing.
+       * java/awt/Container.java (addImpl): Only post container event if
+       container is showing.
+       (remove): Likewise.
+       * java/awt/Window.java (setLocationRelativeTo): Implement.
+       (setBoundsCallback): Only post component events if component is
+       showing.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (clearRect):
+       Protect against null graphics structure.  Flush gdk event queue.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/imageio/ImageReader.java,
+       javax/imageio/ImageTranscoder.java,
+       javax/imageio/ImageWriter.java,
+       javax/imageio/spi/ImageInputStreamSpi.java,
+       javax/imageio/spi/ImageOutputStreamSpi.java,
+       javax/imageio/spi/ServiceRegistry.java,
+       javax/imageio/stream/ImageInputStream.java,
+       javax/imageio/stream/ImageOutputStream.java: Updated.
+       * javax/imageio/IIOException.java,
+       javax/imageio/IIOImage.java,
+       javax/imageio/IIOParam.java,
+       javax/imageio/IIOParamController.java,
+       javax/imageio/ImageIO.java,
+       javax/imageio/ImageReadParam.java,
+       javax/imageio/ImageTypeSpecifier.java,
+       javax/imageio/ImageWriteParam.java,
+       javax/imageio/spi/IIORegistry.java,
+       javax/imageio/spi/ImageReaderSpi.java,
+       javax/imageio/spi/ImageWriterSpi.java,
+       javax/imageio/stream/FileCacheImageInputStream.java,
+       javax/imageio/stream/FileCacheImageOutputStream.java,
+       javax/imageio/stream/FileImageInputStream.java,
+       javax/imageio/stream/FileImageOutputStream.java,
+       javax/imageio/stream/ImageInputStreamImpl.java,
+       javax/imageio/stream/ImageOutputStreamImpl.java,
+       javax/imageio/stream/MemoryCacheImageInputStream.java,
+       javax/imageio/stream/MemoryCacheImageOutputStream.java,
+       javax/imageio/event/IIOReadProgressListener.java,
+       javax/imageio/event/IIOReadUpdateListener.java,
+       javax/imageio/event/IIOReadWarningListener.java,
+       javax/imageio/event/IIOWriteProgressListener.java,
+       javax/imageio/event/IIOWriteWarningListener.java,
+       javax/imageio/metadata/IIOMetadata.java,
+       javax/imageio/metadata/IIOMetadataController.java,
+       javax/imageio/metadata/IIOMetadataFormat.java,
+       javax/imageio/metadata/IIOInvalidTreeException.java,
+       javax/imageio/metadata/IIOMetadataFormatImpl.java,
+       javax/imageio/metadata/IIOMetadataNode.java: New files.
+       * Makefile.am (javax_source_files): Added new files
+       * Makefile.in: Regenerated.
+
+2005-02-15  Graydon Hoare  <graydon@redhat.com>
+
+       * gnu/java/awt/peer/gtk/GdkGraphics2D.java: 
+       Rework painting into BufferedImages
+       * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
+       Construct BufferedImage with alpha only when alpha is
+       present in colormodel.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
+       Rework painting into client-side jint arrays.
+       * jni/gtk-peer/gtkcairopeer.h: 
+       Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/DefaultListCellRenderer.java
+       (serialVersionUID): Made private.
+       (getListCellRendererComponent): Set horizontal alignment.
+       * javax/swing/JLabel.java
+       (setVerticalAlignment): Re-implemented.
+       (setHorizontalAlignment): Do nothing if old value = new value.
+       * javax/swing/JList.java
+       (setCellRenderer): Likewise.
+       (setModel): Re-implemented.
+       (setSelectionModel): Likewise.
+
+2005-02-15  David Gilbert <david.gilbert@object-refinery.com>
+
+       * java/awt/Component.java,
+       java/awt/geom/Rectangle2D.java:
+       Javadoc fixes.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/AbstractListModel.java
+       (fireContentsChanged): Simplified.
+       (fireIntervalAdded): Likewise.
+       (fireIntervalRemoved): Likewise.
+       * javax/swing/DefaultSingleSelectionModel.java:
+       Reformatted.
+       (fireStateChanged): Simplified.
+       * javax/swing/JPopupMenu.java
+       (setSelectionModel): Set property.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/print/Book.java: Reformatted.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/geom/Area.java
+       (QuadSegment.curveArea): Remove unused variables.
+       (CubicSegment.curveArea): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JTree.java
+       (ANCHOR_SELECTION_PATH_PROPERTY): Added @since tag.
+       (LEAD_SELECTION_PATH_PROPERTY): Likewise.
+       (EXPANDS_SELECTED_PATHS_PROPERTY): Likewise.
+       (EXPANDED): New constant.
+       (COLLAPSED): Likewise.
+       (nodeStates): New field.
+       (cellEditor): New method.
+       (cellRenderer): Likewise.
+       (selectionModel): Likewise.
+       (treeModel): Likewise.
+       (scrollPathToVisible): Likewise.
+       (scrollRowToVisible): Likewise.
+       (isCollapsed): Likewise.
+       (isExpanded): Likewise.
+       (clearToggledPaths): Likewise.
+       (getDescendantToggledPaths): Likewise.
+       (hasBeenExpanded): Likewise.
+       (isVisible): Likewise.
+       (isPathEditable): Likewise.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JLayeredPane.java: Reformatted.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/tree/DefaultMutableTreeNode.java:
+       Completely Revised.
+       * javax/swing/tree/MutableTreeNode.java:
+       Reformatted.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JFormattedTextField.java
+       (setDocument): Call setDocument of super class. Don't fire property
+       change event.
+
+2005-02-15  Sven de Marothy  <sven@physto.se>
+
+       * java/awt/image/IndexColorModel.java:
+       Add FIXME with respect to alpha handling.
+       (getAlpha): Default to returning opaque pixels. 
+       * java/awt/image/MultiPixelPackedSampleModel.java
+       (MultiPixelPackedSampleModel): Corrected parameters, order of
+       bit shifts and masks, stride length off by one.
+
+2005-02-15  Michael Koch  <konqueror@gmx.de>
+
+       * javax/swing/JList.java, javax/swing/JTree.java:
+       Added much new methods and fixed much methods setting bound properties.
+
 2005-02-16  Mark Wielaard  <mark@klomp.org>
 
        * Makefile.am (gnu_xml_source_files): Removed
index dd499f3..3f17b35 100644 (file)
@@ -262,12 +262,11 @@ endif
 gtk_c_source_files = \
 $(gtk_cairo_c_source_files) \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c \
@@ -284,7 +283,6 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
@@ -314,8 +312,11 @@ gnu/java/awt/peer/gtk/GdkFontPeer.java \
 gnu/java/awt/peer/gtk/GdkGlyphVector.java \
 gnu/java/awt/peer/gtk/GdkGraphics.java \
 gnu/java/awt/peer/gtk/GdkGraphics2D.java \
+gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java \
 gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java \
 gnu/java/awt/peer/gtk/GdkPixbufDecoder.java \
+gnu/java/awt/peer/gtk/GdkRobotPeer.java \
+gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java \
 gnu/java/awt/peer/gtk/GtkButtonPeer.java \
 gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
 gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java        \
@@ -334,7 +335,6 @@ gnu/java/awt/peer/gtk/GtkImage.java \
 gnu/java/awt/peer/gtk/GtkImagePainter.java \
 gnu/java/awt/peer/gtk/GtkLabelPeer.java        \
 gnu/java/awt/peer/gtk/GtkListPeer.java \
-gnu/java/awt/peer/gtk/GtkMainThread.java \
 gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
 gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java        \
 gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
@@ -355,8 +355,6 @@ gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java
 
 gtk_jni_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
 
-jniinclude/gnu_java_awt_peer_gtk_GdkFontMetrics.h: gnu/java/awt/peer/gtk/GdkFontMetrics.java
-jniinclude/gnu_java_awt_peer_gtk_GdkGlyphVector.h: gnu/java/awt/peer/gtk/GdkGlyphVector.java
 jniinclude/gnu_java_awt_peer_gtk_GdkGraphics.h: gnu/java/awt/peer/gtk/GdkGraphics.java
 jniinclude/gnu_java_awt_peer_gtk_GdkGraphics2D.h: gnu/java/awt/peer/gtk/GdkGraphics2D.java
 jniinclude/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h: gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
@@ -380,7 +378,6 @@ jniinclude/gnu_java_awt_peer_gtk_GtkImage.h: gnu/java/awt/peer/gtk/GtkImage.java
 jniinclude/gnu_java_awt_peer_gtk_GtkImagePainter.h: gnu/java/awt/peer/gtk/GtkImagePainter.java
 jniinclude/gnu_java_awt_peer_gtk_GtkLabelPeer.h: gnu/java/awt/peer/gtk/GtkLabelPeer.java
 jniinclude/gnu_java_awt_peer_gtk_GtkListPeer.h: gnu/java/awt/peer/gtk/GtkListPeer.java
-jniinclude/gnu_java_awt_peer_gtk_GtkMainThread.h: gnu/java/awt/peer/gtk/GtkMainThread.java
 jniinclude/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h: gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
 jniinclude/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.h: gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
 jniinclude/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h: gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
@@ -405,9 +402,7 @@ $(gtk_jni_headers): %.h:
        echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
        $(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
 
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkFontMetrics.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkFontPeer.h
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGlyphVector.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGraphics2D.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGraphics.h
@@ -429,7 +424,6 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.lo: $(top_builddir)/jniinclude
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkImagePainter.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkLabelPeer.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkListPeer.h
-jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMainThread.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h
@@ -486,6 +480,7 @@ lib_gnu_awt_xlib_la_DEPENDENCIES = libgcj-@gcc_version@.jar libgcj.la libgcj.spe
 lib_gnu_awt_xlib_la_LIBADD = $(xlib_javao_files)
 ## We require libstdc++-v3 to be in the same build tree.
 lib_gnu_awt_xlib_la_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
        -I../libstdc++-v3/include \
        -I../libstdc++-v3/include/$(target_noncanonical) \
        -I$(srcdir)/../libstdc++-v3/libsupc++
@@ -1499,6 +1494,7 @@ javax/swing/plaf/basic/BasicComboBoxRenderer.java \
 javax/swing/plaf/basic/BasicComboPopup.java \
 javax/swing/plaf/basic/BasicDesktopIconUI.java \
 javax/swing/plaf/basic/BasicDesktopPaneUI.java \
+javax/swing/plaf/basic/BasicEditorPaneUI.java \
 javax/swing/plaf/basic/BasicFormattedTextFieldUI.java \
 javax/swing/plaf/basic/BasicGraphicsUtils.java \
 javax/swing/plaf/basic/BasicInternalFrameTitlePane.java \
@@ -1555,7 +1551,9 @@ javax/swing/plaf/TabbedPaneUI.java \
 javax/swing/plaf/TextUI.java \
 javax/swing/plaf/TreeUI.java \
 javax/swing/plaf/ViewportUI.java \
+javax/swing/plaf/metal/DefaultMetalTheme.java \
 javax/swing/plaf/metal/MetalLookAndFeel.java \
+javax/swing/plaf/metal/MetalTheme.java \
 javax/swing/plaf/ColorUIResource.java \
 javax/swing/plaf/DimensionUIResource.java \
 javax/swing/plaf/FontUIResource.java \
@@ -1585,7 +1583,6 @@ javax/swing/plaf/TableUI.java \
 javax/swing/plaf/ToolBarUI.java \
 javax/swing/plaf/ToolTipUI.java \
 javax/swing/AbstractListModel.java \
-javax/swing/AbstractSet.java \
 javax/swing/colorchooser/AbstractColorChooserPanel.java \
 javax/swing/colorchooser/ColorChooserComponentFactory.java \
 javax/swing/colorchooser/ColorSelectionModel.java \
@@ -1615,12 +1612,12 @@ javax/swing/ButtonGroup.java \
 javax/swing/ButtonModel.java \
 javax/swing/ComponentInputMap.java \
 javax/swing/DefaultButtonModel.java \
-javax/swing/DefaultCellRenderer.java \
 javax/swing/DefaultListModel.java \
 javax/swing/DefaultListSelectionModel.java \
 javax/swing/Icon.java \
 javax/swing/ImageIcon.java \
 javax/swing/InputMap.java \
+javax/swing/InternalFrameFocusTraversalPolicy.java \
 javax/swing/JApplet.java \
 javax/swing/JButton.java \
 javax/swing/JCheckBox.java \
@@ -1649,11 +1646,13 @@ javax/swing/JTree.java \
 javax/swing/JViewport.java \
 javax/swing/JWindow.java \
 javax/swing/KeyStroke.java \
+javax/swing/LayoutFocusTraversalPolicy.java \
 javax/swing/ListCellRenderer.java \
 javax/swing/ListModel.java \
 javax/swing/ListSelectionModel.java \
 javax/swing/LookAndFeel.java \
 javax/swing/Scrollable.java \
+javax/swing/SortingFocusTraversalPolicy.java \
 javax/swing/SpinnerListModel.java \
 javax/swing/SpinnerModel.java \
 javax/swing/SpinnerNumberModel.java \
@@ -1719,6 +1718,7 @@ javax/swing/text/ComponentView.java \
 javax/swing/text/DefaultCaret.java \
 javax/swing/text/DefaultEditorKit.java \
 javax/swing/text/DefaultHighlighter.java \
+javax/swing/text/DefaultStyledDocument.java \
 javax/swing/text/Document.java \
 javax/swing/text/DocumentFilter.java \
 javax/swing/text/EditorKit.java \
@@ -1737,6 +1737,7 @@ javax/swing/text/PlainView.java \
 javax/swing/text/Position.java \
 javax/swing/text/Segment.java \
 javax/swing/text/SimpleAttributeSet.java \
+javax/swing/text/StringContent.java \
 javax/swing/text/Style.java \
 javax/swing/text/StyleConstants.java \
 javax/swing/text/StyleContext.java \
index bb42f66..0f09d77 100644 (file)
@@ -146,8 +146,11 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST =  \
        gnu/java/awt/peer/gtk/GdkGlyphVector.java \
        gnu/java/awt/peer/gtk/GdkGraphics.java \
        gnu/java/awt/peer/gtk/GdkGraphics2D.java \
+       gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java \
        gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java \
        gnu/java/awt/peer/gtk/GdkPixbufDecoder.java \
+       gnu/java/awt/peer/gtk/GdkRobotPeer.java \
+       gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java \
        gnu/java/awt/peer/gtk/GtkButtonPeer.java \
        gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
        gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java \
@@ -166,7 +169,6 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST =  \
        gnu/java/awt/peer/gtk/GtkImagePainter.java \
        gnu/java/awt/peer/gtk/GtkLabelPeer.java \
        gnu/java/awt/peer/gtk/GtkListPeer.java \
-       gnu/java/awt/peer/gtk/GtkMainThread.java \
        gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
        gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java \
        gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
@@ -185,12 +187,11 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST =  \
        gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c \
-       jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c \
-       jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c \
@@ -207,7 +208,6 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST =  \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
-       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
        jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
@@ -234,8 +234,11 @@ am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.lo \
+       gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.lo \
+       gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo \
+       gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkCanvasPeer.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkCheckboxGroupPeer.lo \
@@ -254,7 +257,6 @@ am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkImagePainter.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkLabelPeer.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.lo \
-       gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuComponentPeer.lo \
        gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuItemPeer.lo \
@@ -274,12 +276,11 @@ am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout
 @GTK_CAIRO_TRUE@am__objects_4 = jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo
 am__objects_5 = $(am__objects_4) \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo \
-       jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo \
-       jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo \
+       jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkCanvasPeer.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.lo \
@@ -296,7 +297,6 @@ am__objects_5 = $(am__objects_4) \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkImagePainter.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.lo \
-       jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo \
        jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo \
@@ -1621,6 +1621,7 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/plaf/basic/BasicComboPopup.java \
        javax/swing/plaf/basic/BasicDesktopIconUI.java \
        javax/swing/plaf/basic/BasicDesktopPaneUI.java \
+       javax/swing/plaf/basic/BasicEditorPaneUI.java \
        javax/swing/plaf/basic/BasicFormattedTextFieldUI.java \
        javax/swing/plaf/basic/BasicGraphicsUtils.java \
        javax/swing/plaf/basic/BasicInternalFrameTitlePane.java \
@@ -1675,7 +1676,9 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/plaf/TabbedPaneUI.java \
        javax/swing/plaf/TextUI.java javax/swing/plaf/TreeUI.java \
        javax/swing/plaf/ViewportUI.java \
+       javax/swing/plaf/metal/DefaultMetalTheme.java \
        javax/swing/plaf/metal/MetalLookAndFeel.java \
+       javax/swing/plaf/metal/MetalTheme.java \
        javax/swing/plaf/ColorUIResource.java \
        javax/swing/plaf/DimensionUIResource.java \
        javax/swing/plaf/FontUIResource.java \
@@ -1703,7 +1706,6 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/plaf/TableUI.java javax/swing/plaf/ToolBarUI.java \
        javax/swing/plaf/ToolTipUI.java \
        javax/swing/AbstractListModel.java \
-       javax/swing/AbstractSet.java \
        javax/swing/colorchooser/AbstractColorChooserPanel.java \
        javax/swing/colorchooser/ColorChooserComponentFactory.java \
        javax/swing/colorchooser/ColorSelectionModel.java \
@@ -1730,14 +1732,14 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/ButtonGroup.java javax/swing/ButtonModel.java \
        javax/swing/ComponentInputMap.java \
        javax/swing/DefaultButtonModel.java \
-       javax/swing/DefaultCellRenderer.java \
        javax/swing/DefaultListModel.java \
        javax/swing/DefaultListSelectionModel.java \
        javax/swing/Icon.java javax/swing/ImageIcon.java \
-       javax/swing/InputMap.java javax/swing/JApplet.java \
-       javax/swing/JButton.java javax/swing/JCheckBox.java \
-       javax/swing/JComponent.java javax/swing/JDialog.java \
-       javax/swing/JEditorPane.java \
+       javax/swing/InputMap.java \
+       javax/swing/InternalFrameFocusTraversalPolicy.java \
+       javax/swing/JApplet.java javax/swing/JButton.java \
+       javax/swing/JCheckBox.java javax/swing/JComponent.java \
+       javax/swing/JDialog.java javax/swing/JEditorPane.java \
        javax/swing/JFormattedTextField.java javax/swing/JFrame.java \
        javax/swing/JLabel.java javax/swing/JLayeredPane.java \
        javax/swing/JList.java javax/swing/JMenuBar.java \
@@ -1749,9 +1751,11 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/JToggleButton.java javax/swing/JToolTip.java \
        javax/swing/JTree.java javax/swing/JViewport.java \
        javax/swing/JWindow.java javax/swing/KeyStroke.java \
+       javax/swing/LayoutFocusTraversalPolicy.java \
        javax/swing/ListCellRenderer.java javax/swing/ListModel.java \
        javax/swing/ListSelectionModel.java \
        javax/swing/LookAndFeel.java javax/swing/Scrollable.java \
+       javax/swing/SortingFocusTraversalPolicy.java \
        javax/swing/SpinnerListModel.java \
        javax/swing/SpinnerModel.java \
        javax/swing/SpinnerNumberModel.java javax/swing/Spring.java \
@@ -1813,6 +1817,7 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/text/DefaultCaret.java \
        javax/swing/text/DefaultEditorKit.java \
        javax/swing/text/DefaultHighlighter.java \
+       javax/swing/text/DefaultStyledDocument.java \
        javax/swing/text/Document.java \
        javax/swing/text/DocumentFilter.java \
        javax/swing/text/EditorKit.java javax/swing/text/Element.java \
@@ -1829,6 +1834,7 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
        javax/swing/text/PlainView.java javax/swing/text/Position.java \
        javax/swing/text/Segment.java \
        javax/swing/text/SimpleAttributeSet.java \
+       javax/swing/text/StringContent.java \
        javax/swing/text/Style.java \
        javax/swing/text/StyleConstants.java \
        javax/swing/text/StyleContext.java \
@@ -3148,6 +3154,7 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/plaf/basic/BasicComboPopup.lo \
        javax/swing/plaf/basic/BasicDesktopIconUI.lo \
        javax/swing/plaf/basic/BasicDesktopPaneUI.lo \
+       javax/swing/plaf/basic/BasicEditorPaneUI.lo \
        javax/swing/plaf/basic/BasicFormattedTextFieldUI.lo \
        javax/swing/plaf/basic/BasicGraphicsUtils.lo \
        javax/swing/plaf/basic/BasicInternalFrameTitlePane.lo \
@@ -3198,7 +3205,9 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/plaf/PanelUI.lo javax/swing/plaf/ScrollPaneUI.lo \
        javax/swing/plaf/TabbedPaneUI.lo javax/swing/plaf/TextUI.lo \
        javax/swing/plaf/TreeUI.lo javax/swing/plaf/ViewportUI.lo \
+       javax/swing/plaf/metal/DefaultMetalTheme.lo \
        javax/swing/plaf/metal/MetalLookAndFeel.lo \
+       javax/swing/plaf/metal/MetalTheme.lo \
        javax/swing/plaf/ColorUIResource.lo \
        javax/swing/plaf/DimensionUIResource.lo \
        javax/swing/plaf/FontUIResource.lo \
@@ -3221,7 +3230,7 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/plaf/SpinnerUI.lo javax/swing/plaf/SplitPaneUI.lo \
        javax/swing/plaf/TableHeaderUI.lo javax/swing/plaf/TableUI.lo \
        javax/swing/plaf/ToolBarUI.lo javax/swing/plaf/ToolTipUI.lo \
-       javax/swing/AbstractListModel.lo javax/swing/AbstractSet.lo \
+       javax/swing/AbstractListModel.lo \
        javax/swing/colorchooser/AbstractColorChooserPanel.lo \
        javax/swing/colorchooser/ColorChooserComponentFactory.lo \
        javax/swing/colorchooser/ColorSelectionModel.lo \
@@ -3248,10 +3257,10 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/ButtonGroup.lo javax/swing/ButtonModel.lo \
        javax/swing/ComponentInputMap.lo \
        javax/swing/DefaultButtonModel.lo \
-       javax/swing/DefaultCellRenderer.lo \
        javax/swing/DefaultListModel.lo \
        javax/swing/DefaultListSelectionModel.lo javax/swing/Icon.lo \
        javax/swing/ImageIcon.lo javax/swing/InputMap.lo \
+       javax/swing/InternalFrameFocusTraversalPolicy.lo \
        javax/swing/JApplet.lo javax/swing/JButton.lo \
        javax/swing/JCheckBox.lo javax/swing/JComponent.lo \
        javax/swing/JDialog.lo javax/swing/JEditorPane.lo \
@@ -3266,15 +3275,17 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/JToggleButton.lo javax/swing/JToolTip.lo \
        javax/swing/JTree.lo javax/swing/JViewport.lo \
        javax/swing/JWindow.lo javax/swing/KeyStroke.lo \
+       javax/swing/LayoutFocusTraversalPolicy.lo \
        javax/swing/ListCellRenderer.lo javax/swing/ListModel.lo \
        javax/swing/ListSelectionModel.lo javax/swing/LookAndFeel.lo \
-       javax/swing/Scrollable.lo javax/swing/SpinnerListModel.lo \
-       javax/swing/SpinnerModel.lo javax/swing/SpinnerNumberModel.lo \
-       javax/swing/Spring.lo javax/swing/SpringLayout.lo \
-       javax/swing/SwingConstants.lo javax/swing/SwingUtilities.lo \
-       javax/swing/Timer.lo javax/swing/ToolTipManager.lo \
-       javax/swing/TransferHandler.lo javax/swing/UIDefaults.lo \
-       javax/swing/UIManager.lo \
+       javax/swing/Scrollable.lo \
+       javax/swing/SortingFocusTraversalPolicy.lo \
+       javax/swing/SpinnerListModel.lo javax/swing/SpinnerModel.lo \
+       javax/swing/SpinnerNumberModel.lo javax/swing/Spring.lo \
+       javax/swing/SpringLayout.lo javax/swing/SwingConstants.lo \
+       javax/swing/SwingUtilities.lo javax/swing/Timer.lo \
+       javax/swing/ToolTipManager.lo javax/swing/TransferHandler.lo \
+       javax/swing/UIDefaults.lo javax/swing/UIManager.lo \
        javax/swing/UnsupportedLookAndFeelException.lo \
        javax/swing/event/AncestorEvent.lo \
        javax/swing/event/AncestorListener.lo \
@@ -3326,6 +3337,7 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/text/DefaultCaret.lo \
        javax/swing/text/DefaultEditorKit.lo \
        javax/swing/text/DefaultHighlighter.lo \
+       javax/swing/text/DefaultStyledDocument.lo \
        javax/swing/text/Document.lo \
        javax/swing/text/DocumentFilter.lo \
        javax/swing/text/EditorKit.lo javax/swing/text/Element.lo \
@@ -3340,7 +3352,8 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
        javax/swing/text/PlainView.lo javax/swing/text/Position.lo \
        javax/swing/text/Segment.lo \
        javax/swing/text/SimpleAttributeSet.lo \
-       javax/swing/text/Style.lo javax/swing/text/StyleConstants.lo \
+       javax/swing/text/StringContent.lo javax/swing/text/Style.lo \
+       javax/swing/text/StyleConstants.lo \
        javax/swing/text/StyleContext.lo \
        javax/swing/text/StyledDocument.lo \
        javax/swing/text/StyledEditorKit.lo \
@@ -5050,12 +5063,11 @@ libgcj_la_LINK = $(LIBLINK)
 gtk_c_source_files = \
 $(gtk_cairo_c_source_files) \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c \
@@ -5072,7 +5084,6 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
@@ -5101,8 +5112,11 @@ gnu/java/awt/peer/gtk/GdkFontPeer.java \
 gnu/java/awt/peer/gtk/GdkGlyphVector.java \
 gnu/java/awt/peer/gtk/GdkGraphics.java \
 gnu/java/awt/peer/gtk/GdkGraphics2D.java \
+gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java \
 gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java \
 gnu/java/awt/peer/gtk/GdkPixbufDecoder.java \
+gnu/java/awt/peer/gtk/GdkRobotPeer.java \
+gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java \
 gnu/java/awt/peer/gtk/GtkButtonPeer.java \
 gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
 gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java        \
@@ -5121,7 +5135,6 @@ gnu/java/awt/peer/gtk/GtkImage.java \
 gnu/java/awt/peer/gtk/GtkImagePainter.java \
 gnu/java/awt/peer/gtk/GtkLabelPeer.java        \
 gnu/java/awt/peer/gtk/GtkListPeer.java \
-gnu/java/awt/peer/gtk/GtkMainThread.java \
 gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
 gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java        \
 gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
@@ -5177,6 +5190,7 @@ lib_gnu_awt_xlib_la_SOURCES = \
 lib_gnu_awt_xlib_la_DEPENDENCIES = libgcj-@gcc_version@.jar libgcj.la libgcj.spec
 lib_gnu_awt_xlib_la_LIBADD = $(xlib_javao_files)
 lib_gnu_awt_xlib_la_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
        -I../libstdc++-v3/include \
        -I../libstdc++-v3/include/$(target_noncanonical) \
        -I$(srcdir)/../libstdc++-v3/libsupc++
@@ -5745,6 +5759,7 @@ javax/swing/plaf/basic/BasicComboBoxRenderer.java \
 javax/swing/plaf/basic/BasicComboPopup.java \
 javax/swing/plaf/basic/BasicDesktopIconUI.java \
 javax/swing/plaf/basic/BasicDesktopPaneUI.java \
+javax/swing/plaf/basic/BasicEditorPaneUI.java \
 javax/swing/plaf/basic/BasicFormattedTextFieldUI.java \
 javax/swing/plaf/basic/BasicGraphicsUtils.java \
 javax/swing/plaf/basic/BasicInternalFrameTitlePane.java \
@@ -5801,7 +5816,9 @@ javax/swing/plaf/TabbedPaneUI.java \
 javax/swing/plaf/TextUI.java \
 javax/swing/plaf/TreeUI.java \
 javax/swing/plaf/ViewportUI.java \
+javax/swing/plaf/metal/DefaultMetalTheme.java \
 javax/swing/plaf/metal/MetalLookAndFeel.java \
+javax/swing/plaf/metal/MetalTheme.java \
 javax/swing/plaf/ColorUIResource.java \
 javax/swing/plaf/DimensionUIResource.java \
 javax/swing/plaf/FontUIResource.java \
@@ -5831,7 +5848,6 @@ javax/swing/plaf/TableUI.java \
 javax/swing/plaf/ToolBarUI.java \
 javax/swing/plaf/ToolTipUI.java \
 javax/swing/AbstractListModel.java \
-javax/swing/AbstractSet.java \
 javax/swing/colorchooser/AbstractColorChooserPanel.java \
 javax/swing/colorchooser/ColorChooserComponentFactory.java \
 javax/swing/colorchooser/ColorSelectionModel.java \
@@ -5861,12 +5877,12 @@ javax/swing/ButtonGroup.java \
 javax/swing/ButtonModel.java \
 javax/swing/ComponentInputMap.java \
 javax/swing/DefaultButtonModel.java \
-javax/swing/DefaultCellRenderer.java \
 javax/swing/DefaultListModel.java \
 javax/swing/DefaultListSelectionModel.java \
 javax/swing/Icon.java \
 javax/swing/ImageIcon.java \
 javax/swing/InputMap.java \
+javax/swing/InternalFrameFocusTraversalPolicy.java \
 javax/swing/JApplet.java \
 javax/swing/JButton.java \
 javax/swing/JCheckBox.java \
@@ -5895,11 +5911,13 @@ javax/swing/JTree.java \
 javax/swing/JViewport.java \
 javax/swing/JWindow.java \
 javax/swing/KeyStroke.java \
+javax/swing/LayoutFocusTraversalPolicy.java \
 javax/swing/ListCellRenderer.java \
 javax/swing/ListModel.java \
 javax/swing/ListSelectionModel.java \
 javax/swing/LookAndFeel.java \
 javax/swing/Scrollable.java \
+javax/swing/SortingFocusTraversalPolicy.java \
 javax/swing/SpinnerListModel.java \
 javax/swing/SpinnerModel.java \
 javax/swing/SpinnerNumberModel.java \
@@ -5965,6 +5983,7 @@ javax/swing/text/ComponentView.java \
 javax/swing/text/DefaultCaret.java \
 javax/swing/text/DefaultEditorKit.java \
 javax/swing/text/DefaultHighlighter.java \
+javax/swing/text/DefaultStyledDocument.java \
 javax/swing/text/Document.java \
 javax/swing/text/DocumentFilter.java \
 javax/swing/text/EditorKit.java \
@@ -5983,6 +6002,7 @@ javax/swing/text/PlainView.java \
 javax/swing/text/Position.java \
 javax/swing/text/Segment.java \
 javax/swing/text/SimpleAttributeSet.java \
+javax/swing/text/StringContent.java \
 javax/swing/text/Style.java \
 javax/swing/text/StyleConstants.java \
 javax/swing/text/StyleContext.java \
@@ -8241,12 +8261,21 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics.lo:  \
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.lo:  \
        gnu/java/awt/peer/gtk/$(am__dirstamp) \
        gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo:  \
+       gnu/java/awt/peer/gtk/$(am__dirstamp) \
+       gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.lo:  \
        gnu/java/awt/peer/gtk/$(am__dirstamp) \
        gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.lo:  \
        gnu/java/awt/peer/gtk/$(am__dirstamp) \
        gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo:  \
+       gnu/java/awt/peer/gtk/$(am__dirstamp) \
+       gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo:  \
+       gnu/java/awt/peer/gtk/$(am__dirstamp) \
+       gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.lo:  \
        gnu/java/awt/peer/gtk/$(am__dirstamp) \
        gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
@@ -8301,9 +8330,6 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkLabelPeer.lo:  \
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.lo:  \
        gnu/java/awt/peer/gtk/$(am__dirstamp) \
        gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
-gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo:  \
-       gnu/java/awt/peer/gtk/$(am__dirstamp) \
-       gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.lo:  \
        gnu/java/awt/peer/gtk/$(am__dirstamp) \
        gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
@@ -8364,15 +8390,9 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo:  \
-       jni/gtk-peer/$(am__dirstamp) \
-       jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo:  \
-       jni/gtk-peer/$(am__dirstamp) \
-       jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
@@ -8382,6 +8402,9 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvir
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo:  \
+       jni/gtk-peer/$(am__dirstamp) \
+       jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
@@ -8430,9 +8453,6 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo:
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo:  \
-       jni/gtk-peer/$(am__dirstamp) \
-       jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo:  \
        jni/gtk-peer/$(am__dirstamp) \
        jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
@@ -12811,6 +12831,9 @@ javax/swing/plaf/basic/BasicDesktopIconUI.lo:  \
 javax/swing/plaf/basic/BasicDesktopPaneUI.lo:  \
        javax/swing/plaf/basic/$(am__dirstamp) \
        javax/swing/plaf/basic/$(DEPDIR)/$(am__dirstamp)
+javax/swing/plaf/basic/BasicEditorPaneUI.lo:  \
+       javax/swing/plaf/basic/$(am__dirstamp) \
+       javax/swing/plaf/basic/$(DEPDIR)/$(am__dirstamp)
 javax/swing/plaf/basic/BasicFormattedTextFieldUI.lo:  \
        javax/swing/plaf/basic/$(am__dirstamp) \
        javax/swing/plaf/basic/$(DEPDIR)/$(am__dirstamp)
@@ -12979,9 +13002,15 @@ javax/swing/plaf/metal/$(am__dirstamp):
 javax/swing/plaf/metal/$(DEPDIR)/$(am__dirstamp):
        @$(mkdir_p) javax/swing/plaf/metal/$(DEPDIR)
        @: > javax/swing/plaf/metal/$(DEPDIR)/$(am__dirstamp)
+javax/swing/plaf/metal/DefaultMetalTheme.lo:  \
+       javax/swing/plaf/metal/$(am__dirstamp) \
+       javax/swing/plaf/metal/$(DEPDIR)/$(am__dirstamp)
 javax/swing/plaf/metal/MetalLookAndFeel.lo:  \
        javax/swing/plaf/metal/$(am__dirstamp) \
        javax/swing/plaf/metal/$(DEPDIR)/$(am__dirstamp)
+javax/swing/plaf/metal/MetalTheme.lo:  \
+       javax/swing/plaf/metal/$(am__dirstamp) \
+       javax/swing/plaf/metal/$(DEPDIR)/$(am__dirstamp)
 javax/swing/plaf/ColorUIResource.lo: javax/swing/plaf/$(am__dirstamp) \
        javax/swing/plaf/$(DEPDIR)/$(am__dirstamp)
 javax/swing/plaf/DimensionUIResource.lo:  \
@@ -13045,8 +13074,6 @@ javax/swing/plaf/ToolTipUI.lo: javax/swing/plaf/$(am__dirstamp) \
        javax/swing/plaf/$(DEPDIR)/$(am__dirstamp)
 javax/swing/AbstractListModel.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
-javax/swing/AbstractSet.lo: javax/swing/$(am__dirstamp) \
-       javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/colorchooser/$(am__dirstamp):
        @$(mkdir_p) javax/swing/colorchooser
        @: > javax/swing/colorchooser/$(am__dirstamp)
@@ -13141,8 +13168,6 @@ javax/swing/ComponentInputMap.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/DefaultButtonModel.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
-javax/swing/DefaultCellRenderer.lo: javax/swing/$(am__dirstamp) \
-       javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/DefaultListModel.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/DefaultListSelectionModel.lo: javax/swing/$(am__dirstamp) \
@@ -13153,6 +13178,9 @@ javax/swing/ImageIcon.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/InputMap.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
+javax/swing/InternalFrameFocusTraversalPolicy.lo:  \
+       javax/swing/$(am__dirstamp) \
+       javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/JApplet.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/JButton.lo: javax/swing/$(am__dirstamp) \
@@ -13209,6 +13237,9 @@ javax/swing/JWindow.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/KeyStroke.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
+javax/swing/LayoutFocusTraversalPolicy.lo:  \
+       javax/swing/$(am__dirstamp) \
+       javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/ListCellRenderer.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/ListModel.lo: javax/swing/$(am__dirstamp) \
@@ -13219,6 +13250,9 @@ javax/swing/LookAndFeel.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/Scrollable.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
+javax/swing/SortingFocusTraversalPolicy.lo:  \
+       javax/swing/$(am__dirstamp) \
+       javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/SpinnerListModel.lo: javax/swing/$(am__dirstamp) \
        javax/swing/$(DEPDIR)/$(am__dirstamp)
 javax/swing/SpinnerModel.lo: javax/swing/$(am__dirstamp) \
@@ -13400,6 +13434,9 @@ javax/swing/text/DefaultEditorKit.lo:  \
 javax/swing/text/DefaultHighlighter.lo:  \
        javax/swing/text/$(am__dirstamp) \
        javax/swing/text/$(DEPDIR)/$(am__dirstamp)
+javax/swing/text/DefaultStyledDocument.lo:  \
+       javax/swing/text/$(am__dirstamp) \
+       javax/swing/text/$(DEPDIR)/$(am__dirstamp)
 javax/swing/text/Document.lo: javax/swing/text/$(am__dirstamp) \
        javax/swing/text/$(DEPDIR)/$(am__dirstamp)
 javax/swing/text/DocumentFilter.lo: javax/swing/text/$(am__dirstamp) \
@@ -13440,6 +13477,8 @@ javax/swing/text/Segment.lo: javax/swing/text/$(am__dirstamp) \
 javax/swing/text/SimpleAttributeSet.lo:  \
        javax/swing/text/$(am__dirstamp) \
        javax/swing/text/$(DEPDIR)/$(am__dirstamp)
+javax/swing/text/StringContent.lo: javax/swing/text/$(am__dirstamp) \
+       javax/swing/text/$(DEPDIR)/$(am__dirstamp)
 javax/swing/text/Style.lo: javax/swing/text/$(am__dirstamp) \
        javax/swing/text/$(DEPDIR)/$(am__dirstamp)
 javax/swing/text/StyleConstants.lo: javax/swing/text/$(am__dirstamp) \
@@ -16083,10 +16122,16 @@ mostlyclean-compile:
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.$(OBJEXT)
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.lo
+       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.$(OBJEXT)
+       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.$(OBJEXT)
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.$(OBJEXT)
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.lo
+       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.$(OBJEXT)
+       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo
+       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.$(OBJEXT)
+       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.$(OBJEXT)
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.$(OBJEXT)
@@ -16125,8 +16170,6 @@ mostlyclean-compile:
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkLabelPeer.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.$(OBJEXT)
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.lo
-       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.$(OBJEXT)
-       -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.$(OBJEXT)
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.lo
        -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuComponentPeer.$(OBJEXT)
@@ -20335,8 +20378,6 @@ mostlyclean-compile:
        -rm -f javax/swing/AbstractCellEditor.lo
        -rm -f javax/swing/AbstractListModel.$(OBJEXT)
        -rm -f javax/swing/AbstractListModel.lo
-       -rm -f javax/swing/AbstractSet.$(OBJEXT)
-       -rm -f javax/swing/AbstractSet.lo
        -rm -f javax/swing/AbstractSpinnerModel.$(OBJEXT)
        -rm -f javax/swing/AbstractSpinnerModel.lo
        -rm -f javax/swing/Action.$(OBJEXT)
@@ -20373,8 +20414,6 @@ mostlyclean-compile:
        -rm -f javax/swing/DefaultButtonModel.lo
        -rm -f javax/swing/DefaultCellEditor.$(OBJEXT)
        -rm -f javax/swing/DefaultCellEditor.lo
-       -rm -f javax/swing/DefaultCellRenderer.$(OBJEXT)
-       -rm -f javax/swing/DefaultCellRenderer.lo
        -rm -f javax/swing/DefaultComboBoxModel.$(OBJEXT)
        -rm -f javax/swing/DefaultComboBoxModel.lo
        -rm -f javax/swing/DefaultDesktopManager.$(OBJEXT)
@@ -20403,6 +20442,8 @@ mostlyclean-compile:
        -rm -f javax/swing/InputMap.lo
        -rm -f javax/swing/InputVerifier.$(OBJEXT)
        -rm -f javax/swing/InputVerifier.lo
+       -rm -f javax/swing/InternalFrameFocusTraversalPolicy.$(OBJEXT)
+       -rm -f javax/swing/InternalFrameFocusTraversalPolicy.lo
        -rm -f javax/swing/JApplet.$(OBJEXT)
        -rm -f javax/swing/JApplet.lo
        -rm -f javax/swing/JButton.$(OBJEXT)
@@ -20495,6 +20536,8 @@ mostlyclean-compile:
        -rm -f javax/swing/JWindow.lo
        -rm -f javax/swing/KeyStroke.$(OBJEXT)
        -rm -f javax/swing/KeyStroke.lo
+       -rm -f javax/swing/LayoutFocusTraversalPolicy.$(OBJEXT)
+       -rm -f javax/swing/LayoutFocusTraversalPolicy.lo
        -rm -f javax/swing/ListCellRenderer.$(OBJEXT)
        -rm -f javax/swing/ListCellRenderer.lo
        -rm -f javax/swing/ListModel.$(OBJEXT)
@@ -20537,6 +20580,8 @@ mostlyclean-compile:
        -rm -f javax/swing/SizeRequirements.lo
        -rm -f javax/swing/SizeSequence.$(OBJEXT)
        -rm -f javax/swing/SizeSequence.lo
+       -rm -f javax/swing/SortingFocusTraversalPolicy.$(OBJEXT)
+       -rm -f javax/swing/SortingFocusTraversalPolicy.lo
        -rm -f javax/swing/SpinnerListModel.$(OBJEXT)
        -rm -f javax/swing/SpinnerListModel.lo
        -rm -f javax/swing/SpinnerModel.$(OBJEXT)
@@ -20803,6 +20848,8 @@ mostlyclean-compile:
        -rm -f javax/swing/plaf/basic/BasicDesktopIconUI.lo
        -rm -f javax/swing/plaf/basic/BasicDesktopPaneUI.$(OBJEXT)
        -rm -f javax/swing/plaf/basic/BasicDesktopPaneUI.lo
+       -rm -f javax/swing/plaf/basic/BasicEditorPaneUI.$(OBJEXT)
+       -rm -f javax/swing/plaf/basic/BasicEditorPaneUI.lo
        -rm -f javax/swing/plaf/basic/BasicFormattedTextFieldUI.$(OBJEXT)
        -rm -f javax/swing/plaf/basic/BasicFormattedTextFieldUI.lo
        -rm -f javax/swing/plaf/basic/BasicGraphicsUtils.$(OBJEXT)
@@ -20885,8 +20932,12 @@ mostlyclean-compile:
        -rm -f javax/swing/plaf/basic/BasicViewportUI.lo
        -rm -f javax/swing/plaf/basic/ComboPopup.$(OBJEXT)
        -rm -f javax/swing/plaf/basic/ComboPopup.lo
+       -rm -f javax/swing/plaf/metal/DefaultMetalTheme.$(OBJEXT)
+       -rm -f javax/swing/plaf/metal/DefaultMetalTheme.lo
        -rm -f javax/swing/plaf/metal/MetalLookAndFeel.$(OBJEXT)
        -rm -f javax/swing/plaf/metal/MetalLookAndFeel.lo
+       -rm -f javax/swing/plaf/metal/MetalTheme.$(OBJEXT)
+       -rm -f javax/swing/plaf/metal/MetalTheme.lo
        -rm -f javax/swing/table/AbstractTableModel.$(OBJEXT)
        -rm -f javax/swing/table/AbstractTableModel.lo
        -rm -f javax/swing/table/DefaultTableCellRenderer.$(OBJEXT)
@@ -20923,6 +20974,8 @@ mostlyclean-compile:
        -rm -f javax/swing/text/DefaultEditorKit.lo
        -rm -f javax/swing/text/DefaultHighlighter.$(OBJEXT)
        -rm -f javax/swing/text/DefaultHighlighter.lo
+       -rm -f javax/swing/text/DefaultStyledDocument.$(OBJEXT)
+       -rm -f javax/swing/text/DefaultStyledDocument.lo
        -rm -f javax/swing/text/Document.$(OBJEXT)
        -rm -f javax/swing/text/Document.lo
        -rm -f javax/swing/text/DocumentFilter.$(OBJEXT)
@@ -20959,6 +21012,8 @@ mostlyclean-compile:
        -rm -f javax/swing/text/Segment.lo
        -rm -f javax/swing/text/SimpleAttributeSet.$(OBJEXT)
        -rm -f javax/swing/text/SimpleAttributeSet.lo
+       -rm -f javax/swing/text/StringContent.$(OBJEXT)
+       -rm -f javax/swing/text/StringContent.lo
        -rm -f javax/swing/text/Style.$(OBJEXT)
        -rm -f javax/swing/text/Style.lo
        -rm -f javax/swing/text/StyleConstants.$(OBJEXT)
@@ -21189,12 +21244,8 @@ mostlyclean-compile:
        -rm -f jni/classpath/lib_gnu_java_awt_peer_gtk_la-primlib.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo
-       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.$(OBJEXT)
-       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo
-       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.$(OBJEXT)
-       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.$(OBJEXT)
@@ -21203,6 +21254,8 @@ mostlyclean-compile:
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo
+       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.$(OBJEXT)
+       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.$(OBJEXT)
@@ -21237,8 +21290,6 @@ mostlyclean-compile:
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkLabelPeer.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.lo
-       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.$(OBJEXT)
-       -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.$(OBJEXT)
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo
        -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuComponentPeer.$(OBJEXT)
@@ -21466,8 +21517,11 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphics.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkCanvasPeer.Plo@am__quote@
@@ -21487,7 +21541,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkImagePainter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkLabelPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuComponentPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuItemPeer.Plo@am__quote@
@@ -23592,7 +23645,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/AbstractButton.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/AbstractCellEditor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/AbstractListModel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/AbstractSet.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/AbstractSpinnerModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/Action.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/ActionMap.Plo@am__quote@
@@ -23611,7 +23663,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultBoundedRangeModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultButtonModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultCellEditor.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultCellRenderer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultComboBoxModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultDesktopManager.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/DefaultFocusManager.Plo@am__quote@
@@ -23626,6 +23677,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/ImageIcon.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/InputMap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/InputVerifier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/InternalFrameFocusTraversalPolicy.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/JApplet.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/JButton.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/JCheckBox.Plo@am__quote@
@@ -23672,6 +23724,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/JViewport.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/JWindow.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/KeyStroke.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/LayoutFocusTraversalPolicy.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/ListCellRenderer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/ListModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/ListSelectionModel.Plo@am__quote@
@@ -23693,6 +23746,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SingleSelectionModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SizeRequirements.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SizeSequence.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SortingFocusTraversalPolicy.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SpinnerListModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SpinnerModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/SpinnerNumberModel.Plo@am__quote@
@@ -23826,6 +23880,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicComboPopup.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicDesktopIconUI.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicDesktopPaneUI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicEditorPaneUI.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicFormattedTextFieldUI.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicGraphicsUtils.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicIconFactory.Plo@am__quote@
@@ -23867,7 +23922,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicTreeUI.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicViewportUI.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/ComboPopup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/metal/$(DEPDIR)/DefaultMetalTheme.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/metal/$(DEPDIR)/MetalLookAndFeel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/metal/$(DEPDIR)/MetalTheme.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/table/$(DEPDIR)/AbstractTableModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/table/$(DEPDIR)/DefaultTableCellRenderer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/table/$(DEPDIR)/DefaultTableColumnModel.Plo@am__quote@
@@ -23886,6 +23943,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/DefaultCaret.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/DefaultEditorKit.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/DefaultHighlighter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/DefaultStyledDocument.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/Document.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/DocumentFilter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/EditorKit.Plo@am__quote@
@@ -23904,6 +23962,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/Position.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/Segment.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/SimpleAttributeSet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/StringContent.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/Style.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/StyleConstants.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/StyleContext.Plo@am__quote@
@@ -24019,13 +24078,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@jni/classpath/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-native_state.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/classpath/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-primlib.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkCanvasPeer.Plo@am__quote@
@@ -24043,7 +24101,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkImagePainter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkLabelPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuComponentPeer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuItemPeer.Plo@am__quote@
@@ -24107,13 +24164,6 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
 
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
-@am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c; \
-@am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
-
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
 @am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c; \
 @am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.Tpo"; exit 1; fi
@@ -24121,13 +24171,6 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
 
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
-@am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c; \
-@am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
-
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
 @am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c; \
 @am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.Tpo"; exit 1; fi
@@ -24149,6 +24192,13 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
 
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c; \
+@am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkRobotPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
+
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
 @am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c; \
 @am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.Tpo"; exit 1; fi
@@ -24261,13 +24311,6 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.lo:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkListPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
 
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
-@am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c; \
-@am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMainThread.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
-
 jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
 @am__fastdepCC_TRUE@   if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_gnu_java_awt_peer_gtk_la_CFLAGS) $(CFLAGS) -MT jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c; \
 @am__fastdepCC_TRUE@   then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkMenuBarPeer.Tpo"; exit 1; fi
@@ -24645,6 +24688,13 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.lo: gnu/java/aw
 @AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics2D.lo `test -f 'gnu/java/awt/peer/gtk/GdkGraphics2D.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkGraphics2D.java
 
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo: gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
+@am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo `test -f 'gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java; \
+@am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     source='gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsConfiguration.lo `test -f 'gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
+
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.lo: gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
 @am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.lo `test -f 'gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java; \
 @am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGraphicsEnvironment.Tpo"; exit 1; fi
@@ -24659,6 +24709,20 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.lo: gnu/java
 @AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkPixbufDecoder.lo `test -f 'gnu/java/awt/peer/gtk/GdkPixbufDecoder.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
 
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo: gnu/java/awt/peer/gtk/GdkRobotPeer.java
+@am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo `test -f 'gnu/java/awt/peer/gtk/GdkRobotPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkRobotPeer.java; \
+@am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     source='gnu/java/awt/peer/gtk/GdkRobotPeer.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkRobotPeer.lo `test -f 'gnu/java/awt/peer/gtk/GdkRobotPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkRobotPeer.java
+
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo: gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+@am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo `test -f 'gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java; \
+@am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     source='gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkScreenGraphicsDevice.lo `test -f 'gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.lo: gnu/java/awt/peer/gtk/GtkButtonPeer.java
 @am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkButtonPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkButtonPeer.java; \
 @am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.Tpo"; exit 1; fi
@@ -24785,13 +24849,6 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.lo: gnu/java/awt/
 @AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkListPeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkListPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkListPeer.java
 
-gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo: gnu/java/awt/peer/gtk/GtkMainThread.java
-@am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo `test -f 'gnu/java/awt/peer/gtk/GtkMainThread.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkMainThread.java; \
-@am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     source='gnu/java/awt/peer/gtk/GtkMainThread.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepGCJ_FALSE@     DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMainThread.lo `test -f 'gnu/java/awt/peer/gtk/GtkMainThread.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkMainThread.java
-
 gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.lo: gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
 @am__fastdepGCJ_TRUE@  if $(LIBTOOL) --mode=compile $(GCJ) $(lib_gnu_java_awt_peer_gtk_la_GCJFLAGS) $(GCJFLAGS) -MT gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkMenuBarPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkMenuBarPeer.java; \
 @am__fastdepGCJ_TRUE@  then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkMenuBarPeer.Tpo"; exit 1; fi
@@ -25828,8 +25885,6 @@ uninstall-info: uninstall-info-recursive
        uninstall-toolexecmainlibDATA
 
 
-jniinclude/gnu_java_awt_peer_gtk_GdkFontMetrics.h: gnu/java/awt/peer/gtk/GdkFontMetrics.java
-jniinclude/gnu_java_awt_peer_gtk_GdkGlyphVector.h: gnu/java/awt/peer/gtk/GdkGlyphVector.java
 jniinclude/gnu_java_awt_peer_gtk_GdkGraphics.h: gnu/java/awt/peer/gtk/GdkGraphics.java
 jniinclude/gnu_java_awt_peer_gtk_GdkGraphics2D.h: gnu/java/awt/peer/gtk/GdkGraphics2D.java
 jniinclude/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h: gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
@@ -25853,7 +25908,6 @@ jniinclude/gnu_java_awt_peer_gtk_GtkImage.h: gnu/java/awt/peer/gtk/GtkImage.java
 jniinclude/gnu_java_awt_peer_gtk_GtkImagePainter.h: gnu/java/awt/peer/gtk/GtkImagePainter.java
 jniinclude/gnu_java_awt_peer_gtk_GtkLabelPeer.h: gnu/java/awt/peer/gtk/GtkLabelPeer.java
 jniinclude/gnu_java_awt_peer_gtk_GtkListPeer.h: gnu/java/awt/peer/gtk/GtkListPeer.java
-jniinclude/gnu_java_awt_peer_gtk_GtkMainThread.h: gnu/java/awt/peer/gtk/GtkMainThread.java
 jniinclude/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h: gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
 jniinclude/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.h: gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
 jniinclude/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h: gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
@@ -25878,9 +25932,7 @@ $(gtk_jni_headers): %.h:
        echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
        $(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
 
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkFontMetrics.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkFontPeer.h
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGlyphVector.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGraphics2D.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkGraphics.h
@@ -25902,7 +25954,6 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.lo: $(top_builddir)/jniinclude
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkImagePainter.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkLabelPeer.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkListPeer.h
-jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMainThread.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.h
 jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h
index 6687818..8f78287 100644 (file)
@@ -21,12 +21,11 @@ import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
 import java.util.Vector;
 
-public class XEventLoop implements Runnable
+public class XEventLoop
 {
   Display display;
   EventQueue queue;
   XAnyEvent anyEvent;
-  Thread eventLoopThread;
 
   LightweightRedirector lightweightRedirector = new LightweightRedirector();
     
@@ -36,44 +35,40 @@ public class XEventLoop implements Runnable
     this.queue = queue;
     
     anyEvent = new XAnyEvent(display);
-    eventLoopThread = new Thread(this, "AWT thread for XEventLoop");
-    eventLoopThread.start();
   }
 
-  public void run()
+  void interrupt()
   {
-    while (true) 
-      postNextEvent();
+    anyEvent.interrupt();
   }
 
-  void postNextEvent()
+  void postNextEvent(boolean block)
   {
-    AWTEvent evt = getNextEvent();
-    queue.postEvent(evt);
+    AWTEvent evt = getNextEvent(block);
+    if (evt != null)
+      queue.postEvent(evt);
   }
     
   /** get next event. Will block until events become available. */
  
-  public AWTEvent getNextEvent()
+  public AWTEvent getNextEvent(boolean block)
   {
     // ASSERT:
     if (isIdle())
       throw new Error("should not be idle");
     
     AWTEvent event = null;
-    while (event == null)
+    if (loadNextEvent(block))
       {
-       loadNextEvent();
-       event = createEvent();
-      }
-
-    event = lightweightRedirector.redirect(event);
-
+        event = createEvent();        
+        event = lightweightRedirector.redirect(event);
+      }    
     return event;
   }
 
-  void loadNextEvent()
+  boolean loadNextEvent(boolean block)
   {
+    boolean gotEvent = false;
     try
       {
        setIdle(true);
@@ -100,7 +95,7 @@ public class XEventLoop implements Runnable
           of events. */
        
        //display.flush(); // implicit?
-       anyEvent.loadNext();
+       gotEvent = anyEvent.loadNext(block);
       }
     catch (RuntimeException re)
       {
@@ -110,6 +105,7 @@ public class XEventLoop implements Runnable
       {
        setIdle(false);
       }
+    return gotEvent;
   }
     
   /**
index ec15907..f3c655e 100644 (file)
@@ -78,7 +78,7 @@ public class XFramePeer extends XCanvasPeer implements FramePeer
      bounds.  */
   public void setBounds(int x, int y, int width, int height)
   {
-    if (Thread.currentThread() == getXToolkit().eventLoop.eventLoopThread)
+    if (EventQueue.isDispatchThread())
       return;
     
     super.setBounds(x, y, width, height);
index a1d2440..1e937c2 100644 (file)
@@ -438,5 +438,29 @@ public class XToolkit extends ClasspathToolkit
   {
     throw new java.lang.UnsupportedOperationException ();
   }
-  
+
+  public RobotPeer createRobot (GraphicsDevice screen) throws AWTException
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+  boolean interrupted;
+
+  public boolean nativeQueueEmpty() 
+  { 
+    return eventLoop.isIdle(); 
+  }
+
+  public void wakeNativeQueue() 
+  {
+    interrupted = true;
+    eventLoop.interrupt();
+  }
+
+  public void iterateNativeQueue(java.awt.EventQueue locked, boolean block) 
+  {
+    interrupted = false;
+    while (!interrupted)
+      eventLoop.postNextEvent(block);
+  }; 
 }
index 061d613..bce3a61 100644 (file)
@@ -70,7 +70,8 @@ public final class XAnyEvent
   /**
    * Load next event into the event structure.
    */
-  public native void loadNext();
+  public native boolean loadNext(boolean block);
+  public native void interrupt();
 
   public native int getType();
   public native void setType(int type);
@@ -86,6 +87,7 @@ public final class XAnyEvent
   public native void send(Window destination, boolean propagate,
                          long mask);
 
+  RawData pipefds;
   RawData structure;
   Display display;
 
index 439f204..0bef563 100644 (file)
@@ -6,6 +6,12 @@ This software is copyrighted work licensed under the terms of the
 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
 details.  */
 
+#include <config.h>
+#include <platform.h>
+
+#include <gcj/javaprims.h>
+#include <jvm.h>
+
 #include <X11/Xlib.h>
 
 #include <gcj/cni.h>
@@ -22,24 +28,72 @@ details.  */
 #include <gnu/gcj/xlib/XExposeEvent.h>
 #include <gnu/gcj/xlib/XException.h>
 
+#include <unistd.h>
+#include <posix.h>
+
 void gnu::gcj::xlib::XAnyEvent::init()
 {
   ::XEvent* event = new ::XEvent;
+  int *pipes = new int[2];
+  pipe(pipes);
   structure = reinterpret_cast<gnu::gcj::RawData*>(event);
+  pipefds = reinterpret_cast<gnu::gcj::RawData*>(pipes);
 }
 
 void gnu::gcj::xlib::XAnyEvent::finalize()
 {
   delete structure;
+  int *pipe = reinterpret_cast<int *>(pipefds);
+  close(pipe[0]);
+  close(pipe[1]);
+  delete [] pipefds;
+  pipefds = 0;
   structure = 0;
 }
 
-void gnu::gcj::xlib::XAnyEvent::loadNext()
+jboolean gnu::gcj::xlib::XAnyEvent::loadNext(jboolean block)
 {
   ::Display* dpy = (::Display*) display->display;
   ::XEvent* evt = (::XEvent*) structure;
-  XNextEvent(dpy, evt);
-  // What does XNextEvent return?
+
+  if (XPending(dpy))
+    {
+      XNextEvent(dpy, evt);
+      return true;  
+    }
+
+  if (!block)
+    return false;
+
+  int *pipe = reinterpret_cast<int *>(pipefds);
+  int xfd = XConnectionNumber(dpy);
+  int pipefd = pipe[0];
+  int n = (xfd > pipefd ? xfd : pipefd) + 1;
+  fd_set rfds;
+  FD_ZERO(&rfds);
+  FD_SET(xfd, &rfds);
+  FD_SET(pipefd, &rfds);  
+  int sel = _Jv_select (n, &rfds, NULL, NULL, NULL);
+  if (sel > 0)
+    {
+      if (FD_ISSET(xfd, &rfds))
+       {
+         XNextEvent(dpy, evt);
+         return true;  
+       }
+      if (FD_ISSET(pipefd, &rfds))
+       {
+         char c;
+         read(pipefd, &c, 1);
+       }
+    }
+  return false;
+}
+
+void gnu::gcj::xlib::XAnyEvent::interrupt()
+{
+  int *pipe = reinterpret_cast<int *>(pipefds);
+  write(pipe[1], "W", 1);
 }
 
 jint gnu::gcj::xlib::XAnyEvent::getType()
index de97c4a..72302e1 100644 (file)
@@ -41,16 +41,20 @@ package gnu.java.awt;
 import gnu.java.awt.peer.ClasspathFontPeer;
 import gnu.java.awt.peer.ClasspathTextLayoutPeer;
 
-import java.awt.Image;
+import java.awt.AWTException;
 import java.awt.Dimension;
 import java.awt.DisplayMode;
+import java.awt.EventQueue;
 import java.awt.Font;
 import java.awt.FontMetrics;
+import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
+import java.awt.Image;
 import java.awt.Toolkit;
 import java.awt.font.FontRenderContext;
 import java.awt.image.ColorModel;
 import java.awt.image.ImageProducer;
+import java.awt.peer.RobotPeer;
 import java.io.File;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -90,7 +94,7 @@ public abstract class ClasspathToolkit
    * #getImage(java.net.URL)}. For images that were loaded via a path
    * to an image file, the map contains a key with a file URL.
    */
-  private Map imageCache;
+  private HashMap imageCache;
 
 
   /**
@@ -169,7 +173,6 @@ public abstract class ClasspathToolkit
    * this font peer should have, such as size, weight, family name, or
    * transformation.
    */
-
   public abstract ClasspathFontPeer getClasspathFontPeer (String name, Map attrs); 
 
   public abstract ClasspathTextLayoutPeer 
@@ -184,7 +187,6 @@ public abstract class ClasspathToolkit
    * implement {@link java.awt.font.OpenType} or
    * {@link java.awt.font.MultipleMaster}.
    */
-
   public Font getFont (String name, Map attrs) 
   {
     return new Font (name, attrs);
@@ -350,6 +352,9 @@ public abstract class ClasspathToolkit
     return null;
   }
 
+  public abstract RobotPeer createRobot (GraphicsDevice screen)
+    throws AWTException;
+
   /** 
    * Used to register ImageIO SPIs provided by the toolkit.
    */
@@ -357,4 +362,8 @@ public abstract class ClasspathToolkit
   public void registerImageIOSpis(IIORegistry reg)
   {
   }
+
+  public abstract boolean nativeQueueEmpty();
+  public abstract void wakeNativeQueue();  
+  public abstract void iterateNativeQueue(EventQueue locked, boolean block);
 }
index 08bc027..c3cfac4 100644 (file)
@@ -38,7 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt;
 
-import gnu.classpath.Configuration;
 import gnu.java.awt.peer.EmbeddedWindowPeer;
 import gnu.java.security.action.SetAccessibleAction;
 
index d33a688..5b06f48 100644 (file)
@@ -38,7 +38,6 @@
 
 package gnu.java.awt.color;
 
-import java.awt.color.ColorSpace;
 import java.awt.color.ICC_Profile;
 
 
index 233dfb1..d279d56 100644 (file)
@@ -74,6 +74,11 @@ public abstract class ImageDecoder implements ImageProducer
     this.url = url;
   }
 
+  public ImageDecoder (InputStream is)
+  {
+    this.input = is;
+  }
+
   public ImageDecoder (byte[] imagedata, int imageoffset, int imagelength)
   {
     data = imagedata;
@@ -99,7 +104,7 @@ public abstract class ImageDecoder implements ImageProducer
   public void startProduction (ImageConsumer ic)
   {
     if (!isConsumer(ic))
-    addConsumer (ic);
+      addConsumer(ic);
 
     Vector list = (Vector) consumers.clone ();
     try 
@@ -108,17 +113,30 @@ public abstract class ImageDecoder implements ImageProducer
        // ImageDecoder constructors so that exceptions cause
        // imageComplete to be called with an appropriate error
        // status.
-       if (url != null)
-         input = url.openStream();
-       else
-         {
-           if (filename != null)
-             input = new FileInputStream (filename);
-           else
-             input = new ByteArrayInputStream (data, offset, length);
-         }
-
-       produce (list, input);
+        if (input == null)
+          {
+            try 
+              {
+                if (url != null)
+                  input = url.openStream();
+                else
+                  {
+                    if (filename != null)
+                      input = new FileInputStream (filename);
+                    else
+                      input = new ByteArrayInputStream (data, offset, length);
+                  }
+                produce (list, input);
+              } 
+            finally 
+              {
+                input = null;
+              }
+          }
+        else
+          {
+            produce (list, input);
+          }
       }
     catch (Exception e)
       {
index 143412c..07b4b3e 100644 (file)
@@ -38,19 +38,12 @@ exception statement from your version. */
 
 package gnu.java.awt.peer;
 
-import java.awt.Font;
 import java.awt.Graphics2D;
 import java.awt.Shape;
 import java.awt.font.TextHitInfo;
 import java.awt.font.TextLayout;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
-import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
-import java.util.Map;
-import java.awt.font.TextAttribute;
-
 
 /**
  * @author Graydon Hoare
index 3cd2f9a..e871587 100644 (file)
@@ -63,8 +63,6 @@ public class GdkFontMetrics extends FontMetrics
   static final int TEXT_METRICS_X_ADVANCE = 4;
   static final int TEXT_METRICS_Y_ADVANCE = 5;
 
-  static native void getPeerFontMetrics(GdkFontPeer peer, double [] metrics);
-  static native void getPeerTextMetrics(GdkFontPeer peer, String str, double [] metrics);
 
   public GdkFontMetrics (Font font)
   {    
@@ -77,12 +75,7 @@ public class GdkFontMetrics extends FontMetrics
 
     font_metrics = new int[5];
     double [] hires = new double[5];
-
-    if (GtkToolkit.useGraphics2D ())
-      GdkGraphics2D.getPeerFontMetrics(peer, hires);
-    else
-      getPeerFontMetrics (peer, hires);
-
+    peer.getFontMetrics (hires);
     for (int i = 0; i < 5; ++i)
       font_metrics[i] = (int) hires[i];
   }
@@ -90,10 +83,7 @@ public class GdkFontMetrics extends FontMetrics
   public int stringWidth (String str)
   {
     double [] hires = new double[6];
-    if (GtkToolkit.useGraphics2D())
-      GdkGraphics2D.getPeerTextMetrics(peer, str, hires);
-    else
-      getPeerTextMetrics(peer, str, hires);
+    peer.getTextMetrics(str, hires);
     return (int) hires [TEXT_METRICS_WIDTH];
   }
 
@@ -115,7 +105,6 @@ public class GdkFontMetrics extends FontMetrics
   public int getLeading ()
   {
     return 1;
-//      return metrics[ASCENT] + metrics[DESCENT];
   }
 
   public int getAscent ()
index ee05145..5573a1b 100644 (file)
@@ -37,19 +37,21 @@ exception statement from your version. */
 
 
 package gnu.java.awt.peer.gtk;
-import java.awt.peer.FontPeer;
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.font.*;
+
+import gnu.classpath.Configuration;
+import gnu.java.awt.peer.ClasspathFontPeer;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.LineMetrics;
+import java.awt.geom.Rectangle2D;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
-import java.util.MissingResourceException;
 import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
 import java.text.StringCharacterIterator;
-import gnu.classpath.Configuration;
-import gnu.java.awt.peer.ClasspathFontPeer;
 
 public class GdkFontPeer extends ClasspathFontPeer
 {
@@ -81,6 +83,9 @@ public class GdkFontPeer extends ClasspathFontPeer
   private native void dispose ();
   private native void setFont (String family, int style, int size, boolean useGraphics2D);
 
+  native void getFontMetrics(double [] metrics);
+  native void getTextMetrics(String str, double [] metrics);
+
   protected void finalize ()
   {
     if (GtkToolkit.useGraphics2D ())
@@ -158,26 +163,33 @@ public class GdkFontPeer extends ClasspathFontPeer
 
   public boolean canDisplay (Font font, char c)
   {
-    throw new UnsupportedOperationException ();
+    // FIXME: inquire with pango
+    return true;
   }
 
   public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit)
   {
-    throw new UnsupportedOperationException ();
+    // FIXME: inquire with pango
+    return -1;
   }
+  
+  private native GdkGlyphVector getGlyphVector(String txt, 
+                                               Font f, 
+                                               FontRenderContext ctx);
 
   public GlyphVector createGlyphVector (Font font, 
                                         FontRenderContext ctx, 
                                         CharacterIterator i)
   {
-    return new GdkGlyphVector(font, this, ctx, buildString (i));
+    return getGlyphVector(buildString (i), font, ctx);
   }
 
   public GlyphVector createGlyphVector (Font font, 
                                         FontRenderContext ctx, 
                                         int[] glyphCodes)
   {
-    return new GdkGlyphVector (font, this, ctx, glyphCodes);
+    return null;
+    //    return new GdkGlyphVector (font, this, ctx, glyphCodes);
   }
 
   public byte getBaselineFor (Font font, char c)
@@ -259,7 +271,8 @@ public class GdkFontPeer extends ClasspathFontPeer
   public Rectangle2D getStringBounds (Font font, CharacterIterator ci, 
                                       int begin, int limit, FontRenderContext frc)
   {
-    throw new UnsupportedOperationException ();
+    GdkGlyphVector gv = getGlyphVector(buildString (ci, begin, limit), font, frc);
+    return gv.getVisualBounds();
   }
 
   public boolean hasUniformLineMetrics (Font font)
index c37de52..4e66a86 100644 (file)
@@ -38,8 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import gnu.classpath.Configuration;
-
 import java.awt.Font;
 import java.awt.Rectangle;
 import java.awt.Shape;
@@ -54,36 +52,57 @@ import java.awt.geom.Rectangle2D;
 public class GdkGlyphVector extends GlyphVector
 {
 
-  static 
+  /* We use a simple representation for glyph vectors here. Glyph i
+   * consumes 8 doubles:
+   *
+   *      logical x: extents[ 10*i     ]
+   *      logical y: extents[ 10*i + 1 ]
+   *  logical width: extents[ 10*i + 2 ]
+   * logical height: extents[ 10*i + 3 ]
+   *
+   *       visual x: extents[ 10*i + 4 ]
+   *       visual y: extents[ 10*i + 5 ]
+   *   visual width: extents[ 10*i + 6 ]
+   *  visual height: extents[ 10*i + 7 ]
+   *
+   *   origin pos x: extents[ 10*i + 8 ]
+   *   origin pos y: extents[ 10*i + 9 ]
+   * 
+   * as well as one int, code[i], representing the glyph code in the font.
+   */
+
+  double [] extents;
+  int [] codes;
+
+  Font font;
+  FontRenderContext fontRenderContext;
+
+  Rectangle2D allLogical;
+  Rectangle2D allVisual;
+
+  public GdkGlyphVector(double[] extents, int[] codes, Font font, FontRenderContext frc)
   {
-    if (Configuration.INIT_LOAD_LIBRARY)
+    this.extents = extents;
+    this.codes = codes;
+    this.font = font;
+    this.fontRenderContext = frc;
+
+    allLogical = new Rectangle2D.Double();
+    allVisual = new Rectangle2D.Double();
+    
+    for (int i = 0; i < codes.length; ++i)
       {
-        System.loadLibrary("gtkpeer");
+        allLogical.add (new Rectangle2D.Double(extents[10*i    ] + extents[10*i + 8],
+                                               extents[10*i + 1] + extents[10*i + 9],
+                                               extents[10*i + 2],
+                                               extents[10*i + 3]));
+
+        allVisual.add (new Rectangle2D.Double(extents[10*i + 4] + extents[10*i + 8],
+                                              extents[10*i + 5] + extents[10*i + 9],
+                                              extents[10*i + 6],
+                                              extents[10*i + 7]));
       }
-
-    if (GtkToolkit.useGraphics2D ())
-      initStaticState ();
   }
-  native static void initStaticState ();
-  private final int native_state = GtkGenericPeer.getUniqueInteger ();
-
-  private Font font;
-  private FontRenderContext ctx;
-    
-  private native void initState (GdkFontPeer peer, FontRenderContext ctx);
-  private native void setChars (String s);
-  private native void setGlyphCodes (int codes[]);
-  private native void dispose ();
-  private native int glyphCode (int idx);
-  private native int numGlyphs ();
-  private native int glyphCharIndex (int idx);
-  private native double[] allLogicalExtents ();
-  private native double[] allInkExtents ();
-  private native double[] glyphLogicalExtents (int idx);
-  private native double[] glyphInkExtents (int idx);
-  private native boolean glyphIsHorizontal (int idx);
-  private native boolean isEqual (GdkGlyphVector ggv);
-
 
   /* 
      geometric notes:
@@ -108,26 +127,14 @@ public class GdkGlyphVector extends GlyphVector
      
    */
 
-
-  public GdkGlyphVector (Font f, GdkFontPeer peer, FontRenderContext c, String s)
+  public double[] getExtents() 
   {
-    font = f;
-    ctx = c;
-    initState (peer, ctx);
-    setChars (s);
+    return extents;
   }
 
-  public GdkGlyphVector (Font f, GdkFontPeer peer, FontRenderContext c, int codes[])
+  public int[] getCodes()
   {
-    font = f;
-    ctx = c;
-    initState (peer, ctx);
-    setGlyphCodes (codes);
-  }
-
-  protected void finalize ()
-  {
-    dispose ();
+    return codes;
   }
 
   public Font getFont () 
@@ -137,12 +144,15 @@ public class GdkGlyphVector extends GlyphVector
 
   public FontRenderContext getFontRenderContext () 
   { 
-    return ctx
+    return fontRenderContext
   }
 
   public int getGlyphCharIndex (int glyphIndex) 
   { 
-    return glyphCharIndex (glyphIndex); 
+    // FIXME: currently pango does not provide glyph-by-glyph
+    // reverse mapping information, so we assume a broken 1:1
+    // glyph model here. This is plainly wrong.
+    return glyphIndex;
   }
 
   public int[] getGlyphCharIndices (int beginGlyphIndex, 
@@ -154,50 +164,44 @@ public class GdkGlyphVector extends GlyphVector
       ix = new int[numEntries];
 
     for (int i = 0; i < numEntries; i++)
-      ix[i] = glyphCharIndex (beginGlyphIndex + i);
+      ix[i] = getGlyphCharIndex (beginGlyphIndex + i);
     return ix;
   }
 
   public int getGlyphCode (int glyphIndex) 
   { 
-    return glyphCode (glyphIndex); 
+    return codes[glyphIndex];
   }
 
   public int[] getGlyphCodes (int beginGlyphIndex, int numEntries,
                               int[] codeReturn)
   {
-    int ix[] = codeReturn;
-    if (ix == null)
-      ix = new int[numEntries];
+    if (codeReturn == null)
+      codeReturn = new int[numEntries];
 
-    for (int i = 0; i < numEntries; i++)
-      ix[i] = glyphCode (beginGlyphIndex + i);
-    return ix;
+    System.arraycopy(codes, beginGlyphIndex, codeReturn, 0, numEntries);
+    return codeReturn;
   }
 
-  public Shape getGlyphLogicalBounds (int glyphIndex)
+  public Shape getGlyphLogicalBounds (int i)
   {
-    double extents[] = glyphLogicalExtents (glyphIndex);
-    return new Rectangle2D.Double (extents[0], extents[1],
-                                   extents[2], extents[3]);
+    return new Rectangle2D.Double (extents[8*i], extents[8*i + 1],
+                                   extents[8*i + 2], extents[8*i + 3]);
   }
     
-  public GlyphMetrics getGlyphMetrics (int glyphIndex)
+  public GlyphMetrics getGlyphMetrics (int i)
   {
-    double extents[] = glyphLogicalExtents (glyphIndex);
-    Rectangle2D log_bounds = new Rectangle2D.Double (extents[0], extents[1],
-                                                     extents[2], extents[3]);
-
-    extents = glyphInkExtents (glyphIndex);
-    Rectangle2D ink_bounds = new Rectangle2D.Double (extents[0], extents[1],
-                                                     extents[2], extents[3]);
-      
-    boolean is_horizontal = glyphIsHorizontal (glyphIndex);
-
-    return new GlyphMetrics (is_horizontal,
-                             (float)(log_bounds.getWidth() + log_bounds.getX()), 
-                             (float)(log_bounds.getHeight() + log_bounds.getY()),
-                             ink_bounds, GlyphMetrics.STANDARD);
+    // FIXME: pango does not yield vertical layout information at the
+    // moment.
+
+    boolean is_horizontal = true;
+    double advanceX = extents[8*i + 2]; // "logical width" == advanceX 
+    double advanceY = 0; 
+   
+    return new GlyphMetrics (is_horizontal, 
+                             (float) advanceX, (float) advanceY, 
+                             (Rectangle2D) getGlyphVisualBounds(i), 
+                             GlyphMetrics.STANDARD);
   }
 
   public Shape getGlyphOutline (int glyphIndex)
@@ -210,20 +214,18 @@ public class GdkGlyphVector extends GlyphVector
     throw new UnsupportedOperationException ();
   }
 
-  public Rectangle getGlyphPixelBounds (int glyphIndex
+  public Rectangle getGlyphPixelBounds (int i
                                         FontRenderContext renderFRC,
                                         float x, float y)
   {
-    double extents[] = glyphInkExtents(glyphIndex);
-    return new Rectangle ((int)x, (int)y, (int)extents[2], (int)extents[3]);
+    return new Rectangle((int) x, (int) y,
+                         (int) extents[8*i + 6], (int) extents[8*i + 7]);
   }
     
-  public Point2D getGlyphPosition (int glyphIndex)
+  public Point2D getGlyphPosition (int i)
   {
-    float[] ret = new float[2 * (glyphIndex + 1)];
-    getGlyphPositions (0, glyphIndex + 1, ret);
-    return new Point2D.Float (ret[2 * glyphIndex], 
-                              ret[2 * glyphIndex + 1]);
+    return new Point2D.Double (extents[10*i + 8], 
+                               extents[10*i + 9]);
   }
 
   public float[] getGlyphPositions (int beginGlyphIndex,
@@ -234,35 +236,25 @@ public class GdkGlyphVector extends GlyphVector
     if (fx == null)
       fx = new float[numEntries * 2];
 
-
-    float x = 0.0f;
-    float y = 0.0f;
     for (int i = 0; i < numEntries; ++i)
       {
-        boolean is_horizontal = glyphIsHorizontal (beginGlyphIndex + i);
-        double log_extents[] = glyphLogicalExtents (beginGlyphIndex + i);
-        fx[2*i]     = x + (float)log_extents[0]; // x offset
-        fx[2*i + 1] = y + (float)log_extents[1]; // y offset
-        if (is_horizontal)
-          x += (float)log_extents[2]; // x advance ("logical width") in pango-ese
-        else
-          y += (float)log_extents[3]; // y advance ("logical height") in pango-ese
+        fx[2*i    ] = (float) extents[10*i + 8];
+        fx[2*i + 1] = (float) extents[10*i + 9];
       }
     return fx;
   }
 
   public AffineTransform getGlyphTransform (int glyphIndex)
   {
-    // glyphs don't have independent transforms in these simple glyph
+    // Glyphs don't have independent transforms in these simple glyph
     // vectors; docs specify null is an ok return here.
     return null;  
   }
     
-  public Shape getGlyphVisualBounds (int glyphIndex)
+  public Shape getGlyphVisualBounds (int i)
   {
-    double extents[] = glyphInkExtents (glyphIndex);
-    return new Rectangle2D.Double (extents[0], extents[1], 
-                                   extents[2], extents[3]);
+    return new Rectangle2D.Double(extents[8*i + 4], extents[8*i + 5],
+                                  extents[8*i + 6], extents[8*i + 7]);
   }
     
   public int getLayoutFlags ()
@@ -272,14 +264,12 @@ public class GdkGlyphVector extends GlyphVector
 
   public Rectangle2D getLogicalBounds ()
   {
-    double extents[] = allLogicalExtents ();
-    return new Rectangle2D.Double (extents[0], extents[1], 
-                                   extents[2], extents[3]);
+    return allLogical;
   }
 
   public int getNumGlyphs ()
   {
-    return numGlyphs ();
+    return codes.length;
   }
 
   public Shape getOutline ()
@@ -290,26 +280,28 @@ public class GdkGlyphVector extends GlyphVector
   public Rectangle getPixelBounds (FontRenderContext renderFRC,
                                    float x, float y)
   {
-    double extents[] = allInkExtents();
-    return new Rectangle ((int)x, (int)y, 
-                          (int)extents[2], (int)extents[3]);
+    return new Rectangle((int)x, 
+                         (int)y, 
+                         (int) allVisual.getWidth(),
+                         (int) allVisual.getHeight());
   }
     
   public Rectangle2D getVisualBounds ()
   {
-    double extents[] = allInkExtents();
-    return new Rectangle2D.Double (extents[0], extents[1], 
-                                   extents[2], extents[3]);
+    return allVisual;
   }
 
   public void performDefaultLayout ()
   {
   }
     
-  public void setGlyphPosition (int glyphIndex, Point2D newPos)
+  public void setGlyphPosition (int i, Point2D newPos)
   {
-    // should we be ok twiddling pango's structure here?
-    throw new UnsupportedOperationException ();      
+    extents[8*i    ] = newPos.getX();
+    extents[8*i + 1] = newPos.getY();
+
+    extents[8*i + 4] = newPos.getX();
+    extents[8*i + 5] = newPos.getY();
   }
 
   public void setGlyphTransform (int glyphIndex,
@@ -327,8 +319,31 @@ public class GdkGlyphVector extends GlyphVector
     if (! (gv instanceof GdkGlyphVector))
       return false;
 
-    GdkGlyphVector ggv = (GdkGlyphVector)gv;
-    return isEqual(ggv);
+    GdkGlyphVector ggv = (GdkGlyphVector) gv;
+
+    if ((ggv.codes.length != this.codes.length)
+        || (ggv.extents.length != this.extents.length))
+      return false;
+    
+    if ((ggv.font == null && this.font != null)
+        || (ggv.font != null && this.font == null)
+        || (!ggv.font.equals(this.font)))
+      return false;
+
+    if ((ggv.fontRenderContext == null && this.fontRenderContext != null)
+        || (ggv.fontRenderContext != null && this.fontRenderContext == null)
+        || (!ggv.fontRenderContext.equals(this.fontRenderContext)))
+      return false;
+
+    for (int i = 0; i < ggv.codes.length; ++i)
+      if (ggv.codes[i] != this.codes[i])
+        return false;
+
+    for (int i = 0; i < ggv.extents.length; ++i)
+      if (ggv.extents[i] != this.extents[i])
+        return false;
+
+    return true;
   }
 
   public GlyphJustificationInfo getGlyphJustificationInfo(int idx)
index 5aacf52..0811287 100644 (file)
@@ -426,7 +426,8 @@ public class GdkGraphics extends Graphics
 
   public void setClip (int x, int y, int width, int height)
   {
-    if (component != null && ! component.isRealized ())
+    if ((component != null && ! component.isRealized ())
+        || clip == null)
       return;
 
     clip.x = x;
index 82de03d..3bf169c 100644 (file)
@@ -1,5 +1,5 @@
-/* GdkGraphics2D.java
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+/* GdkGraphics2D.java --
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,7 +40,6 @@ package gnu.java.awt.peer.gtk;
 
 import gnu.classpath.Configuration;
 import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathFontPeer;
 
 import java.awt.AlphaComposite;
 import java.awt.BasicStroke;
@@ -60,17 +59,15 @@ import java.awt.Shape;
 import java.awt.Stroke;
 import java.awt.TexturePaint;
 import java.awt.Toolkit;
-import java.awt.color.ColorSpace;
 import java.awt.font.FontRenderContext;
 import java.awt.font.GlyphVector;
-import java.awt.font.GlyphJustificationInfo;
+import java.awt.geom.AffineTransform;
 import java.awt.geom.Arc2D;
 import java.awt.geom.GeneralPath;
 import java.awt.geom.NoninvertibleTransformException;
 import java.awt.geom.PathIterator;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
-import java.awt.geom.AffineTransform;
 import java.awt.image.AffineTransformOp;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImageOp;
@@ -78,16 +75,17 @@ import java.awt.image.ColorModel;
 import java.awt.image.CropImageFilter;
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferInt;
+import java.awt.image.DirectColorModel;
 import java.awt.image.FilteredImageSource;
-import java.awt.image.ImageConsumer;
 import java.awt.image.ImageObserver;
 import java.awt.image.ImagingOpException;
-import java.awt.image.SampleModel;
+import java.awt.image.MultiPixelPackedSampleModel;
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
+import java.awt.image.SampleModel;
 import java.awt.image.WritableRaster;
-import java.awt.image.renderable.RenderableImage;
 import java.awt.image.renderable.RenderContext;
+import java.awt.image.renderable.RenderableImage;
 import java.text.AttributedCharacterIterator;
 import java.util.HashMap;
 import java.util.Map;
@@ -95,7 +93,6 @@ import java.util.Stack;
 
 public class GdkGraphics2D extends Graphics2D
 {
-
   //////////////////////////////////////
   ////// State Management Methods //////
   //////////////////////////////////////
@@ -103,14 +100,14 @@ public class GdkGraphics2D extends Graphics2D
   static 
   {
     if (Configuration.INIT_LOAD_LIBRARY)
-      {
-        System.loadLibrary("gtkpeer");
-      }
+      System.loadLibrary("gtkpeer");
 
-    if (GtkToolkit.useGraphics2D ())
-      initStaticState ();
+    if (GtkToolkit.useGraphics2D())
+      initStaticState();
   }
-  native static void initStaticState ();
+  
+  static native void initStaticState();
+  
   private final int native_state = GtkGenericPeer.getUniqueInteger();  
 
   private Paint paint;
@@ -120,246 +117,255 @@ public class GdkGraphics2D extends Graphics2D
   private Shape clip;
   private AffineTransform transform;
   private GtkComponentPeer component;
-  private Font font;  
+  private Font font;
   private RenderingHints hints;
   private BufferedImage bimage;
-
+  private boolean pixelConversionRequired;
+  private int[] pixelBuffer;
   private Composite comp;
-
   private Stack stateStack;
-  
-  native private void initState (GtkComponentPeer component);
-  native private void initState (int width, int height);
-  native private void copyState (GdkGraphics2D g);
-  native public void dispose ();
-  native private int[] getImagePixels();
-  native private void cairoSurfaceSetFilter(int filter);
-  native void connectSignals (GtkComponentPeer component);
 
-  public void finalize ()
+  private native void initState(GtkComponentPeer component);
+  private native void initState(int width, int height);
+  private native void initState(int[] pixes, int width, int height);
+  private native void copyState(GdkGraphics2D g);
+  public native void dispose();
+  private native void cairoSurfaceSetFilter(int filter);
+  native void connectSignals(GtkComponentPeer component);
+
+  public void finalize()
   {
     dispose();
   }
 
-  public Graphics create ()
+  public Graphics create()
   {
-    return new GdkGraphics2D (this);
+    return new GdkGraphics2D(this);
   }
 
-  public Graphics create (int x, int y, int width, int height)
+  public Graphics create(int x, int y, int width, int height)
   {
-    return new GdkGraphics2D (width, height);
+    return new GdkGraphics2D(width, height);
   }
 
-  GdkGraphics2D (GdkGraphics2D g)
+  GdkGraphics2D(GdkGraphics2D g)
   {
     paint = g.paint;
     stroke = g.stroke;
-    setRenderingHints (g.hints);
+    setRenderingHints(g.hints);
 
     if (g.fg.getAlpha() != -1)
-      fg = new Color (g.fg.getRed (), g.fg.getGreen (), 
-                      g.fg.getBlue (), g.fg.getAlpha ());
-    else 
-      fg = new Color (g.fg.getRGB ());
+      fg = new Color(g.fg.getRed(), g.fg.getGreen(), g.fg.getBlue(),
+                     g.fg.getAlpha());
+    else
+      fg = new Color(g.fg.getRGB());
 
     if (g.bg.getAlpha() != -1)
-      bg = new Color(g.bg.getRed (), g.bg.getGreen (), 
-                     g.bg.getBlue (), g.bg.getAlpha ());
+      bg = new Color(g.bg.getRed(), g.bg.getGreen(), g.bg.getBlue(),
+                     g.bg.getAlpha());
     else
-      bg = new Color (g.bg.getRGB ());
+      bg = new Color(g.bg.getRGB());
 
     if (g.clip == null)
       clip = null;
     else
-      clip = new Rectangle (g.getClipBounds ());
+      clip = new Rectangle(g.getClipBounds());
 
     if (g.transform == null)
-      transform = new AffineTransform ();
+      transform = new AffineTransform();
     else
-      transform = new AffineTransform (g.transform);
+      transform = new AffineTransform(g.transform);
 
     font = g.font;
     component = g.component;
-    copyState (g);
-
-    setColor (fg);
-    setBackground (bg);
-    setPaint (paint);
-    setStroke (stroke);
-    setTransform (transform);
-    setClip (clip);
+    copyState(g);
+
+    setColor(fg);
+    setBackground(bg);
+    setPaint(paint);
+    setStroke(stroke);
+    setTransform(transform);
+    setClip(clip);
     stateStack = new Stack();
   }
 
-  GdkGraphics2D (int width, int height)
+  GdkGraphics2D(int width, int height)
   {
-    initState (width, height);
+    initState(width, height);
 
     setColor(Color.black);
-    setBackground (Color.black);
-    setPaint (getColor());
-    setFont (new Font("SansSerif", Font.PLAIN, 12));
-    setTransform (new AffineTransform ());
-    setStroke (new BasicStroke ());
-    setRenderingHints (getDefaultHints());
+    setBackground(Color.black);
+    setPaint(getColor());
+    setFont(new Font("SansSerif", Font.PLAIN, 12));
+    setTransform(new AffineTransform());
+    setStroke(new BasicStroke());
+    setRenderingHints(getDefaultHints());
 
     stateStack = new Stack();
   }
 
-  GdkGraphics2D (GtkComponentPeer component)
+  GdkGraphics2D(GtkComponentPeer component)
   {
     this.component = component;
-
-    setFont (new Font("SansSerif", Font.PLAIN, 12));
-
-    if (component.isRealized ())
-      initComponentGraphics2D ();
+    
+    if (component.isRealized())
+      initComponentGraphics2D();
     else
-      connectSignals (component);
+      connectSignals(component);
   }
 
-  void initComponentGraphics2D ()
+  void initComponentGraphics2D()
   {
-    initState (component);
+    initState(component);
 
-    setColor (component.awtComponent.getForeground ());
-    setBackground (component.awtComponent.getBackground ());
-    setPaint (getColor());
-    setTransform (new AffineTransform ());
-    setStroke (new BasicStroke ());
-    setRenderingHints (getDefaultHints());
+    setColor(component.awtComponent.getForeground());
+    setBackground(component.awtComponent.getBackground());
+    setPaint(getColor());
+    setTransform(new AffineTransform());
+    setStroke(new BasicStroke());
+    setRenderingHints(getDefaultHints());
+    setFont(new Font("SansSerif", Font.PLAIN, 12));
 
-    stateStack = new Stack ();
+    stateStack = new Stack();
   }
 
-  GdkGraphics2D (BufferedImage bimage)
+  GdkGraphics2D(BufferedImage bimage)
   {
-    
-    this.bimage = bimage;    
-    initState (bimage.getWidth(), bimage.getHeight());
+    this.bimage = bimage;
+    this.pixelBuffer = findSimpleIntegerArray(bimage.getColorModel(),
+                                              bimage.getRaster());
+    if (this.pixelBuffer == null)
+      {
+       this.pixelBuffer = new int[bimage.getRaster().getWidth() * bimage.getRaster()
+                                                                        .getHeight()];
+       this.pixelConversionRequired = true;
+      }
+    else
+      {
+        this.pixelConversionRequired = false;
+      }
+
+    initState(this.pixelBuffer, bimage.getWidth(), bimage.getHeight());
 
     setColor(Color.black);
-    setBackground (Color.black);
-    setPaint (getColor());
-    setFont (new Font("SansSerif", Font.PLAIN, 12));
-    setTransform (new AffineTransform ());
-    setStroke (new BasicStroke ());
-    setRenderingHints (getDefaultHints());
+    setBackground(Color.black);
+    setPaint(getColor());
+    setFont(new Font("SansSerif", Font.PLAIN, 12));
+    setTransform(new AffineTransform());
+    setStroke(new BasicStroke());
+    setRenderingHints(getDefaultHints());
 
     stateStack = new Stack();
-    
+
     // draw current buffered image to the pixmap associated 
-    // with it.
-    
-    drawImage (bimage, new AffineTransform (1,0,0,1,0,0), bg, null);
+    // with it, if the image is not equal to our paint buffer.
+    if (pixelConversionRequired)
+      drawImage(bimage, new AffineTransform(1, 0, 0, 1, 0, 0), bg, null);
   }
 
-
   ////////////////////////////////////
   ////// Native Drawing Methods //////
   ////////////////////////////////////
 
   // GDK drawing methods
-  private native void gdkDrawDrawable (GdkGraphics2D other, int x, int y);
+  private native void gdkDrawDrawable(GdkGraphics2D other, int x, int y);
 
   // drawing utility methods
-  private native void drawPixels (int pixels[], int w, int h, int stride, double i2u[]);
-  private native void setTexturePixels (int pixels[], int w, int h, int stride);
-  private native void setGradient (double x1, double y1,
-                                   double x2, double y2,
-                                   int r1, int g1, int b1, int a1,
-                                   int r2, int g2, int b2, int a2,
-                                   boolean cyclic);
+  private native void drawPixels(int[] pixels, int w, int h, int stride,
+                                 double[] i2u);
+  private native void setTexturePixels(int[] pixels, int w, int h, int stride);
+  private native void setGradient(double x1, double y1, double x2, double y2,
+                                  int r1, int g1, int b1, int a1, int r2,
+                                  int g2, int b2, int a2, boolean cyclic);
 
   // simple passthroughs to cairo
-  private native void cairoSave ();
-  private native void cairoRestore ();
-  private native void cairoSetMatrix (double m[]);
-  private native void cairoSetOperator (int cairoOperator);
-  private native void cairoSetRGBColor (double red, double green, double blue);
-  private native void cairoSetAlpha (double alpha);
-  private native void cairoSetFillRule (int cairoFillRule);
-  private native void cairoSetLineWidth (double width);
-  private native void cairoSetLineCap (int cairoLineCap);
-  private native void cairoSetLineJoin (int cairoLineJoin);
-  private native void cairoSetDash (double dashes[], int ndash, double offset);
-  private native void cairoSetMiterLimit (double limit);
-  private native void cairoNewPath ();
-  private native void cairoMoveTo (double x, double y);
-  private native void cairoLineTo (double x, double y);
-  private native void cairoCurveTo (double x1, double y1,
-                                    double x2, double y2,
-                                    double x3, double y3);  
-  private native void cairoRelMoveTo (double dx, double dy);
-  private native void cairoRelLineTo (double dx, double dy);
-  private native void cairoRelCurveTo (double dx1, double dy1,
-                                       double dx2, double dy2,
-                                       double dx3, double dy3);
-  private native void cairoRectangle (double x, double y, 
-                                   double width, double height);
-  private native void cairoClosePath ();
-  private native void cairoStroke ();
-  private native void cairoFill ();
-  private native void cairoClip ();
-
+  private native void cairoSave();
+  private native void cairoRestore();
+  private native void cairoSetMatrix(double[] m);
+  private native void cairoSetOperator(int cairoOperator);
+  private native void cairoSetRGBColor(double red, double green, double blue);
+  private native void cairoSetAlpha(double alpha);
+  private native void cairoSetFillRule(int cairoFillRule);
+  private native void cairoSetLineWidth(double width);
+  private native void cairoSetLineCap(int cairoLineCap);
+  private native void cairoSetLineJoin(int cairoLineJoin);
+  private native void cairoSetDash(double[] dashes, int ndash, double offset);
+
+  private native void cairoSetMiterLimit(double limit);
+  private native void cairoNewPath();
+  private native void cairoMoveTo(double x, double y);
+  private native void cairoLineTo(double x, double y);
+  private native void cairoCurveTo(double x1, double y1, double x2, double y2,
+                                   double x3, double y3);
+  private native void cairoRelMoveTo(double dx, double dy);
+  private native void cairoRelLineTo(double dx, double dy);
+  private native void cairoRelCurveTo(double dx1, double dy1, double dx2,
+                                      double dy2, double dx3, double dy3);
+  private native void cairoRectangle(double x, double y, double width,
+                                     double height);
+  private native void cairoClosePath();
+  private native void cairoStroke();
+  private native void cairoFill();
+  private native void cairoClip();
 
   /////////////////////////////////////////////
   ////// General Drawing Support Methods //////
   /////////////////////////////////////////////
 
-    private class DrawState
-    {
-       private Paint paint;
-       private Stroke stroke;
-       private Color fg;
-       private Color bg;
-       private Shape clip;
-       private AffineTransform transform;
-       private Font font;  
-       private Composite comp;
-       DrawState (GdkGraphics2D g)
-       {
-           this.paint = g.paint;
-           this.stroke = g.stroke;
-           this.fg = g.fg;
-           this.bg = g.bg;
-           this.clip = g.clip;
-           if (g.transform != null)
-               this.transform = (AffineTransform) g.transform.clone();
-           this.font = g.font;
-           this.comp = g.comp;
-       }
-       public void restore(GdkGraphics2D g)
-       {
-           g.paint = this.paint;
-           g.stroke = this.stroke;
-           g.fg = this.fg;
-           g.bg = this.bg;
-           g.clip = this.clip;
-           g.transform = this.transform;
-           g.font = this.font;
-           g.comp = this.comp;
-       }
-    }
-    
-    private void stateSave ()
+  private class DrawState
+  {
+    private Paint paint;
+    private Stroke stroke;
+    private Color fg;
+    private Color bg;
+    private Shape clip;
+    private AffineTransform transform;
+    private Font font;
+    private Composite comp;
+
+    DrawState(GdkGraphics2D g)
     {
-       stateStack.push (new DrawState (this));
-       cairoSave ();
+      this.paint = g.paint;
+      this.stroke = g.stroke;
+      this.fg = g.fg;
+      this.bg = g.bg;
+      this.clip = g.clip;
+      if (g.transform != null)
+       this.transform = (AffineTransform) g.transform.clone();
+      this.font = g.font;
+      this.comp = g.comp;
     }
 
-    private void stateRestore ()
+    public void restore(GdkGraphics2D g)
     {
-       ((DrawState)(stateStack.pop ())).restore (this);
-       cairoRestore ();
+      g.paint = this.paint;
+      g.stroke = this.stroke;
+      g.fg = this.fg;
+      g.bg = this.bg;
+      g.clip = this.clip;
+      g.transform = this.transform;
+      g.font = this.font;
+      g.comp = this.comp;
     }
+  }
+
+  private void stateSave()
+  {
+    stateStack.push(new DrawState(this));
+    cairoSave();
+  }
+
+  private void stateRestore()
+  {
+    ((DrawState) (stateStack.pop())).restore(this);
+    cairoRestore();
+  }
 
   // Some operations (drawing rather than filling) require that their
   // coords be shifted to land on 0.5-pixel boundaries, in order to land on
   // "middle of pixel" coordinates and light up complete pixels.
-
   private boolean shiftDrawCalls = false;
+
   private final double shifted(double coord, boolean doShift)
   {
     if (doShift)
@@ -372,406 +378,377 @@ public class GdkGraphics2D extends Graphics2D
   {
     double x = 0;
     double y = 0;
-    double coords[] = new double[6];
+    double[] coords = new double[6];
 
-    cairoSetFillRule (p.getWindingRule ());
-    for ( ; ! p.isDone (); p.next())
+    cairoSetFillRule(p.getWindingRule());
+    for (; ! p.isDone(); p.next())
       {
-        int seg = p.currentSegment (coords);
-        switch(seg)
-          {
-
-          case PathIterator.SEG_MOVETO:
-            x = shifted(coords[0], doShift);
-            y = shifted(coords[1], doShift);
-            cairoMoveTo (x, y);
-            break;
-
-          case PathIterator.SEG_LINETO:
-            x = shifted(coords[0], doShift);
-            y = shifted(coords[1], doShift);
-            cairoLineTo (x, y);
-            break;
-
-          case PathIterator.SEG_QUADTO:
-
-            // splitting a quadratic bezier into a cubic:
-            // see: http://pfaedit.sourceforge.net/bezier.html
-
-            double x1 = x + (2.0/3.0) * (shifted(coords[0], doShift) - x);
-            double y1 = y + (2.0/3.0) * (shifted(coords[1], doShift) - y);
-            
-            double x2 = x1 + (1.0/3.0) * (shifted(coords[2], doShift) - x);
-            double y2 = y1 + (1.0/3.0) * (shifted(coords[3], doShift) - y);
-
-            x = shifted(coords[2], doShift);
-            y = shifted(coords[3], doShift);
-            cairoCurveTo (x1, y1,
-                          x2, y2,
-                          x, y);
-            break;
-
-          case PathIterator.SEG_CUBICTO:
-            x = shifted(coords[4], doShift);
-            y = shifted(coords[5], doShift);
-            cairoCurveTo (shifted(coords[0], doShift), shifted(coords[1], doShift),
-                          shifted(coords[2], doShift), shifted(coords[3], doShift),
-                          x, y);
-            break;
-
-          case PathIterator.SEG_CLOSE:
-            cairoClosePath ();
-            break;
-          }
-      }    
+       int seg = p.currentSegment(coords);
+       switch (seg)
+         {
+         case PathIterator.SEG_MOVETO:
+           x = shifted(coords[0], doShift);
+           y = shifted(coords[1], doShift);
+           cairoMoveTo(x, y);
+           break;
+         case PathIterator.SEG_LINETO:
+           x = shifted(coords[0], doShift);
+           y = shifted(coords[1], doShift);
+           cairoLineTo(x, y);
+           break;
+         case PathIterator.SEG_QUADTO:
+           // splitting a quadratic bezier into a cubic:
+           // see: http://pfaedit.sourceforge.net/bezier.html
+           double x1 = x + (2.0 / 3.0) * (shifted(coords[0], doShift) - x);
+           double y1 = y + (2.0 / 3.0) * (shifted(coords[1], doShift) - y);
+
+           double x2 = x1 + (1.0 / 3.0) * (shifted(coords[2], doShift) - x);
+           double y2 = y1 + (1.0 / 3.0) * (shifted(coords[3], doShift) - y);
+
+           x = shifted(coords[2], doShift);
+           y = shifted(coords[3], doShift);
+           cairoCurveTo(x1, y1, x2, y2, x, y);
+           break;
+         case PathIterator.SEG_CUBICTO:
+           x = shifted(coords[4], doShift);
+           y = shifted(coords[5], doShift);
+           cairoCurveTo(shifted(coords[0], doShift),
+                        shifted(coords[1], doShift),
+                        shifted(coords[2], doShift),
+                        shifted(coords[3], doShift), x, y);
+           break;
+         case PathIterator.SEG_CLOSE:
+           cairoClosePath();
+           break;
+         }
+      }
   }
 
-
   private final Map getDefaultHints()
   {
-    HashMap defaultHints = new HashMap ();
-    
-    defaultHints.put (RenderingHints.KEY_TEXT_ANTIALIASING, 
-                      RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
-                     
-    defaultHints.put (RenderingHints.KEY_STROKE_CONTROL, 
-                      RenderingHints.VALUE_STROKE_DEFAULT);    
-                     
-    defaultHints.put (RenderingHints.KEY_FRACTIONALMETRICS, 
-                      RenderingHints.VALUE_FRACTIONALMETRICS_OFF);    
-                     
-    defaultHints.put (RenderingHints.KEY_ANTIALIASING, 
-                      RenderingHints.VALUE_ANTIALIAS_OFF);    
-                     
-    defaultHints.put (RenderingHints.KEY_RENDERING,  
-                      RenderingHints.VALUE_RENDER_DEFAULT);
-    
+    HashMap defaultHints = new HashMap();
+
+    defaultHints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
+                     RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
+
+    defaultHints.put(RenderingHints.KEY_STROKE_CONTROL,
+                     RenderingHints.VALUE_STROKE_DEFAULT);
+
+    defaultHints.put(RenderingHints.KEY_FRACTIONALMETRICS,
+                     RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
+
+    defaultHints.put(RenderingHints.KEY_ANTIALIASING,
+                     RenderingHints.VALUE_ANTIALIAS_OFF);
+
+    defaultHints.put(RenderingHints.KEY_RENDERING,
+                     RenderingHints.VALUE_RENDER_DEFAULT);
+
     return defaultHints;
-    
   }
 
-  private final void updateBufferedImage()
+  public static final int[] findSimpleIntegerArray (ColorModel cm, Raster raster)
   {
-    int[] pixels = getImagePixels();
-    updateImagePixels(pixels);
-  }
+    if (cm == null || raster == null)
+      return null;
 
-  
-  private final boolean isBufferedImageGraphics ()
-  {
-    return bimage != null;
-  }
-    
-  private final void updateImagePixels (int[] pixels)
-  {
+    if (! cm.getColorSpace().isCS_sRGB())
+      return null;
 
-    // This function can only be used if 
-    // this graphics object is used to draw into 
-    // buffered image 
-       
-    if (! isBufferedImageGraphics ()) 
-      return;
+    if (! (cm instanceof DirectColorModel))
+      return null;
 
-    WritableRaster raster = bimage.getRaster();                      
-    DataBuffer db = raster.getDataBuffer ();
+    DirectColorModel dcm = (DirectColorModel) cm;
 
-    // update pixels in the bufferedImage
+    if (dcm.getRedMask() != 0x00FF0000 || dcm.getGreenMask() != 0x0000FF00
+        || dcm.getBlueMask() != 0x000000FF)
+      return null;
 
-    if (raster.getSampleModel ().getDataType () == DataBuffer.TYPE_INT 
-        && db instanceof DataBufferInt 
-        && db.getNumBanks () == 1)
-      {
+    if (! (raster instanceof WritableRaster))
+      return null;
 
-        // single bank, ARGB-ints buffer in sRGB space
-        DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer ();
+    if (raster.getSampleModel().getDataType() != DataBuffer.TYPE_INT)
+      return null;
 
-        for (int i=0; i < pixels.length; i++) 
-          dbi.setElem(i, pixels[i]);
-                               
-      }
-    else 
-      {        
-        bimage.getRaster().setPixels (0, 0, raster.getWidth (),
-                                      raster.getHeight (), pixels);
-      }
-  }
+    if (! (raster.getDataBuffer() instanceof DataBufferInt))
+      return null;
 
+    DataBufferInt db = (DataBufferInt) raster.getDataBuffer();
 
-  private final boolean drawImage(Image img, 
-                                  AffineTransform xform,
-                                  Color bgcolor,                           
-                                  ImageObserver obs)
+    if (db.getNumBanks() != 1)
+      return null;
+
+    // Finally, we have determined that this is a single bank, [A]RGB-int
+    // buffer in sRGB space. It's worth checking all this, because it means
+    // that cairo can paint directly into the data buffer, which is very
+    // fast compared to all the normal copying and converting.
+
+    return db.getData();
+  }
+
+  private final void updateBufferedImage()
   {
+    if (bimage != null && pixelConversionRequired)
+      {
+        int height = bimage.getHeight();
+        int width = bimage.getWidth();
+        for (int y = 0; y < height; ++y)
+          for (int x = 0; x < width; ++x)
+            bimage.setRGB(x, y, pixelBuffer[y*width+height]);
+      }
+  }
 
+  private final boolean drawImage(Image img, AffineTransform xform,
+                                  Color bgcolor, ImageObserver obs)
+  {
     if (img == null)
       return false;
 
-    if (img instanceof GtkOffScreenImage &&
-        img.getGraphics () instanceof GdkGraphics2D &&            
-        (xform == null 
-         || xform.getType () == AffineTransform.TYPE_IDENTITY 
-         || xform.getType () == AffineTransform.TYPE_TRANSLATION)
-        ) 
+    if (img instanceof GtkOffScreenImage
+        && img.getGraphics() instanceof GdkGraphics2D
+        && (xform == null || xform.getType() == AffineTransform.TYPE_IDENTITY
+        || xform.getType() == AffineTransform.TYPE_TRANSLATION))
       {
-        // we are being asked to flush a double buffer from Gdk
-        GdkGraphics2D g2 = (GdkGraphics2D) img.getGraphics ();
-        gdkDrawDrawable (g2, (int)xform.getTranslateX(), (int)xform.getTranslateY());
-        
-        if (isBufferedImageGraphics ()) 
-          updateBufferedImage();   
-        
-        return true;
+       // we are being asked to flush a double buffer from Gdk
+       GdkGraphics2D g2 = (GdkGraphics2D) img.getGraphics();
+       gdkDrawDrawable(g2, (int) xform.getTranslateX(),
+                       (int) xform.getTranslateY());
+
+       updateBufferedImage();
+
+       return true;
       }
     else
-      {      
-
-        // In this case, xform is an AffineTransform that transforms bounding
-        // box of the specified image from image space to user space. However
-        // when we pass this transform to cairo, cairo will use this transform
-        // to map "user coordinates" to "pixel" coordinates, which is the 
-        // other way around. Therefore to get the "user -> pixel" transform 
-        // that cairo wants from "image -> user" transform that we currently
-        // have, we will need to invert the transformation matrix.
-       
-        AffineTransform invertedXform = new AffineTransform();
-
-        try
-          {             
-            invertedXform = xform.createInverse();
-             if (img instanceof BufferedImage)
-               {
-                   // draw an image which has actually been loaded 
-                   // into memory fully
-                   
-                 BufferedImage b = (BufferedImage) img;
-                 return drawRaster (b.getColorModel (), 
-                                    b.getData (), 
-                                    invertedXform,
-                                    bgcolor);
-               }
-             else
-               {
-                 return this.drawImage(GdkPixbufDecoder.createBufferedImage(img.getSource()),
-                                       xform, bgcolor,obs);
-               }              
-          }
-        catch (NoninvertibleTransformException e)
-          {
-              throw new ImagingOpException("Unable to invert transform " 
-                                           + xform.toString());
-          }          
+      {
+       // In this case, xform is an AffineTransform that transforms bounding
+       // box of the specified image from image space to user space. However
+       // when we pass this transform to cairo, cairo will use this transform
+       // to map "user coordinates" to "pixel" coordinates, which is the 
+       // other way around. Therefore to get the "user -> pixel" transform 
+       // that cairo wants from "image -> user" transform that we currently
+       // have, we will need to invert the transformation matrix.
+       AffineTransform invertedXform = new AffineTransform();
+
+       try
+         {
+           invertedXform = xform.createInverse();
+           if (img instanceof BufferedImage)
+             {
+               // draw an image which has actually been loaded 
+               // into memory fully
+               BufferedImage b = (BufferedImage) img;
+               return drawRaster(b.getColorModel(), b.getData(),
+                                 invertedXform, bgcolor);
+             }
+           else
+             return this.drawImage(GdkPixbufDecoder.createBufferedImage(img
+                                                                        .getSource()),
+                                   xform, bgcolor, obs);
+         }
+       catch (NoninvertibleTransformException e)
+         {
+           throw new ImagingOpException("Unable to invert transform "
+                                        + xform.toString());
+         }
       }
   }
 
-
   //////////////////////////////////////////////////
   ////// Implementation of Graphics2D Methods //////
   //////////////////////////////////////////////////
 
-  public void draw (Shape s)
+  public void draw(Shape s)
   {
-
-    if (stroke != null &&
-        !(stroke instanceof BasicStroke))
+    if (stroke != null && ! (stroke instanceof BasicStroke))
       {
-        fill (stroke.createStrokedShape (s));
-        return;
+       fill(stroke.createStrokedShape(s));
+       return;
       }
 
-    cairoNewPath ();
-    
+    cairoNewPath();
+
     if (s instanceof Rectangle2D)
       {
-        Rectangle2D r = (Rectangle2D)s;
-        cairoRectangle (shifted(r.getX (), shiftDrawCalls), 
-                        shifted(r.getY (), shiftDrawCalls), 
-                        r.getWidth (), r.getHeight ());
+       Rectangle2D r = (Rectangle2D) s;
+       cairoRectangle(shifted(r.getX(), shiftDrawCalls),
+                      shifted(r.getY(), shiftDrawCalls), r.getWidth(),
+                      r.getHeight());
       }
-    else      
-      walkPath (s.getPathIterator (null), shiftDrawCalls);
-    cairoStroke ();
-    
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    else
+      walkPath(s.getPathIterator(null), shiftDrawCalls);
+    cairoStroke();
+
+    updateBufferedImage();
   }
 
-  public void fill (Shape s)
+  public void fill(Shape s)
   {
-    cairoNewPath ();
+    cairoNewPath();
     if (s instanceof Rectangle2D)
       {
-        Rectangle2D r = (Rectangle2D)s;
-        cairoRectangle (r.getX (), r.getY (), r.getWidth (), r.getHeight ());
+       Rectangle2D r = (Rectangle2D) s;
+       cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
       }
-    else      
-      walkPath (s.getPathIterator (null), false);
-    cairoFill ();
-    
-   if (isBufferedImageGraphics ()) 
-     updateBufferedImage();   
+    else
+      walkPath(s.getPathIterator(null), false);
+
+    cairoFill();
 
+    updateBufferedImage();
   }
 
-  public void clip (Shape s)
+  public void clip(Shape s)
   {
-      // update it
+    // update it
+    if (clip == null || s == null)
+      clip = s;
+    else if (s instanceof Rectangle2D && clip instanceof Rectangle2D)
+      {
+       Rectangle2D r = (Rectangle2D) s;
+       Rectangle2D curr = (Rectangle2D) clip;
+       clip = curr.createIntersection(r);
+      }
+    else
+      throw new UnsupportedOperationException();
 
-      if (clip == null || s == null)
-         clip = s;
-      else if (s instanceof Rectangle2D
-              && clip instanceof Rectangle2D)
+    // draw it
+    if (clip != null)
+      {
+       cairoNewPath();
+       if (clip instanceof Rectangle2D)
          {
-             Rectangle2D r = (Rectangle2D)s;
-             Rectangle2D curr = (Rectangle2D)clip;
-             clip = curr.createIntersection (r);
+           Rectangle2D r = (Rectangle2D) clip;
+           cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
          }
-      else
-         throw new UnsupportedOperationException ();
+       else
+         walkPath(clip.getPathIterator(null), false);
 
-      // draw it
-      if (clip != null)
-         {
-             cairoNewPath ();
-             if (clip instanceof Rectangle2D)
-                 {
-                     Rectangle2D r = (Rectangle2D)clip;
-                     cairoRectangle (r.getX (), r.getY (), 
-                                     r.getWidth (), r.getHeight ());
-                 }
-             else
-                walkPath (clip.getPathIterator (null), false);
-             // cairoClosePath ();
-             cairoClip ();
-         }
+       // cairoClosePath ();
+       cairoClip();
+      }
   }
 
-  public Paint getPaint ()
+  public Paint getPaint()
   {
     return paint;
   }
 
-  public AffineTransform getTransform ()
+  public AffineTransform getTransform()
   {
-      return (AffineTransform) transform.clone ();
+    return (AffineTransform) transform.clone();
   }
 
-  public void setPaint (Paint p)
+  public void setPaint(Paint p)
   {
     if (paint == null)
-        return;
-      
+      return;
+
     paint = p;
     if (paint instanceof Color)
       {
-        setColor ((Color) paint);
+        setColor((Color) paint);
       }
     else if (paint instanceof TexturePaint)
       {
-        TexturePaint tp = (TexturePaint) paint;
-        BufferedImage img = tp.getImage ();
-        
-        // map the image to the anchor rectangle  
+       TexturePaint tp = (TexturePaint) paint;
+       BufferedImage img = tp.getImage();
 
-        int width = (int) tp.getAnchorRect ().getWidth ();
-        int height = (int) tp.getAnchorRect ().getHeight ();
-       
-        double scaleX = width / (double) img.getWidth ();
-        double scaleY = width / (double) img.getHeight ();
-        
-        AffineTransform at = new AffineTransform (scaleX, 0, 0, scaleY, 0, 0);
-        AffineTransformOp op = new AffineTransformOp (at, getRenderingHints());
-        BufferedImage texture = op.filter(img, null);
-        int pixels[] = texture.getRGB (0, 0, width, height, null, 0, width);
-        setTexturePixels (pixels, width, height, width);
+       // map the image to the anchor rectangle  
+       int width = (int) tp.getAnchorRect().getWidth();
+       int height = (int) tp.getAnchorRect().getHeight();
+
+       double scaleX = width / (double) img.getWidth();
+       double scaleY = width / (double) img.getHeight();
 
+       AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, 0, 0);
+       AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
+       BufferedImage texture = op.filter(img, null);
+       int[] pixels = texture.getRGB(0, 0, width, height, null, 0, width);
+       setTexturePixels(pixels, width, height, width);
       }
     else if (paint instanceof GradientPaint)
       {
-        GradientPaint gp = (GradientPaint) paint;
-        Point2D p1 = gp.getPoint1 ();
-        Point2D p2 = gp.getPoint2 ();
-        Color c1 = gp.getColor1 ();
-        Color c2 = gp.getColor2 ();        
-        setGradient (p1.getX (), p1.getY (),
-                     p2.getX (), p2.getY (),
-                     c1.getRed (), c1.getGreen (), 
-                     c1.getBlue (), c1.getAlpha (),
-                     c2.getRed (), c2.getGreen (), 
-                     c2.getBlue (), c2.getAlpha (),
-                     gp.isCyclic ());
+       GradientPaint gp = (GradientPaint) paint;
+       Point2D p1 = gp.getPoint1();
+       Point2D p2 = gp.getPoint2();
+       Color c1 = gp.getColor1();
+       Color c2 = gp.getColor2();
+       setGradient(p1.getX(), p1.getY(), p2.getX(), p2.getY(), c1.getRed(),
+                   c1.getGreen(), c1.getBlue(), c1.getAlpha(), c2.getRed(),
+                   c2.getGreen(), c2.getBlue(), c2.getAlpha(), gp.isCyclic());
       }
     else
-      throw new java.lang.UnsupportedOperationException ();
+      throw new java.lang.UnsupportedOperationException();
   }
 
-  public void setTransform (AffineTransform tx)
+  public void setTransform(AffineTransform tx)
   {
     transform = tx;
     if (transform != null)
       {
-        double m[] = new double[6];
-        transform.getMatrix (m);
-        cairoSetMatrix (m);
+       double[] m = new double[6];
+       transform.getMatrix(m);
+       cairoSetMatrix(m);
       }
   }
 
-  public void transform (AffineTransform tx)
+  public void transform(AffineTransform tx)
   {
     if (transform == null)
-      transform = new AffineTransform (tx);
+      transform = new AffineTransform(tx);
     else
-      transform.concatenate (tx);
-    setTransform (transform);
+      transform.concatenate(tx);
+    setTransform(transform);
     if (clip != null)
       {
-        // FIXME: this should actuall try to transform the shape
-        // rather than degrade to bounds.
-        Rectangle2D r = clip.getBounds2D();
-        double[] coords = new double[] { r.getX(), r.getY(), 
-                                         r.getX() + r.getWidth(),
-                                         r.getY() + r.getHeight() };
-        try 
-          {
-            tx.createInverse().transform(coords, 0, coords, 0, 2);
-            r.setRect(coords[0], coords[1],
-                      coords[2] - coords[0], 
-                      coords[3] - coords[1]);
-            clip = r;
-          }
-        catch (java.awt.geom.NoninvertibleTransformException e)
-          {
-          }
+       // FIXME: this should actuall try to transform the shape
+       // rather than degrade to bounds.
+       Rectangle2D r = clip.getBounds2D();
+       double[] coords = new double[]
+                         {
+                           r.getX(), r.getY(), r.getX() + r.getWidth(),
+                           r.getY() + r.getHeight()
+                         };
+       try
+         {
+           tx.createInverse().transform(coords, 0, coords, 0, 2);
+           r.setRect(coords[0], coords[1], coords[2] - coords[0],
+                     coords[3] - coords[1]);
+           clip = r;
+         }
+       catch (java.awt.geom.NoninvertibleTransformException e)
+         {
+         }
       }
   }
 
   public void rotate(double theta)
   {
-    transform (AffineTransform.getRotateInstance (theta));
+    transform(AffineTransform.getRotateInstance(theta));
   }
 
   public void rotate(double theta, double x, double y)
   {
-    transform (AffineTransform.getRotateInstance (theta, x, y));
+    transform(AffineTransform.getRotateInstance(theta, x, y));
   }
 
   public void scale(double sx, double sy)
   {
-    transform (AffineTransform.getScaleInstance (sx, sy));
+    transform(AffineTransform.getScaleInstance(sx, sy));
   }
 
-  public void translate (double tx, double ty)
+  public void translate(double tx, double ty)
   {
-    transform (AffineTransform.getTranslateInstance (tx, ty));
+    transform(AffineTransform.getTranslateInstance(tx, ty));
   }
 
-  public void translate (int x, int y)
+  public void translate(int x, int y)
   {
-    translate ((double) x, (double) y);
+    translate((double) x, (double) y);
   }
 
   public void shear(double shearX, double shearY)
   {
-    transform (AffineTransform.getShearInstance (shearX, shearY));
+    transform(AffineTransform.getShearInstance(shearX, shearY));
   }
 
   public Stroke getStroke()
@@ -779,173 +756,165 @@ public class GdkGraphics2D extends Graphics2D
     return stroke;
   }
 
-  public void setStroke (Stroke st)
+  public void setStroke(Stroke st)
   {
     stroke = st;
     if (stroke instanceof BasicStroke)
       {
-        BasicStroke bs = (BasicStroke) stroke;
-        cairoSetLineCap (bs.getEndCap());
-        cairoSetLineWidth (bs.getLineWidth());
-        cairoSetLineJoin (bs.getLineJoin());
-        cairoSetMiterLimit (bs.getMiterLimit());
-        float dashes[] = bs.getDashArray();
-        if (dashes != null)
-          {
-            double double_dashes[] = new double[dashes.length];
-            for (int i = 0; i < dashes.length; i++)
-              double_dashes[i] = dashes[i];
-            cairoSetDash (double_dashes, double_dashes.length, 
-                          (double) bs.getDashPhase ());        
-          }
+       BasicStroke bs = (BasicStroke) stroke;
+       cairoSetLineCap(bs.getEndCap());
+       cairoSetLineWidth(bs.getLineWidth());
+       cairoSetLineJoin(bs.getLineJoin());
+       cairoSetMiterLimit(bs.getMiterLimit());
+       float[] dashes = bs.getDashArray();
+       if (dashes != null)
+         {
+           double[] double_dashes = new double[dashes.length];
+           for (int i = 0; i < dashes.length; i++)
+             double_dashes[i] = dashes[i];
+           cairoSetDash(double_dashes, double_dashes.length,
+                        (double) bs.getDashPhase());
+         }
       }
   }
 
-
   ////////////////////////////////////////////////
   ////// Implementation of Graphics Methods //////
   ////////////////////////////////////////////////
 
-  public void setPaintMode () 
-  { 
-    setComposite (java.awt.AlphaComposite.SrcOver); 
+  public void setPaintMode()
+  {
+    setComposite(java.awt.AlphaComposite.SrcOver);
   }
 
-  public void setXORMode (Color c) 
-  { 
-    setComposite (new gnu.java.awt.BitwiseXORComposite(c)); 
+  public void setXORMode(Color c)
+  {
+    setComposite(new gnu.java.awt.BitwiseXORComposite(c));
   }
 
-  public void setColor (Color c)
+  public void setColor(Color c)
   {
     if (c == null)
       c = Color.BLACK;
-    
+
     fg = c;
     paint = c;
-    cairoSetRGBColor (fg.getRed() / 255.0, 
-                      fg.getGreen() / 255.0, 
-                      fg.getBlue() / 255.0);
-    cairoSetAlpha ((fg.getAlpha() & 255) / 255.0);
+    cairoSetRGBColor(fg.getRed() / 255.0, fg.getGreen() / 255.0,
+                     fg.getBlue() / 255.0);
+    cairoSetAlpha((fg.getAlpha() & 255) / 255.0);
   }
 
-  public Color getColor ()
+  public Color getColor()
   {
     return fg;
   }
 
-  public void clipRect (int x, int y, int width, int height)
+  public void clipRect(int x, int y, int width, int height)
   {
-      clip (new Rectangle (x, y, width, height));
+    clip(new Rectangle(x, y, width, height));
   }
 
-  public Shape getClip ()
+  public Shape getClip()
   {
-    return getClipInDevSpace ();
+    return clip.getBounds2D(); //getClipInDevSpace();
   }
 
-  public Rectangle getClipBounds ()
+  public Rectangle getClipBounds()
   {
     if (clip == null)
       return null;
     else
-      return clip.getBounds ();
+      return clip.getBounds();
   }
 
-  protected Rectangle2D getClipInDevSpace ()
+  protected Rectangle2D getClipInDevSpace()
   {
-    Rectangle2D uclip = clip.getBounds2D ();
+    Rectangle2D uclip = clip.getBounds2D();
     if (transform == null)
       return uclip;
     else
       {
-        Point2D pos = transform.transform (new Point2D.Double(uclip.getX (), 
-                                                              uclip.getY ()), 
-                                           (Point2D)null);             
-        Point2D extent = transform.deltaTransform (new Point2D.Double(uclip.getWidth (), 
-                                                                      uclip.getHeight ()), 
-                                                   (Point2D)null);
-        return new Rectangle2D.Double (pos.getX (), pos.getY (),
-                                       extent.getX (), extent.getY ());              
+       Point2D pos = transform.transform(new Point2D.Double(uclip.getX(),
+                                                            uclip.getY()),
+                                         (Point2D) null);
+       Point2D extent = transform.deltaTransform(new Point2D.Double(uclip
+                                                                    .getWidth(),
+                                                                    uclip
+                                                                    .getHeight()),
+                                                 (Point2D) null);
+       return new Rectangle2D.Double(pos.getX(), pos.getY(), extent.getX(),
+                                     extent.getY());
       }
   }
 
-  public void setClip (int x, int y, int width, int height)
+  public void setClip(int x, int y, int width, int height)
   {
-    setClip(new Rectangle2D.Double ((double)x, (double)y, 
-                                    (double)width, (double)height));
+    setClip(new Rectangle2D.Double((double) x, (double) y, (double) width,
+                                   (double) height));
   }
-  
-  public void setClip (Shape s)
+
+  public void setClip(Shape s)
   {
     clip = s;
     if (s != null)
       {
-        cairoNewPath ();
-        if (s instanceof Rectangle2D)
-          {
-            Rectangle2D r = (Rectangle2D)s;
-            cairoRectangle (r.getX (), r.getY (), 
-                            r.getWidth (), r.getHeight ());
-          }
-        else
-          walkPath (s.getPathIterator (null), false);
-        // cairoClosePath ();
-        cairoClip ();
+       cairoNewPath();
+       if (s instanceof Rectangle2D)
+         {
+           Rectangle2D r = (Rectangle2D) s;
+           cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
+         }
+       else
+         walkPath(s.getPathIterator(null), false);
+
+       // cairoClosePath ();
+       cairoClip();
       }
   }
-  
+
   private static BasicStroke draw3DRectStroke = new BasicStroke();
 
-  public void draw3DRect(int x, int y, int width, 
-                         int height, boolean raised)
+  public void draw3DRect(int x, int y, int width, int height, boolean raised)
   {
     Stroke tmp = stroke;
     setStroke(draw3DRectStroke);
     super.draw3DRect(x, y, width, height, raised);
-    setStroke(tmp);    
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    setStroke(tmp);
+    updateBufferedImage();
   }
 
-  public void fill3DRect(int x, int y, int width, 
-                         int height, boolean raised)
+  public void fill3DRect(int x, int y, int width, int height, boolean raised)
   {
     Stroke tmp = stroke;
     setStroke(draw3DRectStroke);
     super.fill3DRect(x, y, width, height, raised);
-    setStroke(tmp);    
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    setStroke(tmp);
+    updateBufferedImage();
   }
 
-
-  public void drawRect (int x, int y, int width, int height)
+  public void drawRect(int x, int y, int width, int height)
   {
-    draw(new Rectangle (x, y, width, height));
+    draw(new Rectangle(x, y, width, height));
   }
 
-  public void fillRect (int x, int y, int width, int height)
+  public void fillRect(int x, int y, int width, int height)
   {
-    cairoNewPath ();
-    cairoRectangle (x, y, width, height);
-    cairoFill ();
+    cairoNewPath();
+    cairoRectangle(x, y, width, height);
+    cairoFill();
   }
 
-  public void clearRect (int x, int y, int width, int height)
+  public void clearRect(int x, int y, int width, int height)
   {
-    cairoSetRGBColor (bg.getRed() / 255.0, 
-                      bg.getGreen() / 255.0, 
-                      bg.getBlue() / 255.0);
-    cairoSetAlpha (1.0);
-    cairoNewPath ();
-    cairoRectangle (x, y, width, height);
-    cairoFill ();
-    setColor (fg);
-       
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    cairoSetRGBColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
+                     bg.getBlue() / 255.0);
+    cairoSetAlpha(1.0);
+    cairoNewPath();
+    cairoRectangle(x, y, width, height);
+    cairoFill();
+    setColor(fg);
 
+    updateBufferedImage();
   }
 
   public void setBackground(Color c)
@@ -958,181 +927,172 @@ public class GdkGraphics2D extends Graphics2D
     return bg;
   }
 
-  private final void doPolygon(int[] xPoints, int[] yPoints, int nPoints, 
+  private final void doPolygon(int[] xPoints, int[] yPoints, int nPoints,
                                boolean close, boolean fill)
-  {    
+  {
     if (nPoints < 1)
       return;
-    GeneralPath gp = new GeneralPath (PathIterator.WIND_EVEN_ODD);
-    gp.moveTo ((float)xPoints[0], (float)yPoints[0]);
+    GeneralPath gp = new GeneralPath(PathIterator.WIND_EVEN_ODD);
+    gp.moveTo((float) xPoints[0], (float) yPoints[0]);
     for (int i = 1; i < nPoints; i++)
-      gp.lineTo ((float)xPoints[i], (float)yPoints[i]);
-    
+      gp.lineTo((float) xPoints[i], (float) yPoints[i]);
+
     if (close)
-      gp.closePath ();
+      gp.closePath();
 
     Shape sh = gp;
-    if (fill == false &&
-        stroke != null &&
-        !(stroke instanceof BasicStroke))
+    if (fill == false && stroke != null && ! (stroke instanceof BasicStroke))
       {
-        sh = stroke.createStrokedShape (gp);
-        fill = true;
+       sh = stroke.createStrokedShape(gp);
+       fill = true;
       }
-    
-    if (fill) 
-      fill (sh);
-    else 
-      draw (sh);
+
+    if (fill)
+      fill(sh);
+    else
+      draw(sh);
   }
 
-  public void drawLine (int x1, int y1, int x2, int y2)
+  public void drawLine(int x1, int y1, int x2, int y2)
   {
-    int xp[] = new int[2];
-    int yp[] = new int[2];
+    int[] xp = new int[2];
+    int[] yp = new int[2];
 
     xp[0] = x1;
     xp[1] = x2;
     yp[0] = y1;
     yp[1] = y2;
-    
-    doPolygon (xp, yp, 2, false, false);
+
+    doPolygon(xp, yp, 2, false, false);
   }
 
   public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
   {
-    doPolygon (xPoints, yPoints, nPoints, true, true);
+    doPolygon(xPoints, yPoints, nPoints, true, true);
   }
-  
+
   public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
-  {    
-    doPolygon (xPoints, yPoints, nPoints, true, false);
+  {
+    doPolygon(xPoints, yPoints, nPoints, true, false);
   }
 
   public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
   {
-    doPolygon (xPoints, yPoints, nPoints, false, false);
+    doPolygon(xPoints, yPoints, nPoints, false, false);
   }
 
-  private final boolean drawRaster (ColorModel cm, Raster r, 
-                                    AffineTransform imageToUser, 
-                                    Color bgcolor)
+  private final boolean drawRaster(ColorModel cm, Raster r,
+                                   AffineTransform imageToUser, Color bgcolor)
   {
     if (r == null)
       return false;
 
-    SampleModel sm = r.getSampleModel ();
-    DataBuffer db = r.getDataBuffer ();
+    SampleModel sm = r.getSampleModel();
+    DataBuffer db = r.getDataBuffer();
 
     if (db == null || sm == null)
       return false;
 
     if (cm == null)
-      cm = ColorModel.getRGBdefault ();
+      cm = ColorModel.getRGBdefault();
 
     double[] i2u = new double[6];
     if (imageToUser != null)
       imageToUser.getMatrix(i2u);
     else
       {
-        i2u[0] = 1; i2u[1] = 0;
-        i2u[2] = 0; i2u[3] = 1;
-        i2u[4] = 0; i2u[5] = 0;
+       i2u[0] = 1;
+       i2u[1] = 0;
+       i2u[2] = 0;
+       i2u[3] = 1;
+       i2u[4] = 0;
+       i2u[5] = 0;
       }
 
-    int pixels[] = null;
+    int[] pixels = findSimpleIntegerArray(cm, r);
 
-    if (sm.getDataType () == DataBuffer.TYPE_INT &&
-        db instanceof DataBufferInt &&
-        db.getNumBanks () == 1)
+    if (pixels == null)
       {
-        // single bank, ARGB-ints buffer in sRGB space
-        DataBufferInt dbi = (DataBufferInt)db;
-        pixels = dbi.getData ();
+       // FIXME: I don't think this code will work correctly with a non-RGB
+       // MultiPixelPackedSampleModel. Although this entire method should 
+       // probably be rewritten to better utilize Cairo's different supported
+       // data formats.
+       if (sm instanceof MultiPixelPackedSampleModel)
+         {
+           pixels = r.getPixels(0, 0, r.getWidth(), r.getHeight(), pixels);
+           for (int i = 0; i < pixels.length; i++)
+             pixels[i] = cm.getRGB(pixels[i]);
+         }
+       else
+         {
+           pixels = new int[r.getWidth() * r.getHeight()];
+           for (int i = 0; i < pixels.length; i++)
+             pixels[i] = cm.getRGB(db.getElem(i));
+         }
       }
-    else
-      pixels = r.getPixels (0, 0, r.getWidth (), r.getHeight (), pixels);
-    
-    ColorSpace cs = cm.getColorSpace ();
-    if (cs != null && 
-        cs.getType () != ColorSpace.CS_sRGB)
+
+    // Change all transparent pixels in the image to the specified bgcolor,
+    // or (if there's no alpha) fill in an alpha channel so that it paints
+    // correctly.
+    if (cm.hasAlpha())
       {
-        int pixels2[] = new int[pixels.length];        
-        for (int i = 0; i < pixels2.length; i++)
-          pixels2[i] = cm.getRGB (pixels[i]);        
-        pixels = pixels2;
+       if (bgcolor != null && cm.hasAlpha())
+         for (int i = 0; i < pixels.length; i++)
+           {
+             if (cm.getAlpha(pixels[i]) == 0)
+               pixels[i] = bgcolor.getRGB();
+           }
       }
-    
-    // change all transparent pixels in the image to the 
-    // specified bgcolor
-            
-    if (bgcolor != null) 
-      {
-        for (int i = 0; i < pixels.length; i++) 
-          {
-            if (cm.getAlpha (pixels[i]) == 0) 
-              pixels[i] = bgcolor.getRGB ();       
-          }
-      } 
-
-    drawPixels (pixels, r.getWidth (), r.getHeight (), r.getWidth (), i2u);
-    
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    else
+      for (int i = 0; i < pixels.length; i++)
+       pixels[i] |= 0xFF000000;
+
+    drawPixels(pixels, r.getWidth(), r.getHeight(), r.getWidth(), i2u);
+
+    updateBufferedImage();
 
     return true;
   }
 
-  public void drawRenderedImage(RenderedImage image,
-                                AffineTransform xform)
+  public void drawRenderedImage(RenderedImage image, AffineTransform xform)
   {
-    drawRaster (image.getColorModel(), image.getData(), xform, bg);
+    drawRaster(image.getColorModel(), image.getData(), xform, bg);
   }
-  
-  public void drawRenderableImage(RenderableImage image,
-                                  AffineTransform xform)
+
+  public void drawRenderableImage(RenderableImage image, AffineTransform xform)
   {
-    drawRenderedImage (image.createRendering (new RenderContext (xform)), xform);
+    drawRenderedImage(image.createRendering(new RenderContext(xform)), xform);
   }
-  
-  public boolean drawImage(Image img, 
-                           AffineTransform xform,
-                           ImageObserver obs)
+
+  public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
   {
-    return drawImage(img, xform, bg, obs); 
+    return drawImage(img, xform, bg, obs);
   }
 
-  public void drawImage(BufferedImage image,
-                        BufferedImageOp op,
-                        int x,
-                        int y)
+  public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y)
   {
     Image filtered = op.filter(image, null);
-    drawImage(filtered, new AffineTransform(1f,0f,0f,1f,x,y), bg, null);
+    drawImage(filtered, new AffineTransform(1f, 0f, 0f, 1f, x, y), bg, null);
   }
 
-  public boolean drawImage (Image img, int x, int y, 
-                            ImageObserver observer)
+  public boolean drawImage(Image img, int x, int y, ImageObserver observer)
   {
-    return drawImage(img, new AffineTransform(1f,0f,0f,1f,x,y), bg, observer);    
+    return drawImage(img, new AffineTransform(1f, 0f, 0f, 1f, x, y), bg,
+                     observer);
   }
 
-
   ///////////////////////////////////////////////
   ////// Unimplemented Stubs and Overloads //////
   ///////////////////////////////////////////////
 
-  
-    
-  public boolean hit(Rectangle rect, Shape text,
-                     boolean onStroke)
+  public boolean hit(Rectangle rect, Shape text, boolean onStroke)
   {
-    throw new java.lang.UnsupportedOperationException ();
+    throw new java.lang.UnsupportedOperationException();
   }
 
   public GraphicsConfiguration getDeviceConfiguration()
   {
-    throw new java.lang.UnsupportedOperationException ();
+    throw new java.lang.UnsupportedOperationException();
   }
 
   public void setComposite(Composite comp)
@@ -1141,87 +1101,81 @@ public class GdkGraphics2D extends Graphics2D
 
     if (comp instanceof AlphaComposite)
       {
-        AlphaComposite a = (AlphaComposite) comp;
-        cairoSetOperator(a.getRule());
-        Color c = getColor();
-        setColor(new Color(c.getRed(),
-                           c.getGreen(),
-                           c.getBlue(),
-                           (int) (a.getAlpha() * ((float) c.getAlpha()))));
+       AlphaComposite a = (AlphaComposite) comp;
+       cairoSetOperator(a.getRule());
+       Color c = getColor();
+       setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(),
+                          (int) (a.getAlpha() * ((float) c.getAlpha()))));
       }
     else
-      throw new java.lang.UnsupportedOperationException ();
+      throw new java.lang.UnsupportedOperationException();
   }
 
-  public void setRenderingHint(RenderingHints.Key hintKey,
-                               Object hintValue)
+  public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
   {
-    hints.put (hintKey, hintValue);    
-    
+    hints.put(hintKey, hintValue);
+
     if (hintKey.equals(RenderingHints.KEY_INTERPOLATION)
-        || hintKey.equals(RenderingHints.KEY_ALPHA_INTERPOLATION)) 
+        || hintKey.equals(RenderingHints.KEY_ALPHA_INTERPOLATION))
       {
-                       
-        if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
-           cairoSurfaceSetFilter(0);
-          
-        else if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
-           cairoSurfaceSetFilter(1); 
-          
-        else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
-           cairoSurfaceSetFilter(2);
-          
-        else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
-           cairoSurfaceSetFilter(3);
-          
-        else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
-           cairoSurfaceSetFilter(4);
-      
+       if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
+         cairoSurfaceSetFilter(0);
+
+       else if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
+         cairoSurfaceSetFilter(1);
+
+       else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
+         cairoSurfaceSetFilter(2);
+
+       else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
+         cairoSurfaceSetFilter(3);
+
+       else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
+         cairoSurfaceSetFilter(4);
       }
 
-    shiftDrawCalls = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE)
-      || hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT);
-    
+    shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
+                     || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
   }
 
   public Object getRenderingHint(RenderingHints.Key hintKey)
   {
-    return hints.get (hintKey);
+    return hints.get(hintKey);
   }
-  
+
   public void setRenderingHints(Map hints)
   {
-    this.hints = new RenderingHints (getDefaultHints ());
-    this.hints.add (new RenderingHints (hints));
-        
-    if (hints.containsKey(RenderingHints.KEY_INTERPOLATION)) 
+    this.hints = new RenderingHints(getDefaultHints());
+    this.hints.add(new RenderingHints(hints));
+
+    if (hints.containsKey(RenderingHints.KEY_INTERPOLATION))
+      {
+       if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
+         cairoSurfaceSetFilter(0);
+
+       else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
+         cairoSurfaceSetFilter(1);
+      }
+
+    if (hints.containsKey(RenderingHints.KEY_ALPHA_INTERPOLATION))
       {
-         if(hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)) 
-            cairoSurfaceSetFilter(0);
-           
-         else if(hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR)) 
-            cairoSurfaceSetFilter(1);  
+       if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
+         cairoSurfaceSetFilter(2);
+
+       else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
+         cairoSurfaceSetFilter(3);
+
+       else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
+         cairoSurfaceSetFilter(4);
       }
-          
-    if (hints.containsKey(RenderingHints.KEY_ALPHA_INTERPOLATION)) 
-      { 
-         if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED)) 
-            cairoSurfaceSetFilter(2);
-           
-         else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY)) 
-            cairoSurfaceSetFilter(3);
-           
-         else if(hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT)) 
-            cairoSurfaceSetFilter(4);
-      }      
-
-    shiftDrawCalls = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE)
-      || hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT);
+
+    shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
+                     || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
   }
 
   public void addRenderingHints(Map hints)
   {
-    this.hints.add (new RenderingHints (hints));
+    this.hints.add(new RenderingHints(hints));
   }
 
   public RenderingHints getRenderingHints()
@@ -1237,70 +1191,62 @@ public class GdkGraphics2D extends Graphics2D
       return comp;
   }
 
-  public FontRenderContext getFontRenderContext ()
+  public FontRenderContext getFontRenderContext()
   {
-    return new FontRenderContext (transform, true, true);
+    return new FontRenderContext(transform, true, true);
   }
 
-  public void copyArea (int x, int y, int width, int height, int dx, int dy)
+  public void copyArea(int x, int y, int width, int height, int dx, int dy)
   {
-    throw new java.lang.UnsupportedOperationException ();
+    throw new java.lang.UnsupportedOperationException();
   }
 
-  public void drawArc (int x, int y, int width, int height,
-                       int startAngle, int arcAngle)
+  public void drawArc(int x, int y, int width, int height, int startAngle,
+                      int arcAngle)
   {
-    draw (new Arc2D.Double((double)x, (double)y, 
-                           (double)width, (double)height,
-                           (double)startAngle, (double)arcAngle,
-                           Arc2D.OPEN));
+    draw(new Arc2D.Double((double) x, (double) y, (double) width,
+                          (double) height, (double) startAngle,
+                          (double) arcAngle, Arc2D.OPEN));
   }
 
-  public boolean drawImage (Image img, int x, int y, Color bgcolor, 
-                            ImageObserver observer)
+  public boolean drawImage(Image img, int x, int y, Color bgcolor,
+                           ImageObserver observer)
   {
-    return drawImage (img, x, y, img.getWidth (observer), 
-                      img.getHeight (observer), bgcolor, observer);
+    return drawImage(img, x, y, img.getWidth(observer),
+                     img.getHeight(observer), bgcolor, observer);
   }
 
-  public boolean drawImage (Image img, int x, int y, int width, int height, 
-                            Color bgcolor, ImageObserver observer)
+  public boolean drawImage(Image img, int x, int y, int width, int height,
+                           Color bgcolor, ImageObserver observer)
   {
-   
-    double scaleX =  width / (double) img.getWidth (observer);           
-    double scaleY =  height / (double) img.getHeight (observer);
-
-    return drawImage (img, 
-                      new AffineTransform(scaleX, 0f, 0f, scaleY, x, y),
-                      bgcolor,
-                      observer);
+    double scaleX = width / (double) img.getWidth(observer);
+    double scaleY = height / (double) img.getHeight(observer);
 
+    return drawImage(img, new AffineTransform(scaleX, 0f, 0f, scaleY, x, y),
+                     bgcolor, observer);
   }
 
-  public boolean drawImage (Image img, int x, int y, int width, int height, 
-                            ImageObserver observer)
+  public boolean drawImage(Image img, int x, int y, int width, int height,
+                           ImageObserver observer)
   {
-
-    return drawImage (img, x, y, width, height, bg, observer);
-
+    return drawImage(img, x, y, width, height, bg, observer);
   }
 
-  public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, 
-                            int sx1, int sy1, int sx2, int sy2, 
-                            Color bgcolor, ImageObserver observer)
+  public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
+                           int sx1, int sy1, int sx2, int sy2, Color bgcolor,
+                           ImageObserver observer)
   {
-  
     if (img == null)
       return false;
 
-    Image subImage;    
-    
+    Image subImage;
+
     int sourceWidth = sx2 - sx1;
-    int sourceHeight = sy2 - sy1;     
-    
+    int sourceHeight = sy2 - sy1;
+
     int destWidth = dx2 - dx1;
     int destHeight = dy2 - dy1;
-    
+
     double scaleX = destWidth / (double) sourceWidth;
     double scaleY = destHeight / (double) sourceHeight;
 
@@ -1309,48 +1255,42 @@ public class GdkGraphics2D extends Graphics2D
        
     if (img instanceof BufferedImage)
       {
-
-        BufferedImage b = (BufferedImage) img;
-        subImage = b.getSubimage(sx1,sy1,sx2,sy2);  
-      } 
-    else 
+       BufferedImage b = (BufferedImage) img;
+       subImage = b.getSubimage(sx1, sy1, sx2, sy2);
+      }
+    else
       {
-
-        // FIXME: This code currently doesn't work. Null Pointer 
-        // exception is thrown in this case. This happens 
-        // because img.getSource() always returns null, since source gets 
-        // never initialized when it is created with the help of 
-        // createImage(int width, int height). 
-             
-        CropImageFilter filter = new CropImageFilter(sx1,sx2,sx2,sy2);
-        FilteredImageSource src = new FilteredImageSource(img.getSource(), 
-                                                          filter);     
-                                                                                                         
-        subImage = Toolkit.getDefaultToolkit().createImage(src);
+       // FIXME: This code currently doesn't work. Null Pointer 
+       // exception is thrown in this case. This happens 
+       // because img.getSource() always returns null, since source gets 
+       // never initialized when it is created with the help of 
+       // createImage(int width, int height). 
+       CropImageFilter filter = new CropImageFilter(sx1, sx2, sx2, sy2);
+       FilteredImageSource src = new FilteredImageSource(img.getSource(),
+                                                         filter);
+
+       subImage = Toolkit.getDefaultToolkit().createImage(src);
       }
 
-    return drawImage(subImage, new AffineTransform(scaleX, 0, 0,
-                                                   scaleY, dx1, dy1), 
-                                                   bgcolor,
-                                                   observer);
+    return drawImage(subImage,
+                     new AffineTransform(scaleX, 0, 0, scaleY, dx1, dy1),
+                     bgcolor, observer);
   }
 
-  public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, 
-                            int sx1, int sy1, int sx2, int sy2, 
-                            ImageObserver observer) 
+  public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
+                           int sx1, int sy1, int sx2, int sy2,
+                           ImageObserver observer)
   {
-
-    return drawImage (img, dx1, dy1, dx2, dy2, 
-                      sx1, sy1, sx2, sy2, bg, observer);         
+    return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bg, observer);
   }
 
   public void drawOval(int x, int y, int width, int height)
   {
-    drawArc (x, y, width, height, 0, 360);
+    drawArc(x, y, width, height, 0, 360);
   }
 
-  public void drawRoundRect(int x, int y, int width, int height, 
-                            int arcWidth, int arcHeight)
+  public void drawRoundRect(int x, int y, int width, int height, int arcWidth,
+                            int arcHeight)
   {
     if (arcWidth > width)
       arcWidth = width;
@@ -1360,93 +1300,89 @@ public class GdkGraphics2D extends Graphics2D
     int xx = x + width - arcWidth;
     int yy = y + height - arcHeight;
 
-    drawArc (x, y, arcWidth, arcHeight, 90, 90);
-    drawArc (xx, y, arcWidth, arcHeight, 0, 90);
-    drawArc (xx, yy, arcWidth, arcHeight, 270, 90);
-    drawArc (x, yy, arcWidth, arcHeight, 180, 90);
+    drawArc(x, y, arcWidth, arcHeight, 90, 90);
+    drawArc(xx, y, arcWidth, arcHeight, 0, 90);
+    drawArc(xx, yy, arcWidth, arcHeight, 270, 90);
+    drawArc(x, yy, arcWidth, arcHeight, 180, 90);
 
     int y1 = y + arcHeight / 2;
     int y2 = y + height - arcHeight / 2;
-    drawLine (x, y1, x, y2);
-    drawLine (x + width, y1, x + width, y2);
+    drawLine(x, y1, x, y2);
+    drawLine(x + width, y1, x + width, y2);
 
     int x1 = x + arcWidth / 2;
     int x2 = x + width - arcWidth / 2;
-    drawLine (x1, y, x2, y);
-    drawLine (x1, y + height, x2, y + height);
+    drawLine(x1, y, x2, y);
+    drawLine(x1, y + height, x2, y + height);
   }
 
   // these are the most accelerated painting paths
-  native void cairoDrawGdkGlyphVector (GdkFontPeer f, GdkGlyphVector gv, float x, float y);
-  native void cairoDrawGdkTextLayout (GdkFontPeer f, GdkTextLayout gl, float x, float y);
-  native void cairoDrawString (GdkFontPeer f, String str, float x, float y);
+  native void cairoDrawGlyphVector(GdkFontPeer font, 
+                                   float x, float y, int n, 
+                                   int[] codes, float[] positions);
 
-  GdkFontPeer getFontPeer() 
-  {
-    return (GdkFontPeer) getFont().getPeer(); 
-  }
+  native void cairoDrawGdkTextLayout(GdkTextLayout gl, 
+                                     float x, float y);
 
-  public void drawGdkGlyphVector(GdkGlyphVector gv, float x, float y)
+  GdkFontPeer getFontPeer()
   {
-    cairoDrawGdkGlyphVector(getFontPeer(), gv, x, y);
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    return (GdkFontPeer) getFont().getPeer();
   }
 
   public void drawGdkTextLayout(GdkTextLayout gl, float x, float y)
   {
-    cairoDrawGdkTextLayout(getFontPeer(), gl, x, y);
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();   
+    cairoDrawGdkTextLayout (gl, x, y);
+    updateBufferedImage ();
   }
 
-  public void drawString (String str, float x, float y)
+  public void drawString(String str, float x, float y)
   {
-    cairoDrawString(getFontPeer(), str, x, y);
-    if (isBufferedImageGraphics ()) 
-      updateBufferedImage();       
+    drawGlyphVector(getFont().createGlyphVector(null, str), x, y);
+    updateBufferedImage ();
   }
 
-  public void drawString (String str, int x, int y)
+  public void drawString(String str, int x, int y)
   {
-    drawString (str, (float)x, (float)y);
+    drawString (str, (float) x, (float) y);
   }
 
-  public void drawString (AttributedCharacterIterator ci, int x, int y)
+  public void drawString(AttributedCharacterIterator ci, int x, int y)
   {
-    drawString (ci, (float)x, (float)y);
+    drawString (ci, (float) x, (float) y);
   }
 
-  public void drawGlyphVector (GlyphVector gv, float x, float y)
+  public void drawGlyphVector(GlyphVector gv, float x, float y)
   {
-    if (gv instanceof GdkGlyphVector)
-      drawGdkGlyphVector((GdkGlyphVector)gv, x, y);
-    else
-      throw new java.lang.UnsupportedOperationException ();
+    int n = gv.getNumGlyphs ();
+    int[] codes = gv.getGlyphCodes (0, n, null);
+    float[] positions = gv.getGlyphPositions (0, n, null);
+    
+    setFont (gv.getFont ());
+    cairoDrawGlyphVector (getFontPeer(), x, y, n, codes, positions);
+    updateBufferedImage ();
   }
 
-  public void drawString (AttributedCharacterIterator ci, float x, float y)
+  public void drawString(AttributedCharacterIterator ci, float x, float y)
   {
-    GlyphVector gv = font.createGlyphVector (getFontRenderContext(), ci);
-    drawGlyphVector (gv, x, y);
+    GlyphVector gv = getFont().createGlyphVector(getFontRenderContext(), ci);
+    drawGlyphVector(gv, x, y);
   }
 
-  public void fillArc (int x, int y, int width, int height, 
-                       int startAngle, int arcAngle)
+  public void fillArc(int x, int y, int width, int height, int startAngle,
+                      int arcAngle)
   {
-    fill (new Arc2D.Double((double)x, (double)y, 
-                           (double)width, (double)height,
-                           (double)startAngle, (double)arcAngle,
-                           Arc2D.OPEN));
+    fill(new Arc2D.Double((double) x, (double) y, (double) width,
+                          (double) height, (double) startAngle,
+                          (double) arcAngle, Arc2D.OPEN));
   }
 
   public void fillOval(int x, int y, int width, int height)
   {
-    fillArc (x, y, width, height, 0, 360);
+    fillArc(x, y, width, height, 0, 360);
   }
 
-  public void fillRoundRect (int x, int y, int width, int height, 
-                             int arcWidth, int arcHeight)
+  public void fillRoundRect(int x, int y, int width, int height, int arcWidth,
+                            int arcHeight)
   {
     if (arcWidth > width)
       arcWidth = width;
@@ -1456,17 +1392,19 @@ public class GdkGraphics2D extends Graphics2D
     int xx = x + width - arcWidth;
     int yy = y + height - arcHeight;
 
-    fillArc (x, y, arcWidth, arcHeight, 90, 90);
-    fillArc (xx, y, arcWidth, arcHeight, 0, 90);
-    fillArc (xx, yy, arcWidth, arcHeight, 270, 90);
-    fillArc (x, yy, arcWidth, arcHeight, 180, 90);
+    fillArc(x, y, arcWidth, arcHeight, 90, 90);
+    fillArc(xx, y, arcWidth, arcHeight, 0, 90);
+    fillArc(xx, yy, arcWidth, arcHeight, 270, 90);
+    fillArc(x, yy, arcWidth, arcHeight, 180, 90);
 
-    fillRect (x, y + arcHeight / 2, width, height - arcHeight + 1);
-    fillRect (x + arcWidth / 2, y, width - arcWidth + 1, height);
+    fillRect(x, y + arcHeight / 2, width, height - arcHeight + 1);
+    fillRect(x + arcWidth / 2, y, width - arcWidth + 1, height);
   }
 
-  public Font getFont ()
+  public Font getFont()
   {
+    if (font == null)
+      return new Font("SansSerif", Font.PLAIN, 12);
     return font;
   }
 
@@ -1475,38 +1413,34 @@ public class GdkGraphics2D extends Graphics2D
   // GtkFontMetrics into the drawing kit and ask cairo ourselves.
 
   static native void releasePeerGraphicsResource(GdkFontPeer f);
-  static native void getPeerTextMetrics (GdkFontPeer f, String str, double [] metrics);
-  static native void getPeerFontMetrics (GdkFontPeer f, double [] metrics);
 
-  public FontMetrics getFontMetrics ()
+  public FontMetrics getFontMetrics()
   {
-    // the reason we go via the toolkit here is to try to get
-    // a cached object. the toolkit keeps such a cache.
-    return Toolkit.getDefaultToolkit ().getFontMetrics (font);
+    return getFontMetrics(getFont());
   }
 
-  public FontMetrics getFontMetrics (Font f)
+  public FontMetrics getFontMetrics(Font f)
   {
     // the reason we go via the toolkit here is to try to get
     // a cached object. the toolkit keeps such a cache.
-    return Toolkit.getDefaultToolkit ().getFontMetrics (f);
+    return Toolkit.getDefaultToolkit().getFontMetrics(f);
   }
 
-  public void setFont (Font f)
+  public void setFont(Font f)
   {
     if (f.getPeer() instanceof GdkFontPeer)
       font = f;
     else
       font = 
-        ((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
-        .getFont (f.getName(), f.getAttributes ());    
+        ((ClasspathToolkit)(Toolkit.getDefaultToolkit()))
+        .getFont(f.getName(), f.getAttributes());    
   }
-  
+
   public String toString()
   {
-    return  getClass ().getName () +
-            "[font=" + font.toString () +
-            ",color=" + fg.toString () + "]";
+    return  (getClass().getName()
+             + "[font=" + getFont().toString()
+             + ",color=" + fg.toString()
+            + "]");
   }
-
 }
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
new file mode 100644 (file)
index 0000000..c5afd0b
--- /dev/null
@@ -0,0 +1,138 @@
+/* GdkGraphicsConfiguration.java -- describes characteristics of graphics
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.BufferCapabilities;
+import java.awt.ImageCapabilities;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.Rectangle;
+
+import java.awt.geom.AffineTransform;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.VolatileImage;
+
+public class GdkGraphicsConfiguration 
+  extends GraphicsConfiguration
+{
+  GdkScreenGraphicsDevice gdkScreenGraphicsDevice;
+  ColorModel cm;
+  Rectangle bounds;
+
+  public GtkToolkit getToolkit()
+  {
+    return gdkScreenGraphicsDevice.getToolkit();
+  }
+
+  public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev)
+  {
+    this.gdkScreenGraphicsDevice = dev;
+    cm = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).getColorModel();
+    bounds = getToolkit().getBounds();
+  }
+
+  public GraphicsDevice getDevice()
+  {
+    return gdkScreenGraphicsDevice;
+  }
+
+  public BufferedImage createCompatibleImage(int w, int h)
+  {
+    return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+  }
+
+  public BufferedImage createCompatibleImage(int w, int h, 
+                                             int transparency)
+  {
+    return createCompatibleImage(w, h);
+  }
+
+  public VolatileImage createCompatibleVolatileImage(int w, int h)
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+  public VolatileImage createCompatibleVolatileImage(int w, int h,
+                                                     ImageCapabilities caps)
+    throws java.awt.AWTException
+  {
+    throw new java.lang.UnsupportedOperationException ();
+  }
+
+  public ColorModel getColorModel()
+  {
+    return cm;
+  }
+
+  public ColorModel getColorModel(int transparency)
+  {
+    return getColorModel();
+  }
+
+  public AffineTransform getDefaultTransform()
+  {
+    // FIXME: extract the GDK DPI information here.
+    return new AffineTransform();
+  }
+
+  public AffineTransform getNormalizingTransform()
+  {
+    // FIXME: extract the GDK DPI information here.
+    return new AffineTransform();
+  }
+
+  public Rectangle getBounds()
+  {
+    return bounds;
+  }
+
+  public BufferCapabilities getBufferCapabilities()
+  {
+    return new BufferCapabilities(getImageCapabilities(), 
+                                  getImageCapabilities(),
+                                  BufferCapabilities.FlipContents.UNDEFINED);
+  }
+
+  public ImageCapabilities getImageCapabilities()
+  {
+    return new ImageCapabilities(false);
+  }
+
+}
index 45e0c21..1f10c48 100644 (file)
@@ -42,26 +42,37 @@ import java.awt.Font;
 import java.awt.Graphics2D;
 import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
-import java.awt.Rectangle;
-import java.awt.Shape;
+import java.awt.HeadlessException;
 import java.awt.image.BufferedImage;
 import java.util.Locale;
 
 public class GdkGraphicsEnvironment extends GraphicsEnvironment
 {
-  public GdkGraphicsEnvironment ()
+  GtkToolkit gtkToolkit;
+
+  public GtkToolkit getToolkit()
+  {
+    return gtkToolkit;
+  }
+
+  public GdkGraphicsEnvironment (GtkToolkit tk)
   {
     super();
+    gtkToolkit = tk;
   }
 
   public GraphicsDevice[] getScreenDevices ()
   {
-    throw new java.lang.UnsupportedOperationException ();
+    // FIXME: Support multiple screens, since GDK can.
+    return new GraphicsDevice[] { new GdkScreenGraphicsDevice (this) };
   }
 
   public GraphicsDevice getDefaultScreenDevice ()
   {
-    throw new java.lang.UnsupportedOperationException ();
+    if (GraphicsEnvironment.isHeadless ())
+      throw new HeadlessException ();
+
+    return new GdkScreenGraphicsDevice (this);
   }
 
   public Graphics2D createGraphics (BufferedImage image)
index a7b93e5..a9c1fb9 100644 (file)
@@ -45,14 +45,31 @@ import java.awt.image.ColorModel;
 import java.awt.image.DirectColorModel;
 import java.awt.image.ImageConsumer;
 import java.awt.image.ImageProducer;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
+import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
+import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Locale;
 import java.util.Vector;
 
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriter;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.IIOImage;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.spi.ImageWriterSpi;
+import javax.imageio.spi.IIORegistry;
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.stream.ImageOutputStream;
+
 public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
 {
   static 
@@ -65,20 +82,27 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
   }
   native static void initStaticState ();
   private final int native_state = GtkGenericPeer.getUniqueInteger ();
+  private boolean initialized = false;
 
   // the current set of ImageConsumers for this decoder
   Vector curr;
 
   // interface to GdkPixbuf
   native void initState ();
-  native void pumpBytes (byte bytes[], int len);
+  native void pumpBytes (byte[] bytes, int len);
   native void finish ();
+  static native void streamImage(int[] bytes, String format, int width, int height, boolean hasAlpha, DataOutput sink);
   
   // gdk-pixbuf provids data in RGBA format
   static final ColorModel cm = new DirectColorModel (32, 0xff000000, 
                                                      0x00ff0000, 
                                                      0x0000ff00, 
                                                      0x000000ff);
+  public GdkPixbufDecoder (InputStream in)
+  {
+    super (in);
+  }
+
   public GdkPixbufDecoder (String filename)
   {
     super (filename);
@@ -150,24 +174,349 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
     curr = null;
   }
 
-  // remaining helper class and static method is a convenience for the Gtk
-  // peers, for loading a BufferedImage in off a disk file. one would think
-  // this ought to be fairly straightforward, but it does not appear
-  // anywhere else I can find.
+  public void finalize()
+  {
+    finish();
+  }
+
+
+  public static class ImageFormatSpec
+  {
+    public String name;
+    public boolean writable = false;    
+    public ArrayList mimeTypes = new ArrayList();
+    public ArrayList extensions = new ArrayList();
+
+    public ImageFormatSpec(String name, boolean writable)
+    {
+      this.name = name;
+      this.writable = writable;
+    }
+
+    public synchronized void addMimeType(String m)
+    {
+      mimeTypes.add(m);
+    }
+
+    public synchronized void addExtension(String e)
+    {
+      extensions.add(e);
+    }    
+  }
+
+  static ArrayList imageFormatSpecs;
+
+  public static ImageFormatSpec registerFormat(String name, boolean writable) 
+  {
+    ImageFormatSpec ifs = new ImageFormatSpec(name, writable);
+    synchronized(GdkPixbufDecoder.class)
+      {
+        if (imageFormatSpecs == null)
+          imageFormatSpecs = new ArrayList();
+        imageFormatSpecs.add(ifs);
+      }
+    return ifs;
+  }
+
+  static String[] getFormatNames(boolean writable)
+  {
+    ArrayList names = new ArrayList();
+    synchronized (imageFormatSpecs) 
+      {
+        Iterator i = imageFormatSpecs.iterator();
+        while (i.hasNext())
+          {
+            ImageFormatSpec ifs = (ImageFormatSpec) i.next();
+            if (writable && !ifs.writable)
+              continue;
+            names.add(ifs.name);
+
+            /* 
+             * In order to make the filtering code work, we need to register
+             * this type under every "format name" likely to be used as a synonym.
+             * This generally means "all the extensions people might use". 
+             */
+
+            Iterator j = ifs.extensions.iterator();
+            while (j.hasNext())
+              names.add((String) j.next());
+          }
+      }
+    Object[] objs = names.toArray();
+    String[] strings = new String[objs.length];
+    for (int i = 0; i < objs.length; ++i)
+      strings[i] = (String) objs[i];
+    return strings;
+  }
+
+  static String[] getFormatExtensions(boolean writable)
+  {
+    ArrayList extensions = new ArrayList();
+    synchronized (imageFormatSpecs) 
+      {
+        Iterator i = imageFormatSpecs.iterator();
+        while (i.hasNext())
+          {
+            ImageFormatSpec ifs = (ImageFormatSpec) i.next();
+            if (writable && !ifs.writable)
+              continue;
+            Iterator j = ifs.extensions.iterator();
+            while (j.hasNext())
+              extensions.add((String) j.next());
+          }
+      }
+    Object[] objs = extensions.toArray();
+    String[] strings = new String[objs.length];
+    for (int i = 0; i < objs.length; ++i)
+      strings[i] = (String) objs[i];
+    return strings;
+  }
+
+  static String[] getFormatMimeTypes(boolean writable)
+  {
+    ArrayList mimeTypes = new ArrayList();
+    synchronized (imageFormatSpecs) 
+      {
+        Iterator i = imageFormatSpecs.iterator();
+        while (i.hasNext())
+          {
+            ImageFormatSpec ifs = (ImageFormatSpec) i.next();
+            if (writable && !ifs.writable)
+              continue;
+            Iterator j = ifs.mimeTypes.iterator();
+            while (j.hasNext())
+              mimeTypes.add((String) j.next());
+          }
+      }
+    Object[] objs = mimeTypes.toArray();
+    String[] strings = new String[objs.length];
+    for (int i = 0; i < objs.length; ++i)
+      strings[i] = (String) objs[i];
+    return strings;
+  }
+
+  
+  static String findFormatName(Object ext, boolean needWritable)
+  {
+    if (ext == null)
+      throw new IllegalArgumentException("extension is null");
+
+    if (!(ext instanceof String))
+      throw new IllegalArgumentException("extension is not a string");
+
+    String str = (String) ext;
+
+    Iterator i = imageFormatSpecs.iterator();
+    while (i.hasNext())
+      {
+        ImageFormatSpec ifs = (ImageFormatSpec) i.next();
+
+        if (needWritable && !ifs.writable)
+          continue;
+
+        if (ifs.name.equals(str))
+          return str;
+
+        Iterator j = ifs.extensions.iterator(); 
+        while (j.hasNext())
+          {
+            String extension = (String)j.next();
+            if (extension.equals(str))
+              return ifs.name;
+          }
+
+        j = ifs.mimeTypes.iterator(); 
+        while (j.hasNext())
+          {
+            String mimeType = (String)j.next();
+            if (mimeType.equals(str))
+              return ifs.name;
+          }
+      }      
+    throw new IllegalArgumentException("unknown extension '" + str + "'");
+  }
+
+  private static GdkPixbufReaderSpi readerSpi;
+  private static GdkPixbufWriterSpi writerSpi;
+
+  public static synchronized GdkPixbufReaderSpi getReaderSpi()
+  {
+    if (readerSpi == null)
+      readerSpi = new GdkPixbufReaderSpi();
+    return readerSpi;
+  }
+
+  public static synchronized GdkPixbufWriterSpi getWriterSpi()
+  {
+    if (writerSpi == null)
+      writerSpi = new GdkPixbufWriterSpi();
+    return writerSpi;
+  }
+
+  public static void registerSpis(IIORegistry reg) 
+  {
+    reg.registerServiceProvider(getReaderSpi(), ImageReaderSpi.class);
+    reg.registerServiceProvider(getWriterSpi(), ImageWriterSpi.class);
+  }
+
+  public static class GdkPixbufWriterSpi extends ImageWriterSpi
+  {
+    public GdkPixbufWriterSpi() 
+    {      
+      super("GdkPixbuf", "2.x",
+            GdkPixbufDecoder.getFormatNames(true), 
+            GdkPixbufDecoder.getFormatExtensions(true), 
+            GdkPixbufDecoder.getFormatMimeTypes(true),
+            "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriter",
+            new Class[] { ImageOutputStream.class },
+            new String[] { "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReaderSpi" },
+            false, null, null, null, null,
+            false, null, null, null, null);
+    }
+
+    public boolean canEncodeImage(ImageTypeSpecifier ts)
+    {
+      return true;
+    }
+
+    public ImageWriter createWriterInstance(Object ext)
+    {
+      return new GdkPixbufWriter(this, ext);
+    }
+
+    public String getDescription(java.util.Locale loc)
+    {
+      return "GdkPixbuf Writer SPI";
+    }
+
+  }
+
+  public static class GdkPixbufReaderSpi extends ImageReaderSpi
+  {
+    public GdkPixbufReaderSpi() 
+    { 
+      super("GdkPixbuf", "2.x",
+            GdkPixbufDecoder.getFormatNames(false), 
+            GdkPixbufDecoder.getFormatExtensions(false), 
+            GdkPixbufDecoder.getFormatMimeTypes(false),
+            "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReader",
+            new Class[] { ImageInputStream.class },
+            new String[] { "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriterSpi" },
+            false, null, null, null, null,
+            false, null, null, null, null);
+    }
 
-  private static class BufferedImageBuilder implements ImageConsumer
+    public boolean canDecodeInput(Object obj) 
+    { 
+      return true; 
+    }
+
+    public ImageReader createReaderInstance(Object ext)
+    {
+      return new GdkPixbufReader(this, ext);
+    }
+
+    public String getDescription(Locale loc)
+    {
+      return "GdkPixbuf Reader SPI";
+    }
+  }
+
+  private static class GdkPixbufWriter
+    extends ImageWriter
+  {
+    String ext;
+    public GdkPixbufWriter(GdkPixbufWriterSpi ownerSpi, Object ext)
+    {
+      super(ownerSpi);
+      this.ext = findFormatName(ext, true);
+    }
+
+    public IIOMetadata convertImageMetadata (IIOMetadata inData,
+                                             ImageTypeSpecifier imageType,
+                                             ImageWriteParam param)
+    {
+      return null;
+    }
+
+    public IIOMetadata convertStreamMetadata (IIOMetadata inData,
+                                              ImageWriteParam param)
+    {
+      return null;
+    }
+
+    public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, 
+                                                ImageWriteParam param)
+    {
+      return null;
+    }
+
+    public IIOMetadata getDefaultStreamMetadata (ImageWriteParam param)
+    {
+      return null;
+    }
+
+  public void write (IIOMetadata streamMetadata, IIOImage i, ImageWriteParam param)
+    throws IOException
+    {
+      RenderedImage image = i.getRenderedImage();
+      Raster ras = image.getData();
+      int width = ras.getWidth();
+      int height = ras.getHeight();
+      ColorModel model = image.getColorModel();
+      int[] pixels = GdkGraphics2D.findSimpleIntegerArray (image.getColorModel(), ras);
+      
+      if (pixels == null)
+        {
+          BufferedImage img = new BufferedImage(width, height, 
+                                                (model != null && model.hasAlpha() ? 
+                                                 BufferedImage.TYPE_INT_ARGB
+                                                 : BufferedImage.TYPE_INT_RGB));
+          int[] pix = new int[4];
+          for (int y = 0; y < height; ++y)
+            for (int x = 0; x < width; ++x)
+              img.setRGB(x, y, model.getRGB(ras.getPixel(x, y, pix)));
+          pixels = GdkGraphics2D.findSimpleIntegerArray (img.getColorModel(), 
+                                                         img.getRaster());
+          model = img.getColorModel();
+        }
+
+      processImageStarted(1);
+      streamImage(pixels, this.ext, width, height, model.hasAlpha(), 
+                  (DataOutput) this.getOutput());
+      processImageComplete();
+    }    
+  }
+
+  private static class GdkPixbufReader 
+    extends ImageReader
+    implements ImageConsumer
   {
+    // ImageConsumer parts
+    GdkPixbufDecoder dec;
     BufferedImage bufferedImage;
     ColorModel defaultModel;
+    int width;
+    int height;
+    String ext;
+    
+    public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext)
+    {
+      super(ownerSpi);
+      this.ext = findFormatName(ext, false);
+    }
 
-    public BufferedImage getBufferedImage()
+    public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext, GdkPixbufDecoder d)
     {
-      return bufferedImage;
+      this(ownerSpi, ext);
+      dec = d;
     }
 
-    public void setDimensions(int width, int height)
+    public void setDimensions(int w, int h)
     {
-      bufferedImage = new BufferedImage (width, height, BufferedImage.TYPE_INT_ARGB);
+      processImageStarted(1);
+      width = w;
+      height = h;
     }
     
     public void setProperties(Hashtable props) {}
@@ -189,65 +538,137 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
                           ColorModel model, int[] pixels, 
                           int offset, int scansize)
     {
-      if (bufferedImage != null)
+      if (model == null)
+        model = defaultModel;
+      
+      if (bufferedImage == null)
         {
+          bufferedImage = new BufferedImage (width, height, (model != null && model.hasAlpha() ? 
+                                                             BufferedImage.TYPE_INT_ARGB
+                                                             : BufferedImage.TYPE_INT_RGB));
+        }
 
-          if (model == null)
-            model = defaultModel;
-
-          int pixels2[];
-          if (model != null)
-            {
-              pixels2 = new int[pixels.length];
-              for (int yy = 0; yy < h; yy++)
-                for (int xx = 0; xx < w; xx++)
-                  {
-                    int i = yy * scansize + xx;
-                    pixels2[i] = model.getRGB (pixels[i]);
-                  }
-            }
-          else
-            pixels2 = pixels;
-
-          bufferedImage.setRGB (x, y, w, h, pixels2, offset, scansize);
+      int pixels2[];
+      if (model != null)
+        {
+          pixels2 = new int[pixels.length];
+          for (int yy = 0; yy < h; yy++)
+            for (int xx = 0; xx < w; xx++)
+              {
+                int i = yy * scansize + xx;
+                pixels2[i] = model.getRGB (pixels[i]);
+              }
         }
+      else
+        pixels2 = pixels;
+
+      bufferedImage.setRGB (x, y, w, h, pixels2, offset, scansize);
+      processImageProgress(y / (height == 0 ? 1 : height));
+    }
+
+    public void imageComplete(int status) 
+    {
+      processImageComplete();
+    }
+
+    public BufferedImage getBufferedImage()
+    {
+      if (bufferedImage == null && dec != null)
+        dec.startProduction (this);
+      return bufferedImage;
+    }
+
+    // ImageReader parts
+
+    public int getNumImages(boolean allowSearch)
+      throws IOException
+    {
+      return 1;
+    }
+
+    public IIOMetadata getImageMetadata(int i) 
+    {
+      return null;
+    }
+
+    public IIOMetadata getStreamMetadata()
+      throws IOException
+    {
+      return null;
     }
 
-    public void imageComplete(int status) {}
+    public Iterator getImageTypes(int imageIndex)
+      throws IOException
+    {
+      BufferedImage img = getBufferedImage();
+      Vector vec = new Vector();
+      vec.add(new ImageTypeSpecifier(img));
+      return vec.iterator();
+    }
+    
+    public int getHeight(int imageIndex)
+      throws IOException
+    {
+      return getBufferedImage().getHeight();
+    }
+
+    public int getWidth(int imageIndex)
+      throws IOException
+    {
+      return getBufferedImage().getWidth();
+    }
+
+    public void setInput(Object input,
+                         boolean seekForwardOnly,
+                         boolean ignoreMetadata)
+    {
+      super.setInput(input, seekForwardOnly, ignoreMetadata);
+      dec = new GdkPixbufDecoder((InputStream) getInput());
+    }
+
+    public BufferedImage read(int imageIndex, ImageReadParam param)
+      throws IOException
+    {
+      return getBufferedImage ();
+    }
   }
 
+  // remaining helper class and static method is a convenience for the Gtk
+  // peers, for loading a BufferedImage in off a disk file without going
+  // through the whole imageio system. 
+
   public static BufferedImage createBufferedImage (String filename)
   {
-    BufferedImageBuilder bb = new BufferedImageBuilder ();
-    GdkPixbufDecoder dec = new GdkPixbufDecoder (filename);
-    dec.startProduction (bb);
-    return bb.getBufferedImage ();
+    GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(), 
+                                             "png", // reader auto-detects, doesn't matter
+                                             new GdkPixbufDecoder (filename));
+    return r.getBufferedImage ();
   }
 
   public static BufferedImage createBufferedImage (URL u)
   {
-    BufferedImageBuilder bb = new BufferedImageBuilder ();
-    GdkPixbufDecoder dec = new GdkPixbufDecoder (u);
-    dec.startProduction (bb);
-    return bb.getBufferedImage ();
+    GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(), 
+                                             "png", // reader auto-detects, doesn't matter
+                                             new GdkPixbufDecoder (u));
+    return r.getBufferedImage ();
   }
 
   public static BufferedImage createBufferedImage (byte[] imagedata, int imageoffset,
                                                    int imagelength)
   {
-    BufferedImageBuilder bb = new BufferedImageBuilder ();
-    GdkPixbufDecoder dec = new GdkPixbufDecoder (imagedata, imageoffset, imagelength);
-    dec.startProduction (bb);
-    return bb.getBufferedImage ();
+    GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(), 
+                                             "png", // reader auto-detects, doesn't matter
+                                             new GdkPixbufDecoder (imagedata,
+                                                                   imageoffset,
+                                                                   imagelength));
+    return r.getBufferedImage ();
   }
   
   public static BufferedImage createBufferedImage (ImageProducer producer)
   {
-    BufferedImageBuilder bb = new BufferedImageBuilder ();
-    producer.startProduction(bb);
-    return bb.getBufferedImage ();
+    GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(), "png" /* ignored */, null);
+    producer.startProduction(r);
+    return r.getBufferedImage ();
   }
-  
-
 
 }
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkRobotPeer.java b/libjava/gnu/java/awt/peer/gtk/GdkRobotPeer.java
new file mode 100644 (file)
index 0000000..2438b68
--- /dev/null
@@ -0,0 +1,94 @@
+/* GdkRobot.java -- an XTest implementation of RobotPeer
+   Copyright (C) 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.AWTException;
+import java.awt.GraphicsDevice;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.Rectangle;
+import java.awt.peer.RobotPeer;
+
+/**
+ * Implements the RobotPeer interface using the XTest extension.
+ *
+ * @author Thomas Fitzsimmons
+ */
+public class GdkRobotPeer implements RobotPeer
+{
+  // gdk-pixbuf provides data in RGBA format
+  static final ColorModel cm = new DirectColorModel (32, 0xff000000,
+                                                    0x00ff0000,
+                                                    0x0000ff00,
+                                                    0x000000ff);
+
+  public GdkRobotPeer (GraphicsDevice screen) throws AWTException
+  {
+    // FIXME: make use of screen parameter when GraphicsDevice is
+    // implemented.
+    if (!initXTest ())
+      throw new AWTException ("XTest extension not supported");
+  }
+
+  native boolean initXTest ();
+
+  // RobotPeer methods
+  public native void mouseMove (int x, int y);
+  public native void mousePress (int buttons);
+  public native void mouseRelease (int buttons);
+  public native void mouseWheel (int wheelAmt);
+  public native void keyPress (int keycode);
+  public native void keyRelease (int keycode);
+  native int[] nativeGetRGBPixels (int x, int y, int width, int height);
+
+  public int getRGBPixel (int x, int y)
+  {
+    return cm.getRGB (nativeGetRGBPixels (x, y, 1, 1)[0]);
+  }
+
+  public int[] getRGBPixels (Rectangle r)
+  {
+    int[] gdk_pixels = nativeGetRGBPixels (r.x, r.y, r.width, r.height);
+    int[] pixels = new int[r.width * r.height];
+
+    for (int i = 0; i < r.width * r.height; i++)
+      pixels[i] = cm.getRGB (gdk_pixels[i]);
+
+    return pixels;
+  }
+}
@@ -1,5 +1,5 @@
-/* AbstractSet.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* GdkScreenGraphicsDevice.java -- information about a screen device
+   Copyright (C) 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,69 +35,48 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
-package javax.swing;
 
-import java.util.AbstractCollection;
-import java.util.Collection;
-import java.util.Set;
+package gnu.java.awt.peer.gtk;
 
-/**
- * Empty
- *
- * @author Ronald Veldema (rveldema@cs.vu.nl)
- */
-public abstract class AbstractSet extends AbstractCollection implements Set
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsConfiguration;
+
+public class GdkScreenGraphicsDevice extends GraphicsDevice
 {
-       boolean contained(Object []a1, Object b)
-       {
-               for (int i=0;i<a1.length;i++)
-               {
-                       if (a1[i] == b)
-                               return true;
-               }
-               return false;
-       }
-
-       public boolean equals(Object o)
-       {
-               if (! (o instanceof AbstractSet))
-                       return false;
-               AbstractSet s = (AbstractSet) o;
-
-               if (s == this)
-                       return true;
-
-               if (s.size() != size())
-                       return false;
-
-               Object[] a1 = s.toArray();
-               Object[] a2 = toArray();
-
-               for (int i=0;i<a1.length;i++)
-               {
-                       if (! contained(a2, a1[i]))
-                               return false;
-               }
-               return true;
-       }
-
-       public int hashCode()
-       {
-               int hash = 0;
-               Object[] a1 = toArray();
-
-               if (a1 == null)
-                       return 0;
-
-               for (int i=0; i<a1.length; i++)
-               {
-                       hash += a1[i].hashCode();
-               }
-               return hash;
-       }
-
-       public boolean removeAll(Collection c)
-       {
-               return false;
-       }
+  GdkGraphicsEnvironment env;
+
+  public GtkToolkit getToolkit()
+  {
+    return env.getToolkit();
+  }
+
+  public GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
+  {    
+    super ();
+    env = e;
+  }
+
+  public int getType ()
+  {
+    return GraphicsDevice.TYPE_RASTER_SCREEN;
+  }
+
+  public String getIDstring ()
+  {
+    // FIXME: query X for this string
+    return "default GDK device ID string";
+  }
+
+  public GraphicsConfiguration[] getConfigurations ()
+  {
+    // FIXME: query X for the list of possible configurations
+    return new GraphicsConfiguration [] { new GdkGraphicsConfiguration(this) };
+  }
+
+  public GraphicsConfiguration getDefaultConfiguration ()
+  {
+    
+    // FIXME: query X for default configuration
+    return new GdkGraphicsConfiguration(this);
+  }
 }
index 26cfc16..b5548a8 100644 (file)
@@ -52,7 +52,6 @@ import java.awt.geom.Rectangle2D;
 import java.text.CharacterIterator;
 import java.text.AttributedCharacterIterator;
 import java.text.AttributedString;
-import java.util.Map;
 import java.awt.font.TextAttribute;
 
 import gnu.classpath.Configuration;
index 9fba828..1ef992f 100644 (file)
@@ -41,7 +41,6 @@ package gnu.java.awt.peer.gtk;
 import java.awt.AWTEvent;
 import java.awt.Button;
 import java.awt.Component;
-import java.awt.Font;
 import java.awt.Point;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
index adb7008..2d1f650 100644 (file)
@@ -38,6 +38,8 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
+import java.awt.ItemSelectable;
+import java.awt.event.ItemEvent;
 import java.awt.CheckboxMenuItem;
 import java.awt.peer.CheckboxMenuItemPeer;
 import java.awt.peer.MenuItemPeer;
@@ -54,4 +56,15 @@ public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
   }
 
   native public void setState (boolean t);
+
+  protected void postMenuActionEvent ()
+  {
+    CheckboxMenuItem item = (CheckboxMenuItem)awtWidget;
+    q().postEvent (new ItemEvent ((ItemSelectable)awtWidget,
+      ItemEvent.ITEM_STATE_CHANGED,
+      item.getActionCommand(),
+      item.getState() ? ItemEvent.DESELECTED : ItemEvent.SELECTED));
+
+    super.postMenuActionEvent();
+  }
 }
index a6fd1ba..4af88f5 100644 (file)
@@ -40,8 +40,6 @@ package gnu.java.awt.peer.gtk;
 
 import java.awt.Checkbox;
 import java.awt.CheckboxGroup;
-import java.awt.Component;
-import java.awt.Font;
 import java.awt.peer.CheckboxPeer;
 
 public class GtkCheckboxPeer extends GtkComponentPeer
index 0546414..a065e13 100644 (file)
@@ -38,7 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.AWTEvent;
 import java.awt.Choice;
 import java.awt.event.ItemEvent;
 import java.awt.peer.ChoicePeer;
index 31d59ce..d9d9907 100644 (file)
@@ -47,14 +47,12 @@ import java.awt.Cursor;
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.FontMetrics;
-import java.awt.Frame;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.GraphicsConfiguration;
 import java.awt.Image;
 import java.awt.Insets;
 import java.awt.ItemSelectable;
-import java.awt.KeyboardFocusManager;
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Toolkit;
@@ -386,7 +384,7 @@ public class GtkComponentPeer extends GtkGenericPeer
     if (x == 0 && y == 0 && width == 0 && height == 0)
       return;
 
-    q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
+    q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
                                  new Rectangle (x, y, width, height)));
   }
 
@@ -508,14 +506,14 @@ public class GtkComponentPeer extends GtkGenericPeer
   protected void postMouseEvent(int id, long when, int mods, int x, int y, 
                                int clickCount, boolean popupTrigger) 
   {
-    q.postEvent(new MouseEvent(awtComponent, id, when, mods, x, y, 
+    q().postEvent(new MouseEvent(awtComponent, id, when, mods, x, y, 
                               clickCount, popupTrigger));
   }
 
   protected void postExposeEvent (int x, int y, int width, int height)
   {
     if (!isInRepaint)
-      q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+      q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
                                    new Rectangle (x, y, width, height)));
   }
 
@@ -535,23 +533,23 @@ public class GtkComponentPeer extends GtkGenericPeer
       {
         synchronized (q)
           {
-            q.postEvent (keyEvent);
-            q.postEvent (new KeyEvent (awtComponent, KeyEvent.KEY_TYPED, when, mods,
+            q().postEvent (keyEvent);
+            q().postEvent (new KeyEvent (awtComponent, KeyEvent.KEY_TYPED, when, mods,
                                         KeyEvent.VK_UNDEFINED, keyChar, keyLocation));
           }
       }
     else
-      q.postEvent (keyEvent);
+      q().postEvent (keyEvent);
   }
 
   protected void postFocusEvent (int id, boolean temporary)
   {
-    q.postEvent (new FocusEvent (awtComponent, id, temporary));
+    q().postEvent (new FocusEvent (awtComponent, id, temporary));
   }
 
   protected void postItemEvent (Object item, int stateChange)
   {
-    q.postEvent (new ItemEvent ((ItemSelectable)awtComponent, 
+    q().postEvent (new ItemEvent ((ItemSelectable)awtComponent, 
                                ItemEvent.ITEM_STATE_CHANGED,
                                item, stateChange));
   }
index 7fddd56..6155183 100644 (file)
@@ -38,7 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.AWTEvent;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
@@ -46,7 +45,6 @@ import java.awt.Font;
 import java.awt.Graphics;
 import java.awt.Insets;
 import java.awt.Window;
-import java.awt.event.PaintEvent;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.ContainerPeer;
 
index af22a27..9bf2344 100644 (file)
@@ -38,8 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.AWTEvent;
-import java.awt.Component;
 import java.awt.Dialog;
 import java.awt.Graphics;
 import java.awt.Rectangle;
@@ -76,7 +74,7 @@ public class GtkDialogPeer extends GtkWindowPeer
   protected void postExposeEvent (int x, int y, int width, int height)
   {
     if (!isInRepaint)
-      q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+      q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
                                    new Rectangle (x + insets.left, 
                                                   y + insets.top, 
                                                   width, height)));
index 1992556..fd9c155 100644 (file)
@@ -38,12 +38,10 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.AWTEvent;
 import java.awt.Dialog;
 import java.awt.FileDialog;
 import java.awt.Graphics;
 import java.awt.Window;
-import java.awt.event.WindowEvent;
 import java.awt.peer.FileDialogPeer;
 import java.io.File;
 import java.io.FilenameFilter;
@@ -114,7 +112,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
 
     // GtkFileChooser requires absolute filenames. If the given filename
     // is not absolute, let's construct it based on current directory.
-        currentFile = fileName;
+    currentFile = fileName;
     if (fileName.indexOf(FS) == 0)
       {
         nativeSetFile (fileName);
index 605d738..1369657 100644 (file)
@@ -46,7 +46,6 @@ import java.awt.font.FontRenderContext;
 import java.awt.font.GlyphVector;
 import java.awt.font.LineMetrics;
 import java.awt.geom.Rectangle2D;
-import java.awt.peer.FontPeer;
 import java.text.CharacterIterator;
 import java.util.Locale;
 import java.util.MissingResourceException;
index c0c1437..b22a25e 100644 (file)
@@ -38,11 +38,8 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.Component;
-import java.awt.Container;
 import java.awt.Frame;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Image;
 import java.awt.MenuBar;
 import java.awt.Rectangle;
@@ -165,7 +162,7 @@ public class GtkFramePeer extends GtkWindowPeer
     setMenuBar (frame.getMenuBar ());
 
     setTitle (frame.getTitle ());
-    setResizable (frame.isResizable ());
+    gtkWindowSetResizable (frame.isResizable ());
     setIconImage(frame.getIconImage());
   }
 
@@ -237,9 +234,9 @@ public class GtkFramePeer extends GtkWindowPeer
                            frame_y,
                            frame_width,
                            frame_height);
-      }
 
-    awtComponent.validate();
+        awtComponent.validate();
+      }
   }
 
   protected void postMouseEvent(int id, long when, int mods, int x, int y, 
@@ -253,7 +250,7 @@ public class GtkFramePeer extends GtkWindowPeer
   protected void postExposeEvent (int x, int y, int width, int height)
   {
     if (!isInRepaint)
-      q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+      q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
                                    new Rectangle (x + insets.left, 
                                                   y + insets.top, 
                                                   width, height)));
index 657e830..f161526 100644 (file)
@@ -39,6 +39,7 @@ exception statement from your version. */
 package gnu.java.awt.peer.gtk;
 
 import java.awt.EventQueue;
+import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 
 public class GtkGenericPeer
@@ -57,6 +58,11 @@ public class GtkGenericPeer
   // Dispose of our native state.
   public native void dispose ();
 
+  static EventQueue q ()
+  {
+    return Toolkit.getDefaultToolkit ().getSystemEventQueue ();
+  }
+
   protected GtkGenericPeer (Object awtWidget)
   {
     this.awtWidget = awtWidget;
@@ -70,7 +76,7 @@ public class GtkGenericPeer
 
   protected void postActionEvent (String command, int mods) 
   {
-    q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, 
+    q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, 
                                  command, mods));
   }
 
index 25473d7..3e3e2e3 100644 (file)
@@ -38,8 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.Component;
-import java.awt.Font;
 import java.awt.Label;
 import java.awt.peer.LabelPeer;
 
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java b/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java
deleted file mode 100644 (file)
index 4cbe190..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/* GtkMainThread.java -- Runs gtk_main()
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-public class GtkMainThread extends GtkGenericPeer implements Runnable
-{
-  private static Thread mainThread = null;
-  private static Object mainThreadLock = new Object();
-
-  // Whether the gtk+ subsystem has been initialized.
-  private boolean gtkInitCalled = false;
-
-  /**
-   * Call gtk_init.  It is very important that this happen before any other
-   * gtk calls.
-   *
-   * @param portableNativeSync 1 if the Java property
-   * gnu.classpath.awt.gtk.portable.native.sync is set to "true".  0 if it is
-   * set to "false".  -1 if unset.
-   */
-  static native void gtkInit(int portableNativeSync);
-  native void gtkMain();
-  
-  public GtkMainThread() 
-  {
-    super (null);
-    synchronized (mainThreadLock) 
-      {
-       if (mainThread != null)
-         throw new IllegalStateException();
-       mainThread = new Thread(this, "GtkMain");
-      }
-    
-    synchronized (this) 
-      {
-       mainThread.start();
-       
-       while (!gtkInitCalled)
-         {
-           try
-             {
-               wait();
-             }
-           catch (InterruptedException e) { }
-         }
-      }
-  }
-  
-  public void run() 
-  {
-    /* Pass the value of the gnu.classpath.awt.gtk.portable.native.sync system
-     * property to C. */ 
-    int portableNativeSync;     
-    String portNatSyncProp = 
-      System.getProperty("gnu.classpath.awt.gtk.portable.native.sync");
-
-    if (portNatSyncProp == null)
-      portableNativeSync = -1;  // unset
-    else if (Boolean.valueOf(portNatSyncProp).booleanValue())
-      portableNativeSync = 1;   // true
-    else
-      portableNativeSync = 0;   // false
-    
-    synchronized (this) 
-      {
-       gtkInit(portableNativeSync);
-       gtkInitCalled = true;
-       notifyAll();
-      }
-    gtkMain();
-  }
-}
-
-
-
index dd061ed..cd7ca8a 100644 (file)
@@ -38,8 +38,6 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.Font;
-import java.awt.MenuComponent;
 import java.awt.peer.MenuComponentPeer;
 
 public class GtkMenuComponentPeer extends GtkGenericPeer
index 81da90d..33242f6 100644 (file)
@@ -43,8 +43,6 @@ import java.awt.Menu;
 import java.awt.MenuComponent;
 import java.awt.MenuBar;
 import java.awt.MenuItem;
-import java.awt.peer.MenuBarPeer;
-import java.awt.peer.MenuComponentPeer;
 import java.awt.peer.MenuItemPeer;
 import java.awt.peer.MenuPeer;
 
index 233bed7..b99ef24 100644 (file)
@@ -41,7 +41,6 @@ package gnu.java.awt.peer.gtk;
 import java.awt.Adjustable;
 import java.awt.Dimension;
 import java.awt.ScrollPane;
-import java.awt.peer.ComponentPeer;
 import java.awt.peer.ScrollPanePeer;
 
 public class GtkScrollPanePeer extends GtkContainerPeer
index ef42896..d6a498c 100644 (file)
@@ -73,7 +73,7 @@ public class GtkScrollbarPeer extends GtkComponentPeer
 
   protected void postAdjustmentEvent (int type, int value)
   {
-    q.postEvent (new AdjustmentEvent ((Adjustable)awtComponent, 
+    q().postEvent (new AdjustmentEvent ((Adjustable)awtComponent, 
                                      AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                                      type, value));
   }
index 8893e36..3051ecf 100644 (file)
@@ -38,11 +38,8 @@ exception statement from your version. */
 
 package gnu.java.awt.peer.gtk;
 
-import java.awt.AWTEvent;
-import java.awt.Component;
 import java.awt.Rectangle;
 import java.awt.TextComponent;
-import java.awt.event.KeyEvent;
 import java.awt.event.TextEvent;
 import java.awt.peer.TextComponentPeer;
 
@@ -85,6 +82,6 @@ public class GtkTextComponentPeer extends GtkComponentPeer
 
   protected void postTextEvent ()
   {
-    q.postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED));
+    q().postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED));
   }
 }
index def22e9..f57f53a 100644 (file)
@@ -51,7 +51,6 @@ import java.awt.datatransfer.Clipboard;
 import java.awt.dnd.DragGestureEvent;
 import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.font.FontRenderContext;
-import java.awt.font.TextAttribute;
 import java.awt.im.InputMethodHighlight;
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
@@ -59,15 +58,17 @@ import java.awt.image.ImageConsumer;
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
 import java.awt.peer.*;
+import java.io.InputStream;
 import java.net.URL;
 import java.text.AttributedString;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.MissingResourceException;
 import java.util.Properties;
+import javax.imageio.spi.IIORegistry;
 
 /* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
    This merits comment.  We are basically calling Sun's bluff on this one.
@@ -86,9 +87,8 @@ import java.util.Properties;
 public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
   implements EmbeddedWindowSupport
 {
-  GtkMainThread main;
   Hashtable containers = new Hashtable();
-  static EventQueue q = new EventQueue();
+  static EventQueue q;
   static Clipboard systemClipboard;
   static boolean useGraphics2dSet;
   static boolean useGraphics2d;
@@ -103,19 +103,32 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
     return useGraphics2d;
   }
 
+  static native void gtkInit(int portableNativeSync);
+
   static
   {
     if (Configuration.INIT_LOAD_LIBRARY)
       System.loadLibrary("gtkpeer");
+
+    int portableNativeSync;     
+    String portNatSyncProp = 
+      System.getProperty("gnu.classpath.awt.gtk.portable.native.sync");
+    
+    if (portNatSyncProp == null)
+      portableNativeSync = -1;  // unset
+    else if (Boolean.valueOf(portNatSyncProp).booleanValue())
+      portableNativeSync = 1;   // true
+    else
+      portableNativeSync = 0;   // false
+
+    gtkInit(portableNativeSync);
   }
 
   public GtkToolkit ()
   {
-    main = new GtkMainThread ();
     systemClipboard = new GtkClipboard ();
-    GtkGenericPeer.enableQueue (q);
   }
-  
+
   native public void beep ();
   native private void getScreenSizeDimensions (int[] xy);
   
@@ -313,7 +326,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
                           "SansSerif" });
   }
 
-  private class LRUCache extends java.util.LinkedHashMap
+  private class LRUCache extends LinkedHashMap
   {    
     int max_entries;
     public LRUCache(int max)
@@ -333,15 +346,18 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
 
   public FontMetrics getFontMetrics (Font font) 
   {
-    if (metricsCache.containsKey(font))
-      return (FontMetrics) metricsCache.get(font);
-    else
+    synchronized (metricsCache)
+      {
+        if (metricsCache.containsKey(font))
+          return (FontMetrics) metricsCache.get(font);
+      }
+
+    FontMetrics m = new GdkFontMetrics (font);
+    synchronized (metricsCache)
       {
-        FontMetrics m;
-        m = new GdkFontMetrics (font);
         metricsCache.put(font, m);
-        return m;
-      }    
+      }
+    return m;
   }
 
   public Image getImage (String filename) 
@@ -594,6 +610,14 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
 
   protected EventQueue getSystemEventQueueImpl() 
   {
+    synchronized (GtkToolkit.class)
+      {
+        if (q == null)
+          {
+            q = new EventQueue();
+            GtkGenericPeer.enableQueue (q);
+          }
+      }    
     return q;
   }
 
@@ -609,19 +633,37 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
     throw new Error("not implemented");
   }
 
+  public Rectangle getBounds()
+  {
+    int[] dims = new int[2];
+    getScreenSizeDimensions(dims);
+    return new Rectangle(0, 0, dims[0], dims[1]);
+  }
+  
   // ClasspathToolkit methods
 
   public GraphicsEnvironment getLocalGraphicsEnvironment()
   {
-    GraphicsEnvironment ge;
-    ge = new GdkGraphicsEnvironment ();  
-    return ge;
+    return new GdkGraphicsEnvironment(this);
+  }
+
+  public Font createFont(int format, InputStream stream)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public RobotPeer createRobot (GraphicsDevice screen) throws AWTException
+  {
+    return new GdkRobotPeer (screen);
   }
 
-  public Font createFont(int format, java.io.InputStream stream)
+  public void registerImageIOSpis(IIORegistry reg)
   {
-    throw new java.lang.UnsupportedOperationException ();
+    GdkPixbufDecoder.registerSpis(reg);
   }
 
+  public native boolean nativeQueueEmpty();
+  public native void wakeNativeQueue();  
+  public native void iterateNativeQueue(EventQueue locked, boolean block);
 
 } // class GtkToolkit
index c61eecd..1d6e253 100644 (file)
@@ -39,7 +39,6 @@ exception statement from your version. */
 package gnu.java.awt.peer.gtk;
 
 import java.awt.Component;
-import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.Window;
 import java.awt.event.WindowEvent;
@@ -166,10 +165,12 @@ public class GtkWindowPeer extends GtkContainerPeer
        || frame_y != awtComponent.getY()
        || frame_width != awtComponent.getWidth()
        || frame_height != awtComponent.getHeight())
-      setBoundsCallback ((Window) awtComponent,
-                        frame_x, frame_y, frame_width, frame_height);
+      {
+        setBoundsCallback ((Window) awtComponent,
+                           frame_x, frame_y, frame_width, frame_height);
 
-    awtComponent.validate();
+        awtComponent.validate();
+      }
   }
 
   native void nativeSetVisible (boolean b);
@@ -192,7 +193,7 @@ public class GtkWindowPeer extends GtkContainerPeer
        // Post a WINDOW_OPENED event the first time this window is shown.
        if (!hasBeenShown)
          {
-           q.postEvent (new WindowEvent ((Window) awtComponent, id,
+           q().postEvent (new WindowEvent ((Window) awtComponent, id,
                                          opposite));
            hasBeenShown = true;
          }
@@ -201,12 +202,12 @@ public class GtkWindowPeer extends GtkContainerPeer
       {
        if (oldState != newState)
          {
-           q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite,
+           q().postEvent (new WindowEvent ((Window) awtComponent, id, opposite,
                                          oldState, newState));
            oldState = newState;
          }
       }
     else
-      q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite));
+      q().postEvent (new WindowEvent ((Window) awtComponent, id, opposite));
   }
 }
index cf4d7d6..235c8ed 100644 (file)
@@ -525,6 +525,9 @@ void _Jv_SetCurrentJNIEnv (_Jv_JNIEnv *);
 /* Free a JNIEnv. */
 void _Jv_FreeJNIEnv (_Jv_JNIEnv *);
 
+/* Free a JNIEnv. */
+void _Jv_FreeJNIEnv (_Jv_JNIEnv *);
+
 struct _Jv_JavaVM;
 _Jv_JavaVM *_Jv_GetJavaVM (); 
 
index 53e64b7..1519f1d 100644 (file)
@@ -1,5 +1,5 @@
 /* AWTKeyStroke.java -- an immutable key stroke
-   Copyright (C) 2002, 2004  Free Software Foundation
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -393,15 +393,16 @@ public class AWTKeyStroke implements Serializable
    * </code>      
    *
    * @param s the string to parse
+   * @throws IllegalArgumentException if s is null or cannot be parsed
    * @return the specified keystroke
-   * @throws NullPointerException if s is null
-   * @throws IllegalArgumentException if s cannot be parsed
    */
   public static AWTKeyStroke getAWTKeyStroke(String s)
   {
+    if (s == null)
+      throw new IllegalArgumentException("null argument");
     StringTokenizer t = new StringTokenizer(s, " ");
     if (! t.hasMoreTokens())
-      throw new IllegalArgumentException();
+      throw new IllegalArgumentException("no tokens '" + s + "'");
     int modifiers = 0;
     boolean released = false;
     String token = null;
@@ -432,7 +433,8 @@ public class AWTKeyStroke implements Serializable
                                          KeyEvent.VK_UNDEFINED, modifiers,
                                          false);
               }
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("Invalid 'typed' argument '"
+                                              + s + "'");
           }
         else if ("pressed".equals(token))
           {
@@ -453,8 +455,11 @@ public class AWTKeyStroke implements Serializable
     while (t.hasMoreTokens());
     // Now token contains the VK name we must parse.
     Integer code = (Integer) vktable.get(token);
-    if (code == null || t.hasMoreTokens())
-      throw new IllegalArgumentException();
+    if (code == null)
+      throw new IllegalArgumentException("Unknown token '" + token
+                                        + "' in '" + s + "'");
+    if (t.hasMoreTokens())
+      throw new IllegalArgumentException("Too many tokens: " + s);
     return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, code.intValue(),
                            modifiers, released);
   }
index e302a0e..b177254 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicStroke.java -- 
-   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -48,6 +48,7 @@ public class BasicStroke implements Stroke
   public static final int JOIN_MITER = 0;
   public static final int JOIN_ROUND = 1;
   public static final int JOIN_BEVEL = 2;
+
   public static final int CAP_BUTT = 0;
   public static final int CAP_ROUND = 1;
   public static final int CAP_SQUARE = 2;
@@ -208,11 +209,34 @@ public class BasicStroke implements Stroke
     return phase;
   }
 
+  /**
+   * Returns the hash code for this object. The hash is calculated by
+   * xoring the hash, cap, join, limit, dash array and phase values
+   * (converted to <code>int</code> first with
+   * <code>Float.floatToIntBits()</code> if the value is a
+   * <code>float</code>).
+   */
   public int hashCode()
   {
-    throw new Error("not implemented");
+    int hash = Float.floatToIntBits(width);
+    hash ^= cap;
+    hash ^= join;
+    hash ^= Float.floatToIntBits(limit);
+   
+    if (dash != null)
+      for (int i = 0; i < dash.length; i++)
+       hash ^=  Float.floatToIntBits(dash[i]);
+
+    hash ^= Float.floatToIntBits(phase);
+
+    return hash;
   }
 
+  /**
+   * Returns true if the given Object is an instance of BasicStroke
+   * and the width, cap, join, limit, dash array and phase are all
+   * equal.
+   */
   public boolean equals(Object o)
   {
     if (! (o instanceof BasicStroke))
index 86cb37c..0458ebb 100644 (file)
@@ -47,7 +47,6 @@ import java.util.EventListener;
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRelation;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleValue;
 
@@ -429,9 +428,18 @@ paramString()
     + getWidth () + "x" + getHeight () + ",label=" + getLabel ();
 }
 
+/**
+ * Gets the AccessibleContext associated with this <code>Button</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
 public AccessibleContext getAccessibleContext()
 {
-  return new AccessibleAWTButton();
+  /* Create the context if this is the first request */
+  if (accessibleContext == null)
+    accessibleContext = new AccessibleAWTButton();
+  return accessibleContext;
 }
 
   /**
index d177c9b..05055f2 100644 (file)
@@ -174,10 +174,7 @@ public class Canvas
   {
     /* Create the context if this is the first request */
     if (accessibleContext == null)
-      {
-        /* Create the context */
-        accessibleContext = new AccessibleAWTCanvas();
-      }
+      accessibleContext = new AccessibleAWTCanvas();
     return accessibleContext;
   }
 
index 04ace46..b3fc4c2 100644 (file)
@@ -48,6 +48,7 @@ import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 import javax.accessibility.AccessibleValue;
 
 /**
@@ -55,7 +56,7 @@ import javax.accessibility.AccessibleValue;
  * or more Checkboxes can be grouped by a CheckboxGroup.
  *
  * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
  */
 public class Checkbox extends Component
   implements ItemSelectable, Accessible, Serializable
@@ -94,13 +95,38 @@ private boolean state;
 // The list of listeners for this object.
 private transient ItemListener item_listeners;
 
-protected class AccessibleAWTCheckBox
+/**
+ * This class provides accessibility support for the
+ * checkbox.
+ *
+ * @author Jerry Quinn  (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+protected class AccessibleAWTCheckbox
   extends AccessibleAWTComponent
   implements ItemListener, AccessibleAction, AccessibleValue
 {
-  
 
-  /* (non-Javadoc)
+  /**
+   * Serialization constant to match JDK 1.5
+   */
+  private static final long serialVersionUID = 7881579233144754107L;
+
+  /**
+   * Default constructor which simply calls the
+   * super class for generic component accessibility
+   * handling.
+   */
+  public AccessibleAWTCheckbox()
+  {
+    super();
+  }
+
+  /**
+   * Captures changes to the state of the checkbox and
+   * fires appropriate accessible property change events.
+   *
+   * @param event the event fired.
    * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
    */
   public void itemStateChanged(ItemEvent event)
@@ -110,58 +136,121 @@ protected class AccessibleAWTCheckBox
                        state ? AccessibleState.CHECKED : null);
   }
   
+  /**
+   * Returns an implementation of the <code>AccessibleAction</code>
+   * interface for this accessible object.  In this case, the
+   * current instance is simply returned (with a more appropriate
+   * type), as it also implements the accessible action as well as
+   * the context.
+   *
+   * @return the accessible action associated with this context.
+   * @see javax.accessibility.AccessibleAction
+   */
   public AccessibleAction getAccessibleAction()
   {
     return this;
   }
   
+  /**
+   * Returns an implementation of the <code>AccessibleValue</code>
+   * interface for this accessible object.  In this case, the
+   * current instance is simply returned (with a more appropriate
+   * type), as it also implements the accessible value as well as
+   * the context.
+   *
+   * @return the accessible value associated with this context.
+   * @see javax.accessibility.AccessibleValue
+   */
   public AccessibleValue getAccessibleValue()
   {
     return this;
   }
   
-  /* (non-Javadoc)
+  /* 
+   * The following methods are implemented in the JDK (up to
+   * 1.5) as stubs.  We do likewise here.
+   */
+
+  /**
+   * Returns the number of actions associated with this accessible
+   * object.  This default implementation returns 0.
+   *
+   * @return the number of accessible actions available.
    * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
    */
   public int getAccessibleActionCount()
   {
-    // 1.4.1 does this
+    // 1.4.1 and 1.5 do this
     return 0;
   }
 
-  /* (non-Javadoc)
+  /**
+   * Returns a description of the action with the supplied id.
+   * This default implementation always returns null.
+   *
+   * @param i the id of the action whose description should be
+   *          retrieved.
+   * @return a <code>String</code> describing the action.
    * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
    */
   public String getAccessibleActionDescription(int i)
   {
+    // 1.5 does this
     return null;
   }
 
-  /* (non-Javadoc)
+  /**
+   * Executes the action with the specified id.  This
+   * default implementation simply returns false.
+   *
+   * @param i the id of the action to perform.
+   * @return true if the action was performed.
    * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
    */
   public boolean doAccessibleAction(int i)
   {
+    // 1.5 does this
     return false;
   }
 
-  /* (non-Javadoc)
+  /**
+   * Returns the current value of this accessible object.
+   * If no value has been set, null is returned.  This
+   * default implementation always returns null, regardless.
+   *
+   * @return the numeric value of this object, or null if
+   *         no value has been set.
    * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
    */
   public Number getCurrentAccessibleValue()
   {
+    // 1.5 does this
     return null;
   }
 
-  /* (non-Javadoc)
+  /**
+   * Sets the current value of this accessible object
+   * to that supplied.  In this default implementation,
+   * the value is never set and the method always returns
+   * false.
+   *
+   * @param number the new accessible value.
+   * @return true if the value was set.
    * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
    */
   public boolean setCurrentAccessibleValue(Number number)
   {
+    // 1.5 does this
     return false;
   }
 
-  /* (non-Javadoc)
+  /**
+   * Returns the minimum acceptable accessible value used
+   * by this object, or null if no minimum value exists.
+   * This default implementation always returns null.
+   *
+   * @return the minimum acceptable accessible value, or null
+   *         if there is no minimum.
    * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
    */
   public Number getMinimumAccessibleValue()
@@ -169,7 +258,13 @@ protected class AccessibleAWTCheckBox
     return null;
   }
 
-  /* (non-Javadoc)
+  /**
+   * Returns the maximum acceptable accessible value used
+   * by this object, or null if no maximum value exists.
+   * This default implementation always returns null.
+   *
+   * @return the maximum acceptable accessible value, or null
+   *         if there is no maximum.
    * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
    */
   public Number getMaximumAccessibleValue()
@@ -177,11 +272,35 @@ protected class AccessibleAWTCheckBox
     return null;
   }
   
+  /**
+   * Returns the role of this accessible object.
+   *
+   * @return the instance of <code>AccessibleRole</code>,
+   *         which describes this object.
+   * @see javax.accessibility.AccessibleRole
+   */
   public AccessibleRole getAccessibleRole() 
   {
     return AccessibleRole.CHECK_BOX;
   }
   
+  /**
+   * Returns the state set of this accessible object.
+   *
+   * @return a set of <code>AccessibleState</code>s
+   *         which represent the current state of the
+   *         accessible object.
+   * @see javax.accessibility.AccessibleState
+   * @see javax.accessibility.AccessibleStateSet
+   */
+  public AccessibleStateSet getAccessibleStateSet()
+  {
+    AccessibleStateSet set = super.getAccessibleStateSet();
+    if (state)
+      set.add(AccessibleState.CHECKED);
+    return set;
+  }
+
 }
 
 /*************************************************************************/
@@ -490,11 +609,22 @@ paramString()
          + "," + super.paramString());
 }
 
+/**
+ * Gets the AccessibleContext associated with this <code>Checkbox</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
 public AccessibleContext getAccessibleContext()
 {
-  AccessibleAWTCheckBox ac = new AccessibleAWTCheckBox();
-  addItemListener(ac);
-  return ac;
+  /* Create the context if this is the first request */
+  if (accessibleContext == null)
+  {
+    AccessibleAWTCheckbox ac = new AccessibleAWTCheckbox();
+    accessibleContext = ac;
+    addItemListener(ac);
+  }
+  return accessibleContext;
 }
 
 } // class Checkbox 
index ab4cb60..6b9002a 100644 (file)
@@ -43,6 +43,11 @@ import java.awt.event.ItemListener;
 import java.awt.peer.CheckboxMenuItemPeer;
 import java.util.EventListener;
 
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleValue;
+
 /**
   * This class implements a menu item that has a checkbox on it indicating
   * the selected state of some option.
@@ -50,7 +55,8 @@ import java.util.EventListener;
   * @author Aaron M. Renn (arenn@urbanophile.com)
   * @author Tom Tromey <tromey@redhat.com>
   */
-public class CheckboxMenuItem extends MenuItem implements ItemSelectable
+public class CheckboxMenuItem extends MenuItem
+  implements ItemSelectable, Accessible
 {
 
 /*
@@ -268,6 +274,14 @@ processItemEvent(ItemEvent event)
 void
 dispatchEventImpl(AWTEvent e)
 {
+  if (e instanceof ItemEvent)
+    {
+      synchronized (this)
+        {
+          state = (((ItemEvent) e).getStateChange() == ItemEvent.SELECTED);
+        }
+    }
+
   if (e.id <= ItemEvent.ITEM_LAST 
       && e.id >= ItemEvent.ITEM_FIRST
       && (item_listeners != null 
@@ -315,5 +329,27 @@ paramString()
   {
     return (ItemListener[]) getListeners (ItemListener.class);
   }
+
+
+  protected class AccessibleAWTCheckboxMenuItem extends AccessibleAWTMenuItem
+    implements AccessibleAction, AccessibleValue
+  {
+    // I think the base class provides the necessary implementation
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>CheckboxMenuItem</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTCheckboxMenuItem();
+    return accessibleContext;
+  }
+
 } // class CheckboxMenuItem
 
index 89e91ca..c6a532a 100644 (file)
@@ -45,6 +45,7 @@ import java.io.Serializable;
 import java.util.EventListener;
 import java.util.Vector;
 
+import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
@@ -54,7 +55,8 @@ import javax.accessibility.AccessibleRole;
   *
   * @author Aaron M. Renn (arenn@urbanophile.com)
   */
-public class Choice extends Component implements ItemSelectable, Serializable
+public class Choice extends Component
+  implements ItemSelectable, Serializable, Accessible
 {
 
 /*
@@ -83,23 +85,65 @@ private int selectedIndex = -1;
 // Listener chain
 private ItemListener item_listeners;
 
+/**
+ * This class provides accessibility support for the
+ * combo box.
+ *
+ * @author Jerry Quinn  (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
   protected class AccessibleAWTChoice
-    extends Component.AccessibleAWTComponent
-    implements AccessibleAction
+  extends AccessibleAWTComponent
+  implements AccessibleAction
   {
+
+    /**
+     * Serialization constant to match JDK 1.5
+     */
+    private static final long serialVersionUID = 7175603582428509322L;
+
+    /**
+     * Default constructor which simply calls the
+     * super class for generic component accessibility
+     * handling.
+     */
+    public AccessibleAWTChoice()
+    {
+      super();
+    }
+
+    /**
+     * Returns an implementation of the <code>AccessibleAction</code>
+     * interface for this accessible object.  In this case, the
+     * current instance is simply returned (with a more appropriate
+     * type), as it also implements the accessible action as well as
+     * the context.
+     *
+     * @return the accessible action associated with this context.
+     * @see javax.accessibility.AccessibleAction
+     */
     public AccessibleAction getAccessibleAction()
     {
       return this;
     }
 
-    // FIXME: I think this is right, but should be checked by someone who
-    // knows better.
+    /**
+     * Returns the role of this accessible object.
+     *
+     * @return the instance of <code>AccessibleRole</code>,
+     *         which describes this object.
+     * @see javax.accessibility.AccessibleRole
+     */
     public AccessibleRole getAccessibleRole()
     {
-      return AccessibleRole.POPUP_MENU;
+      return AccessibleRole.COMBO_BOX;
     }
          
-    /* (non-Javadoc)
+    /**
+     * Returns the number of actions associated with this accessible
+     * object.  In this case, it is the number of choices available.
+     *
+     * @return the number of choices available.
      * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
      */
     public int getAccessibleActionCount()
@@ -107,7 +151,14 @@ private ItemListener item_listeners;
       return pItems.size();
     }
 
-    /* (non-Javadoc)
+    /**
+     * Returns a description of the action with the supplied id.
+     * In this case, it is the text used in displaying the particular
+     * choice on-screen.
+     *
+     * @param i the id of the choice whose description should be
+     *          retrieved.
+     * @return the <code>String</code> used to describe the choice.
      * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
      */
     public String getAccessibleActionDescription(int i)
@@ -115,7 +166,13 @@ private ItemListener item_listeners;
       return (String) pItems.get(i);
     }
          
-    /* (non-Javadoc)
+    /**
+     * Executes the action with the specified id.  In this case,
+     * calling this method provides the same behaviour as would
+     * choosing a choice from the list in a visual manner.
+     *
+     * @param i the id of the choice to select.
+     * @return true if a valid choice was specified.
      * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
      */
     public boolean doAccessibleAction(int i)
@@ -564,8 +621,17 @@ paramString()
     return (ItemListener[]) getListeners (ItemListener.class);
   }
 
+  /**
+   * Gets the AccessibleContext associated with this <code>Choice</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
   public AccessibleContext getAccessibleContext()
   {
-    return new AccessibleAWTChoice();
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTChoice();
+    return accessibleContext;
   }
 } // class Choice 
index cb47f77..3a7960c 100644 (file)
@@ -1080,7 +1080,7 @@ public abstract class Component
    *
    * @return the locale for this component
    * @throws IllegalComponentStateException if it has no locale or parent
-   * @see setLocale(Locale)
+   * @see #setLocale(Locale)
    * @since 1.1
    */
   public Locale getLocale()
@@ -1362,7 +1362,7 @@ public abstract class Component
       peer.setBounds (x, y, width, height);
 
     // Erase old bounds and repaint new bounds for lightweights.
-    if (isLightweight())
+    if (isLightweight() && isShowing ())
       {
         boolean shouldRepaintParent = false;
         boolean shouldRepaintSelf = false;
@@ -1386,13 +1386,16 @@ public abstract class Component
           repaint();
       }
 
-    if (oldx != x || oldy != y)
+    // Only post event if this component is visible and has changed size.
+    if (isShowing ()
+        && (oldx != x || oldy != y))
       {
         ComponentEvent ce = new ComponentEvent(this,
                                                ComponentEvent.COMPONENT_MOVED);
         getToolkit().getSystemEventQueue().postEvent(ce);
       }
-    if (oldwidth != width || oldheight != height)
+    if (isShowing ()
+        && (oldwidth != width || oldheight != height))
       {
         ComponentEvent ce = new ComponentEvent(this,
                                                ComponentEvent.COMPONENT_RESIZED);
@@ -1955,7 +1958,7 @@ public abstract class Component
    * @see Graphics#drawImage(Image, int, int, ImageObserver)
    * @see Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)
    * @see Graphics#drawImage(Image, int, int, int, int, ImageObserver)
-   * @see ImageObserver#update(Image, int, int, int, int, int)
+   * @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
    */
   public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
   {
@@ -2097,7 +2100,7 @@ public abstract class Component
    * @param observer the observer to notify of image loading progress
    * @return the image observer flags indicating the status of the load
    * @see #prepareImage(Image, int, int, ImageObserver)
-   * @see #Toolkit#checkImage(Image, int, int, ImageObserver)
+   * @see Toolkit#checkImage(Image, int, int, ImageObserver)
    * @throws NullPointerException if image is null
    */
   public int checkImage(Image image, ImageObserver observer)
@@ -2115,7 +2118,7 @@ public abstract class Component
    * @param observer the observer to notify of image loading progress
    * @return the image observer flags indicating the status of the load
    * @see #prepareImage(Image, int, int, ImageObserver)
-   * @see #Toolkit#checkImage(Image, int, int, ImageObserver)
+   * @see Toolkit#checkImage(Image, int, int, ImageObserver)
    */
   public int checkImage(Image image, int width, int height,
                         ImageObserver observer)
@@ -2134,7 +2137,7 @@ public abstract class Component
    * @param ignoreRepaint the new setting for ignoring repaint events
    * @see #getIgnoreRepaint()
    * @see BufferStrategy
-   * @see GraphicsDevice.setFullScreenWindow(Window)
+   * @see GraphicsDevice#setFullScreenWindow(Window)
    * @since 1.4
    */
   public void setIgnoreRepaint(boolean ignoreRepaint)
@@ -2250,9 +2253,9 @@ public abstract class Component
    * calls {@link #postEvent}.
    *
    * @param e the event to deliver
-   * @deprecated use {@link #dispatchEvent(AWTEvent)} instead
+   * @deprecated use {@link #dispatchEvent (AWTEvent)} instead
    */
-  public void deliverEvent(Event e)
+  public void deliverEvent (Event e)
   {
     postEvent (e);
   }
@@ -2284,7 +2287,7 @@ public abstract class Component
    * @return true if the event was handled, false otherwise
    * @deprecated use {@link #dispatchEvent(AWTEvent)} instead
    */
-  public boolean postEvent(Event e)
+  public boolean postEvent (Event e)
   {
     boolean handled = handleEvent (e);
 
@@ -3178,8 +3181,8 @@ public abstract class Component
    * AWT 1.0 event handler.
    *
    * This method calls one of the event-specific handler methods.  For
-   * example for key events, either {@link #keyDown (Event evt, int
-   * key)} or {@link keyUp (Event evt, int key)} is called.  A derived
+   * example for key events, either {@link #keyDown(Event,int)}
+   * or {@link #keyUp(Event,int)} is called.  A derived
    * component can override one of these event-specific methods if it
    * only needs to handle certain event types.  Otherwise it can
    * override handleEvent itself and handle any event.
@@ -3188,7 +3191,7 @@ public abstract class Component
    * @return true if the event was handled, false otherwise
    * @deprecated use {@link #processEvent(AWTEvent)} instead
    */
-  public boolean handleEvent(Event evt)
+  public boolean handleEvent (Event evt)
   {
     switch (evt.id)
       {
@@ -3405,9 +3408,15 @@ public abstract class Component
    */
   public void removeNotify()
   {
-    if (peer != null)
-      peer.dispose();
+    // We null our peer field before disposing of it, such that if we're
+    // not the event dispatch thread and the dispatch thread is awoken by
+    // the dispose call, there will be no race checking the peer's null
+    // status.
+
+    ComponentPeer tmp = peer;
     peer = null;
+    if (tmp != null)
+      tmp.dispose();
   }
 
   /**
@@ -3469,8 +3478,8 @@ public abstract class Component
    * Specify whether this component can receive focus. This method also
    * sets the {@link #isFocusTraversableOverridden} field to 1, which
    * appears to be the undocumented way {@link
-   * DefaultFocusTraversalPolicy#accept()} determines whether to respect
-   * the {@link #isFocusable()} method of the component.
+   * DefaultFocusTraversalPolicy#accept(Component)} determines whether to
+   * respect the {@link #isFocusable()} method of the component.
    *
    * @param focusable the new focusable status
    * @since 1.4
@@ -3484,10 +3493,10 @@ public abstract class Component
 
   /**
    * Sets the focus traversal keys for one of the three focus
-   * traversal directions supported by Components: {@link
-   * #KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}, {@link
-   * #KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, or {@link
-   * #KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}. Normally, the
+   * traversal directions supported by Components:
+   * {@link #KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS},
+   * {@link #KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, or
+   * {@link #KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}. Normally, the
    * default values should match the operating system's native
    * choices. To disable a given traversal, use
    * <code>Collections.EMPTY_SET</code>. The event dispatcher will
@@ -3716,7 +3725,7 @@ public abstract class Component
    * receives a FOCUS_GAINED event.
    *
    * The behaviour of this method is platform-dependent.
-   * {@link #requestFocusInWindow} should be used instead.
+   * {@link #requestFocusInWindow()} should be used instead.
    *
    * @see #requestFocusInWindow ()
    * @see FocusEvent
@@ -3791,7 +3800,7 @@ public abstract class Component
    * receives a FOCUS_GAINED event.
    *
    * The behaviour of this method is platform-dependent.
-   * {@link #requestFocusInWindow} should be used instead.
+   * {@link #requestFocusInWindow()} should be used instead.
    *
    * If the return value is false, the request is guaranteed to fail.
    * If the return value is true, the request will succeed unless it
@@ -3855,10 +3864,10 @@ public abstract class Component
                                                          currentFocusOwner));
                           }
                         else
-                    eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+                          eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+                      }
                   }
               }
-              }
             else
               // FIXME: need to add a focus listener to our top-level
               // ancestor, so that we can post this event when it becomes
@@ -3973,10 +3982,10 @@ public abstract class Component
                                                              currentFocusOwner));
                               }
                             else
-                        eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+                              eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
+                          }
                       }
                   }
-                  }
                 else
                   return false;
               }
@@ -4069,8 +4078,8 @@ public abstract class Component
    * However, if this is a Window, the default focus owner in the
    * window in the current focus cycle is focused instead.
    *
-   * @see #requestFocus ()
-   * @see #isFocusCycleRoot ()
+   * @see #requestFocus()
+   * @see #isFocusCycleRoot(Container)
    * @since 1.4
    */
   public void transferFocusUpCycle ()
index 6c835d2..6c5dec2 100644 (file)
@@ -1,5 +1,5 @@
 /* Container.java -- parent container class in AWT
-   Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -387,11 +387,14 @@ public class Container extends Component
               layoutMgr.addLayoutComponent(null, comp);
           }
 
-        // Post event to notify of adding the container.
-        ContainerEvent ce = new ContainerEvent(this,
-                                               ContainerEvent.COMPONENT_ADDED,
-                                               comp);
-        getToolkit().getSystemEventQueue().postEvent(ce);
+        if (isShowing ())
+          {
+            // Post event to notify of adding the component.
+            ContainerEvent ce = new ContainerEvent(this,
+                                                   ContainerEvent.COMPONENT_ADDED,
+                                                   comp);
+            getToolkit().getSystemEventQueue().postEvent(ce);
+          }
       }
   }
 
@@ -419,11 +422,14 @@ public class Container extends Component
 
         r.parent = null;
 
-        // Post event to notify of adding the container.
-        ContainerEvent ce = new ContainerEvent(this,
-                                               ContainerEvent.COMPONENT_REMOVED,
-                                               r);
-        getToolkit().getSystemEventQueue().postEvent(ce);
+        if (isShowing ())
+          {
+            // Post event to notify of removing the component.
+            ContainerEvent ce = new ContainerEvent(this,
+                                                   ContainerEvent.COMPONENT_REMOVED,
+                                                   r);
+            getToolkit().getSystemEventQueue().postEvent(ce);
+          }
       }
   }
 
@@ -1046,11 +1052,14 @@ public class Container extends Component
    */
   protected String paramString()
   {
-    String param = super.paramString();
-    if (layoutMgr != null)
-      param = param + ",layout=" + layoutMgr.getClass().getName();
+    if (layoutMgr == null)
+      return super.paramString();
 
-    return param;
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",layout=");
+    sb.append(layoutMgr.getClass().getName());
+    return sb.toString();
   }
 
   /**
index 800b01d..9c94d8a 100644 (file)
@@ -226,7 +226,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
         Component focusOwner = getGlobalPermanentFocusOwner ();
 
         if (focusOwner != null)
-        processKeyEvent (focusOwner, (KeyEvent) e);
+          processKeyEvent (focusOwner, (KeyEvent) e);
 
         if (e.isConsumed ())
           return true;
index 6bfb80c..30631b3 100644 (file)
@@ -40,6 +40,11 @@ package java.awt;
 
 import java.awt.peer.DialogPeer;
 
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
 /**
  * A dialog box widget class.
  *
@@ -511,5 +516,38 @@ paramString()
 
     this.undecorated = undecorated;
   }
+  
+  protected class AccessibleAWTDialog extends AccessibleAWTWindow
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.DIALOG;
+    }
+    
+    public AccessibleStateSet getAccessibleState()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (isResizable())
+        states.add(AccessibleState.RESIZABLE);
+      if (isModal())
+        states.add(AccessibleState.MODAL);
+      return states;
+    }
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>Dialog</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTDialog();
+    return accessibleContext;
+  }
+
 } // class Dialog
 
index 0803ff6..d55f0f5 100644 (file)
@@ -53,7 +53,6 @@ class EventDispatchThread extends Thread
     setName("AWT-EventQueue-" + ++dispatchThreadNum);
     this.queue = queue;
     setPriority(NORM_PRIORITY + 1);
-    start();
   }
 
   public void run()
@@ -63,11 +62,6 @@ class EventDispatchThread extends Thread
         try
        {
          AWTEvent evt = queue.getNextEvent();
-         if (isInterrupted ())
-           {
-             // We are interrupted when we should finish executing
-             return;
-           }
 
           KeyboardFocusManager manager;
           manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
@@ -80,6 +74,11 @@ class EventDispatchThread extends Thread
           if (!manager.dispatchEvent (evt))
             queue.dispatchEvent(evt);
        }
+        catch (ThreadDeath death)
+        {
+          // If someone wants to kill us, let them.
+          return;
+        }
        catch (InterruptedException ie)
        {
          // We are interrupted when we should finish executing
index fd1c806..fc0926c 100644 (file)
@@ -40,9 +40,12 @@ package java.awt;
 import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
 import java.awt.event.InvocationEvent;
+import java.awt.event.WindowEvent;
 import java.lang.reflect.InvocationTargetException;
 import java.util.EmptyStackException;
 
+import gnu.java.awt.ClasspathToolkit;
+
 /* Written using on-line Java 2 Platform Standard Edition v1.3 API 
  * Specification, as well as "The Java Class Libraries", 2nd edition 
  * (Addison-Wesley, 1998).
@@ -71,6 +74,35 @@ public class EventQueue
   private long lastWhen = System.currentTimeMillis();
 
   private EventDispatchThread dispatchThread = new EventDispatchThread(this);
+  private boolean shutdown = false;
+
+  private long lastNativeQueueAccess = 0;
+  private long humanLatencyThreshold = 100;
+
+  synchronized void setShutdown (boolean b) 
+  {
+    shutdown = b;
+  }
+
+  synchronized boolean isShutdown ()
+  {
+    if (shutdown)
+      return true;
+
+    // This is the exact self-shutdown condition specified in J2SE:
+    // http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/AWTThreadIssues.html
+    
+    if (peekEvent() == null
+        && ((ClasspathToolkit) Toolkit.getDefaultToolkit()).nativeQueueEmpty())
+      {
+        Frame[] frames = Frame.getFrames();
+        for (int i = 0; i < frames.length; ++i)
+          if (frames[i].isDisplayable())
+            return false;
+        return true;
+      }
+    return false;
+  }
 
   /**
    * Initializes a new instance of <code>EventQueue</code>.
@@ -93,9 +125,51 @@ public class EventQueue
   {
     if (next != null)
       return next.getNextEvent();
+    
+    ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit());
+    long curr = System.currentTimeMillis();
+
+    if (! tk.nativeQueueEmpty() &&
+        (curr - lastNativeQueueAccess > humanLatencyThreshold))
+      {
+        tk.iterateNativeQueue(this, false);
+        lastNativeQueueAccess = curr;
+      }
 
     while (next_in == next_out)
-      wait();
+      {
+        // Only the EventDispatchThread associated with the top of the stack is
+        // allowed to get events from the native source; everyone else just
+        // waits on the head of the queue.
+
+        if (isDispatchThread())
+          {
+            // We are not allowed to return null from this method, yet it
+            // is possible that we actually have run out of native events
+            // in the enclosing while() loop, and none of the native events
+            // happened to cause AWT events. We therefore ought to check
+            // the isShutdown() condition here, before risking a "native
+            // wait". If we check it before entering this function we may
+            // wait forever for events after the shutdown condition has
+            // arisen.
+
+            if (isShutdown())
+              throw new InterruptedException();
+
+            tk.iterateNativeQueue(this, true);
+            lastNativeQueueAccess = System.currentTimeMillis();
+          }
+        else
+          {
+            try
+              {
+                wait();
+              }
+            catch (InterruptedException ie)
+              {
+              }
+          }
+      }
 
     AWTEvent res = queue[next_out];
 
@@ -215,6 +289,22 @@ public class EventQueue
         next_out = 0;
         next_in = oldQueue.length;
       }
+    
+    if (dispatchThread == null || !dispatchThread.isAlive())
+      {
+        dispatchThread = new EventDispatchThread(this);
+        dispatchThread.start();
+      }
+
+    // Window events might represent the closing of a window, which
+    // might cause the end of the dispatch thread's life, so we'll wake
+    // it up here to give it a chance to check for shutdown.
+
+    if (!isDispatchThread() 
+        || (evt.getID() == WindowEvent.WINDOW_CLOSED)
+        || (evt.getID() == WindowEvent.WINDOW_CLOSING))
+      ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
+
     notify();
   }
 
@@ -386,9 +476,10 @@ public class EventQueue
            next_in = 0;
            next_out = 0;
 
-            // Tell our EventDispatchThread that it can end execution
-            dispatchThread.interrupt ();
+            ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
+            setShutdown(true);
            dispatchThread = null;
+            this.notifyAll();
           }
       }
   }
index 80d2c99..465a268 100644 (file)
@@ -39,8 +39,16 @@ exception statement from your version. */
 package java.awt;
 
 import java.awt.peer.FramePeer;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.Vector;
 
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
 /**
   * This class is a top-level window with a title bar and window
   * decorations.
@@ -196,7 +204,7 @@ private String title = "";
    */
   private boolean undecorated = false;
 
-/*
+  /*
    * The number used to generate the name returned by getName.
    */
   private static transient long next_frame_number;
@@ -209,6 +217,7 @@ public
 Frame()
 {
   this("");
+  noteFrame(this);
 }
 
 /**
@@ -224,6 +233,7 @@ Frame(String title)
   this.title = title;
   // Top-level frames are initially invisible.
   visible = false;
+  noteFrame(this);
 }
 
 public
@@ -231,6 +241,7 @@ Frame(GraphicsConfiguration gc)
 {
   super(gc);
   visible = false;
+  noteFrame(this);
 }
 
 public
@@ -239,6 +250,7 @@ Frame(String title, GraphicsConfiguration gc)
   super(gc);
   setTitle(title);
   visible = false;
+  noteFrame(this);
 }
 
 /**
@@ -391,6 +403,12 @@ remove(MenuComponent menu)
 /**
   * Notifies this frame that it should create its native peer.
   */
+
+private static void fireDummyEvent()
+{
+  EventQueue.invokeLater(new Runnable() { public void run() { } });
+}
+
 public void
 addNotify()
 {
@@ -398,6 +416,12 @@ addNotify()
     menuBar.addNotify();
   if (peer == null)
     peer = getToolkit ().createFrame (this);
+
+  // We now know there's a Frame (us) with a live peer, so we can start the
+  // fundamental queue and dispatch thread, by inserting a dummy event.
+  if (parent != null && parent.isDisplayable())
+    fireDummyEvent();
+  
   super.addNotify();
 }
 
@@ -406,15 +430,21 @@ public void removeNotify()
   if (menuBar != null)
     menuBar.removeNotify();
   super.removeNotify();
+
+  // By now we've been disconnected from the peer, and the peer set to
+  // null.  This is formally the same as saying "we just became
+  // un-displayable", so we wake up the event queue with a dummy event to
+  // see if it's time to shut down.
+  fireDummyEvent();
 }
 
-/**
-  * Returns a debugging string describing this window.
-  *
-  * @return A debugging string describing this window.
-  */
+  /**
+   * Returns a debugging string describing this window.
+   *
+   * @return A debugging string describing this window.
+   */
   protected String paramString ()
-{
+  {
     String title = getTitle ();
 
     String resizable = "";
@@ -442,15 +472,43 @@ public void removeNotify()
       }
 
     return super.paramString () + ",title=" + title + resizable + state;
+  }
+
+private static ArrayList weakFrames = new ArrayList();
+
+private static void noteFrame(Frame f)
+{
+  weakFrames.add(new WeakReference(f));
 }
 
-public static Frame[]
-getFrames()
+public static Frame[] getFrames()
 {
-  //Frame[] array = new Frames[frames.size()];
-  //return frames.toArray(array);
-  String msg = "FIXME: can't be implemented without weak references";
-  throw new UnsupportedOperationException(msg);
+  int n = 0;
+  synchronized (weakFrames)
+    {
+      Iterator i = weakFrames.iterator();
+      while (i.hasNext())
+        {
+          WeakReference wr = (WeakReference) i.next();
+          if (wr.get() != null)
+            ++n;
+        }
+      if (n == 0)
+        return new Frame[0];
+      else
+        {
+          Frame[] frames = new Frame[n];
+          n = 0;
+          i = weakFrames.iterator();
+          while (i.hasNext())
+            {
+              WeakReference wr = (WeakReference) i.next();
+              if (wr.get() != null)
+                frames[n++] = (Frame) wr.get();
+            }
+          return frames;
+        }
+    }
 }
 
   public void setState (int state)
@@ -549,4 +607,37 @@ getFrames()
   {
     return next_frame_number++;
   }
+  
+  protected class AccessibleAWTFrame extends AccessibleAWTWindow
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.FRAME;
+    }
+    
+    public AccessibleStateSet getAccessibleState()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (isResizable())
+        states.add(AccessibleState.RESIZABLE);
+      if ((state & ICONIFIED) != 0)
+        states.add(AccessibleState.ICONIFIED);
+      return states;
+    }
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>Frame</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTFrame();
+    return accessibleContext;
+  }
+
 }
index 189bc10..0206cec 100644 (file)
@@ -306,10 +306,7 @@ public AccessibleContext getAccessibleContext()
 {
   /* Create the context if this is the first request */
   if (accessibleContext == null)
-    {
-      /* Create the context */
-      accessibleContext = new AccessibleAWTLabel();
-    }
+    accessibleContext = new AccessibleAWTLabel();
   return accessibleContext;
 }
 
index 8fbbc07..e10cbae 100644 (file)
@@ -47,6 +47,11 @@ import java.util.EventListener;
 import java.util.Vector;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 
 /**
   * Class that implements a listbox widget
@@ -106,6 +111,7 @@ private ItemListener item_listeners;
 // The list of ActionListeners for this object.
 private ActionListener action_listeners;
 
+
 /*************************************************************************/
 
 /*
@@ -1076,4 +1082,182 @@ paramString()
   {
     return (ItemListener[]) getListeners (ItemListener.class);
   }
+  
+  // Accessibility internal class 
+  protected class AccessibleAWTList extends AccessibleAWTComponent
+    implements AccessibleSelection, ItemListener, ActionListener
+  {
+    protected class AccessibleAWTListChild extends AccessibleAWTComponent
+      implements Accessible
+    {
+      private int index;
+      private List parent;
+      
+      public AccessibleAWTListChild(List parent, int indexInParent)
+      {
+        this.parent = parent;
+        index = indexInParent;
+        if (parent == null)
+          index = -1;
+      }
+      
+      /* (non-Javadoc)
+       * @see javax.accessibility.Accessible#getAccessibleContext()
+       */
+      public AccessibleContext getAccessibleContext()
+      {
+        return this;
+      }
+      
+      public AccessibleRole getAccessibleRole()
+      {
+        return AccessibleRole.LIST_ITEM;
+      }
+      
+      public AccessibleStateSet getAccessibleStateSet()
+      {
+        AccessibleStateSet states = super.getAccessibleStateSet();
+        if (parent.isIndexSelected(index))
+          states.add(AccessibleState.SELECTED);
+        return states;
+      }
+      
+      public int getAccessibleIndexInParent()
+      {
+        return index;
+      }
+
+    }
+    
+    public AccessibleAWTList()
+    {
+      addItemListener(this);
+      addActionListener(this);
+    }
+    
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.LIST;
+    }
+    
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      states.add(AccessibleState.SELECTABLE);
+      if (isMultipleMode())
+        states.add(AccessibleState.MULTISELECTABLE);
+      return states;
+    }
+
+    public int getAccessibleChildrenCount()
+    {
+      return getItemCount();
+    }
+
+    public Accessible getAccessibleChild(int i)
+    {
+      if (i >= getItemCount())
+        return null;
+      return new AccessibleAWTListChild(List.this, i);
+    }
+    
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#getAccessibleSelectionCount()
+     */
+    public int getAccessibleSelectionCount()
+    {
+      return getSelectedIndexes().length;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#getAccessibleSelection()
+     */
+    public AccessibleSelection getAccessibleSelection()
+    {
+      return this;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#getAccessibleSelection(int)
+     */
+    public Accessible getAccessibleSelection(int i)
+    {
+      int[] items = getSelectedIndexes();
+      if (i >= items.length)
+        return null;
+      return new AccessibleAWTListChild(List.this, items[i]);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#isAccessibleChildSelected(int)
+     */
+    public boolean isAccessibleChildSelected(int i)
+    {
+      return isIndexSelected(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#addAccessibleSelection(int)
+     */
+    public void addAccessibleSelection(int i)
+    {
+      select(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#removeAccessibleSelection(int)
+     */
+    public void removeAccessibleSelection(int i)
+    {
+      deselect(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#clearAccessibleSelection()
+     */
+    public void clearAccessibleSelection()
+    {
+      for (int i = 0; i < getItemCount(); i++)
+        deselect(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#selectAllAccessibleSelection()
+     */
+    public void selectAllAccessibleSelection()
+    {
+      if (isMultipleMode())
+        for (int i = 0; i < getItemCount(); i++)
+          select(i);
+    }
+
+    /* (non-Javadoc)
+     * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+     */
+    public void itemStateChanged(ItemEvent event)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     */
+    public void actionPerformed(ActionEvent event)
+    {
+    }
+    
+  }
+
+  /**
+   * Gets the AccessibleContext associated with this <code>List</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTList();
+    return accessibleContext;
+  }
 } // class List
index 35798a0..3cc9cc3 100644 (file)
@@ -451,12 +451,18 @@ paramString()
     }
   }
 
-  /* (non-Javadoc)
-   * @see java.awt.MenuComponent#getAccessibleContext()
+  /**
+   * Gets the AccessibleContext associated with this <code>Menu</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
    */
   public AccessibleContext getAccessibleContext()
   {
-    return new AccessibleAWTMenu();
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTMenu();
+    return accessibleContext;
   }
 
 } // class Menu
index 6a97fa9..c040235 100644 (file)
@@ -381,10 +381,7 @@ public AccessibleContext getAccessibleContext()
 {
   /* Create the context if this is the first request */
   if (accessibleContext == null)
-    {
-      /* Create the context */
-      accessibleContext = new AccessibleAWTMenuBar();
-    }
+    accessibleContext = new AccessibleAWTMenuBar();
   return accessibleContext;
 }
 
index 78adfae..db6d4bd 100644 (file)
@@ -130,7 +130,7 @@ private static final long serialVersionUID = -4536902356223894379L;
    * @see #getAccessibleContext()
    * @serial the accessibility information for this component.
    */
-  private AccessibleContext accessibleContext;
+  AccessibleContext accessibleContext;
 
   /**
    * Was the name of the component set?  This value defaults
index a587742..56082d3 100644 (file)
@@ -47,6 +47,7 @@ import java.util.EventListener;
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleValue;
 
@@ -562,7 +563,10 @@ protected void
 processActionEvent(ActionEvent event)
 {
   if (action_listeners != null)
-    action_listeners.actionPerformed(event);
+    {
+      event.setSource(this);
+      action_listeners.actionPerformed(event);
+    }
 }
 
 /*************************************************************************/
@@ -579,7 +583,18 @@ paramString()
          ",actionCommand=" + actionCommand + "," + super.paramString());
 }
 
-// Accessibility API not yet implemented.
-// public AccessibleContext getAccessibleContext()
+/**
+ * Gets the AccessibleContext associated with this <code>MenuItem</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+public AccessibleContext getAccessibleContext()
+{
+  /* Create the context if this is the first request */
+  if (accessibleContext == null)
+    accessibleContext = new AccessibleAWTMenuItem();
+  return accessibleContext;
+}
 
 } // class MenuItem 
index 7508202..92840df 100644 (file)
@@ -151,9 +151,18 @@ show(Component component, int x, int y)
     
   }
   
+  /**
+   * Gets the AccessibleContext associated with this <code>PopupMenu</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
   public AccessibleContext getAccessibleContext()
   {
-    return new AccessibleAWTPopupMenu();
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTPopupMenu();
+    return accessibleContext;
   }
 
 } // class PopupMenu
index f633fc0..49726c8 100644 (file)
@@ -1,5 +1,5 @@
-/* Robot.java -- 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* Robot.java -- a native input event generator
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,112 +38,384 @@ exception statement from your version. */
 
 package java.awt;
 
+import gnu.java.awt.ClasspathToolkit;
+
+import java.awt.event.InputEvent;
 import java.awt.image.BufferedImage;
+import java.awt.peer.RobotPeer;
 
 /**
+ * The Robot class is used to simulate user interaction with graphical
+ * programs.  It can generate native windowing system input events and
+ * retrieve image data from the current screen.  Robot is used to test
+ * the AWT and Swing library implementations; it can also be used to
+ * create self-running demo programs.
+ *
+ * Since Robot generates native windowing system events, rather than
+ * simply inserting {@link AWTEvents} on the AWT event queue, its use
+ * is not restricted to Java programs.  It can be to programatically
+ * drive any graphical application.
+ *
+ * This implementation requires an X server that supports the XTest
+ * extension.
+ *
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
+ *
  * @since 1.3
  */
-/** STUB CLASS ONLY */
 public class Robot
 {
-  private GraphicsDevice screen;
   private boolean waitForIdle;
   private int autoDelay;
-  
+  private RobotPeer peer;
+
   /**
-   * Creates a <code>Robot</code> object.
-   * 
-   * @exception AWTException If GraphicsEnvironment.isHeadless() returns true.
-   * @exception SecurityException If createRobot permission is not granted.
+   * Construct a Robot object that operates on the default screen.
+   *
+   * @exception AWTException if GraphicsEnvironment.isHeadless()
+   * returns true or if the X server does not support the XTest
+   * extension
+   * @exception SecurityException if createRobot permission is not
+   * granted
    */
-  public Robot() throws AWTException
+  public Robot () throws AWTException
   {
-    throw new Error("not implemented");
+    if (GraphicsEnvironment.isHeadless ())
+      throw new AWTException ("Robot: headless graphics environment");
+
+    SecurityManager sm = System.getSecurityManager ();
+    if (sm != null)
+      sm.checkPermission (new AWTPermission ("createRobot"));
+
+    ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit ();
+
+    // createRobot will throw AWTException if XTest is not supported.
+    peer = tk.createRobot (GraphicsEnvironment.getLocalGraphicsEnvironment ()
+                          .getDefaultScreenDevice ());
   }
 
   /**
-   * Creates a <code>Robot</code> object.
-   * 
-   * @exception AWTException If GraphicsEnvironment.isHeadless() returns true.
-   * @exception IllegalArgumentException If <code>screen</code> is not a screen
-   * GraphicsDevice.
-   * @exception SecurityException If createRobot permission is not granted.
+   * Construct a Robot object that operates on the specified screen.
+   *
+   * @exception AWTException if GraphicsEnvironment.isHeadless()
+   * returns true or if the X server does not support the XTest
+   * extension
+   * @exception IllegalArgumentException if screen is not a screen
+   * GraphicsDevice
+   * @exception SecurityException if createRobot permission is not
+   * granted
    */
-  public Robot(GraphicsDevice screen) throws AWTException
+  public Robot (GraphicsDevice screen) throws AWTException
   {
-    this();
-    this.screen = screen;
+    if (GraphicsEnvironment.isHeadless ())
+      throw new AWTException ("Robot: headless graphics environment");
+
+    if (screen.getType () != GraphicsDevice.TYPE_RASTER_SCREEN)
+      throw new IllegalArgumentException ("Robot: graphics"
+                                         + " device is not a screen");
+
+    SecurityManager sm = System.getSecurityManager ();
+    if (sm != null)
+      sm.checkPermission (new AWTPermission ("createRobot"));
+
+    ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit ();
+
+    // createRobot will throw AWTException if XTest is not supported.
+    peer = tk.createRobot (screen);
   }
 
+  /**
+   * Move the mouse pointer to absolute coordinates (x, y).
+   *
+   * @param x the destination x coordinate
+   * @param y the destination y coordinate
+   */
   public void mouseMove(int x, int y)
   {
+    peer.mouseMove (x, y);
+
+    if (waitForIdle)
+      waitForIdle ();
+
+    if (autoDelay > 0)
+      delay (autoDelay);
   }
 
-  public void mousePress(int buttons)
+  /**
+   * Press one or more mouse buttons.
+   *
+   * @param buttons the buttons to press; a bitmask of one or more of
+   * these {@link InputEvent} fields:
+   *
+   * <ul>
+   *   <li>BUTTON1_MASK</li>
+   *   <li>BUTTON2_MASK</li>
+   *   <li>BUTTON3_MASK</li>
+   * </ul>
+   *
+   * @exception IllegalArgumentException if the button mask is invalid
+   */
+  public void mousePress (int buttons)
   {
+    if ((buttons & InputEvent.BUTTON1_MASK) == 0
+       && (buttons & InputEvent.BUTTON2_MASK) == 0
+       && (buttons & InputEvent.BUTTON3_MASK) == 0)
+      throw new IllegalArgumentException ("Robot: mousePress:"
+                                         + " invalid button mask");
+
+    peer.mousePress (buttons);
+
+    if (waitForIdle)
+      waitForIdle ();
+
+    if (autoDelay > 0)
+      delay (autoDelay);
   }
 
+  /**
+   * Release one or more mouse buttons.
+   *
+   * @param buttons the buttons to release; a bitmask of one or more
+   * of these {@link InputEvent} fields:
+   *
+   * <ul>
+   *   <li>BUTTON1_MASK</li>
+   *   <li>BUTTON2_MASK</li>
+   *   <li>BUTTON3_MASK</li>
+   * </ul>
+   *
+   * @exception IllegalArgumentException if the button mask is invalid
+   */
   public void mouseRelease(int buttons)
   {
+    if ((buttons & InputEvent.BUTTON1_MASK) == 0
+       && (buttons & InputEvent.BUTTON2_MASK) == 0
+       && (buttons & InputEvent.BUTTON3_MASK) == 0)
+      throw new IllegalArgumentException ("Robot: mouseRelease:"
+                                         + " invalid button mask");
+
+    peer.mouseRelease (buttons);
+
+    if (waitForIdle)
+      waitForIdle ();
+
+    if (autoDelay > 0)
+      delay (autoDelay);
   }
 
-  public void mouseWheel(int wheelAmt)
+  /**
+   * Rotate the mouse scroll wheel.
+   *
+   * @param wheelAmt number of steps to rotate mouse wheel.  negative
+   * to rotate wheel up (away from the user), positive to rotate wheel
+   * down (toward the user).
+   *
+   * @since 1.4
+   */
+  public void mouseWheel (int wheelAmt)
   {
+    peer.mouseWheel (wheelAmt);
+
+    if (waitForIdle)
+      waitForIdle ();
+
+    if (autoDelay > 0)
+      delay (autoDelay);
   }
 
-  public void keyPress(int keycode)
+  /**
+   * Press a key.
+   *
+   * @param keycode key to press, a {@link KeyEvent} VK_ constant
+   *
+   * @exception IllegalArgumentException if keycode is not a valid key
+   */
+  public void keyPress (int keycode)
   {
+    peer.keyPress (keycode);
+
+    if (waitForIdle)
+      waitForIdle ();
+
+    if (autoDelay > 0)
+      delay (autoDelay);
   }
 
-  public void keyRelease(int keycode)
+  /**
+   * Release a key.
+   *
+   * @param keycode key to release, a {@link KeyEvent} VK_ constant
+   *
+   * @exception IllegalArgumentException if keycode is not a valid key
+   */
+  public void keyRelease (int keycode)
   {
+    peer.keyRelease (keycode);
+
+    if (waitForIdle)
+      waitForIdle ();
+
+    if (autoDelay > 0)
+      delay (autoDelay);
   }
-  
-  public Color getPixelColor(int x, int y)
+
+  /**
+   * Return the color of the pixel at the given screen coordinates.
+   *
+   * @param x the x coordinate of the pixel
+   * @param y the y coordinate of the pixel
+   *
+   * @return the Color of the pixel at screen coodinates <code>(x, y)</code>
+   */
+  public Color getPixelColor (int x, int y)
   {
-    return null;
+    return new Color (peer.getRGBPixel (x, y));
   }
 
-  public BufferedImage createScreenCapture(Rectangle screen)
+  /**
+   * Create an image containing pixels read from the screen.  The
+   * image does not include the mouse pointer.
+   *
+   * @param screenRect the rectangle of pixels to capture, in screen
+   * coordinates
+   *
+   * @return a BufferedImage containing the requested pixels
+   *
+   * @exception IllegalArgumentException if requested width and height
+   * are not both greater than zero
+   * @exception SecurityException if readDisplayPixels permission is
+   * not granted
+   */
+  public BufferedImage createScreenCapture (Rectangle screenRect)
   {
-    return null;
+    if (screenRect.width <= 0)
+      throw new IllegalArgumentException ("Robot: capture width is <= 0");
+
+    if (screenRect.height <= 0)
+      throw new IllegalArgumentException ("Robot: capture height is <= 0");
+
+    SecurityManager sm = System.getSecurityManager ();
+    if (sm != null)
+      sm.checkPermission (new AWTPermission ("readDisplayPixels"));
+
+    int[] pixels = peer.getRGBPixels (screenRect);
+
+    BufferedImage bufferedImage =
+      new BufferedImage (screenRect.width, screenRect.height,
+                        BufferedImage.TYPE_INT_ARGB);
+
+    bufferedImage.setRGB (0, 0, screenRect.width, screenRect.height,
+                         pixels, 0, screenRect.width);
+
+    return bufferedImage;
   }
-  
-  public boolean isAutoWaitForIdle()
+
+  /**
+   * Check if this Robot automatically calls {@link waitForIdle} after
+   * generating an event.
+   *
+   * @return true if waitForIdle is automatically called
+   */
+  public boolean isAutoWaitForIdle ()
   {
     return waitForIdle;
   }
-  
-  public void setAutoWaitForIdle(boolean value)
+
+  /**
+   * Set whether or not this Robot automatically calls {@link
+   * waitForIdle} after generating an event.
+   *
+   * @param isOn true if waitForIdle should be called automatically
+   */
+  public void setAutoWaitForIdle (boolean isOn)
   {
-    waitForIdle = value;
+    waitForIdle = isOn;
   }
-  
-  public int getAutoDelay()
+
+  /**
+   * Retrieve the length of time this Robot sleeps after generating an
+   * event.
+   *
+   * @return the length of time in milliseconds
+   */
+  public int getAutoDelay ()
   {
     return autoDelay;
   }
-  
-  public void setAutoDelay(int ms)
+
+  /**
+   * Set the length of time this Robot sleeps after generating an
+   * event.
+   *
+   * @param ms the length of time in milliseconds
+   *
+   * @exception IllegalArgumentException if ms is not between 0 and
+   * 60,000 milliseconds inclusive
+   */
+  public void setAutoDelay (int ms)
   {
-    if (ms < 0 || ms > 60000)
-      throw new IllegalArgumentException();
-    
+    if (ms <= 0 || ms >= 60000)
+      throw new IllegalArgumentException ("Robot: delay length out-of-bounds");
+
     autoDelay = ms;
   }
 
-  public void delay(int ms)
+  /**
+   * Sleep for a specified length of time.
+   *
+   * @param ms the length of time in milliseconds
+   *
+   * @exception IllegalArgumentException if ms is not between 0 and
+   * 60,000 milliseconds inclusive
+   */
+  public void delay (int ms)
   {
     if (ms < 0 || ms > 60000)
-      throw new IllegalArgumentException();
+      throw new IllegalArgumentException ("Robot: delay length out-of-bounds");
+
+    try
+      {
+       Thread.sleep (ms);
+      }
+    catch (InterruptedException e)
+      {
+       System.err.println ("Robot: delay interrupted");
+      }
   }
 
-  public void waitForIdle()
+  /**
+   * Wait until the event dispatch thread is idle.
+   */
+  public void waitForIdle ()
   {
+    if (EventQueue.isDispatchThread ())
+      throw new IllegalThreadStateException ("Robot: waitForIdle called from "
+                                            + "the event dispatch thread");
+
+    EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
+
+    while (q.peekEvent () != null)
+      {
+       try
+         {
+           wait ();
+         }
+       catch (InterruptedException e)
+         {
+           System.err.println ("Robot: waitForIdle interrupted");
+         }
+      }
   }
 
-  public String toString()
+  /**
+   * Return a string representation of this Robot.
+   *
+   * @return a string representation
+   */
+  public String toString ()
   {
-    return "unimplemented";
+    return getClass ().getName ()
+       + "[ autoDelay = " + autoDelay + ", autoWaitForIdle = "
+       + waitForIdle + " ]";
   }
-} // class Robot
+}
index abd5514..c38feb3 100644 (file)
@@ -43,6 +43,8 @@ import java.awt.peer.ComponentPeer;
 import java.awt.peer.ScrollPanePeer;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
 
 /**
   * This widget provides a scrollable region that allows a single 
@@ -587,5 +589,27 @@ paramString()
   {
     wheelScrollingEnabled = enable;
   }
+  
+  protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.SCROLL_PANE;
+    }
+  }
+
+  /**
+   * Gets the AccessibleContext associated with this <code>ScrollPane</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTScrollPane();
+    return accessibleContext;
+  }
 } // class ScrollPane 
 
index 7cc9715..9141ea5 100644 (file)
@@ -1,5 +1,5 @@
 /* Scrollbar.java -- AWT Scrollbar widget
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -45,694 +45,603 @@ import java.awt.peer.ScrollbarPeer;
 import java.util.EventListener;
 
 import javax.accessibility.Accessible;
-
-/**
-  * This class implements a scrollbar widget.
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
-  */
-public class Scrollbar extends Component implements Accessible,
-                                                    Adjustable
-{
-
-// FIXME: Serialization readObject/writeObject
-
-/*
- * Static Variables
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleValue;
+
+/**
+ * This class implements a scrollbar widget.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  */
+public class Scrollbar extends Component implements Accessible, Adjustable
+{
+  // FIXME: Serialization readObject/writeObject
 
-/**
-  * Constant indicating that a scrollbar is horizontal.
-  */
-public static final int HORIZONTAL = 0;
-
-/**
-  * Constant indicating that a scrollbar is vertical.
-  */
-public static final int VERTICAL = 1;
+  /**
+   * Constant indicating that a scrollbar is horizontal.
+   */
+  public static final int HORIZONTAL = 0;
 
-// Serialization Constant
-private static final long serialVersionUID = 8451667562882310543L;
+  /**
+   * Constant indicating that a scrollbar is vertical.
+   */
+  public static final int VERTICAL = 1;
 
-/*************************************************************************/
+  /**
+   * Serialization Constant.
+   */
+  private static final long serialVersionUID = 8451667562882310543L;
 
-/**
-  * @serial The amount by which the value of the scrollbar is changed
-  * when incrementing in line mode.
-  */
-private int lineIncrement;
+  /**
+   * @serial The amount by which the value of the scrollbar is changed
+   * when incrementing in line mode.
+   */
+  private int lineIncrement;
 
-/**
-  * @serial The amount by which the value of the scrollbar is changed
-  * when incrementing in page mode.
-  */
-private int pageIncrement;
+  /**
+   * @serial The amount by which the value of the scrollbar is changed
+   * when incrementing in page mode.
+   */
+  private int pageIncrement;
 
-/**
-  * @serial The maximum value for this scrollbar
-  */
-private int maximum;
+  /**
+   * @serial The maximum value for this scrollbar
+   */
+  private int maximum;
 
-/**
-  * @serial The minimum value for this scrollbar
-  */
-private int minimum;
+  /**
+   * @serial The minimum value for this scrollbar
+   */
+  private int minimum;
 
-/**
-  * @serial The orientation of this scrollbar, which will be either
-  * the <code>HORIZONTAL</code> or <code>VERTICAL</code> constant
-  * from this class.
-  */
-private int orientation;
+  /**
+   * @serial The orientation of this scrollbar, which will be either
+   * the <code>HORIZONTAL</code> or <code>VERTICAL</code> constant
+   * from this class.
+   */
+  private int orientation;
 
-/**
-  * @serial The current value of this scrollbar.
-  */
-private int value;
+  /**
+   * @serial The current value of this scrollbar.
+   */
+  private int value;
 
-/**
-  * @serial The width of the scrollbar's thumb, which is relative
-  * to the minimum and maximum value of the scrollbar.
-  */
-private int visibleAmount;
+  /**
+   * @serial The width of the scrollbar's thumb, which is relative
+   * to the minimum and maximum value of the scrollbar.
+   */
+  private int visibleAmount;
 
-// List of AdjustmentListener's.
-private AdjustmentListener adjustment_listeners;
+  /**
+   * List of AdjustmentListener's.
+   */
+  private AdjustmentListener adjustment_listeners;
 
-private transient boolean valueIsAdjusting = false;
+  /**
+   * true if the scrollbar is adjusting, false otherwise.
+   */
+  private transient boolean valueIsAdjusting = false;
 
-  /*
+  /**
    * The number used to generate the name returned by getName.
    */
   private static transient long next_scrollbar_number;
 
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
-  * Initializes a new instance of <code>Scrollbar</code> with a
-  * vertical orientation and default values for all other parameters.
-  *
-  * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
-  */
-public
-Scrollbar()
-{
-  this(VERTICAL);
-}
-
-/*************************************************************************/
-
-/**
-  * Initializes a new instance of <code>Scrollbar</code> with the
-  * specified orientation and default values for all other parameters.
-  * The orientation must be either the constant <code>HORIZONTAL</code> or
-  * <code>VERTICAL</code> from this class.  An incorrect value will throw
-  * an exception.
-  *
-  * @param orientation The orientation of this scrollbar.
-  *
-  * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
-  * @exception IllegalArgumentException If the orientation value is not valid.
-  */
-public
-Scrollbar(int orientation) throws IllegalArgumentException
-{
-  this(orientation, 0, 10, 0, 100);
-}
-
-/*************************************************************************/
-
-/**
-  * Initializes a new instance of <code>Scrollbar</code> with the
-  * specified parameters.  The orientation must be either the constant
-  * <code>HORIZONTAL</code> or <code>VERTICAL</code>.  An incorrect value
-  * will throw an exception.  Inconsistent values for other parameters
-  * are silently corrected to valid values.
-  *
-  * @param orientation The orientation of this scrollbar.
-  * @param value The initial value of the scrollbar.
-  * @param visibleAmount The width of the scrollbar thumb.
-  * @param minimum The minimum value of the scrollbar.
-  * @param maximum The maximum value of the scrollbar.
-  *
-  * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
-  * @exception IllegalArgumentException If the orientation value is not valid.
-  */
-public 
-Scrollbar(int orientation, int value, int visibleAmount, int minimum, 
-          int maximum) throws IllegalArgumentException
-{
-  if (GraphicsEnvironment.isHeadless())
-    throw new HeadlessException ();
-
-  if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
-    throw new IllegalArgumentException("Bad orientation value: "
-                                      + orientation);
-
-  this.orientation = orientation;
-
-  setValues(value, visibleAmount, minimum, maximum);
-
-  // Default is 1 according to online docs.
-  lineIncrement = 1;
-
-  // Default is 10 according to javadocs.
-  pageIncrement = 10;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
-  * Returns the orientation constant for this object.
-  *
-  * @return The orientation constant for this object.
-  */
-public int
-getOrientation()
-{
-  return(orientation);
-}
-
-/*************************************************************************/
-
-/**
-  * Sets the orientation of this scrollbar to the specified value.  This
-  * value must be either the constant <code>HORIZONTAL</code> or
-  * <code>VERTICAL</code> from this class or an exception will be thrown.
-  *
-  * @param orientation The new orientation value.
-  *
-  * @exception IllegalArgumentException If the orientation value is not valid.
-  */
-public void
-setOrientation(int orientation)
-{
-  if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
-    throw new IllegalArgumentException("Bad orientation value: "
-                                      + orientation);
-
-  // FIXME: Communicate to peer?  Or must this be called before peer creation?
-  this.orientation = orientation;
-}
-
-/*************************************************************************/
-
-/**
-  * Returns the current value for this scrollbar.
-  *
-  * @return The current value for this scrollbar.
-  */
-public int
-getValue()
-{
-  return(value);
-}
-
-/*************************************************************************/
-
-/**
-  * Sets the current value for this scrollbar to the specified value.
-  * If this is inconsistent with the minimum and maximum values for this
-  * scrollbar, the value is silently adjusted.
-  *
-  * @param value The new value for this scrollbar.
-  */
-public void
-setValue(int value)
-{
-  setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
-  * Returns the maximum value for this scrollbar.
-  *
-  * @return The maximum value for this scrollbar.
-  */
-public int
-getMaximum()
-{
-  return(maximum);
-}
-
-/*************************************************************************/
-
-/**
-  * Sets the maximum value for this scrollbar to the specified value.
-  * If the value is less than the current minimum value, it is silent
-  * set to equal the minimum value.
-  *
-  * @param maximum The new maximum value for this scrollbar.
-  */
-public void
-setMaximum(int maximum)
-{
-  setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
-  * Returns the minimum value for this scrollbar.
-  *
-  * @return The minimum value for this scrollbar.
-  */
-public int
-getMinimum()
-{
-  return(minimum);
-}
-
-/*************************************************************************/
-
-/**
-  * Sets the minimum value for this scrollbar to the specified value.  If
-  * this is not consistent with the current value and maximum, it is
-  * silently adjusted to be consistent.
-  *
-  * @param minimum The new minimum value for this scrollbar.
-  */
-public void
-setMinimum(int minimum)
-{
-  setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
-  * Returns the width of the scrollbar's thumb, in units relative to the
-  * maximum and minimum value of the scrollbar.
-  *
-  * @return The width of the scrollbar's thumb.
-  */
-public int
-getVisibleAmount()
-{
-  return getVisible ();
-}
-
-/*************************************************************************/
-
-/**
-  * Returns the width of the scrollbar's thumb, in units relative to the
-  * maximum and minimum value of the scrollbar.
-  *
-  * @return The width of the scrollbar's thumb.
-  *
-  * @deprecated This method is deprecated in favor of 
-  * <code>getVisibleAmount()</code>.
-  */
-public int
-getVisible()
-{
-  return visibleAmount;
-}
-
-/*************************************************************************/
-
-/**
-  * Sets the width of the scrollbar's thumb, in units relative to the
-  * maximum and minimum value of the scrollbar.
-  *
-  * @param visibleAmount The new visible amount value of the scrollbar.
-  */
-public void
-setVisibleAmount(int visibleAmount)
-{
-  setValues(value, visibleAmount, minimum, maximum);
-}
-
-/*************************************************************************/
-
-/**
-  * Sets the current value, visible amount, minimum, and maximum for this
-  * scrollbar.  These values are adjusted to be internally consistent
-  * if necessary.
-  *
-  * @param value The new value for this scrollbar.
-  * @param visibleAmount The new visible amount for this scrollbar.
-  * @param minimum The new minimum value for this scrollbar.
-  * @param maximum The new maximum value for this scrollbar.
-  */
-public synchronized void
-setValues(int value, int visibleAmount, int minimum, int maximum)
-{
-  if (maximum < minimum)
-    maximum = minimum;
-
-  if (value < minimum)
-    value = minimum;
-
-  if (value > maximum)
-    value = maximum;
-
-  if (visibleAmount > maximum - minimum)
-    visibleAmount = maximum - minimum;
-
-  ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
-  if (peer != null
-      && (this.value != value || this.visibleAmount != visibleAmount
-          || this.minimum != minimum || this.maximum != maximum))
-    peer.setValues(value, visibleAmount, minimum, maximum);
-
-  this.value = value;
-  this.visibleAmount = visibleAmount;
-  this.minimum = minimum;
-  this.maximum = maximum;
-
-  int range = maximum - minimum;
-  if (lineIncrement > range)
-    {
-      if (range == 0)
-        lineIncrement = 1;
-      else
-        lineIncrement = range;
-
-      if (peer != null)
-        peer.setLineIncrement(lineIncrement);
-    }
-
-  if (pageIncrement > range)
-    {
-      if (range == 0)
-        pageIncrement = 1;
-      else
-        pageIncrement = range;
-
-      if (peer != null)
-        peer.setPageIncrement(pageIncrement);
-    }
-}
-
-/*************************************************************************/
+  /**
+   * Initializes a new instance of <code>Scrollbar</code> with a
+   * vertical orientation and default values for all other parameters.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
+   */
+  public Scrollbar()
+  {
+    this(VERTICAL);
+  }
 
-/**
-  * Returns the value added or subtracted when the user activates the scrollbar
-  * scroll by a "unit" amount.
-  *
-  * @return The unit increment value.
-  */
-public int
-getUnitIncrement()
-{
-  return getLineIncrement ();
-}
+  /**
+   * Initializes a new instance of <code>Scrollbar</code> with the
+   * specified orientation and default values for all other parameters.
+   * The orientation must be either the constant <code>HORIZONTAL</code> or
+   * <code>VERTICAL</code> from this class.  An incorrect value will throw
+   * an exception.
+   *
+   * @param orientation The orientation of this scrollbar.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
+   * @exception IllegalArgumentException If the orientation value is not valid.
+   */
+  public Scrollbar(int orientation) throws IllegalArgumentException
+  {
+    this(orientation, 0, 10, 0, 100);
+  }
 
-/*************************************************************************/
+  /**
+   * Initializes a new instance of <code>Scrollbar</code> with the
+   * specified parameters.  The orientation must be either the constant
+   * <code>HORIZONTAL</code> or <code>VERTICAL</code>.  An incorrect value
+   * will throw an exception.  Inconsistent values for other parameters
+   * are silently corrected to valid values.
+   *
+   * @param orientation The orientation of this scrollbar.
+   * @param value The initial value of the scrollbar.
+   * @param visibleAmount The width of the scrollbar thumb.
+   * @param minimum The minimum value of the scrollbar.
+   * @param maximum The maximum value of the scrollbar.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
+   * @exception IllegalArgumentException If the orientation value is not valid.
+   */
+  public Scrollbar(int orientation, int value, int visibleAmount, int minimum,
+                   int maximum) throws IllegalArgumentException
+  {
+    if (GraphicsEnvironment.isHeadless())
+      throw new HeadlessException();
 
-/**
-  * Returns the value added or subtracted when the user selects the scrollbar
-  * scroll by a "unit" amount control.
-  *
-  * @return The unit increment value.
-  *
-  * @deprecated This method is deprecated in favor of 
-  * <code>getUnitIncrement()</code>.
-  */
-public int
-getLineIncrement()
-{
-  return lineIncrement;
-}
+    if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
+      throw new IllegalArgumentException("Bad orientation value: "
+                                         + orientation);
 
-/*************************************************************************/
+    this.orientation = orientation;
 
-/**
-  * Sets the value added or subtracted to the scrollbar value when the
-  * user selects the scroll by a "unit" amount control.
-  *
-  * @param unitIncrement The new unit increment amount.
-  */
-public synchronized void
-setUnitIncrement(int unitIncrement)
-{
-  setLineIncrement (unitIncrement);
-}
+    setValues(value, visibleAmount, minimum, maximum);
 
-/*************************************************************************/
+    // Default is 1 according to online docs.
+    lineIncrement = 1;
 
-/**
-  * Sets the value added or subtracted to the scrollbar value when the
-  * user selects the scroll by a "unit" amount control.
-  *
-  * @param lineIncrement The new unit increment amount.
-  *
-  * @deprecated This method is deprecated in favor of
-  * <code>setUnitIncrement()</code>.
-  */
-public void
-setLineIncrement(int lineIncrement)
-{
-  if (lineIncrement < 0)
-    throw new IllegalArgumentException ("Unit increment less than zero.");
+    // Default is 10 according to javadocs.
+    pageIncrement = 10;
+  }
 
-  int range = maximum - minimum;
-  if (lineIncrement > range)
-    {
-      if (range == 0)
-        lineIncrement = 1;
-      else
-        lineIncrement = range;
-    }
+  /**
+   * Returns the orientation constant for this object.
+   *
+   * @return The orientation constant for this object.
+   */
+  public int getOrientation()
+  {
+    return orientation;
+  }
 
-  if (lineIncrement == this.lineIncrement)
-    return;
+  /**
+   * Sets the orientation of this scrollbar to the specified value.  This
+   * value must be either the constant <code>HORIZONTAL</code> or
+   * <code>VERTICAL</code> from this class or an exception will be thrown.
+   *
+   * @param orientation The new orientation value.
+   *
+   * @exception IllegalArgumentException If the orientation value is not valid.
+   */
+  public void setOrientation(int orientation)
+  {
+    if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
+      throw new IllegalArgumentException("Bad orientation value: "
+                                         + orientation);
 
-  this.lineIncrement = lineIncrement;
+    // FIXME: Communicate to peer?  Or must this be called before peer creation?
+    this.orientation = orientation;
+  }
 
-  ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
-  if (peer != null)
-    peer.setLineIncrement (this.lineIncrement);
-}
+  /**
+   * Returns the current value for this scrollbar.
+   *
+   * @return The current value for this scrollbar.
+   */
+  public int getValue()
+  {
+    return value;
+  }
 
-/*************************************************************************/
+  /**
+   * Sets the current value for this scrollbar to the specified value.
+   * If this is inconsistent with the minimum and maximum values for this
+   * scrollbar, the value is silently adjusted.
+   *
+   * @param value The new value for this scrollbar.
+   */
+  public void setValue(int value)
+  {
+    setValues(value, visibleAmount, minimum, maximum);
+  }
 
-/**
-  * Returns the value added or subtracted when the user activates the scrollbar
-  * scroll by a "block" amount.
-  *
-  * @return The block increment value.
-  */
-public int
-getBlockIncrement()
-{
-  return getPageIncrement ();
-}
+  /**
+   * Returns the maximum value for this scrollbar.
+   *
+   * @return The maximum value for this scrollbar.
+   */
+  public int getMaximum()
+  {
+    return maximum;
+  }
 
-/*************************************************************************/
+  /**
+   * Sets the maximum value for this scrollbar to the specified value.
+   * If the value is less than the current minimum value, it is silent
+   * set to equal the minimum value.
+   *
+   * @param maximum The new maximum value for this scrollbar.
+   */
+  public void setMaximum(int maximum)
+  {
+    setValues(value, visibleAmount, minimum, maximum);
+  }
 
-/**
-  * Returns the value added or subtracted when the user selects the scrollbar
-  * scroll by a "block" amount control.
-  *
-  * @return The block increment value.
-  *
-  * @deprecated This method is deprecated in favor of 
-  * <code>getBlockIncrement()</code>.
-  */
-public int
-getPageIncrement()
-{
-  return pageIncrement;
-}
+  /**
+   * Returns the minimum value for this scrollbar.
+   *
+   * @return The minimum value for this scrollbar.
+   */
+  public int getMinimum()
+  {
+    return minimum;
+  }
 
-/*************************************************************************/
+  /**
+   * Sets the minimum value for this scrollbar to the specified value.  If
+   * this is not consistent with the current value and maximum, it is
+   * silently adjusted to be consistent.
+   *
+   * @param minimum The new minimum value for this scrollbar.
+   */
+  public void setMinimum(int minimum)
+  {
+    setValues(value, visibleAmount, minimum, maximum);
+  }
 
-/**
-  * Sets the value added or subtracted to the scrollbar value when the
-  * user selects the scroll by a "block" amount control.
-  *
-  * @param blockIncrement The new block increment amount.
-  */
-public synchronized void
-setBlockIncrement(int blockIncrement)
-{
-  setPageIncrement (blockIncrement);
-}
+  /**
+   * Returns the width of the scrollbar's thumb, in units relative to the
+   * maximum and minimum value of the scrollbar.
+   *
+   * @return The width of the scrollbar's thumb.
+   */
+  public int getVisibleAmount()
+  {
+    return getVisible();
+  }
 
-/*************************************************************************/
+  /**
+   * Returns the width of the scrollbar's thumb, in units relative to the
+   * maximum and minimum value of the scrollbar.
+   *
+   * @return The width of the scrollbar's thumb.
+   *
+   * @deprecated This method is deprecated in favor of
+   * <code>getVisibleAmount()</code>.
+   */
+  public int getVisible()
+  {
+    return visibleAmount;
+  }
 
-/**
-  * Sets the value added or subtracted to the scrollbar value when the
-  * user selects the scroll by a "block" amount control.
-  *
-  * @param pageIncrement The new block increment amount.
-  *
-  * @deprecated This method is deprecated in favor of
-  * <code>setBlockIncrement()</code>.
-  */
-public void
-setPageIncrement(int pageIncrement)
-{
-  if (pageIncrement < 0)
-    throw new IllegalArgumentException ("Block increment less than zero.");
+  /**
+   * Sets the width of the scrollbar's thumb, in units relative to the
+   * maximum and minimum value of the scrollbar.
+   *
+   * @param visibleAmount The new visible amount value of the scrollbar.
+   */
+  public void setVisibleAmount(int visibleAmount)
+  {
+    setValues(value, visibleAmount, minimum, maximum);
+  }
 
-  int range = maximum - minimum;
-  if (pageIncrement > range)
-    {
-      if (range == 0)
-        pageIncrement = 1;
-      else
-        pageIncrement = range;
-    }
+  /**
+   * Sets the current value, visible amount, minimum, and maximum for this
+   * scrollbar.  These values are adjusted to be internally consistent
+   * if necessary.
+   *
+   * @param value The new value for this scrollbar.
+   * @param visibleAmount The new visible amount for this scrollbar.
+   * @param minimum The new minimum value for this scrollbar.
+   * @param maximum The new maximum value for this scrollbar.
+   */
+  public synchronized void setValues(int value, int visibleAmount,
+                                     int minimum, int maximum)
+  {
+    if (maximum < minimum)
+      maximum = minimum;
+
+    if (value < minimum)
+      value = minimum;
+
+    if (value > maximum)
+      value = maximum;
+
+    if (visibleAmount > maximum - minimum)
+      visibleAmount = maximum - minimum;
+
+    ScrollbarPeer peer = (ScrollbarPeer) getPeer();
+    if (peer != null
+        && (this.value != value || this.visibleAmount != visibleAmount
+            || this.minimum != minimum || this.maximum != maximum))
+      peer.setValues(value, visibleAmount, minimum, maximum);
+
+    this.value = value;
+    this.visibleAmount = visibleAmount;
+    this.minimum = minimum;
+    this.maximum = maximum;
+
+    int range = maximum - minimum;
+    if (lineIncrement > range)
+      {
+       if (range == 0)
+         lineIncrement = 1;
+       else
+         lineIncrement = range;
+
+       if (peer != null)
+         peer.setLineIncrement(lineIncrement);
+      }
+
+    if (pageIncrement > range)
+      {
+       if (range == 0)
+         pageIncrement = 1;
+       else
+         pageIncrement = range;
+
+       if (peer != null)
+         peer.setPageIncrement(pageIncrement);
+      }
+  }
 
-  if (pageIncrement == this.pageIncrement)
-    return;
+  /**
+   * Returns the value added or subtracted when the user activates the scrollbar
+   * scroll by a "unit" amount.
+   *
+   * @return The unit increment value.
+   */
+  public int getUnitIncrement()
+  {
+    return getLineIncrement();
+  }
 
-  this.pageIncrement = pageIncrement;
+  /**
+   * Returns the value added or subtracted when the user selects the scrollbar
+   * scroll by a "unit" amount control.
+   *
+   * @return The unit increment value.
+   *
+   * @deprecated This method is deprecated in favor of
+   * <code>getUnitIncrement()</code>.
+   */
+  public int getLineIncrement()
+  {
+    return lineIncrement;
+  }
 
-  ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
-  if (peer != null)
-    peer.setPageIncrement (this.pageIncrement);
-}
+  /**
+   * Sets the value added or subtracted to the scrollbar value when the
+   * user selects the scroll by a "unit" amount control.
+   *
+   * @param unitIncrement The new unit increment amount.
+   */
+  public synchronized void setUnitIncrement(int unitIncrement)
+  {
+    setLineIncrement(unitIncrement);
+  }
 
-/*************************************************************************/
+  /**
+   * Sets the value added or subtracted to the scrollbar value when the
+   * user selects the scroll by a "unit" amount control.
+   *
+   * @param lineIncrement The new unit increment amount.
+   *
+   * @deprecated This method is deprecated in favor of
+   * <code>setUnitIncrement()</code>.
+   */
+  public void setLineIncrement(int lineIncrement)
+  {
+    if (lineIncrement < 0)
+      throw new IllegalArgumentException("Unit increment less than zero.");
+
+    int range = maximum - minimum;
+    if (lineIncrement > range)
+      {
+       if (range == 0)
+         lineIncrement = 1;
+       else
+         lineIncrement = range;
+      }
+
+    if (lineIncrement == this.lineIncrement)
+      return;
+
+    this.lineIncrement = lineIncrement;
+
+    ScrollbarPeer peer = (ScrollbarPeer) getPeer();
+    if (peer != null)
+      peer.setLineIncrement(this.lineIncrement);
+  }
 
-/**
-  * Notifies this object to create its native peer.
-  */
-public synchronized void
-addNotify()
-{
-  if (peer == null)
-    peer = getToolkit ().createScrollbar (this);
-  super.addNotify ();
-}
+  /**
+   * Returns the value added or subtracted when the user activates the scrollbar
+   * scroll by a "block" amount.
+   *
+   * @return The block increment value.
+   */
+  public int getBlockIncrement()
+  {
+    return getPageIncrement();
+  }
 
-/*************************************************************************/
+  /**
+   * Returns the value added or subtracted when the user selects the scrollbar
+   * scroll by a "block" amount control.
+   *
+   * @return The block increment value.
+   *
+   * @deprecated This method is deprecated in favor of
+   * <code>getBlockIncrement()</code>.
+   */
+  public int getPageIncrement()
+  {
+    return pageIncrement;
+  }
 
-/**
-  * Adds a new adjustment listener to the list of registered listeners
-  * for this object.
-  *
-  * @param listener The listener to add.
-  */
-public synchronized void
-addAdjustmentListener(AdjustmentListener listener)
-{
-  adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners, listener);
-  enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);
-}
+  /**
+   * Sets the value added or subtracted to the scrollbar value when the
+   * user selects the scroll by a "block" amount control.
+   *
+   * @param blockIncrement The new block increment amount.
+   */
+  public synchronized void setBlockIncrement(int blockIncrement)
+  {
+    setPageIncrement(blockIncrement);
+  }
 
-/*************************************************************************/
+  /**
+   * Sets the value added or subtracted to the scrollbar value when the
+   * user selects the scroll by a "block" amount control.
+   *
+   * @param pageIncrement The new block increment amount.
+   *
+   * @deprecated This method is deprecated in favor of
+   * <code>setBlockIncrement()</code>.
+   */
+  public void setPageIncrement(int pageIncrement)
+  {
+    if (pageIncrement < 0)
+      throw new IllegalArgumentException("Block increment less than zero.");
+
+    int range = maximum - minimum;
+    if (pageIncrement > range)
+      {
+       if (range == 0)
+         pageIncrement = 1;
+       else
+         pageIncrement = range;
+      }
+
+    if (pageIncrement == this.pageIncrement)
+      return;
+
+    this.pageIncrement = pageIncrement;
+
+    ScrollbarPeer peer = (ScrollbarPeer) getPeer();
+    if (peer != null)
+      peer.setPageIncrement(this.pageIncrement);
+  }
 
-/**
-  * Removes the specified listener from the list of registered listeners
-  * for this object.
-  *
-  * @param listener The listener to remove.
-  */
-public synchronized void
-removeAdjustmentListener(AdjustmentListener listener)
-{
-  adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners, 
-                                                    listener);
-}
+  /**
+   * Notifies this object to create its native peer.
+   */
+  public synchronized void addNotify()
+  {
+    if (peer == null)
+      peer = getToolkit().createScrollbar(this);
+    super.addNotify();
+  }
 
-/*************************************************************************/
+  /**
+   * Adds a new adjustment listener to the list of registered listeners
+   * for this object.
+   *
+   * @param listener The listener to add.
+   */
+  public synchronized void addAdjustmentListener(AdjustmentListener listener)
+  {
+    adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners,
+                                                   listener);
+    enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);
+  }
 
-/**
-  * Processes events for this scrollbar.  It does this by calling
-  * <code>processAdjustmentEvent()</code> if the event is an instance of
-  * <code>AdjustmentEvent</code>, otherwise it calls the superclass to
-  * process the event.
-  *
-  * @param event The event to process.
-  */
-protected void
-processEvent(AWTEvent event)
-{
-  if (event instanceof AdjustmentEvent)
-    processAdjustmentEvent((AdjustmentEvent)event);
-  else
-    super.processEvent(event);
-}
+  /**
+   * Removes the specified listener from the list of registered listeners
+   * for this object.
+   *
+   * @param listener The listener to remove.
+   */
+  public synchronized void removeAdjustmentListener(AdjustmentListener listener)
+  {
+    adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners,
+                                                      listener);
+  }
 
-/*************************************************************************/
+  /**
+   * Processes events for this scrollbar.  It does this by calling
+   * <code>processAdjustmentEvent()</code> if the event is an instance of
+   * <code>AdjustmentEvent</code>, otherwise it calls the superclass to
+   * process the event.
+   *
+   * @param event The event to process.
+   */
+  protected void processEvent(AWTEvent event)
+  {
+    if (event instanceof AdjustmentEvent)
+      processAdjustmentEvent((AdjustmentEvent) event);
+    else
+      super.processEvent(event);
+  }
 
-/**
-  * Processes adjustment events for this object by dispatching them to
-  * any registered listeners.  Note that this method will only be called
-  * if adjustment events are enabled.  This will happen automatically if
-  * any listeners are registered.  Otherwise, it can be enabled by a
-  * call to <code>enableEvents()</code>.
-  *
-  * @param event The event to process.
-  */
-protected void
-processAdjustmentEvent(AdjustmentEvent event)
-{
-  value = event.getValue();
-  if (adjustment_listeners != null)
-    adjustment_listeners.adjustmentValueChanged(event);
-}
+  /**
+   * Processes adjustment events for this object by dispatching them to
+   * any registered listeners.  Note that this method will only be called
+   * if adjustment events are enabled.  This will happen automatically if
+   * any listeners are registered.  Otherwise, it can be enabled by a
+   * call to <code>enableEvents()</code>.
+   *
+   * @param event The event to process.
+   */
+  protected void processAdjustmentEvent(AdjustmentEvent event)
+  {
+    value = event.getValue();
+    if (adjustment_listeners != null)
+      adjustment_listeners.adjustmentValueChanged(event);
+  }
 
-void
-dispatchEventImpl(AWTEvent e)
-{
-  if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST 
+  void dispatchEventImpl(AWTEvent e)
+  {
+    if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST 
       && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST
       && (adjustment_listeners != null 
          || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0))
-    processEvent(e);
-  else
-    super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
+      processEvent(e);
+    else
+      super.dispatchEventImpl(e);
+  }
 
-/**
-  * Returns a debugging string for this object.
-  *
-  * @return A debugging string for this object.
-  */
-protected String
-paramString()
-{
-  return("value=" + getValue() + ",visibleAmount=" +
-         getVisibleAmount() + ",minimum=" + getMinimum()
-        + ",maximum=" + getMaximum()
-        + ",pageIncrement=" + pageIncrement
-        + ",lineIncrement=" + lineIncrement
-        + ",orientation=" + (orientation == HORIZONTAL
-                             ? "HORIZONTAL" : "VERTICAL")
-        + super.paramString());
-}
+  /**
+   * Returns a debugging string for this object.
+   *
+   * @return A debugging string for this object.
+   */
+  protected String paramString()
+  {
+    return ("value=" + getValue() + ",visibleAmount=" + getVisibleAmount()
+            + ",minimum=" + getMinimum() + ",maximum=" + getMaximum()
+            + ",pageIncrement=" + pageIncrement + ",lineIncrement="
+            + lineIncrement + ",orientation="
+            + (orientation == HORIZONTAL ? "HORIZONTAL" : "VERTICAL")
+            + super.paramString());
+  }
 
   /**
    * Returns an array of all the objects currently registered as FooListeners
-   * upon this <code>Scrollbar</code>. FooListeners are registered using the 
+   * upon this <code>Scrollbar</code>. FooListeners are registered using the
    * addFooListener method.
    *
    * @exception ClassCastException If listenerType doesn't specify a class or
    * interface that implements java.util.EventListener.
    */
-  public EventListener[] getListeners (Class listenerType)
+  public EventListener[] getListeners(Class listenerType)
   {
     if (listenerType == AdjustmentListener.class)
-      return AWTEventMulticaster.getListeners (adjustment_listeners,
-                                               listenerType);
+      return AWTEventMulticaster.getListeners(adjustment_listeners,
+                                              listenerType);
 
-    return super.getListeners (listenerType);
+    return super.getListeners(listenerType);
   }
 
   /**
    * Returns an array of all registered adjustment listeners.
    */
-  public AdjustmentListener[] getAdjustmentListeners ()
+  public AdjustmentListener[] getAdjustmentListeners()
   {
-    return (AdjustmentListener[]) getListeners (AdjustmentListener.class);
+    return (AdjustmentListener[]) getListeners(AdjustmentListener.class);
   }
 
   /**
@@ -740,7 +649,7 @@ paramString()
    *
    * @since 1.4
    */
-  public boolean getValueIsAdjusting ()
+  public boolean getValueIsAdjusting()
   {
     return valueIsAdjusting;
   }
@@ -750,7 +659,7 @@ paramString()
    *
    * @since 1.4
    */
-  public void setValueIsAdjusting (boolean valueIsAdjusting)
+  public void setValueIsAdjusting(boolean valueIsAdjusting)
   {
     this.valueIsAdjusting = valueIsAdjusting;
   }
@@ -760,14 +669,157 @@ paramString()
    *
    * @return A unique name for this scroll bar.
    */
-  String generateName ()
+  String generateName()
   {
-    return "scrollbar" + getUniqueLong ();
+    return "scrollbar" + getUniqueLong();
   }
 
-  private static synchronized long getUniqueLong ()
+  private static synchronized long getUniqueLong()
   {
     return next_scrollbar_number++;
   }
-} // class Scrollbar 
 
+  /**
+   * This class provides accessibility support for the
+   * scrollbar.
+   *
+   * @author Jerry Quinn (jlquinn@optonline.net)
+   * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+   */
+  protected class AccessibleAWTScrollBar extends AccessibleAWTComponent
+    implements AccessibleValue
+  {
+    /**
+     * Serialization constant to match JDK 1.5
+     */
+    private static final long serialVersionUID = -344337268523697807L;
+
+    /**
+     * Returns the role of this accessible object.
+     *
+     * @return the instance of <code>AccessibleRole</code>,
+     * which describes this object.
+     *
+     * @see javax.accessibility.AccessibleRole
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.SCROLL_BAR;
+    }
+
+    /**
+     * Returns the state set of this accessible object.
+     *
+     * @return a set of <code>AccessibleState</code>s which
+     * represent the current state of the accessible object.
+     *
+     * @see javax.accessibility.AccessibleState
+     * @see javax.accessibility.AccessibleStateSet
+     */
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (getOrientation() == HORIZONTAL)
+       states.add(AccessibleState.HORIZONTAL);
+      else
+       states.add(AccessibleState.VERTICAL);
+      if (getValueIsAdjusting())
+       states.add(AccessibleState.BUSY);
+      return states;
+    }
+
+    /**
+     * Returns an implementation of the <code>AccessibleValue</code>
+     * interface for this accessible object.  In this case, the
+     * current instance is simply returned (with a more appropriate
+     * type), as it also implements the accessible value as well as
+     * the context.
+     *
+     * @return the accessible value associated with this context.
+     *
+     * @see javax.accessibility.AccessibleValue
+     */
+    public AccessibleValue getAccessibleValue()
+    {
+      return this;
+    }
+
+    /**
+     * Returns the current value of this accessible object.
+     * In this case, this is the same as the value for
+     * the scrollbar, wrapped in an <code>Integer</code>
+     * object.
+     *
+     * @return the numeric value of this scrollbar.
+     *
+     * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
+     */
+    public Number getCurrentAccessibleValue()
+    {
+      return new Integer(getValue());
+    }
+
+    /**
+     * Sets the current value of this accessible object
+     * to that supplied.  In this case, the value of the
+     * scrollbar is set, and this method always returns
+     * true.
+     *
+     * @param number the new accessible value.
+     *
+     * @return true if the value was set.
+     *
+     * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
+     */
+    public boolean setCurrentAccessibleValue(Number number)
+    {
+      setValue(number.intValue());
+      return true;
+    }
+
+    /**
+     * Returns the minimum acceptable accessible value used
+     * by this object.  In this case, this is the same as
+     * the minimum value of the scrollbar, wrapped in an
+     * object.
+     *
+     * @return the minimum value of this scrollbar.
+     *
+     * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
+     */
+    public Number getMinimumAccessibleValue()
+    {
+      return new Integer(getMinimum());
+    }
+
+    /**
+     * Returns the maximum acceptable accessible value used
+     * by this object.  In this case, this is the same as
+     * the maximum value of the scrollbar, wrapped in an
+     * object.
+     *
+     * @return the maximum value of this scrollbar.
+     *
+     * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
+     */
+    public Number getMaximumAccessibleValue()
+    {
+      return new Integer(getMaximum());
+    }
+  }
+
+  /**
+   * Gets the AccessibleContext associated with this <code>Scrollbar</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTScrollBar();
+    
+    return accessibleContext;
+  }
+}
index 9efc775..dda45f3 100644 (file)
@@ -613,8 +613,17 @@ public class TextArea extends TextComponent implements java.io.Serializable
     }
   }
   
+  /**
+   * Gets the AccessibleContext associated with this <code>TextArea</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
   public AccessibleContext getAccessibleContext()
   {
-    return new AccessibleAWTTextArea();
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTTextArea();
+    return accessibleContext;
   }
 }
index 8f9f875..4c38439 100644 (file)
@@ -46,6 +46,7 @@ import java.text.BreakIterator;
 import java.util.EventListener;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleState;
 import javax.accessibility.AccessibleStateSet;
@@ -690,6 +691,21 @@ paramString()
     return (TextListener[]) getListeners (TextListener.class);
   }
 
+  /**
+   * Gets the AccessibleContext associated with this <code>TextComponent</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTTextComponent();
+    return accessibleContext;
+  }
+
+  
   /*******************************/
   // Provide AccessibleAWTTextComponent access to several peer functions that
   // aren't publicly exposed.
index 504572a..f1925a2 100644 (file)
@@ -526,6 +526,10 @@ public abstract class Toolkit
         toolkit = (Toolkit) obj;
         return toolkit;
       }
+    catch (ThreadDeath death)
+      {
+        throw death;
+      }
     catch (Throwable t)
       {
        AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name);
index d084bb4..786e51a 100644 (file)
@@ -56,6 +56,9 @@ import java.util.Vector;
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 
 /**
  * This class represents a top-level window with no decorations.
@@ -84,11 +87,26 @@ public class Window extends Container implements Accessible
   private transient WindowFocusListener windowFocusListener;
   private transient WindowStateListener windowStateListener;
   private transient GraphicsConfiguration graphicsConfiguration;
-  private transient AccessibleContext accessibleContext;
 
   private transient boolean shown;
 
   private transient Component windowFocusOwner;
+  
+  protected class AccessibleAWTWindow extends AccessibleAWTContainer
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.WINDOW;
+    }
+    
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (isActive())
+        states.add(AccessibleState.ACTIVE);
+      return states;
+    }
+  }
 
   /** 
    * This (package access) constructor is used by subclasses that want
@@ -200,12 +218,11 @@ public class Window extends Container implements Accessible
         && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
       throw new IllegalArgumentException ("gc must be from a screen device");
 
-    // FIXME: until we implement this, it just causes AWT to crash.
-//     if (gc == null)
-//       graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
-//         .getDefaultScreenDevice()
-//         .getDefaultConfiguration();
-//     else
+    if (gc == null)
+      graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
+                                                 .getDefaultScreenDevice()
+                                                 .getDefaultConfiguration();
+    else
       graphicsConfiguration = gc;
   }
 
@@ -672,8 +689,34 @@ public class Window extends Container implements Accessible
          }
       }
   }
+  
+  /**
+   * Identifies if this window is active.  The active window is a Frame or
+   * Dialog that has focus or owns the active window.
+   *  
+   * @return true if active, else false.
+   * @since 1.4
+   */
+  public boolean isActive()
+  {
+    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+    return manager.getActiveWindow() == this;
+  }
 
   /**
+   * Identifies if this window is focused.  A window is focused if it is the
+   * focus owner or it contains the focus owner.
+   * 
+   * @return true if focused, else false.
+   * @since 1.4
+   */
+  public boolean isFocused()
+  {
+    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+    return manager.getFocusedWindow() == this;
+  }
+  
+  /**
    * Returns the child window that has focus if this window is active.
    * This method returns <code>null</code> if this window is not active
    * or no children have focus.
@@ -731,6 +774,22 @@ public class Window extends Container implements Accessible
     return super.isShowing();
   }
 
+  public void setLocationRelativeTo (Component c)
+  {
+    if (c == null || !c.isShowing ())
+      {
+        int x = 0;
+        int y = 0;
+
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
+        Point center = ge.getCenterPoint ();
+        x = center.x - (width / 2);
+        y = center.y - (height / 2);
+        setLocation (x, y);
+      }
+    // FIXME: handle case where component is non-null.
+  }
+
   /**
    * @since 1.2
    *
@@ -754,11 +813,18 @@ public class Window extends Container implements Accessible
       applyResourceBundle(rb);    
   }
 
+  /**
+   * Gets the AccessibleContext associated with this <code>Window</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
   public AccessibleContext getAccessibleContext()
   {
-    // FIXME
-    //return null;
-    throw new Error ("Not implemented");
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleAWTWindow();
+    return accessibleContext;
   }
 
   /** 
@@ -866,13 +932,13 @@ public class Window extends Container implements Accessible
     this.y = y;
     width = w;
     height = h;
-    if (resized)
+    if (resized && isShowing ())
       {
         ComponentEvent ce =
           new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
         getToolkit().getSystemEventQueue().postEvent(ce);
       }
-    if (moved)
+    if (moved && isShowing ())
       {
         ComponentEvent ce =
           new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);
index 79aa886..b84eb96 100644 (file)
@@ -316,8 +316,6 @@ public class ICC_Profile implements Serializable
    */
   protected void finalize()
   {
-    header = null;
-    tagTable = null;
   }
 
   /**
index 3e78121..a64fa5a 100644 (file)
@@ -1,5 +1,5 @@
 /* DnDConstants.java -- constants for drag-and-drop operations
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -69,4 +69,9 @@ public final class DnDConstants
 
   /** A synonym for {@link #ACTION_LINK}. */
   public static final int ACTION_REFERENCE = ACTION_LINK;
-} // class DnDConstants
+
+  private DnDConstants()
+  {
+    // Do nothing here.
+  }
+}
index 7379ca7..2a8b79d 100644 (file)
@@ -205,15 +205,14 @@ public class DropTarget
   /**
    * Adds a new <code>DropTargetListener</code>.
    * 
-   * @exception TooManyListenersException If there is already a
-   * <code>DropTargetListener</code>.
+   * @exception TooManyListenersException Sun's JDK does not, despite
+   * documentation, throw this exception here when you install an additional
+   * <code>DropTargetListener</code>.  So to be compatible, we do the same
+   * thing.
    */
   public void addDropTargetListener (DropTargetListener dtl)
     throws TooManyListenersException
   {
-    if (dtl != null)
-      throw new TooManyListenersException ();
-    
     dropTargetListener = dtl;
   }
 
index 9b1b9d3..68f905f 100644 (file)
@@ -2631,11 +2631,9 @@ public class Area implements Shape, Cloneable
 
       double P = (y2 - 2 * y1 + y0);
       double Q = 2 * (y1 - y0);
-      double R = y0;
 
       double A = (x2 - 2 * x1 + x0);
       double B = 2 * (x1 - x0);
-      double C = x0;
 
       double area = (B * P - A * Q) / 3.0;
       return (area);
@@ -2937,12 +2935,10 @@ public class Area implements Shape, Cloneable
       double P = y3 - 3 * y2 + 3 * y1 - y0;
       double Q = 3 * (y2 + y0 - 2 * y1);
       double R = 3 * (y1 - y0);
-      double S = y0;
 
       double A = x3 - 3 * x2 + 3 * x1 - x0;
       double B = 3 * (x2 + x0 - 2 * x1);
       double C = 3 * (x1 - x0);
-      double D = x0;
 
       double area = (B * P - A * Q) / 5.0 + (C * P - A * R) / 2.0
                     + (C * Q - B * R) / 3.0;
index bd1a37c..d8217fe 100644 (file)
@@ -1,5 +1,5 @@
 /* Rectangle2D.java -- generic rectangles in 2-D space
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation
+   Copyright (C) 2000, 2001, 2002, 2004  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -57,30 +57,30 @@ import java.util.NoSuchElementException;
 public abstract class Rectangle2D extends RectangularShape
 {
   /**
-   * The point lies left of the rectangle (p.x < r.x).
+   * The point lies left of the rectangle (p.x &lt; r.x).
    *
-   * @see #outcode()
+   * @see #outcode(double, double)
    */
   public static final int OUT_LEFT = 1;
 
   /**
-   * The point lies above the rectangle (p.y < r.y).
+   * The point lies above the rectangle (p.y &lt; r.y).
    *
-   * @see #outcode()
+   * @see #outcode(double, double)
    */
   public static final int OUT_TOP = 2;
 
   /**
    * The point lies right of the rectangle (p.x &gt; r.maxX).
    *
-   * @see #outcode()
+   * @see #outcode(double, double)
    */
   public static final int OUT_RIGHT = 4;
 
   /**
    * The point lies below of the rectangle (p.y &gt; r.maxY).
    *
-   * @see #outcode()
+   * @see #outcode(double, double)
    */
   public static final int OUT_BOTTOM = 8;
 
index 04e70e3..fc068c2 100644 (file)
@@ -102,8 +102,8 @@ public class InputContext
     while (e.hasMoreElements())
       {
         URL url = (URL) e.nextElement();
-        BufferedReader in = null;
-        String line = null;
+        BufferedReader in;
+        String line;
         try
           {
             in = new BufferedReader
index 6791589..e4ccc54 100644 (file)
@@ -125,7 +125,9 @@ public class IndexColorModel extends ColorModel
   public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
                          byte[] blues, byte[] alphas)
   {
-    super (bits);
+    // FIXME: This super() constructor should not be used since it can give
+    // the wrong value for hasAlpha() which is final and cannot be overloaded
+    super(bits); 
     map_size = size;
     opaque = (alphas == null);
 
@@ -416,10 +418,10 @@ public class IndexColorModel extends ColorModel
    */
   public final int getAlpha (int pixel)
   {
-    if (pixel < map_size)
-           return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits));
-    
-    return 0;
+    if (opaque || pixel >= map_size)
+      return 255;
+
+    return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits));
   }
 
   /**
index 07e42cf..6b43d00 100644 (file)
@@ -1,4 +1,4 @@
-/* MemoryImageSource.java -- Java class for providing image data 
+/* MemoryImageSource.java -- Java class for providing image data
    Copyright (C) 1999, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -41,335 +41,333 @@ package java.awt.image;
 import java.util.Hashtable;
 import java.util.Vector;
 
-public class MemoryImageSource implements ImageProducer 
+public class MemoryImageSource implements ImageProducer
 {
-    private boolean animated = false;
-    private boolean fullbuffers = false;
-    private int pixeli[], width, height, offset, scansize;
-    private byte pixelb[];
-    private ColorModel cm;
-    private Hashtable props = new Hashtable();
-    private Vector consumers = new Vector();
-
-    /**
-     * Construct an image producer that reads image data from a byte
-     * array.
-     *
-     * @param w width of image
-     * @param h height of image
-     * @param cm the color model used to represent pixel values
-     * @param pix a byte array of pixel values
-     * @param off the offset into the array at which the first pixel is stored
-     * @param scan the number of array elements that represents a single pixel row
-     */
-    public MemoryImageSource(int w, int h, ColorModel cm,
-                            byte pix[], int off, int scan)
-    {
-       this ( w, h, cm, pix, off, scan, null );
-    }
-    /**
-       Constructs an ImageProducer from memory
-    */
-    public MemoryImageSource( int w, int h, ColorModel cm,
-                             byte pix[], int off, int scan,
-                             Hashtable props)
-    {
-       width = w;
-       height = h;
-       this.cm = cm;
-       offset = off;
-       scansize = scan;
-       this.props = props;
-       int max = (( scansize > width ) ? scansize : width );
-       pixelb = pix;
-    }
-    /**
-     * Construct an image producer that reads image data from an
-     * integer array.
-     *
-     * @param w width of image
-     * @param h height of image
-     * @param cm the color model used to represent pixel values
-     * @param pix an integer array of pixel values
-     * @param off the offset into the array at which the first pixel is stored
-     * @param scan the number of array elements that represents a single pixel row
-     */
-    public MemoryImageSource(int w, int h, ColorModel cm,
-                            int pix[], int off, int scan)
-    {
-       this ( w, h, cm, pix, off, scan, null );
-    }
-
-    /**
-       Constructs an ImageProducer from memory
-    */
-    public MemoryImageSource(int w, int h, ColorModel cm,
-                            int pix[], int off, int scan,
-                            Hashtable props)
-    {
-       width = w;
-       height = h;
-       this.cm = cm;
-       offset = off;
-       scansize = scan;
-       this.props = props;
-       int max = (( scansize > width ) ? scansize : width );
-       pixeli = pix;
-    }
-    /**
-       Constructs an ImageProducer from memory using the default RGB ColorModel
-    */
-    public MemoryImageSource(int w, int h,
-                            int pix[], int off, int scan,
-                            Hashtable props)
-    {
-       this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, props);
-    }
-
-    /**
-       Constructs an ImageProducer from memory using the default RGB ColorModel
-    */
-    public MemoryImageSource(int w, int h,
-                            int pix[], int off, int scan)
-    {
-       this ( w, h, ColorModel.getRGBdefault(), pix, off, scan, null);
-    }
-
-    /**
-     * Used to register an <code>ImageConsumer</code> with this
-     * <code>ImageProducer</code>.  
-     */
-    public synchronized void addConsumer(ImageConsumer ic) {
-       if (consumers.contains(ic))
-           return;
-
-       consumers.addElement(ic);
-    }
-
-    /**
-     * Used to determine if the given <code>ImageConsumer</code> is
-     * already registered with this <code>ImageProducer</code>.  
-     */
-    public synchronized boolean isConsumer(ImageConsumer ic) {
-       if (consumers.contains(ic))
-           return true;
-       return false;
-    }
-
-    /**
-     * Used to remove an <code>ImageConsumer</code> from the list of
-     * registered consumers for this <code>ImageProducer</code>.  
-     */
-    public synchronized void removeConsumer(ImageConsumer ic) {
-       consumers.removeElement(ic);
-    }
-
-    /**
-     * Used to register an <code>ImageConsumer</code> with this
-     * <code>ImageProducer</code> and then immediately start
-     * reconstruction of the image data to be delivered to all
-     * registered consumers.  
-     */
-    public void startProduction(ImageConsumer ic) {
-       if (!(consumers.contains(ic))) {
-           consumers.addElement(ic);
-       }        
-
+  private boolean animated = false;
+  private boolean fullbuffers = false;
+  private int[] pixeli;
+  private int width;
+  private int height;
+  private int offset;
+  private int scansize;
+  private byte[] pixelb;
+  private ColorModel cm;
+  private Hashtable props = new Hashtable();
+  private Vector consumers = new Vector();
+
+  /**
+   * Construct an image producer that reads image data from a byte
+   * array.
+   *
+   * @param w width of image
+   * @param h height of image
+   * @param cm the color model used to represent pixel values
+   * @param pix a byte array of pixel values
+   * @param off the offset into the array at which the first pixel is stored
+   * @param scan the number of array elements that represents a single pixel row
+   */
+  public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
+                           int scan)
+  {
+    this(w, h, cm, pix, off, scan, null);
+  }
+
+  /**
+   * Constructs an ImageProducer from memory
+   */
+  public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
+                           int scan, Hashtable props)
+  {
+    width = w;
+    height = h;
+    this.cm = cm;
+    offset = off;
+    scansize = scan;
+    this.props = props;
+    int max = ((scansize > width) ? scansize : width);
+    pixelb = pix;
+  }
+
+  /**
+   * Construct an image producer that reads image data from an
+   * integer array.
+   *
+   * @param w width of image
+   * @param h height of image
+   * @param cm the color model used to represent pixel values
+   * @param pix an integer array of pixel values
+   * @param off the offset into the array at which the first pixel is stored
+   * @param scan the number of array elements that represents a single pixel row
+   */
+  public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
+                           int scan)
+  {
+    this(w, h, cm, pix, off, scan, null);
+  }
+
+  /**
+     Constructs an ImageProducer from memory
+  */
+  public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
+                           int scan, Hashtable props)
+  {
+    width = w;
+    height = h;
+    this.cm = cm;
+    offset = off;
+    scansize = scan;
+    this.props = props;
+    int max = ((scansize > width) ? scansize : width);
+    pixeli = pix;
+  }
+
+  /**
+   * Constructs an ImageProducer from memory using the default RGB ColorModel
+   */
+  public MemoryImageSource(int w, int h, int[] pix, int off, int scan,
+                           Hashtable props)
+  {
+    this(w, h, ColorModel.getRGBdefault(), pix, off, scan, props);
+  }
+
+  /**
+   * Constructs an ImageProducer from memory using the default RGB ColorModel
+   */
+  public MemoryImageSource(int w, int h, int[] pix, int off, int scan)
+  {
+    this(w, h, ColorModel.getRGBdefault(), pix, off, scan, null);
+  }
+
+  /**
+   * Used to register an <code>ImageConsumer</code> with this
+   * <code>ImageProducer</code>.
+   */
+  public synchronized void addConsumer(ImageConsumer ic)
+  {
+    if (consumers.contains(ic))
+      return;
+
+    consumers.addElement(ic);
+  }
+
+  /**
+   * Used to determine if the given <code>ImageConsumer</code> is
+   * already registered with this <code>ImageProducer</code>.
+   */
+  public synchronized boolean isConsumer(ImageConsumer ic)
+  {
+    if (consumers.contains(ic))
+      return true;
+    return false;
+  }
+
+  /**
+   * Used to remove an <code>ImageConsumer</code> from the list of
+   * registered consumers for this <code>ImageProducer</code>.
+   */
+  public synchronized void removeConsumer(ImageConsumer ic)
+  {
+    consumers.removeElement(ic);
+  }
+
+  /**
+   * Used to register an <code>ImageConsumer</code> with this
+   * <code>ImageProducer</code> and then immediately start
+   * reconstruction of the image data to be delivered to all
+   * registered consumers.
+   */
+  public void startProduction(ImageConsumer ic)
+  {
+    if (! (consumers.contains(ic)))
+      consumers.addElement(ic);
+
+    Vector list = (Vector) consumers.clone();
+    for (int i = 0; i < list.size(); i++)
+      {
+       ic = (ImageConsumer) list.elementAt(i);
+       sendPicture(ic);
+       if (animated)
+         ic.imageComplete(ImageConsumer.SINGLEFRAME);
+       else
+         ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
+      }
+  }
+
+  /**
+   * Used to register an <code>ImageConsumer</code> with this
+   * <code>ImageProducer</code> and then request that this producer
+   * resend the image data in the order top-down, left-right.
+   */
+  public void requestTopDownLeftRightResend(ImageConsumer ic)
+  {
+    startProduction(ic);
+  }
+
+  /**
+   * Changes a flag to indicate whether this MemoryImageSource supports
+   * animations.
+   *
+   * @param animated A flag indicating whether this class supports animations
+   */
+  public synchronized void setAnimated(boolean animated)
+  {
+    this.animated = animated;
+  }
+
+  /**
+   * A flag to indicate whether or not to send full buffer updates when
+   * sending animation. If this flag is set then full buffers are sent
+   * in the newPixels methods instead of just regions.
+   *
+   * @param fullbuffers - a flag indicating whether to send the full buffers
+   */
+  public synchronized void setFullBufferUpdates(boolean fullbuffers)
+  {
+    this.fullbuffers = fullbuffers;
+  }
+
+  /**
+   * Send an animation frame to the image consumers.
+   */
+  public void newPixels()
+  {
+    if (animated == true)
+      {
+       ImageConsumer ic;
        Vector list = (Vector) consumers.clone();
-       for(int i = 0; i < list.size(); i++) {
+       for (int i = 0; i < list.size(); i++)
+         {
            ic = (ImageConsumer) list.elementAt(i);
-           sendPicture( ic );
-            if (animated)
-              ic.imageComplete( ImageConsumer.SINGLEFRAME );
-            else
-              ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
-       }       
-    }
-
-    /**
-     * Used to register an <code>ImageConsumer</code> with this
-     * <code>ImageProducer</code> and then request that this producer
-     * resend the image data in the order top-down, left-right.  
-     */
-    public void requestTopDownLeftRightResend(ImageConsumer ic) {
-       startProduction ( ic );
-    }
-
-
-    /**
-       Changes a flag to indicate whether this MemoryImageSource supports
-       animations.
-
-       @param animated A flag indicating whether this class supports animations
-     */    
-    public synchronized void setAnimated(boolean animated)
-    {
-       this.animated = animated;
-    }
-
-
-    /**
-       A flag to indicate whether or not to send full buffer updates when
-       sending animation. If this flag is set then full buffers are sent
-       in the newPixels methods instead of just regions.
-
-       @param fullbuffers - a flag indicating whether to send the full buffers 
-     */
-    public synchronized void setFullBufferUpdates(boolean fullbuffers)
-    {
-       this.fullbuffers = fullbuffers;
-    }
-
-    /**
-       Send an animation frame to the image consumers.
-     */
-    public void newPixels()
-    {
-       if( animated == true ) {
-               ImageConsumer ic;
-               Vector list = (Vector) consumers.clone();
-               for(int i = 0; i < list.size(); i++) {
-                       ic = (ImageConsumer) list.elementAt(i);
-                       sendPicture( ic );
-                       ic.imageComplete( ImageConsumer.SINGLEFRAME );
-                   }   
-           }
-    }
-
-    
-    private void sendPicture ( ImageConsumer ic )
-    {
-       ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
-       if( props != null ) {
-           ic.setProperties( props );
-       }
-       ic.setDimensions(width, height);
-       ic.setColorModel(cm);
-       if( pixeli != null ) {
-           ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize );
-       } else {
-           ic.setPixels( 0, 0, width, height, cm, pixelb, offset, scansize );
-       }
-    }
-
-    /**
-       Send an animation frame to the image consumers containing the specified
-       pixels unless setFullBufferUpdates is set.
-     */
-    public synchronized void newPixels(int x,
-                                      int y,
-                                      int w,
-                                      int h)
-    {
-       if( animated == true )
-           {
-               if( fullbuffers ) {
-                   newPixels();
-               } else {
-                   ImageConsumer ic;
-                   Vector list = (Vector) consumers.clone();
-                   for(int i = 0; i < list.size(); i++) {
-                           ic = (ImageConsumer) list.elementAt(i);
-                           ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
-                           if( props != null ) {
-                               ic.setProperties( props );
-                           }
-                           if( pixeli != null ) {
-                               int[] pixelbuf = new int[w * h];
-                               for (int row = y; row < y + h; row++)
-                                   System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, 0, w * h);
-                               ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
-                           } else {
-                               byte[] pixelbuf = new byte[w * h];
-                               for (int row = y; row < y + h; row++)
-                                  System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, 0, w * h);
-
-                               ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
-                           }
-                           ic.imageComplete( ImageConsumer.SINGLEFRAME );
-                   }
-               }     
-           }
-    }
-
-
-
-    /**
-       Send an animation frame to the image consumers containing the specified
-       pixels unless setFullBufferUpdates is set.
-
-       If framenotify is set then a notification is sent when the frame 
-       is sent otherwise no status is sent.
-     */
-    public synchronized void newPixels(int x,
-                                      int y,
-                                      int w,
-                                      int h,
-                                      boolean framenotify)
-    {
-       if( animated == true )
-           {
-               if( fullbuffers ) {
-                   newPixels();
-               } else {
-                   ImageConsumer ic;
-                   Vector list = (Vector) consumers.clone();
-                   for(int i = 0; i < list.size(); i++) {
-                           ic = (ImageConsumer) list.elementAt(i);
-                           ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
-                           if( props != null ) {
-                               ic.setProperties( props );
-                           }
-                           if( pixeli != null ) {
-                               int[] pixelbuf = new int[w * h];
-                               for (int row = y; row < y + h; row++)
-                                   System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, 0, w * h);
-                               ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
-                           } else {
-                               byte[] pixelbuf = new byte[w * h];
-                               for (int row = y; row < y + h; row++)
-                                   System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, 0, w * h);
-                               ic.setPixels( x, y, w, h, cm, pixelbuf, 0, w );
-                           }
-                           if( framenotify == true )
-                               ic.imageComplete( ImageConsumer.SINGLEFRAME );
-                   }
-               }     
-           }
-    }
-
-    public synchronized void newPixels(byte newpix[],
-                                      ColorModel newmodel,
-                                      int offset,
-                                      int scansize)
-
-    {
-       pixeli = null;
-       pixelb = newpix;
-       cm = newmodel;
-       this.offset = offset;
-       this.scansize = scansize;
-       if( animated == true )
-           {
-               newPixels();
-           }
-    }
-
-    public synchronized void newPixels(int newpix[],
-                                      ColorModel newmodel,
-                                      int offset,
-                                      int scansize)
-
-    {
-       pixelb = null;
-       pixeli = newpix;
-       cm = newmodel;
-       this.offset = offset;
-       this.scansize = scansize;
-       if( animated == true )
-           {
-               newPixels();
-           }
-    }
-
+           sendPicture(ic);
+           ic.imageComplete(ImageConsumer.SINGLEFRAME);
+         }
+      }
+  }
+
+  private void sendPicture(ImageConsumer ic)
+  {
+    ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+    if (props != null)
+      ic.setProperties(props);
+    ic.setDimensions(width, height);
+    ic.setColorModel(cm);
+    if (pixeli != null)
+      ic.setPixels(0, 0, width, height, cm, pixeli, offset, scansize);
+    else
+      ic.setPixels(0, 0, width, height, cm, pixelb, offset, scansize);
+  }
+
+  /**
+   * Send an animation frame to the image consumers containing the specified
+   * pixels unless setFullBufferUpdates is set.
+   */
+  public synchronized void newPixels(int x, int y, int w, int h)
+  {
+    if (animated == true)
+      {
+       if (fullbuffers)
+         newPixels();
+       else
+         {
+           ImageConsumer ic;
+           Vector list = (Vector) consumers.clone();
+           for (int i = 0; i < list.size(); i++)
+             {
+               ic = (ImageConsumer) list.elementAt(i);
+               ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+               if (props != null)
+                 ic.setProperties(props);
+               if (pixeli != null)
+                 {
+                   int[] pixelbuf = new int[w * h];
+                   for (int row = y; row < y + h; row++)
+                     System.arraycopy(pixeli, row * scansize + x + offset,
+                                      pixelbuf, 0, w * h);
+                   ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+                 }
+               else
+                 {
+                   byte[] pixelbuf = new byte[w * h];
+                   for (int row = y; row < y + h; row++)
+                     System.arraycopy(pixelb, row * scansize + x + offset,
+                                      pixelbuf, 0, w * h);
+
+                   ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+                 }
+               ic.imageComplete(ImageConsumer.SINGLEFRAME);
+             }
+         }
+      }
+  }
+
+  /**
+   * Send an animation frame to the image consumers containing the specified
+   * pixels unless setFullBufferUpdates is set.
+   *
+   * If framenotify is set then a notification is sent when the frame
+   * is sent otherwise no status is sent.
+   */
+  public synchronized void newPixels(int x, int y, int w, int h,
+                                     boolean framenotify)
+  {
+    if (animated == true)
+      {
+       if (fullbuffers)
+         newPixels();
+       else
+         {
+           ImageConsumer ic;
+           Vector list = (Vector) consumers.clone();
+           for (int i = 0; i < list.size(); i++)
+             {
+               ic = (ImageConsumer) list.elementAt(i);
+               ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+               if (props != null)
+                 ic.setProperties(props);
+               if (pixeli != null)
+                 {
+                   int[] pixelbuf = new int[w * h];
+                   for (int row = y; row < y + h; row++)
+                     System.arraycopy(pixeli, row * scansize + x + offset,
+                                      pixelbuf, 0, w * h);
+                   ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+                 }
+               else
+                 {
+                   byte[] pixelbuf = new byte[w * h];
+                   for (int row = y; row < y + h; row++)
+                     System.arraycopy(pixelb, row * scansize + x + offset,
+                                      pixelbuf, 0, w * h);
+                   ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+                 }
+               if (framenotify == true)
+                 ic.imageComplete(ImageConsumer.SINGLEFRAME);
+             }
+         }
+      }
+  }
+
+  public synchronized void newPixels(byte[] newpix, ColorModel newmodel,
+                                     int offset, int scansize)
+  {
+    pixeli = null;
+    pixelb = newpix;
+    cm = newmodel;
+    this.offset = offset;
+    this.scansize = scansize;
+    if (animated == true)
+      newPixels();
+  }
+
+  public synchronized void newPixels(int[] newpix, ColorModel newmodel,
+                                     int offset, int scansize)
+  {
+    pixelb = null;
+    pixeli = newpix;
+    cm = newmodel;
+    this.offset = offset;
+    this.scansize = scansize;
+    if (animated == true)
+      newPixels();
+  }
 }
index 0525d37..6d5f284 100644 (file)
@@ -59,7 +59,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
   public MultiPixelPackedSampleModel(int dataType, int w, int h,
                                     int numberOfBits)
   {
-    this(dataType, w, h, 0, numberOfBits, 0);
+    this(dataType, w, h, numberOfBits, 0, 0);
   }
 
   public MultiPixelPackedSampleModel(int dataType, int w, int h,
@@ -101,7 +101,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
 
     // Compute scan line large enough for w pixels.
     if (scanlineStride == 0)
-      scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits) + 1;
+      scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits);
     this.scanlineStride = scanlineStride;
 
     
@@ -112,8 +112,9 @@ public class MultiPixelPackedSampleModel extends SampleModel
     bitOffsets = new int[numElems];
     for (int i=0; i < numElems; i++)
       {
-       bitOffsets[i] = numberOfBits * i;
-       bitMasks[i] = ((1 << numberOfBits) - 1) << bitOffsets[i];
+       bitOffsets[numElems - i- 1] = numberOfBits * i;
+       bitMasks[numElems - i - 1] = ((1 << numberOfBits) - 1) << 
+           bitOffsets[numElems - i - 1];
       }
   }
 
index 0fd977e..b613c1b 100644 (file)
@@ -83,7 +83,7 @@ public abstract class RGBImageFilter extends ImageFilter
            }
        else {
                consumer.setColorModel(ColorModel.getRGBdefault());
-           }
+       }
     }
     
     /**
index a572da7..091909d 100644 (file)
@@ -201,10 +201,10 @@ public class ReplicateScaleFilter extends ImageFilter
                            model, destPixels, 0, destScansize);
     }
 
-    protected byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
-                                    ColorModel model, byte[] srcPixels,
-                                    int srcOffset, int srcScansize,
-                                    double rx, double ry, int destScansize)
+    private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
+                                   ColorModel model, byte[] srcPixels,
+                                   int srcOffset, int srcScansize,
+                                   double rx, double ry, int destScansize)
     {
        byte[] destPixels =
          new byte[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
@@ -221,10 +221,10 @@ public class ReplicateScaleFilter extends ImageFilter
        return destPixels;
     }
 
-    protected int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
-                                    ColorModel model, int[] srcPixels,
-                                    int srcOffset, int srcScansize,
-                                    double rx, double ry, int destScansize)
+    private int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
+                                  ColorModel model, int[] srcPixels,
+                                  int srcOffset, int srcScansize,
+                                  double rx, double ry, int destScansize)
     {
        int[] destPixels =
          new int[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
index 2daa14d..a187fc0 100644 (file)
@@ -43,12 +43,12 @@ import java.awt.Rectangle;
 public interface RobotPeer
 {
   void mouseMove (int x, int y);
-  void mousePress (int x);
-  void mouseRelease (int x);
-  void mouseWheel (int x);
-  void keyPress (int x);
-  void keyRelease (int x);
+  void mousePress (int buttons);
+  void mouseRelease (int buttons);
+  void mouseWheel (int wheelAmt);
+  void keyPress (int keycode);
+  void keyRelease (int keycode);
   int getRGBPixel (int x, int y);
-  int[] getRGBPixels (Rectangle r);
+  int[] getRGBPixels (Rectangle screen);
 } // interface RobotPeer
 
index 9bdd7d6..41f360b 100644 (file)
@@ -1,5 +1,5 @@
 /* Book.java -- A mixed group of pages to print.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,146 +41,119 @@ package java.awt.print;
 import java.util.Vector;
 
 /**
-  * This class allows documents to be created with different paper types,
-  * page formatters, and painters.
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  */
-public class Book implements Pageable
-{
-
-/*
- * Instance Variables
- */
-
-// Painter objects for the book
-Vector printables = new Vector();
-
-// Page formats for the book
-Vector page_formats = new Vector();
-
-/*************************************************************************/
-
-/*
- * Constructors
+ * This class allows documents to be created with different paper types,
+ * page formatters, and painters.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
  */
-
-/** 
-  * Initializes a new instance of <code>Book</code> that is empty.
-  */
-public
-Book()
-{
-  ;
-}
-
-/*************************************************************************/
-
-/**
-  * Returns the number of pages in this book.
-  *
-  * @return The number of pages in this book.
-  */
-public int
-getNumberOfPages()
-{
-  return(printables.size());
-}
-
-/*************************************************************************/
-
-/**
-  * This method returns the <code>PageFormat</code> object for the
-  * specified page.
-  *
-  * @param page_number The number of the page to get information for, where
-  * page numbers start at 0.
-  *
-  * @return The <code>PageFormat</code> object for the specified page.
-  *
-  * @exception IndexOutOfBoundsException If the page number is not valid.
-  */
-public PageFormat
-getPageFormat(int page_number)
-{
-  return((PageFormat)page_formats.elementAt(page_number));
-}
-
-/*************************************************************************/
-
-/**
-  * This method returns the <code>Printable</code> object for the
-  * specified page.
-  *
-  * @param page_number The number of the page to get information for, where
-  * page numbers start at 0.
-  *
-  * @return The <code>Printable</code> object for the specified page.
-  *
-  * @exception IndexOutOfBoundsException If the page number is not valid.
-  */
-public Printable
-getPrintable(int page_number)
-{
-  return((Printable)printables.elementAt(page_number));
-}
-
-/*************************************************************************/
-
-/**
-  * This method appends a page to the end of the book.
-  *
-  * @param printable The <code>Printable</code> for this page.
-  * @param page_format The <code>PageFormat</code> for this page.
-  *
-  * @exception NullPointerException If either argument is <code>null</code>.
-  */
-public void
-append(Printable printable, PageFormat page_format)
-{
-  append(printable, page_format, 1);
-} 
-
-/*************************************************************************/
-
-/**
-  * This method appends the specified number of pages to the end of the book.
-  * Each one will be associated with the specified <code>Printable</code>
-  * and <code>PageFormat</code>.
-  *
-  * @param printable The <code>Printable</code> for this page.
-  * @param page_format The <code>PageFormat</code> for this page.
-  * @param num_pages The number of pages to append.
-  *
-  * @exception NullPointerException If any argument is <code>null</code>.
-  */
-public void
-append(Printable printable, PageFormat page_format, int num_pages)
-{
-  for (int i = 0; i < num_pages; i++)
-    {
-      printables.addElement(printable);
-      page_formats.addElement(page_format);
-    }
-}
-
-/*************************************************************************/
-
-/**
-  * This method changes the <code>Printable</code> and <code>PageFormat</code>
-  * for the specified page.  The page must already exist or an exception
-  * will be thrown.
-  *
-  * @param page_num The page number to alter.
-  * @param printable The new <code>Printable</code> for the page.
-  * @param page_format The new <code>PageFormat</code> for the page.
-  *
-  * @throws IndexOutOfBoundsException If the specified page does not exist.
-  */
-public void
-setPage(int page_num, Printable printable, PageFormat page_format)
+public class Book implements Pageable
 {
-  printables.setElementAt(printable, page_num);
-  page_formats.setElementAt(page_format, page_num);
-}
+  /**
+   * Painter objects for the book.
+   */
+  Vector printables = new Vector();
+
+  /**
+   * Page formats for the book.
+   */
+  Vector page_formats = new Vector();
+
+  /**
+   * Initializes a new instance of <code>Book</code> that is empty.
+   */
+  public Book()
+  {
+  }
+
+  /**
+   * Returns the number of pages in this book.
+   *
+   * @return The number of pages in this book.
+   */
+  public int getNumberOfPages()
+  {
+    return printables.size();
+  }
+
+  /**
+   * This method returns the <code>PageFormat</code> object for the
+   * specified page.
+   *
+   * @param page_number The number of the page to get information for, where
+   * page numbers start at 0.
+   *
+   * @return The <code>PageFormat</code> object for the specified page.
+   *
+   * @exception IndexOutOfBoundsException If the page number is not valid.
+   */
+  public PageFormat getPageFormat(int page_number)
+  {
+    return (PageFormat) page_formats.elementAt(page_number);
+  }
+
+  /**
+   * This method returns the <code>Printable</code> object for the
+   * specified page.
+   *
+   * @param page_number The number of the page to get information for, where
+   * page numbers start at 0.
+   *
+   * @return The <code>Printable</code> object for the specified page.
+   *
+   * @exception IndexOutOfBoundsException If the page number is not valid.
+   */
+  public Printable getPrintable(int page_number)
+  {
+    return (Printable) printables.elementAt(page_number);
+  }
+
+  /**
+   * This method appends a page to the end of the book.
+   *
+   * @param printable The <code>Printable</code> for this page.
+   * @param page_format The <code>PageFormat</code> for this page.
+   *
+   * @exception NullPointerException If either argument is <code>null</code>.
+   */
+  public void append(Printable printable, PageFormat page_format)
+  {
+    append(printable, page_format, 1);
+  }
+
+  /**
+   * This method appends the specified number of pages to the end of the book.
+   * Each one will be associated with the specified <code>Printable</code>
+   * and <code>PageFormat</code>.
+   *
+   * @param printable The <code>Printable</code> for this page.
+   * @param page_format The <code>PageFormat</code> for this page.
+   * @param num_pages The number of pages to append.
+   *
+   * @exception NullPointerException If any argument is <code>null</code>.
+   */
+  public void append(Printable printable, PageFormat page_format, int num_pages)
+  {
+    for (int i = 0; i < num_pages; i++)
+      {
+       printables.addElement(printable);
+       page_formats.addElement(page_format);
+      }
+  }
+
+  /**
+   * This method changes the <code>Printable</code> and <code>PageFormat</code>
+   * for the specified page.  The page must already exist or an exception
+   * will be thrown.
+   *
+   * @param page_num The page number to alter.
+   * @param printable The new <code>Printable</code> for the page.
+   * @param page_format The new <code>PageFormat</code> for the page.
+   *
+   * @throws IndexOutOfBoundsException If the specified page does not exist.
+   */
+  public void setPage(int page_num, Printable printable, PageFormat page_format)
+  {
+    printables.setElementAt(printable, page_num);
+    page_formats.setElementAt(page_format, page_num);
+  }
 }
index 8998aa0..bc5cfcd 100644 (file)
@@ -1,5 +1,5 @@
 /* PrinterJob.java -- This job is the printer control class
-   Copyright (C) 1999, 2004  Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,10 +38,9 @@ exception statement from your version. */
 
 package java.awt.print;
 
-import javax.print.DocFlavor;
+import java.awt.HeadlessException;
+
 import javax.print.PrintService;
-import javax.print.PrintServiceLookup;
-//import javax.print.StreamPrintServiceFactory;
 import javax.print.attribute.PrintRequestAttributeSet;
 
 /**
@@ -61,7 +60,7 @@ public abstract class PrinterJob
    */
   public static PrinterJob getPrinterJob()
   {
-  // FIXME: Need to fix this to load a default implementation instance.
+    // FIXME: Need to fix this to load a default implementation instance.
     return null;
   }
 
@@ -149,7 +148,8 @@ public abstract class PrinterJob
    *
    * @return The modified <code>PageFormat</code>.
    */
-  public abstract PageFormat pageDialog(PageFormat page_format);
+  public abstract PageFormat pageDialog(PageFormat page_format)
+    throws HeadlessException;
 
   /**
    * Prints the pages.
@@ -169,7 +169,8 @@ public abstract class PrinterJob
    * @return <code>false</code> if the user cancels the dialog box,
    * <code>true</code> otherwise.
    */
-  public abstract boolean printDialog();
+  public abstract boolean printDialog()
+    throws HeadlessException;
 
   /**
    * Displays a dialog box to the user which allows the print job
@@ -178,7 +179,8 @@ public abstract class PrinterJob
    * @return <code>false</code> if the user cancels the dialog box,
    * <code>true</code> otherwise.
    */
-  public abstract boolean printDialog(PrintRequestAttributeSet attributes);
+  public abstract boolean printDialog(PrintRequestAttributeSet attributes)
+    throws HeadlessException;
 
   /**
    * This sets the pages that are to be printed.
index 4f0af1c..c0ddf44 100644 (file)
@@ -1,5 +1,5 @@
 /* AbstractAction.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -55,15 +55,13 @@ import javax.swing.event.SwingPropertyChangeSupport;
 public abstract class AbstractAction
   implements Action, Cloneable, Serializable
 {
-  static final long serialVersionUID = -6803159439231523484L;
+  private static final long serialVersionUID = -6803159439231523484L;
 
   /**
    * enabled
    */
   protected boolean enabled = true;
   
-  public static final String ENABLED_PROPERTY = "enabled";
-
   /**
    * changeSupport
    */
@@ -193,7 +191,7 @@ public abstract class AbstractAction
     if (enabled != this.enabled)
     {
       this.enabled = enabled;
-      firePropertyChange(ENABLED_PROPERTY, !this.enabled, this.enabled);
+      firePropertyChange("enabled", !this.enabled, this.enabled);
     }
   }
 
index adb3af4..1232a4a 100644 (file)
@@ -661,7 +661,7 @@ public abstract class AbstractButton extends JComponent
    *
    * @param e The event signifying that the button's model changed state
    */
-  public void fireItemStateChanged(ItemEvent e)
+  protected void fireItemStateChanged(ItemEvent e)
   {
     e.setSource(this);
     ItemListener[] listeners = getItemListeners();
@@ -676,7 +676,7 @@ public abstract class AbstractButton extends JComponent
    *
    * @param e The event signifying that the button's model was clicked
    */
-  public void fireActionPerformed(ActionEvent e)
+  protected void fireActionPerformed(ActionEvent e)
   {
     e.setSource(this);
     ActionListener[] listeners = getActionListeners();
@@ -689,7 +689,7 @@ public abstract class AbstractButton extends JComponent
    * Calls {@link ChangeEvent.stateChanged} on each {@link ChangeListener}
    * in the button's listener list.
    */
-  public void fireStateChanged()
+  protected void fireStateChanged()
   {
     ChangeListener[] listeners = getChangeListeners();
 
@@ -740,10 +740,10 @@ public abstract class AbstractButton extends JComponent
 
     if (old != mne)
       {
-    getModel().setMnemonic(mne);
+       getModel().setMnemonic(mne);
 
        if (text != null && ! text.equals(""))
-      {
+         {
            // Since lower case char = upper case char for 
            // mnemonic, we will convert both text and mnemonic 
            // to upper case before checking if mnemonic character occurs
@@ -753,9 +753,9 @@ public abstract class AbstractButton extends JComponent
            setDisplayedMnemonicIndex(upperCaseText.indexOf(upperCaseMne));
          }
 
-        firePropertyChange(MNEMONIC_CHANGED_PROPERTY, old, mne);
-        revalidate();
-        repaint();
+       firePropertyChange(MNEMONIC_CHANGED_PROPERTY, old, mne);
+       revalidate();
+       repaint();
       }
   }
 
@@ -806,7 +806,7 @@ public abstract class AbstractButton extends JComponent
   public void setRolloverEnabled(boolean r)
   {
     if (rollOverEnabled != r)
-  {
+      {
         rollOverEnabled = r;
         firePropertyChange(ROLLOVER_ENABLED_CHANGED_PROPERTY, !r, r);
         revalidate();
@@ -1450,7 +1450,7 @@ public abstract class AbstractButton extends JComponent
 
         // Set actionCommand to button's text by default if it is not specified
         if (actionCommand != null)
-        setActionCommand((String)(a.getValue(Action.ACTION_COMMAND_KEY)));
+          setActionCommand((String)(a.getValue(Action.ACTION_COMMAND_KEY)));
         else
           setActionCommand(getText());
       }
@@ -1509,7 +1509,7 @@ public abstract class AbstractButton extends JComponent
         public void propertyChange(PropertyChangeEvent e)
         {
           Action act = (Action) (e.getSource());       
-         if (e.getPropertyName().equals(AbstractAction.ENABLED_PROPERTY))
+         if (e.getPropertyName().equals("enabled"))
            setEnabled(act.isEnabled());
          else if (e.getPropertyName().equals(Action.NAME))
             setText((String)(act.getValue(Action.NAME)));
@@ -1847,7 +1847,39 @@ public abstract class AbstractButton extends JComponent
    */
   protected String paramString()
   {
-    return "AbstractButton";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",defaultIcon=");
+    if (getIcon() != null)
+      sb.append(getIcon());
+    sb.append(",disabledIcon=");
+    if (getDisabledIcon() != null)
+      sb.append(getDisabledIcon());
+    sb.append(",disabledSelectedIcon=");
+    if (getDisabledSelectedIcon() != null)
+      sb.append(getDisabledSelectedIcon());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(getMargin());
+    sb.append(",paintBorder=").append(isBorderPainted());
+    sb.append(",paintFocus=").append(isFocusPainted());
+    sb.append(",pressedIcon=");
+    if (getPressedIcon() != null)
+      sb.append(getPressedIcon());
+    sb.append(",rolloverEnabled=").append(isRolloverEnabled());
+    sb.append(",rolloverIcon=");
+    if (getRolloverIcon() != null)
+      sb.append(getRolloverIcon());
+    sb.append(",rolloverSelected=");
+    if (getRolloverSelectedIcon() != null)
+      sb.append(getRolloverSelectedIcon());
+    sb.append(",selectedIcon=");
+    if (getSelectedIcon() != null)
+      sb.append(getSelectedIcon());
+    sb.append(",text=");
+    if (getText() != null)
+      sb.append(getText());
+    return sb.toString();
   }
 
   /**
index 196e2e2..7cc5751 100644 (file)
@@ -53,7 +53,7 @@ import javax.swing.event.EventListenerList;
 public abstract class AbstractCellEditor
   implements CellEditor, Serializable
 {
-  static final long serialVersionUID = -1048006551406220959L;
+  private static final long serialVersionUID = -1048006551406220959L;
 
   /**
    * listenerList
index 9fe1bcb..a380b2a 100644 (file)
@@ -54,7 +54,7 @@ import javax.swing.event.ListDataListener;
  */
 public abstract class AbstractListModel implements ListModel, Serializable
 {
-  static final long serialVersionUID = -3285184064379168730L;
+  private static final long serialVersionUID = -3285184064379168730L;
 
   /** List of ListDataListeners called for each change to the list. */
   protected EventListenerList listenerList;
@@ -100,25 +100,12 @@ public abstract class AbstractListModel implements ListModel, Serializable
   protected void fireContentsChanged(Object source, int startIndex,
                                      int endIndex)
   {
-    // Variables
-    ListDataEvent event;
-    ListDataListener[] listeners;
-    ListDataListener listener;
-    int index;
-
-    // Create Event
-    event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
-                              startIndex, endIndex);
-
-    // Get Listeners
-    listeners = getListDataListeners();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = (ListDataListener) listeners[index];
-        listener.contentsChanged(event);
-      }
+    ListDataEvent event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
+                                            startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].contentsChanged(event);
   }
 
   /**
@@ -134,25 +121,13 @@ public abstract class AbstractListModel implements ListModel, Serializable
    */
   protected void fireIntervalAdded(Object source, int startIndex, int endIndex)
   {
-    // Variables
-    ListDataEvent event;
-    ListDataListener[] listeners;
-    ListDataListener listener;
-    int index;
-
-    // Create Event
-    event = new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED,
-                              startIndex, endIndex);
-
-    // Get Listeners
-    listeners = getListDataListeners();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = listeners[index];
-        listener.intervalAdded(event);
-      }
+    ListDataEvent event =
+      new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED,
+                       startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].intervalAdded(event);
   }
 
   /**
@@ -169,25 +144,13 @@ public abstract class AbstractListModel implements ListModel, Serializable
   protected void fireIntervalRemoved(Object source, int startIndex,
                                      int endIndex)
   {
-    // Variables
-    ListDataEvent event;
-    ListDataListener[] listeners;
-    ListDataListener listener;
-    int index;
-
-    // Create Event
-    event = new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED,
-                              startIndex, endIndex);
-
-    // Get Listeners
-    listeners = getListDataListeners();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = listeners[index];
-        listener.intervalRemoved(event);
-      }
+    ListDataEvent event =
+      new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED,
+                       startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].intervalRemoved(event);
   }
 
   /**
index 645252f..26d1d6f 100644 (file)
@@ -49,7 +49,7 @@ import java.util.Set;
 
 
 /**
- * @author     Andrew Selkirk
+ * @author Andrew Selkirk
  * @author Michael Koch
  */
 public class ActionMap
@@ -57,30 +57,30 @@ public class ActionMap
 {
   private static final long serialVersionUID = -6277518704513986346L;
 
-       /**
-        * actionMap
-        */
-       private Map actionMap = new HashMap();
+  /**
+   * actionMap
+   */
+  private Map actionMap = new HashMap();
 
-       /**
-        * parent
-        */
+  /**
+   * parent
+   */
   private ActionMap parent;
 
-       /**
+  /**
    * Creates a new <code>ActionMap</code> instance.
-        */
+   */
   public ActionMap()
   {
   }
 
-       /**
+  /**
    * Returns an action associated with an object.
    *
    * @param key the key of the enty
    *
    * @return the action associated with key, may be null
-        */
+   */
   public Action get(Object key)
   {
     Object result = actionMap.get(key);
@@ -88,123 +88,123 @@ public class ActionMap
     if (result == null && parent != null)
       result = parent.get(key);
 
-               return (Action) result;
+    return (Action) result;
   }
 
-       /**
+  /**
    * Puts a new <code>Action</code> into the <code>ActionMap</code>.
    * If action is null an existing entry will be removed.
    *
    * @param key the key for the entry
    * @param action the action.
-        */
+   */
   public void put(Object key, Action action)
   {
     if (action == null)
-                       actionMap.remove(key);
+      actionMap.remove(key);
     else
-                       actionMap.put(key, action);
+      actionMap.put(key, action);
   }
 
-       /**
+  /**
    * Remove an entry from the <code>ActionMap</code>.
    *
    * @param key the key of the entry to remove
-        */
+   */
   public void remove(Object key)
   {
-               actionMap.remove(key);
+    actionMap.remove(key);
   }
 
-       /**
+  /**
    * Returns the parent of this <code>ActionMap</code>.
    *
    * @return the parent, may be null.
-        */
+   */
   public ActionMap getParent()
   {
-               return parent;
+    return parent;
   }
 
-       /**
+  /**
    * Sets a parent for this <code>ActionMap</code>.
    *
    * @param parentMap the new parent
-        */
+   */
   public void setParent(ActionMap parentMap)
   {
-               parent = parentMap;
+    parent = parentMap;
   }
 
-       /**
+  /**
    * Returns the number of entries in this <code>ActionMap</code>.
    *
    * @return the number of entries
-        */
+   */
   public int size()
   {
-               return actionMap.size();
+    return actionMap.size();
   }
 
-       /**
+  /**
    * Clears the <code>ActionMap</code>.
-        */
+   */
   public void clear()
   {
-               actionMap.clear();
+    actionMap.clear();
   }
 
-       /**
+  /**
    * Returns all keys of entries in this <code>ActionMap</code>.
    *
    * @return an array of keys
-        */
+   */
   public Object[] keys()
   {
     return actionMap.keySet().toArray();
   }
 
-       /**
+  /**
    * Returns all keys of entries in this <code>ActionMap</code>
    * and all its parents.
    *
    * @return an array of keys
-        */
+   */
   public Object[] allKeys()
   {
     Set set = new HashSet();
 
     if (parent != null)
-                       set.addAll(Arrays.asList(parent.allKeys()));
+      set.addAll(Arrays.asList(parent.allKeys()));
 
     set.addAll(actionMap.keySet());
     return set.toArray();
   }
 
-       /**
-        * writeObject
+  /**
+   * writeObject
    *
    * @param stream the stream to write to
    *
    * @exception IOException If an error occurs
-        */
+   */
   private void writeObject(ObjectOutputStream stream)
     throws IOException
   {
-               // TODO
+    // TODO
   }
 
-       /**
-        * readObject
+  /**
+   * readObject
    *
    * @param stream the stream to read from
    *
    * @exception ClassNotFoundException If the serialized class cannot be found
    * @exception IOException If an error occurs
-        */
+   */
   private void readObject(ObjectInputStream stream)
     throws ClassNotFoundException, IOException
   {
-               // TODO
+    // TODO
   }
 }
index 907e704..92cf69d 100644 (file)
@@ -35,103 +35,134 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import javax.swing.event.ChangeListener;
 
 /**
- * BoundedRangeModel
- * @author     Andrew Selkirk
- * @version    1.0
+ * @author Andrew Selkirk
  */
-public interface BoundedRangeModel {
-
-       //-------------------------------------------------------------
-       // Methods ----------------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * getValue
-        * @returns int
-        */
-       int getValue();
-
-       /**
-        * setValue
-        * @param value TODO
-        */
-       void setValue(int value);
-
-       /**
-        * getMinimum
-        * @returns int
-        */
-       int getMinimum();
-
-       /**
-        * setMinimum
-        * @param minimum TODO
-        */
-       void setMinimum(int minimum);
-
-       /**
-        * getMaximum
-        * @returns int
-        */
-       int getMaximum();
-
-       /**
-        * setMaximum
-        * @param maximum TODO
-        */
-       void setMaximum(int maximum);
-
-       /**
-        * getValueIsAdjusting
-        * @returns boolean
-        */
-       boolean getValueIsAdjusting();
-
-       /**
-        * setValueIsAdjusting
-        * @param adjusting TODO
-        */
-       void setValueIsAdjusting(boolean adjusting);
-
-       /**
-        * getExtent
-        * @returns int
-        */
-       int getExtent();
-
-       /**
-        * setExtent
-        * @param extent TODO
-        */
-       void setExtent(int extent);
-
-       /**
-        * setRangeProperties
-        * @param value TODO
-        * @param extent TODO
-        * @param min TODO
-        * @param max TODO
-        * @param adjusting TODO
-        */
-       void setRangeProperties(int value, int extent, int min, 
-                                       int max, boolean adjusting);
-
-       /**
-        * addChangeListener
-        * @param listener TODO
-        */
-       void addChangeListener(ChangeListener listener);
-
-       /**
-        * removeChangeListener
-        * @param listener TODO
-        */
-       void removeChangeListener(ChangeListener listener);
-
-
-} // BoundedRangeModel
+public interface BoundedRangeModel
+{
+  /**
+   * getValue
+   * 
+   * @return int
+   *
+   * @see #setValue(int)
+   */
+  int getValue();
+
+  /**
+   * setValue
+   * 
+   * @param value the value
+   *
+   * @see #getValue()
+   */
+  void setValue(int value);
+
+  /**
+   * getMinimum
+   * 
+   * @return int
+   *
+   * @see #setMinimum(int)
+   */
+  int getMinimum();
+
+  /**
+   * setMinimum
+   * 
+   * @param minimum the minimum value
+   *
+   * @see #getMinimum()
+   */
+  void setMinimum(int minimum);
+
+  /**
+   * getMaximum
+   * 
+   * @return int
+   *
+   * @see #setMaximum(int)
+   */
+  int getMaximum();
+
+  /**
+   * setMaximum
+   * 
+   * @param maximum the maximum value
+   *
+   * @see #getMaximum()
+   */
+  void setMaximum(int maximum);
+
+  /**
+   * Returns the value of the <code>valueIsAdjusting</code> property.
+   * 
+   * @return <code>true</code> if value is adjusting,
+   * otherwise <code>false</code>
+   *
+   * @see setValueIsAdjusting(boolean)
+   */
+  boolean getValueIsAdjusting();
+
+  /**
+   * setValueIsAdjusting
+   * 
+   * @param adjusting <code>true</code> if adjusting,
+   * <code>false</code> otherwise
+   *
+   * @see #getValueIsAdjusting()
+   */
+  void setValueIsAdjusting(boolean adjusting);
+
+  /**
+   * Returns the current extent.
+   *
+   * @return the extent
+   *
+   * @see #setExtent(int)
+   */
+  int getExtent();
+
+  /**
+   * setExtent
+   * 
+   * @param extent the extent
+   *
+   * @see #getExtent()
+   */
+  void setExtent(int extent);
+
+  /**
+   * setRangeProperties
+   * @param value the value
+   * @param extent the extent
+   * @param minnimum the minimum value
+   * @param maximum the maximum value
+   * @param adjusting TODO
+   */
+  void setRangeProperties(int value, int extent, int minimum, int maximum,
+                         boolean adjusting);
+
+  /**
+   * Adds a <code>ChangeListener</code> to this object.
+   * 
+   * @param listener the listener to add
+   * 
+   * @see #removeChangeListener(javax.swing.event.ChangeListener)
+   */
+  void addChangeListener(ChangeListener listener);
+
+  /**
+   * Removes a <code>ChangeListener</code> from this object.
+   * 
+   * @param listener the listener to remove
+   *
+   * @see #addChangeListener(javax.swing.event.ChangeListener)
+   */
+  void removeChangeListener(ChangeListener listener);
+}
index 84110c5..1c85892 100644 (file)
@@ -39,17 +39,17 @@ package javax.swing;
 
 
 /**
- * @author     Andrew Selkirk
+ * @author Andrew Selkirk
  * @author Michael Koch
  */
 public class ComponentInputMap extends InputMap
 {
-       /**
+  /**
    * The component to notify.
-        */
-       private JComponent component;
+   */
+  private JComponent component;
 
-       /**
+  /**
    * Creates <code>ComponentInputMap</code> object that notifies the given
    * component about changes to it.
    *
index 6aa80ad..074d451 100644 (file)
@@ -1,5 +1,5 @@
 /* DebugGraphics.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -56,6 +56,30 @@ import java.text.AttributedCharacterIterator;
  */
 public class DebugGraphics extends Graphics
 {
+  /**
+   * LOG_OPTION
+   */
+  public static final int LOG_OPTION = 1;
+
+  /**
+   * FLASH_OPTION
+   */
+  public static final int FLASH_OPTION = 2;
+
+  /**
+   * BUFFERED_OPTION
+   */
+  public static final int BUFFERED_OPTION = 4;
+
+  /**
+   * NONE_OPTION
+   */
+  public static final int NONE_OPTION = -1;
+
+  static Color debugFlashColor = Color.RED;
+  static int debugFlashCount = 10;
+  static int debugFlashTime = 1000;
+  static PrintStream debugLogStream = System.out;
 
   /**
    * graphics
@@ -63,6 +87,11 @@ public class DebugGraphics extends Graphics
   Graphics graphics;
 
   /**
+   * color
+   */
+  Color color = Color.BLACK;
+  
+  /**
    * buffer
    */
   Image buffer;
@@ -88,26 +117,6 @@ public class DebugGraphics extends Graphics
   int yOffset;
 
   /**
-   * LOG_OPTION
-   */
-  public static final int LOG_OPTION = 1;
-
-  /**
-   * FLASH_OPTION
-   */
-  public static final int FLASH_OPTION = 2;
-
-  /**
-   * BUFFERED_OPTION
-   */
-  public static final int BUFFERED_OPTION = 4;
-
-  /**
-   * NONE_OPTION
-   */
-  public static final int NONE_OPTION = -1;
-
-  /**
    * Creates a <code>DebugGraphics</code> object.
    */
   public DebugGraphics()
@@ -116,55 +125,62 @@ public class DebugGraphics extends Graphics
   }
 
   /**
-   * Constructor DebugGraphics
-   * @param graphics TODO
+   * Creates a <code>DebugGraphics</code> object.
+   *
+   * @param graphics The <code>Graphics</code> object to wrap
    * @param component TODO
    */
   public DebugGraphics(Graphics graphics, JComponent component)
   {
-    // TODO
+    this.graphics = graphics;
+    // FIXME: What shall we do with component ?
   }
 
   /**
-   * Constructor DebugGraphics
-   * @param graphics TODO
+   * Creates a <code>DebugGraphics</code> object.
+   *
+   * @param graphics The <code>Graphics</code> object to wrap
    */
   public DebugGraphics(Graphics graphics)
   {
-    // TODO
+    this.graphics = graphics;
   }
 
   /**
-   * setColor
-   * @param value0 TODO
+   * Sets the color to draw stuff with.
+   * 
+   * @param color The color
    */
   public void setColor(Color color)
   {
-    // TODO
+    this.color = color;
   }
 
   /**
-   * create
+   * Creates a overrides <code>Graphics.create</code> to create a
+   * <code>DebugGraphics</code> object.
    *
-   * @return Graphics
+   * @return a new <code>DebugGraphics</code> object.
    */
   public Graphics create()
   {
-    return null; // TODO
+    return new DebugGraphics(graphics.create());
   }
 
   /**
-   * create
+   * Creates a overrides <code>Graphics.create</code> to create a
+   * <code>DebugGraphics</code> object.
    *
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
-   * @returns Graphics
+   * @param x the x coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
+   *
+   * @return a new <code>DebugGraphics</code> object.
    */
-  public Graphics create(int valx, int y, int w, int h)
+  public Graphics create(int x, int y, int width, int height)
   {
-    return null; // TODO
+    return new DebugGraphics(graphics.create(x, y, width, height));
   }
 
   /**
@@ -174,7 +190,7 @@ public class DebugGraphics extends Graphics
    */
   public static Color flashColor()
   {
-    return null; // TODO
+    return debugFlashColor;
   }
 
   /**
@@ -184,7 +200,7 @@ public class DebugGraphics extends Graphics
    */
   public static void setFlashColor(Color color)
   {
-    // TODO
+    debugFlashColor = color;
   }
 
   /**
@@ -194,7 +210,7 @@ public class DebugGraphics extends Graphics
    */
   public static int flashTime()
   {
-    return 0; // TODO
+    return debugFlashTime;
   }
 
   /**
@@ -204,16 +220,17 @@ public class DebugGraphics extends Graphics
    */
   public static void setFlashTime(int time)
   {
-    // TODO
+    debugFlashTime = time;
   }
 
   /**
    * flashCount
-   * @returns int
+   *
+   * @return The number of flashes
    */
   public static int flashCount()
   {
-    return 0; // TODO
+    return debugFlashCount;
   }
 
   /**
@@ -223,7 +240,7 @@ public class DebugGraphics extends Graphics
    */
   public static void setFlashCount(int count)
   {
-    // TODO
+    debugFlashCount = count;
   }
 
   /**
@@ -233,7 +250,7 @@ public class DebugGraphics extends Graphics
    */
   public static PrintStream logStream()
   {
-    return null; // TODO
+    return debugLogStream;
   }
 
   /**
@@ -243,16 +260,17 @@ public class DebugGraphics extends Graphics
    */
   public static void setLogStream(PrintStream stream)
   {
-    // TODO
+    debugLogStream = stream;
   }
 
   /**
    * getFont
-   * @returns Font
+   *
+   * @return The font
    */
   public Font getFont()
   {
-    return null; // TODO
+    return graphics.getFont();
   }
 
   /**
@@ -262,46 +280,50 @@ public class DebugGraphics extends Graphics
    */
   public void setFont(Font font)
   {
-    // TODO
+    graphics.setFont(font);
   }
 
   /**
-   * getColor
-   * @returns Color
+   * Returns the color used for drawing.
+   * 
+   * @return The color.
    */
   public Color getColor()
   {
-    return null; // TODO
+    return color;
   }
 
   /**
-   * getFontMetrics
-   * @returns FontMetrics
+   * Returns the font metrics of the current font.
+   *
+   * @return a <code>FontMetrics</code> object
    */
   public FontMetrics getFontMetrics()
   {
-    return null; // TODO
+    return graphics.getFontMetrics();
   }
 
   /**
-   * getFontMetrics
-   * @param font TODO
-   * @returns FontMetrics
+   * Returns the font metrics for a given font.
+   *
+   * @param font the font to get the metrics for
+   *
+   * @return a <code>FontMetrics</code> object
    */
   public FontMetrics getFontMetrics(Font font)
   {
-    return null; // TODO
+    return graphics.getFontMetrics(font);
   }
 
   /**
    * translate
    *
-   * @param x TODO
-   * @param y TODO
+   * @param x the x coordinate
+   * @param y the y coordinate
    */
   public void translate(int x, int y)
   {
-    // TODO
+    graphics.translate(x, y);
   }
 
   /**
@@ -309,237 +331,291 @@ public class DebugGraphics extends Graphics
    */
   public void setPaintMode()
   {
-    // TODO
+    graphics.setPaintMode();
   }
 
   /**
    * setXORMode
    *
-   * @param color TODO
+   * @param color the color
    */
   public void setXORMode(Color color)
   {
-    // TODO
+    graphics.setXORMode(color);
   }
 
   /**
    * getClipBounds
-   * @returns Rectangle
+   *
+   * @return Rectangle
    */
   public Rectangle getClipBounds()
   {
-    return null; // TODO
+    return graphics.getClipBounds();
   }
 
   /**
-   * clipRect
-   * @param value0 TODO
-   * @param value1 TODO
-   * @param value2 TODO
-   * @param value3 TODO
+   * Intersects the current clip region with the given region.
+   *
+   * @param x The x-position of the region
+   * @param y The y-position of the region
+   * @param width The width of the region
+   * @param height The height of the region
    */
-  public void clipRect(int value0, int value1, int value2, int value3)
+  public void clipRect(int x, int y, int width, int height)
   {
-    // TODO
+    graphics.clipRect(x, y, width, height);
   }
 
   /**
-   * setClip
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   * Sets the clipping region.
+   *
+   * @param x The x-position of the region
+   * @param y The y-position of the region
+   * @param width The width of the region
+   * @param height The height of the region
    */
-  public void setClip(int x, int y, int w, int h)
+  public void setClip(int x, int y, int width, int height)
   {
-    // TODO
+    graphics.setClip(x, y, width, height);
   }
 
   /**
-   * getClip
-   * @returns Shape
+   * Returns the current clipping region.
+   *
+   * @return Shape
    */
   public Shape getClip()
   {
-    return null; // TODO
+    return graphics.getClip();
   }
 
   /**
-   * setClip
-   * @param shape TODO
+   * Sets the current clipping region
+   *
+   * @param shape The clippin region
    */
   public void setClip(Shape shape)
   {
-    // TODO
+    graphics.setClip(shape);
   }
 
+  private void sleep(int milliseconds)
+  {
+    try
+      {
+       Thread.sleep(milliseconds);
+      }
+    catch (InterruptedException e)
+      {
+       // Ignore this.
+      }
+  }
+  
   /**
-   * drawRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param valh TODO
+   * Draws a rectangle.
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    */
-  public void drawRect(int x, int y, int w, int h)
+  public void drawRect(int x, int y, int width, int height)
   {
-    // TODO
-  } // drawRect()
+    for (int index = 0; index < (debugFlashCount - 1); ++index)
+      {
+       graphics.setColor(color);
+       graphics.drawRect(x, y, width, height);
+       sleep(debugFlashTime);
+       
+       graphics.setColor(debugFlashColor);
+       graphics.drawRect(x, y, width, height);
+       sleep(debugFlashTime);
+      }
+
+    graphics.setColor(color);
+    graphics.drawRect(x, y, width, height);
+  }
 
   /**
-   * fillRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   * Draws a filled rectangle.
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    */
-  public void fillRect(int x, int y, int w, int h)
+  public void fillRect(int x, int y, int width, int height)
   {
-    // TODO
-  } // fillRect()
+    for (int index = 0; index < (debugFlashCount - 1); ++index)
+      {
+       graphics.setColor(color);
+       graphics.fillRect(x, y, width, height);
+       sleep(debugFlashTime);
+       
+       graphics.setColor(debugFlashColor);
+       graphics.fillRect(x, y, width, height);
+       sleep(debugFlashTime);
+      }
+
+    graphics.setColor(color);
+    graphics.fillRect(x, y, width, height);
+  }
 
   /**
    * clearRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    */
-  public void clearRect(int x, int y, int w, int h)
+  public void clearRect(int x, int y, int width, int height)
   {
-    // TODO
+    graphics.clearRect(x, y, width, height);
   }
 
   /**
    * drawRoundRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    * @param arcWidth TODO
    * @param arcHeight TODO
    */
-  public void drawRoundRect(int x, int y, int w, int h, int arcWidth,
-                            int arcHeight)
+  public void drawRoundRect(int x, int y, int width, int height, 
+                           int arcWidth, int arcHeight)
   {
-    // TODO
+    graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
   }
 
   /**
    * fillRoundRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    * @param arcWidth TODO
    * @param arcHeight TODO
    */
-  public void fillRoundRect(int x, int y, int w, int h, int arcWidth,
-                            int arcHeight)
+  public void fillRoundRect(int x, int y, int width, int height, 
+                           int arcWidth, int arcHeight)
   {
-    // TODO
+    graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
   }
 
   /**
    * drawLine
-   * @param x1 TODO
-   * @param y1 TODO
-   * @param x2 TODO
-   * @param y2 TODO
+   *
+   * @param x1 The x-position of the start 
+   * @param y1 The y-position of the start
+   * @param x2 The x-position of the end
+   * @param y2 The y-position of the end
    */
   public void drawLine(int x1, int y1, int x2, int y2)
   {
-    // TODO
+    graphics.drawLine(x1, y1, x2, y2);
   }
 
   /**
    * draw3DRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    * @param raised TODO
    */
-  public void draw3DRect(int x, int y, int w, int h, boolean raised)
+  public void draw3DRect(int x, int y, int width, int height, boolean raised)
   {
-    // TODO
+    graphics.draw3DRect(x, y, width, height, raised);
   }
 
   /**
    * fill3DRect
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
    * @param raised TODO
    */
-  public void fill3DRect(int x, int y, int w, int h, boolean raised)
+  public void fill3DRect(int x, int y, int width, int height, boolean raised)
   {
-    // TODO
+    graphics.fill3DRect(x, y, width, height, raised);
   }
 
   /**
    * drawOval
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x the x coordinate
+   * @param y the y coordiante
+   * @param width the width
+   * @param height the height
    */
-  public void drawOval(int x, int y, int w, int h)
+  public void drawOval(int x, int y, int width, int height)
   {
-    // TODO
+    graphics.drawOval(x, y, width, height);
   }
 
   /**
    * fillOval
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   *
+   * @param x the x coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
    */
-  public void fillOval(int x, int y, int w, int h)
+  public void fillOval(int x, int y, int width, int height)
   {
-    // TODO
+    graphics.fillOval(x, y, width, height);
   }
 
   /**
    * drawArc
    *
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   * @param x the x coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
    * @param startAngle TODO
    * @param arcAngle TODO
    */
-  public void drawArc(int x, int y, int w, int h, int startAngle, int arcAngle)
+  public void drawArc(int x, int y, int width, int height, 
+                     int startAngle, int arcAngle)
   {
-    // TODO
+    graphics.drawArc(x, y, width, height, startAngle, arcAngle);
   }
 
   /**
    * fillArc
    *
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
+   * @param x the coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
    * @param startAngle TODO
    * @param arcAngle TODO
    */
-  public void fillArc(int x, int y, int w, int h, int startAngle, int arcAngle)
+  public void fillArc(int x, int y, int width, int height, 
+                     int startAngle, int arcAngle)
   {
-    // TODO
+    graphics.fillArc(x, y, width, height, startAngle, arcAngle);
   }
 
   /**
    * drawPolyline
+   *
    * @param xpoints TODO
    * @param ypoints TODO
    * @param npoints TODO
    */
   public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
   {
-    // TODO
+    graphics.drawPolyline(xpoints, ypoints, npoints);
   }
 
   /**
@@ -551,7 +627,7 @@ public class DebugGraphics extends Graphics
    */
   public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
   {
-    // TODO
+    graphics.drawPolygon(xpoints, ypoints, npoints);
   }
 
   /**
@@ -563,31 +639,32 @@ public class DebugGraphics extends Graphics
    */
   public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
   {
-    // TODO
+    graphics.fillPolygon(xpoints, ypoints, npoints);
   }
 
   /**
    * drawString
    *
-   * @param string TODO
-   * @param x TODO
-   * @param y TODO
+   * @param string the string
+   * @param x the x coordinate
+   * @param y the y coordinate
    */
-  public void drawString(String string, int s, int y)
+  public void drawString(String string, int x, int y)
   {
-    // TODO
+    graphics.drawString(string, x, y);
   }
 
   /**
    * drawString
    *
    * @param iterator TODO
-   * @param x TODO
-   * @param y TODO
+   * @param x the x coordinate
+   * @param y the y coordinate
    */
-  public void drawString(AttributedCharacterIterator iterator, int x, int y)
+  public void drawString(AttributedCharacterIterator iterator,
+                        int x, int y)
   {
-    // TODO
+    graphics.drawString(iterator, x, y);
   }
 
   /**
@@ -596,86 +673,111 @@ public class DebugGraphics extends Graphics
    * @param data TODO
    * @param offset TODO
    * @param length TODO
-   * @param x TODO
-   * @param y TODO
+   * @param x the x coordinate
+   * @param y the y coordinate
    */
-  public void drawBytes(byte[] data, int offset, int length, int x, int y)
+  public void drawBytes(byte[] data, int offset, int length,
+                       int x, int y)
   {
-    // TODO
+    graphics.drawBytes(data, offset, length, x, y);
   }
 
   /**
    * drawChars
-   * @param data TODO
-   * @param offset TODO
-   * @param length TODO
-   * @param value3 TODO
-   * @param value4 TODO
+   * 
+   * @param data array of characters to draw
+   * @param offset offset in array
+   * @param length number of characters in array to draw
+   * @param x x-position
+   * @param y y-position
    */
-  public void drawChars(char[] data, int offset, int value2, int x, int y)
+  public void drawChars(char[] data, int offset, int length, 
+                       int x, int y)
   {
-    // TODO
-  } // drawChars()
+    for (int index = 0; index < (debugFlashCount - 1); ++index)
+      {
+       graphics.setColor(color);
+       graphics.drawChars(data, offset, length, x, y);
+       sleep(debugFlashTime);
+       
+       graphics.setColor(debugFlashColor);
+       graphics.drawChars(data, offset, length, x, y);
+       sleep(debugFlashTime);
+      }
+
+    graphics.setColor(color);
+    graphics.drawChars(data, offset, length, x, y);
+  }
 
   /**
    * drawImage
-   * @param image TODO
-   * @param x TODO
-   * @param y TODO
-   * @param observer TODO
-   * @returns boolean
+   *
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param observer The image observer
+   * @return boolean
    */
-  public boolean drawImage(Image image, int x, int y, ImageObserver observer)
+  public boolean drawImage(Image image, int x, int y,
+                          ImageObserver observer)
   {
-    return false; // TODO
+    return graphics.drawImage(image, x, y, observer);
   }
 
   /**
    * drawImage
-   * @param image TODO
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
-   * @param observer TODO
-   * @returns boolean
+   * 
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param width The width of the area to draw the image
+   * @param height The height of the area to draw the image
+   * @param observer The image observer
+   *
+   * @return boolean
    */
-  public boolean drawImage(Image image, int x, int y, int w, int h,
-                           ImageObserver observer)
+  public boolean drawImage(Image image, int x, int y, int width, 
+                          int height, ImageObserver observer)
   {
-    return false; // TODO
+    return graphics.drawImage(image, x, y, width, height, observer);
   }
 
   /**
    * drawImage
-   * @param image TODO
-   * @param x TODO
-   * @param y TODO
-   * @param background TODO
-   * @param observer TODO
-   * @returns boolean
+   * 
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param background The color for the background in the opaque regions
+   * of the image
+   * @param observer The image observer
+   *
+   * @return boolean
    */
-  public boolean drawImage(Image image, int x, int y, Color background,
-                           ImageObserver observer)
+  public boolean drawImage(Image image, int x, int y, 
+                          Color background, ImageObserver observer)
   {
-    return false; // TODO
+    return graphics.drawImage(image, x, y, background, observer);
   }
 
   /**
    * drawImage
-   * @param image TODO
-   * @param x TODO
-   * @param y TODO
-   * @param w TODO
-   * @param h TODO
-   * @param background TODO
-   * @param observer TODO
-   * @returns boolean
-   */
-  public boolean drawImage(Image image, int x, int y, int w, int h,
-                           Color background, ImageObserver observer)
+   * 
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param width The width of the area to draw the image
+   * @param height The height of the area to draw the image
+   * @param background The color for the background in the opaque regions
+   * of the image
+   * @param observer The image observer
+   *
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int x, int y, int width, int height, 
+                          Color background, ImageObserver observer)
   {
-    return false; // TODO
+    return graphics.drawImage(image, x, y, width, height, background, observer);
   }
 
   /**
@@ -690,14 +792,15 @@ public class DebugGraphics extends Graphics
    * @param sy1 TODO
    * @param sx2 TODO
    * @param sy2 TODO
-   * @param observer TODO
-   * @returns boolean
+   * @param observer The image observer
+   * 
+   * @return boolean
    */
-  public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
-                           int sx1, int sy1, int sx2, int sy2,
-                           ImageObserver observer)
+  public boolean drawImage(Image image, int dx1, int dy1,
+                          int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
+                          ImageObserver observer)
   {
-    return false; // TODO
+    return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
   }
 
   /**
@@ -712,15 +815,17 @@ public class DebugGraphics extends Graphics
    * @param sy1 TODO
    * @param sx2 TODO
    * @param sy2 TODO
-   * @param background TODO
-   * @param observer TODO
-   * @returns boolean
+   * @param background The color for the background in the opaque regions
+   * of the image
+   * @param observer The image observer
+   *
+   * @return boolean
    */
-  public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
-                           int sx1, int sy1, int sx2, int sy2,
-                           Color background, ImageObserver observer)
+  public boolean drawImage(Image image, int dx1, int dy1,
+                          int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
+                          Color background, ImageObserver observer)
   {
-    return false; // TODO
+    return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, background, observer);
   }
 
   /**
@@ -733,9 +838,10 @@ public class DebugGraphics extends Graphics
    * @param destx The x position of the destination area
    * @param desty The y posiiton of the destination area
    */
-  public void copyArea(int x, int y, int w, int h, int destx, int desty)
+  public void copyArea(int x, int y, int width, int height, 
+                      int destx, int desty)
   {
-    // TODO
+    graphics.copyArea(x, y, width, height, destx, desty);
   }
 
   /**
@@ -743,7 +849,8 @@ public class DebugGraphics extends Graphics
    */
   public void dispose()
   {
-    // TODO
+    graphics.dispose();
+    graphics = null;
   }
 
   /**
@@ -757,22 +864,13 @@ public class DebugGraphics extends Graphics
   }
 
   /**
-   * toShortString
-   * @returns String
-   */
-  String toShortString()
-  {
-    return null; // TODO
-  } // toShortString()
-
-  /**
    * setDebugOptions
    *
    * @param options the debug options
    */
   public void setDebugOptions(int options)
   {
-    // TODO
+    debugOptions = options;
   }
 
   /**
@@ -782,6 +880,6 @@ public class DebugGraphics extends Graphics
    */
   public int getDebugOptions()
   {
-    return 0; // TODO
+    return debugOptions;
   }
 }
index 9a2d974..65bd30c 100644 (file)
@@ -47,7 +47,7 @@ import javax.swing.event.ChangeListener;
 import javax.swing.event.EventListenerList;
 
 /**
- * A default implementation of BoundedRangeModel.
+ * A default implementation of <code>BoundedRangeModel</code>.
  *
  * @author <a href="mailto:aselkirk@sympatico.ca">Andrew Selkirk</a>
  * @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
@@ -59,7 +59,7 @@ public class DefaultBoundedRangeModel
    * The identifier of this class in object serialization. Verified
    * using the serialver tool of Sun J2SE 1.4.1_01.
    */
-  static final long serialVersionUID = 5034068491295259790L;
+  private static final long serialVersionUID = 5034068491295259790L;
 
 
   /**
@@ -67,7 +67,7 @@ public class DefaultBoundedRangeModel
    * when the state of this range model has changed.
    *
    * <p>The event object is created on demand, the first time it
-   * is actually needed.
+   * is actually needed.</p>
    *
    * @see #fireStateChanged()
    */
@@ -155,7 +155,7 @@ public class DefaultBoundedRangeModel
    * @param maximum the initial maximal value of the range model.
    *
    * @throws IllegalArgumentException if the following condition is
-   * not satisfied: <code>minimum <= value <= value + extent <=
+   * not satisfied: <code>minimum &lt;= value &lt;= value + extent &lt;=
    * maximum</code>.
    */
   public DefaultBoundedRangeModel(int value, int extent, int minimum,
@@ -176,6 +176,8 @@ public class DefaultBoundedRangeModel
   /**
    * Returns a string with all relevant properties of this range
    * model.
+   *
+   * @return a string representing the object
    */
   public String toString()
   {
@@ -193,6 +195,8 @@ public class DefaultBoundedRangeModel
    * Returns the current value of this bounded range model.  In a
    * scroll bar visualization of a {@link BoundedRangeModel}, the
    * <code>value</code> is displayed as the position of the thumb.
+   *
+   * @return the value
    */
   public int getValue()
   {
@@ -206,6 +210,8 @@ public class DefaultBoundedRangeModel
    * <code>value</code> is displayed as the position of the thumb;
    * changing the <code>value</code> of a scroll bar's model
    * thus moves the thumb to a different position.
+   *
+   * @param value the value
    */
   public void setValue(int value)
   {
@@ -226,6 +232,8 @@ public class DefaultBoundedRangeModel
    * a number greater than or equal to zero. In a scroll bar
    * visualization of a {@link BoundedRangeModel}, the
    * <code>extent</code> is displayed as the size of the thumb.
+   *
+   * @return the extent
    */
   public int getExtent()
   {
@@ -282,6 +290,8 @@ public class DefaultBoundedRangeModel
 
   /**
    * Returns the current maximal value of this bounded range model.
+   *
+   * @return the maximum
    */
   public int getMaximum()
   {
@@ -313,7 +323,7 @@ public class DefaultBoundedRangeModel
    * around; when the mouse is relased, they set the property to
    * <code>false</code> and post a final {@link ChangeEvent}.
    *
-   * @returns <code>true</code> if the value will change soon again;
+   * @return <code>true</code> if the value will change soon again;
    * <code>false</code> if the value will probably not change soon.
    */
   public boolean getValueIsAdjusting()
@@ -344,7 +354,7 @@ public class DefaultBoundedRangeModel
 
 
   /**
-   * setRangeProperties
+   * Sets all properties.
    *
    * @param value the new value of the range model.  In a scroll bar
    * visualization of a {@link BoundedRangeModel}, the
@@ -422,16 +432,13 @@ public class DefaultBoundedRangeModel
    */
   protected void fireStateChanged()
   {
-    Object[] listeners;
-
-    listeners = listenerList.getListenerList();
-    for (int i = listeners.length - 2; i >= 0; i -= 2)
-      if (listeners[i] == ChangeListener.class)
-        {
-          if (changeEvent == null)
-            changeEvent = new ChangeEvent(this);
-          ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);
-        }
+    ChangeListener[] listeners = getChangeListeners();
+    
+    if (changeEvent == null)
+      changeEvent = new ChangeEvent(this);
+
+    for (int i = listeners.length - 1; i >= 0; --i)
+      listeners[i].stateChanged(changeEvent);
   }
 
 
index 543428a..0473f53 100644 (file)
@@ -71,7 +71,7 @@ import javax.swing.event.EventListenerList;
 public class DefaultButtonModel implements ButtonModel, Serializable
 {
   /** DOCUMENT ME! */
-  static final long serialVersionUID = -5342609566534980231L;
+  private static final long serialVersionUID = -5342609566534980231L;
 
   /**
    * Indicates that the button is <em>partially</em> committed to being
@@ -272,7 +272,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
    *
    * @param e The ItemEvent to fire
    */
-  public void fireItemStateChanged(ItemEvent e)
+  protected void fireItemStateChanged(ItemEvent e)
   {
     ItemListener[] ll = getItemListeners();
 
@@ -288,7 +288,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
    *
    * @param e The ActionEvent to fire
    */
-  public void fireActionPerformed(ActionEvent e)
+  protected void fireActionPerformed(ActionEvent e)
   {
     ActionListener[] ll = getActionListeners();
 
@@ -301,7 +301,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
    * has occurred. This happens in response to the any change to a property
    * of the model.
    */
-  public void fireStateChanged()
+  protected void fireStateChanged()
   {
     ChangeListener[] ll = getChangeListeners();
 
@@ -315,7 +315,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
    * @param stateflag DOCUMENT ME!
    * @param b DOCUMENT ME!
    */
-  protected void changeState(int stateflag, boolean b)
+  private void changeState(int stateflag, boolean b)
   {
     int oldstate = stateMask;
     int newstate;
index 1dd17b4..26bf708 100644 (file)
@@ -58,7 +58,7 @@ public class DefaultCellEditor
   extends AbstractCellEditor
   implements TableCellEditor, TreeCellEditor
 {
-  static final long serialVersionUID = 3564035141373880027L;
+  private static final long serialVersionUID = 3564035141373880027L;
 
   /**
    * EditorDelegate
index a5546f2..c2ece64 100644 (file)
@@ -50,12 +50,13 @@ import java.util.Vector;
  *
  * @author Andrew Selkirk
  * @author Olga Rodimina
+ * @author Robert Schuster
  * @version 1.0
  */
 public class DefaultComboBoxModel extends AbstractListModel
   implements MutableComboBoxModel, Serializable
 {
-  static final long serialVersionUID = 6698657703676921904L;
+  private static final long serialVersionUID = 6698657703676921904L;
 
   /**
    * List containing items in the combo box
@@ -182,13 +183,23 @@ public class DefaultComboBoxModel extends AbstractListModel
    * ListDataEvent to all registered ListDataListeners of the JComboBox. The
    * start and end index of the event is set to -1 to indicate combo box's
    * selection has changed, and not its contents.
+   * 
+   * <p>If the given object is not contained in the combo box list then nothing
+   * happens.</p>
    *
    * @param object item to select in the JComboBox
    */
   public void setSelectedItem(Object object)
   {
-    selectedItem = object;
-    fireContentsChanged(this, -1, -1);
+    
+    /* Updates the selected item only if the given object
+     * is null or in the list (this is how the JDK behaves).
+     */ 
+    if(object == null || list.contains(object)) {
+       selectedItem = object;
+       fireContentsChanged(this, -1, -1);
+    }
+       
   }
 
   /**
index 4928c5d..a0dd5e2 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultDesktopManager.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.Component;
@@ -56,7 +57,7 @@ import javax.swing.JInternalFrame.JDesktopIcon;
 public class DefaultDesktopManager implements DesktopManager, Serializable
 {
   /** DOCUMENT ME! */
-  static final long serialVersionUID = 4657624909838017887L;
+  private static final long serialVersionUID = 4657624909838017887L;
 
   /** The property change event fired when the wasIcon property changes. */
   static final String WAS_ICON_ONCE_PROPERTY = "wasIconOnce";
@@ -80,7 +81,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
   private transient Container pane;
 
   /**
-   * An array of Rectangles that holds the bounds of the JDesktopIcons in the 
+   * An array of Rectangles that holds the bounds of the JDesktopIcons in the
    * JDesktopPane when looking for where to place a new icon.
    */
   private transient Rectangle[] iconRects;
@@ -90,7 +91,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
    */
   public DefaultDesktopManager()
   {
-  } // DefaultDesktopManager()
+  }
 
   /**
    * This method is not normally called since the user will typically add the
@@ -111,7 +112,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
     c.remove(frame.getDesktopIcon());
     c.add(frame);
     frame.setVisible(true);
-  } // openFrame()
+  }
 
   /**
    * This method removes the JInternalFrame and JDesktopIcon (if one is
@@ -132,7 +133,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
          c.remove(frame);
        c.repaint();
       }
-  } // closeFrame()
+  }
 
   /**
    * This method resizes the JInternalFrame to match its parent's bounds.
@@ -171,7 +172,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
            // Do nothing.
          }
       }
-  } // maximizeFrame()
+  }
 
   /**
    * This method restores the JInternalFrame's bounds to what they were
@@ -200,7 +201,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
 
     setBoundsForFrame(frame, normalBounds.x, normalBounds.y,
                       normalBounds.width, normalBounds.height);
-  } // minimizeFrame()
+  }
 
   /**
    * This method removes the JInternalFrame from its parent and adds its
@@ -231,7 +232,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       {
        Rectangle r = getBoundsForIconOf(frame);
        icon.setBounds(r);
-       setWasIcon(frame, true);
+       setWasIcon(frame, Boolean.TRUE);
       }
 
     if (c != null)
@@ -243,7 +244,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
          }
        c.remove(frame);
       }
-  } // iconifyFrame()
+  }
 
   /**
    * This method removes the JInternalFrame's JDesktopIcon representation and
@@ -279,7 +280,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       }
 
     c.invalidate();
-  } // deiconifyFrame()
+  }
 
   /**
    * This method activates the JInternalFrame by moving it to the front and
@@ -305,7 +306,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       }
 
     frame.toFront();
-  } // activateFrame()
+  }
 
   /**
    * This method is called when the JInternalFrame loses focus.
@@ -330,7 +331,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
          {
          }
       }
-  } // deactivateFrame()
+  }
 
   /**
    * This method is called to indicate that the DesktopManager should prepare
@@ -354,7 +355,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       currentDragMode = JDesktopPane.LIVE_DRAG_MODE;
     else
       currentDragMode = ((JDesktopPane) pane).getDragMode();
-  } // beginDraggingFrame()
+  }
 
   /**
    * This method is called to drag the JInternalFrame to a new location.
@@ -378,7 +379,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
          setBoundsForFrame((JInternalFrame) component, newX, newY, b.width,
                            b.height);
       }
-  } // dragFrame()
+  }
 
   /**
    * This method indicates that the dragging is done. Any state information
@@ -396,7 +397,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
        dragCache = null;
       }
     component.repaint();
-  } // endDraggingFrame()
+  }
 
   /**
    * This method is called to indicate that the given JComponent will be
@@ -417,7 +418,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       currentDragMode = JDesktopPane.LIVE_DRAG_MODE;
     else
       currentDragMode = ((JDesktopPane) pane).getDragMode();
-  } // beginResizingFrame()
+  }
 
   /**
    * This method resizes the give JComponent.
@@ -440,7 +441,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
     else
       setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width,
                         dragCache.height);
-  } // resizeFrame()
+  }
 
   /**
    * This method is called to indicate that the given JComponent has finished
@@ -459,7 +460,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
        dragCache = null;
       }
     component.repaint();
-  } // endResizingFrame()
+  }
 
   /**
    * This method calls setBounds with the given parameters and repaints the
@@ -482,7 +483,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       component.getParent().repaint();
     else
       component.repaint();
-  } // setBoundsForFrame()
+  }
 
   /**
    * This is a helper method that removes the JDesktopIcon of the given
@@ -496,7 +497,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
     Container c = icon.getParent();
     if (c != null && icon != null)
       c.remove(icon);
-  } // removeIconFor()
+  }
 
   /**
    * This method is called by iconifyFrame to determine the bounds of the
@@ -570,7 +571,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
       }
 
     return ideal;
-  } // getBoundsForIconOf()
+  }
 
   /**
    * This method sets the bounds of the JInternalFrame right before the
@@ -582,7 +583,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
   protected void setPreviousBounds(JInternalFrame frame, Rectangle rect)
   {
     frame.setNormalBounds(rect);
-  } // setPreviousBounds()
+  }
 
   /**
    * This method returns the normal bounds of the JInternalFrame from before
@@ -595,7 +596,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
   protected Rectangle getPreviousBounds(JInternalFrame frame)
   {
     return frame.getNormalBounds();
-  } // getPreviousBounds()
+  }
 
   /**
    * This method sets the value to true if the given JInternalFrame has been
@@ -605,10 +606,10 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
    * @param value True if the JInternalFrame has been iconized and the bounds
    *        of the JDesktopIcon are valid.
    */
-  protected void setWasIcon(JInternalFrame frame, boolean value)
+  protected void setWasIcon(JInternalFrame frame, Boolean value)
   {
-    frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY);
-  } // setWasIcon()
+    frame.setWasIcon(value.booleanValue(), WAS_ICON_ONCE_PROPERTY);
+  }
 
   /**
    * This method returns true if the given JInternalFrame has been iconized
@@ -622,5 +623,5 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
   protected boolean wasIcon(JInternalFrame frame)
   {
     return frame.getWasIcon();
-  } // wasIcon()
-} // DefaultDesktopManager
+  }
+}
index 4c4cee3..91b8a8a 100644 (file)
@@ -52,10 +52,10 @@ import javax.swing.border.EmptyBorder;
  * @author Andrew Selkirk
  * @version 1.0
  */
-public class DefaultListCellRenderer extends JLabel implements ListCellRenderer,
-                                                               Serializable
+public class DefaultListCellRenderer extends JLabel
+  implements ListCellRenderer, Serializable
 {
-  static final long serialVersionUID = 7708947179685189462L;
+  private static final long serialVersionUID = 7708947179685189462L;
 
   public static class UIResource extends DefaultListCellRenderer
     implements javax.swing.plaf.UIResource
@@ -89,6 +89,7 @@ public class DefaultListCellRenderer extends JLabel implements ListCellRenderer,
     String s = value.toString();
     setText(s);
     setOpaque(true);
+    setHorizontalAlignment(LEFT);
 
     if (isSelected)
       {
index 53dd20c..c3704db 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultListModel.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -198,7 +198,7 @@ public class DefaultListModel extends AbstractListModel
   public void add(int index, Object element)
   {
     elements.add(index, element);
-    fireContentsChanged(this, index, index);
+    fireIntervalAdded(this, index, index);
   }
 
   /**
@@ -209,8 +209,9 @@ public class DefaultListModel extends AbstractListModel
    */
   public void addElement(Object element)
   {
+    int s = elements.size();
     elements.add(element);
-    fireIntervalAdded(this, elements.size(), elements.size());
+    fireIntervalAdded(this, s, s);
   }
 
   /**
@@ -266,8 +267,12 @@ public class DefaultListModel extends AbstractListModel
    */
   public void clear()
   {
-    elements.clear();
-    fireIntervalRemoved(this, 0, elements.size());
+    int s = elements.size();
+    if (s > 0)
+    {
+      elements.clear();
+      fireIntervalRemoved(this, 0, s - 1);
+    }
   }
 
   /**
@@ -341,7 +346,16 @@ public class DefaultListModel extends AbstractListModel
    */
   public void setSize(int size)
   {
+    int oldSize = elements.size();
     elements.setSize(size);
+    if (oldSize < size) 
+    {
+      fireIntervalAdded(this, oldSize, size - 1); 
+    }
+    else if (oldSize > size) 
+    {
+      this.fireIntervalRemoved(this, size, oldSize - 1);
+    }
   }
 
   /**
index d5801c7..ccae280 100644 (file)
@@ -118,7 +118,7 @@ public class DefaultListSelectionModel implements Cloneable,
    * @see #isLeadAnchorNotificationEnabled
    * @see #setLeadAnchorNotificationEnabled
    */
-  boolean leadAnchorNotificationEnabled = true;
+  protected boolean leadAnchorNotificationEnabled = true;
 
 
   /**
@@ -520,6 +520,18 @@ public class DefaultListSelectionModel implements Cloneable,
    *
    * @param firstIndex The low index of the changed range
    * @param lastIndex The high index of the changed range
+   */
+  protected void fireValueChanged(int firstIndex, int lastIndex)
+  {
+    fireValueChanged(firstIndex, lastIndex, getValueIsAdjusting());
+  }
+  
+  /**
+   * Fires a {@link ListSelectionEvent} to all the listeners of type {@link
+   * ListSelectionListener} registered with this selection model.
+   *
+   * @param firstIndex The low index of the changed range
+   * @param lastIndex The high index of the changed range
    * @param isAdjusting Whether this change is part of a seqence of adjustments
    * made to the selection, such as during interactive scrolling
    */
@@ -588,4 +600,21 @@ public class DefaultListSelectionModel implements Cloneable,
   {
     return (ListSelectionListener[]) getListeners(ListSelectionListener.class);
   }
+
+  /**
+   * Returns a clone of this object.
+   * <code>listenerList</code> don't gets duplicated.
+   *
+   * @return the cloned object
+   *
+   * @throws CloneNotSupportedException if an error occurs
+   */
+  public Object clone()
+    throws CloneNotSupportedException
+  {
+    DefaultListSelectionModel model =
+      (DefaultListSelectionModel) super.clone();
+    model.sel = (BitSet) sel.clone();
+    return model;
+  }
 }
index 0b1371e..63611f4 100644 (file)
@@ -47,23 +47,23 @@ import javax.swing.event.EventListenerList;
 
 /**
  * DefaultSingleSelectionModel
- * @author     Andrew Selkirk
- * @version    1.0
+ *
+ * @author Andrew Selkirk
  */
 public class DefaultSingleSelectionModel
   implements SingleSelectionModel, Serializable
 {
-  static final long serialVersionUID = 3676229404753786004L;
+  private static final long serialVersionUID = 3676229404753786004L;
 
   /**
    * changeEvent
    */
-  protected transient ChangeEvent changeEvent = new ChangeEvent (this);
+  protected transient ChangeEvent changeEvent = new ChangeEvent(this);
 
   /**
    * listenerList
    */
-  protected EventListenerList listenerList= new EventListenerList ();
+  protected EventListenerList listenerList = new EventListenerList();
 
   /**
    * index
@@ -73,15 +73,16 @@ public class DefaultSingleSelectionModel
   /**
    * Constructor DefaultSingleSelectionModel
    */
-  public DefaultSingleSelectionModel ()
+  public DefaultSingleSelectionModel()
   {
+    // Do nothing.
   }
 
   /**
    * getSelectedIndex
    * @return int
    */
-  public int getSelectedIndex ()
+  public int getSelectedIndex()
   {
     return index;
   }
@@ -90,34 +91,28 @@ public class DefaultSingleSelectionModel
    * setSelectedIndex
    * @param index TODO
    */
-  public void setSelectedIndex (int index)
+  public void setSelectedIndex(int index)
   {
-    // Set Data
     this.index = index;
-
-    // Notify Listeners
-    fireStateChanged ();
+    fireStateChanged();
   }
 
   /**
    * clearSelection
    */
-  public void clearSelection ()
+  public void clearSelection()
   {
-    // Set Data
     index = -1;
-
-    // Notify Listeners
-    fireStateChanged ();
+    fireStateChanged();
   }
 
   /**
    * isSelected
    * @return boolean
    */
-  public boolean isSelected ()
+  public boolean isSelected()
   {
-    return (index != -1);
+    return index != -1;
   }
 
   /**
@@ -125,9 +120,9 @@ public class DefaultSingleSelectionModel
    *
    * @param listener the listener to add
    */
-  public void addChangeListener (ChangeListener listener)
+  public void addChangeListener(ChangeListener listener)
   {
-    listenerList.add (ChangeListener.class, listener);
+    listenerList.add(ChangeListener.class, listener);
   }
 
   /**
@@ -135,30 +130,20 @@ public class DefaultSingleSelectionModel
    *
    * @param listener the listener to remove
    */
-  public void removeChangeListener (ChangeListener listener)
+  public void removeChangeListener(ChangeListener listener)
   {
-    listenerList.remove (ChangeListener.class, listener);
+    listenerList.remove(ChangeListener.class, listener);
   }
 
   /**
    * fireStateChanged
    */
-  protected void fireStateChanged ()
+  protected void fireStateChanged()
   {
-    // Variables
-    ChangeListener listener;
-    ChangeListener[] listeners;
-    int index;
-
-    // Get Listeners
-    listeners = getChangeListeners ();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = listeners [index];
-        listener.stateChanged (changeEvent);
-      }
+    ChangeListener[] listeners = getChangeListeners();
+
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].stateChanged(changeEvent);
   }
 
   /**
@@ -170,9 +155,9 @@ public class DefaultSingleSelectionModel
    *
    * @since 1.3
    */
-  public EventListener[] getListeners (Class listenerClass)
+  public EventListener[] getListeners(Class listenerClass)
   {
-    return listenerList.getListeners (listenerClass);
+    return listenerList.getListeners(listenerClass);
   }
 
   /**
@@ -180,8 +165,8 @@ public class DefaultSingleSelectionModel
    *
    * @since 1.4
    */
-  public ChangeListener[] getChangeListeners ()
+  public ChangeListener[] getChangeListeners()
   {
-    return (ChangeListener[]) getListeners (ChangeListener.class);
+    return (ChangeListener[]) getListeners(ChangeListener.class);
   }
 }
index c0e8e0d..36bd088 100644 (file)
@@ -1,4 +1,4 @@
-/* ImageIcon.java -- 
+/* ImageIcon.java --
    Copyright (C) 2002, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -57,7 +57,7 @@ public class ImageIcon
   public ImageIcon()
   {
   }
-
+  
   public ImageIcon(String file)
   {
     this(file, file);
@@ -98,12 +98,12 @@ public class ImageIcon
     this.image = Toolkit.getDefaultToolkit().createImage(image.getSource());
     this.description = description;
   }
-
+    
   public ImageObserver getImageObserver()
   {
     return observer;
   }
-
+  
   public void setImageObserver(ImageObserver newObserver)
   {
     observer = newObserver;
@@ -114,6 +114,11 @@ public class ImageIcon
     return image;
   }
 
+  public void setImage(Image image)
+  {
+    this.image = Toolkit.getDefaultToolkit().createImage(image.getSource());
+  }
+
   public String getDescription()
   {
     return description;
index 3f0bc3f..53be5b1 100644 (file)
@@ -49,7 +49,7 @@ import java.util.Set;
 
 
 /**
- * @author     Andrew Selkirk
+ * @author Andrew Selkirk
  * @author Michael Koch
  *
  * @since 1.3
@@ -59,31 +59,31 @@ public class InputMap
 {
   private static final long serialVersionUID = -5429059542008604257L;
 
-       /**
-        * inputMap
-        */
-       private Map inputMap = new HashMap();
+  /**
+   * inputMap
+   */
+  private Map inputMap = new HashMap();
 
-       /**
-        * parent
-        */
+  /**
+   * parent
+   */
   private InputMap parent;
 
-       /**
+  /**
    * Creates a new <code>InputMap</code> instance.
-        */
+   */
   public InputMap()
   {
-               // TODO
+    // TODO
   }
 
-       /**
+  /**
    * Returns the binding for keystroke.
    *
    * @param key the key of the enty
    *
    * @return the binding associated with keystroke may be null
-        */
+   */
   public Object get(KeyStroke keystroke)
   {
     Object result = inputMap.get(keystroke);
@@ -93,121 +93,121 @@ public class InputMap
     return result;
   }
 
-       /**
+  /**
    * Puts a new entry into the <code>InputMap</code>.
    * If actionMapKey is null an existing entry will be removed.
    *
    * @param keystroke the keystroke for the entry
    * @param actionMapKey the action.
-        */
+   */
   public void put(KeyStroke keystroke, Object actionMapKey)
   {
     if (actionMapKey == null)
-                       inputMap.remove(keystroke);
+      inputMap.remove(keystroke);
     else
-                       inputMap.put(keystroke, actionMapKey);
+      inputMap.put(keystroke, actionMapKey);
   }
 
-       /**
+  /**
    * Remove an entry from the <code>InputMap</code>.
    *
    * @param key the key of the entry to remove
-        */
+   */
   public void remove(KeyStroke keystroke)
   {
-               inputMap.remove(keystroke);
+    inputMap.remove(keystroke);
   }
 
-       /**
+  /**
    * Returns the parent of this <code>InputMap</code>.
    *
    * @return the parent, may be null.
-        */
+   */
   public InputMap getParent()
   {
-               return parent;
+    return parent;
   }
 
-       /**
+  /**
    * Sets a parent for this <code>InputMap</code>.
    *
    * @param parentMap the new parent
-        */
+   */
   public void setParent(InputMap parentMap)
   {
-               parent = parentMap;
+    parent = parentMap;
   }
 
-       /**
+  /**
    * Returns the number of entries in this <code>InputMap</code>.
    *
    * @return the number of entries
-        */
+   */
   public int size()
   {
-               return inputMap.size();
+    return inputMap.size();
   }
 
-       /**
+  /**
    * Clears the <code>InputMap</code>.
-        */
+   */
   public void clear()
   {
-               inputMap.clear();
+    inputMap.clear();
   }
 
-       /**
+  /**
    * Returns all keys of entries in this <code>InputMap</code>.
    *
    * @return an array of keys
-        */
+   */
   public KeyStroke[] keys()
   {
     KeyStroke[] array = new KeyStroke[size()];
     return (KeyStroke[]) inputMap.keySet().toArray(array);
   }
 
-       /**
+  /**
    * Returns all keys of entries in this <code>InputMap</code>
    * and all its parents.
    *
    * @return an array of keys
-        */
+   */
   public KeyStroke[] allKeys()
   {
     Set set = new HashSet();
 
     if (parent != null)
-                       set.addAll(Arrays.asList(parent.allKeys()));
+      set.addAll(Arrays.asList(parent.allKeys()));
 
     set.addAll(inputMap.keySet());
     KeyStroke[] array = new KeyStroke[size()];
     return (KeyStroke[]) set.toArray(array);
   }
 
-       /**
-        * writeObject
+  /**
+   * writeObject
    *
    * @param stream the stream to write to
    *
    * @exception IOException If an error occurs
-        */
+   */
   private void writeObject(ObjectOutputStream stream) throws IOException
   {
-               // TODO
+    // TODO
   }
 
-       /**
-        * readObject
+  /**
+   * readObject
    *
    * @param stream the stream to read from
    *
    * @exception ClassNotFoundException If the serialized class cannot be found
    * @exception IOException If an error occurs
-        */
+   */
   private void readObject(ObjectInputStream stream)
     throws ClassNotFoundException, IOException
   {
-               // TODO
+    // TODO
   }
 }
@@ -1,5 +1,5 @@
-/* GtkArg.java
-   Copyright (C) 1999 Free Software Foundation, Inc.
+/* InternalFrameFocusTraversalPolicy.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -36,26 +36,20 @@ obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
-package gnu.java.awt.peer.gtk;
+package javax.swing;
 
-public class GtkArg
-{
-  String name;
-  Object value;
-
-  public GtkArg (String name, Object value)
-  {
-    this.name = name;
-    this.value = value;
-  }
+import java.awt.Component;
+import java.awt.FocusTraversalPolicy;
 
-  public String getName ()
-  {
-    return name;
-  }
-
-  public Object getValue ()
+/**
+ * @author Michael Koch
+ * 
+ * @since 1.4
+ */
+public abstract class InternalFrameFocusTraversalPolicy extends FocusTraversalPolicy
+{
+  public Component getInitialComponent(JInternalFrame frame)
   {
-    return value;
+    return getDefaultComponent(frame);
   }
 }
index 42d7426..8446e27 100644 (file)
@@ -1,5 +1,5 @@
 /* JApplet.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -46,7 +46,6 @@ import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.LayoutManager;
 import java.awt.event.KeyEvent;
-import java.awt.event.WindowEvent;
 
 import javax.accessibility.AccessibleContext;
 
@@ -55,38 +54,18 @@ public class JApplet extends Applet
 {
   private static final long serialVersionUID = 7269359214497372587L;
   
-  public static final int HIDE_ON_CLOSE = 0;
-  public static final int EXIT_ON_CLOSE = 1;
-  public static final int DISPOSE_ON_CLOSE = 2;
-  public static final int DO_NOTHING_ON_CLOSE = 3;
-  
-  private int close_action = EXIT_ON_CLOSE;
-
   protected JRootPane rootPane;
   protected boolean rootPaneCheckingEnabled;
 
   public JApplet()
   {
-    frameInit();
-  }
-
-  public JApplet(String title)
-  {
-    frameInit();
-  }
-
-  protected void frameInit()
-  {
     super.setLayout(new BorderLayout(1, 1));
     getRootPane(); // will do set/create
   }
 
   public Dimension getPreferredSize()
   {
-    Dimension d = super.getPreferredSize();
-    System.out.println("JFrame.getPrefSize(): " + d + " , comp="
-                       + getComponentCount() + ", layout=" + getLayout());
-    return d;
+    return super.getPreferredSize();
   }
 
   public void setLayout(LayoutManager manager)
@@ -111,7 +90,7 @@ public class JApplet extends Applet
     return rootPane;
   }
 
-  public void setRootPane(JRootPane root)
+  protected void setRootPane(JRootPane root)
   {
     if (rootPane != null)
       remove(rootPane);
@@ -120,7 +99,7 @@ public class JApplet extends Applet
     add(rootPane, BorderLayout.CENTER);
   }
 
-  public JRootPane createRootPane()
+  protected JRootPane createRootPane()
   {
     return new JRootPane();
   }
@@ -155,11 +134,6 @@ public class JApplet extends Applet
     return null;
   }
 
-  int getDefaultCloseOperation()
-  {
-    return close_action;
-  }
-
   public JMenuBar getJMenuBar()
   {
     return getRootPane().getJMenuBar();
@@ -179,56 +153,12 @@ public class JApplet extends Applet
   {
     super.processKeyEvent(e);
   }
-
-  protected void processWindowEvent(WindowEvent e)
-  {
-    //      System.out.println("PROCESS_WIN_EV-1: " + e);
-    //        super.processWindowEvent(e); 
-    //      System.out.println("PROCESS_WIN_EV-2: " + e);
-    switch (e.getID())
-      {
-      case WindowEvent.WINDOW_CLOSING:
-        {
-         switch (close_action)
-           {
-           case EXIT_ON_CLOSE:
-             {
-               System.out.println("user requested exit on close");
-               System.exit(1);
-               break;
-             }
-           case DISPOSE_ON_CLOSE:
-             {
-               System.out.println("user requested dispose on close");
-               //dispose();
-               break;
-             }
-           case HIDE_ON_CLOSE:
-           case DO_NOTHING_ON_CLOSE:
-             break;
-           }
-         break;
-        }
-      case WindowEvent.WINDOW_CLOSED:
-      case WindowEvent.WINDOW_OPENED:
-      case WindowEvent.WINDOW_ICONIFIED:
-      case WindowEvent.WINDOW_DEICONIFIED:
-      case WindowEvent.WINDOW_ACTIVATED:
-      case WindowEvent.WINDOW_DEACTIVATED:
-       break;
-      }
-  }
-
+  
   public void remove(Component comp)
   {
     getContentPane().remove(comp);
   }
 
-  void setDefaultCloseOperation(int operation)
-  {
-    close_action = operation;
-  }
-
   protected boolean isRootPaneCheckingEnabled()
   {
     return rootPaneCheckingEnabled;
index 13e3d57..dea3781 100644 (file)
@@ -53,90 +53,90 @@ public class JButton extends AbstractButton
   private static final long serialVersionUID = -1907255238954382202L;
   boolean def;
   boolean is_def;
-    
-    public JButton()
-    {
-       this(null, null);
-    }
-
-    public JButton(Action a)
-    {
-       this();
-       setAction(a);
-    }
-
-    public JButton(Icon icon)
-    { 
-       this(null, icon);
-    }    
-  
-    public JButton(String text)
-    {
-       this(text, null);
-    }
-      
-    public JButton(String text, Icon icon)
-    {
-       super(text, icon);
-    }
-
-    public Object[] getSelectedObjects()
-    {
-       return null;
-    }
-  
-    protected  void configurePropertiesFromAction(Action a)
-    {
-       //Factory method which sets the AbstractButton's properties according to values from the Action instance. 
-       super.configurePropertiesFromAction(a);
-    }
-    
-    public AccessibleContext getAccessibleContext()
-    {
-       //Gets the AccessibleContext associated with this JButton. 
-       return null;
-    }
-  
-    public String getUIClassID()
-    {
+
+  public JButton()
+  {
+    this(null, null);
+  }
+
+  public JButton(Action a)
+  {
+    this();
+    setAction(a);
+  }
+
+  public JButton(Icon icon)
+  {
+    this(null, icon);
+  }
+
+  public JButton(String text)
+  {
+    this(text, null);
+  }
+
+  public JButton(String text, Icon icon)
+  {
+    super(text, icon);
+  }
+
+  public Object[] getSelectedObjects()
+  {
+    return null;
+  }
+
+  protected void configurePropertiesFromAction(Action a)
+  {
+    //Factory method which sets the AbstractButton's properties according to values from the Action instance. 
+    super.configurePropertiesFromAction(a);
+  }
+
+  public AccessibleContext getAccessibleContext()
+  {
+    //Gets the AccessibleContext associated with this JButton. 
+    return null;
+  }
+
+  public String getUIClassID()
+  {
     //Returns a string that specifies the name of the L&F class that renders this component.  
-       return "ButtonUI";
-    }
-  
-    public boolean isDefaultButton()
-    {
-       //Returns whether or not this button is the default button on the RootPane.  
-       return is_def;
-    }
-  
-    public boolean isDefaultCapable()
-    {
-       //Returns whether or not this button is capable of being the default button on the RootPane. 
-       return def;
-    }
-
-    protected  String paramString()
-    {
-       return "JButton";
-    }
-    
+    return "ButtonUI";
+  }
+
+  public boolean isDefaultButton()
+  {
+    //Returns whether or not this button is the default button on the RootPane.  
+    return is_def;
+  }
+
+  public boolean isDefaultCapable()
+  {
+    //Returns whether or not this button is capable of being the default button on the RootPane. 
+    return def;
+  }
+
+  protected String paramString()
+  {
+    return "JButton";
+  }
+
   /**
    * Overrides JComponent.removeNotify to check if this button is currently
    * set as the default button on the RootPane, and if so, sets the RootPane's
    * default button to null to ensure the RootPane doesn't hold onto an invalid
    * button reference.
    */
-    public void removeNotify()
-    {
-    }
-    
-    public void setDefaultCapable(boolean defaultCapable)
+  public void removeNotify()
+  {
+  }
+
+  public void setDefaultCapable(boolean defaultCapable)
   {
     def = defaultCapable;
   }
-    
-    public void updateUI()
-    {
+
+  public void updateUI()
+  {
     setUI((ButtonUI) UIManager.getUI(this));
-    }
+  }
 }
index 36cd071..a8506e5 100644 (file)
@@ -60,20 +60,20 @@ public class JCheckBox extends JToggleButton
     contentAreaFilled = false;
   }
   
-    public JCheckBox()
-    {
+  public JCheckBox()
+  {
     super();
     init();
-    }
+  }
 
   public JCheckBox(Action action)
-    {
+  {
     super(action);
     init();
-    }
+  }
 
-    public JCheckBox(Icon icon)
-    
+  public JCheckBox(Icon icon)
+  { 
     super(icon);
     init();
   }    
@@ -82,10 +82,10 @@ public class JCheckBox extends JToggleButton
   { 
     super(icon, selected);
     init();
-    }    
+  }    
   
-    public JCheckBox(String text)
-    {
+  public JCheckBox(String text)
+  {
     super(text);
     init();
   }
@@ -94,41 +94,41 @@ public class JCheckBox extends JToggleButton
   {
     super(text, selected);
     init();
-    }
+  }
       
-    public JCheckBox(String text, Icon icon)
-    {
-       super(text, icon);
+  public JCheckBox(String text, Icon icon)
+  {
+    super(text, icon);
     init();
-    }
+  }
 
   public JCheckBox(String text, Icon icon, boolean selected)
   {
     super(text, icon, selected);
     init();
   }
-    
+
   /**
    * Gets the AccessibleContext associated with this JCheckBox.
    */
-    public AccessibleContext getAccessibleContext()
-    {
-       return null;
-    }
+  public AccessibleContext getAccessibleContext()
+  {
+    return null;
+  }
   
   /**
    * Returns a string that specifies the name of the Look and Feel class
    * that renders this component.
    */
-    public String getUIClassID()
-    {
-       return "CheckBoxUI";
-    }
+  public String getUIClassID()
+  {
+    return "CheckBoxUI";
+  }
   
-    protected  String paramString()
-    {
-       return "JCheckBox";
-    }
+  protected  String paramString()
+  {
+    return "JCheckBox";
+  }
 
   public boolean isBorderPaintedFlat()
   {
index 76377b6..090c3c2 100644 (file)
@@ -206,7 +206,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
     * This method overrides JComponent.requestFocus with an empty
     * implementation, since JCheckBoxMenuItems should not
     * receve focus in general.
-   */
+    */
   public void requestFocus()
   {
     //  Should do nothing here
index 86f20b0..4e2a881 100644 (file)
@@ -1,5 +1,5 @@
 /* JComboBox.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -60,7 +60,6 @@ import javax.swing.event.ListDataListener;
 import javax.swing.event.PopupMenuListener;
 import javax.swing.plaf.ComboBoxUI;
 
-
 /**
  * JComboBox. JComboBox is a container, that keeps track of elements added to
  * it by the user. JComboBox allows user to select any item in its list and
@@ -69,12 +68,14 @@ import javax.swing.plaf.ComboBoxUI;
  *
  * @author Andrew Selkirk
  * @author Olga Rodimina
+ * @author Robert Schuster
  */
 public class JComboBox extends JComponent implements ItemSelectable,
                                                      ListDataListener,
                                                      ActionListener,
                                                      Accessible
 {
+
   private static final long serialVersionUID = 5654585963292734470L;
 
   /**
@@ -91,43 +92,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
    * Maximum number of rows that should be visible by default  in the
    * JComboBox's popup
    */
-  public static final int DEFAULT_MAXIMUM_ROW_COUNT = 8;
-
-  /**
-   * Fired in a PropertyChangeEvent when the 'editable' property changes.
-   */
-  public static final String EDITABLE_CHANGED_PROPERTY = "editable";
-
-  /**
-   * Fired in a PropertyChangeEvent when the 'maximumRowCount' property
-   * changes.
-   */
-  public static final String MAXIMUM_ROW_COUNT_CHANGED_PROPERTY = "maximumRowCount";
-
-  /**
-   * Fired in a PropertyChangeEvent when the 'enabled' property changes.
-   */
-  public static final String ENABLED_CHANGED_PROPERTY = "enabled";
-
-  /**
-   * Fired in a PropertyChangeEvent when the 'renderer' property changes.
-   */
-  public static final String RENDERER_CHANGED_PROPERTY = "renderer";
-
-  /**
-   * Fired in a PropertyChangeEvent when the 'editor' property changes.
-   */
-  public static final String EDITOR_CHANGED_PROPERTY = "editor";
-
-  /**
-   * Fired in a PropertyChangeEvent when the 'dataModel' property changes.
-   */
-  public static final String MODEL_CHANGED_PROPERTY = "dataModel";
-
-  /**
-   * name for the UI delegate for this combo box.
-   */
-  private static final String uiClassID = "ComboBoxUI";
+  private static final int DEFAULT_MAXIMUM_ROW_COUNT = 8;
 
   /**
    * dataModel used by JComboBox to keep track of its list data and currently
@@ -143,7 +108,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
   protected ListCellRenderer renderer;
 
   /**
-   * editor that is responsible for editting an object in a combo box list
+   * Editor that is responsible for editing an object in a combo box list.
    */
   protected ComboBoxEditor editor;
 
@@ -191,8 +156,9 @@ public class JComboBox extends JComponent implements ItemSelectable,
   private Object prototypeDisplayValue;
 
   /**
-   * Constructs JComboBox object with specified data model for it. The first
-   * item in the specified data model is selected by default.
+   * Constructs JComboBox object with specified data model for it.
+   * <p>Note that the JComboBox will not change the value that
+   * is preselected by your ComboBoxModel implementation.</p>
    *
    * @param model Data model that will be used by this JComboBox to keep track
    *        of its list of items.
@@ -205,10 +171,6 @@ public class JComboBox extends JComponent implements ItemSelectable,
     setModel(model);
     setActionCommand("comboBoxChanged");
 
-    // by default set selected item to the first element in the combo box    
-    if (getItemCount() != 0)
-      setSelectedItem(getItemAt(0));
-
     lightWeightPopupEnabled = true;
     isEditable = false;
 
@@ -300,7 +262,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public String getUIClassID()
   {
-    return uiClassID;
+    return "ComboBoxUI";
   }
 
   /**
@@ -322,21 +284,29 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public void setModel(ComboBoxModel newDataModel)
   {
-    if (this.dataModel == newDataModel)
-      return;
 
-    if (this.dataModel != null)
-      // remove all listeners currently registered with the model.
-      dataModel.removeListDataListener(this);
+    // dataModel is null if it this method is called from inside the constructors.
+    if(dataModel != null) {
+       // Prevents unneccessary updates.
+       if (dataModel == newDataModel)
+               return;
 
-    ComboBoxModel oldDataModel = this.dataModel;
-    this.dataModel = newDataModel;
+       // Removes itself (as DataListener) from the to-be-replaced model.
+       dataModel.removeListDataListener(this);
+    }
+    
+    /* Adds itself as a DataListener to the new model.
+     * It is intentioned that this operation will fail with a NullPointerException if the
+     * caller delivered a null argument.
+     */
+    newDataModel.addListDataListener(this);
 
-    if (this.dataModel != null)
-      // register all listeners with the new data model
-      dataModel.addListDataListener(this);
+    // Stores old data model for event notification.
+    ComboBoxModel oldDataModel = dataModel;
+    dataModel = newDataModel;
 
-    firePropertyChange(MODEL_CHANGED_PROPERTY, oldDataModel, this.dataModel);
+    // Notifies the listeners of the model change.
+    firePropertyChange("model", oldDataModel, dataModel);
   }
 
   /**
@@ -351,8 +321,8 @@ public class JComboBox extends JComponent implements ItemSelectable,
 
   /**
    * This method sets JComboBox's popup to be either lightweight or
-   * heavyweight. If 'enabled' is true then lightweight popup is  used and
-   * heavyweight otherwise. By default lightweight popup is  used to display
+   * heavyweight. If 'enabled' is true then lightweight popup is used and
+   * heavyweight otherwise. By default lightweight popup is used to display
    * this JComboBox's elements.
    *
    * @param enabled indicates if lightweight popup or heavyweight popup should
@@ -360,7 +330,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public void setLightWeightPopupEnabled(boolean enabled)
   {
-    this.lightWeightPopupEnabled = enabled;
+    lightWeightPopupEnabled = enabled;
   }
 
   /**
@@ -388,10 +358,10 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public void setEditable(boolean editable)
   {
-    if (this.isEditable != editable)
+    if (isEditable != editable)
       {
-       this.isEditable = editable;
-       firePropertyChange(EDITABLE_CHANGED_PROPERTY, ! isEditable, isEditable);
+       isEditable = editable;
+       firePropertyChange("editable", ! isEditable, isEditable);
       }
   }
 
@@ -407,10 +377,10 @@ public class JComboBox extends JComponent implements ItemSelectable,
   {
     if (maximumRowCount != rowCount)
       {
-       int oldMaximumRowCount = this.maximumRowCount;
-       this.maximumRowCount = rowCount;
-       firePropertyChange(MAXIMUM_ROW_COUNT_CHANGED_PROPERTY,
-                          oldMaximumRowCount, this.maximumRowCount);
+       int oldMaximumRowCount = maximumRowCount;
+       maximumRowCount = rowCount;
+       firePropertyChange("maximumRowCount",
+                          oldMaximumRowCount, maximumRowCount);
       }
   }
 
@@ -437,12 +407,12 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public void setRenderer(ListCellRenderer aRenderer)
   {
-    if (this.renderer != aRenderer)
+    if (renderer != aRenderer)
       {
-       ListCellRenderer oldRenderer = this.renderer;
-       this.renderer = aRenderer;
-       firePropertyChange(RENDERER_CHANGED_PROPERTY, oldRenderer,
-                          this.renderer);
+       ListCellRenderer oldRenderer = renderer;
+       renderer = aRenderer;
+       firePropertyChange("renderer", oldRenderer,
+                          renderer);
       }
   }
 
@@ -477,11 +447,11 @@ public class JComboBox extends JComponent implements ItemSelectable,
     if (editor != null)
       editor.addActionListener(this);
 
-    firePropertyChange(EDITOR_CHANGED_PROPERTY, oldEditor, editor);
+    firePropertyChange("editor", oldEditor, editor);
   }
 
   /**
-   * Returns editor component that is responsible for displaying/editting
+   * Returns editor component that is responsible for displaying/editing
    * selected item in the combo box.
    *
    * @return ComboBoxEditor
@@ -503,45 +473,76 @@ public class JComboBox extends JComponent implements ItemSelectable,
 
   /**
    * Returns currently selected item in the combo box.
+   * The result may be <code>null</code> to indicate that nothing is
+   * currently selected.
    *
    * @return element that is currently selected in this combo box.
    */
   public Object getSelectedItem()
   {
-    Object item = dataModel.getSelectedItem();
-
-    if (item == null && getItemCount() != 0)
-      item = getItemAt(0);
-
-    return item;
+    return dataModel.getSelectedItem();
   }
 
   /**
-   * Forces JComboBox to select component located in the  given index in the
+   * Forces JComboBox to select component located in the given index in the
    * combo box.
+   * <p>If the index is below -1 or exceeds the upper bound an
+   * <code>IllegalArgumentException</code> is thrown.<p/>
+   * <p>If the index is -1 then no item gets selected.</p>
    *
    * @param index index specifying location of the component that  should be
    *        selected.
    */
   public void setSelectedIndex(int index)
   {
-    // FIXME: if index == -1 then nothing should be selected
-    setSelectedItem(dataModel.getElementAt(index));
+       if(index < -1 || index >= dataModel.getSize()) {
+               // Fails because index is out of bounds. 
+               throw new IllegalArgumentException("illegal index: " + index);
+       } else {
+               /* Selects the item at the given index or clears the selection if the
+                * index value is -1.
+                */
+               setSelectedItem((index == -1) ? null : dataModel.getElementAt(index));
+       }
   }
 
   /**
    * Returns index of the item that is currently selected  in the combo box.
    * If no item is currently selected, then -1 is returned.
+   * 
+   * <p>Note: For performance reasons you should minimize invocation of this
+   * method. If the data model is not an instance of
+   * <code>DefaultComboBoxModel</code> the complexity is O(n) where
+   * n is the number of elements in the combo box.</p>
    *
-   * @return int index specifying location of the currently  selected item in
+   * @return int Index specifying location of the currently selected item in
    *         the combo box or -1 if nothing is selected in the combo box.
    */
   public int getSelectedIndex()
   {
     Object selectedItem = getSelectedItem();
-    if (selectedItem != null && (dataModel instanceof DefaultComboBoxModel))
-      return ((DefaultComboBoxModel) dataModel).getIndexOf(selectedItem);
+    
+    if (selectedItem != null) {
+       
+               if(dataModel instanceof DefaultComboBoxModel) {
+                       // Uses special method of DefaultComboBoxModel to retrieve the index.
+                       return ((DefaultComboBoxModel) dataModel).getIndexOf(selectedItem);
+               } else {
+                       // Iterates over all items to retrieve the index.
+                       int size = dataModel.getSize();
+                       
+                       for(int i=0; i < size; i++) {
+                               Object o = dataModel.getElementAt(i);
+                               
+                               // XXX: Is special handling of ComparableS neccessary?
+                               if((selectedItem != null) ? selectedItem.equals(o) : o == null) {
+                                       return i;
+                               }
+                       }
+               }
+    }
 
+    // returns that no item is currently selected
     return -1;
   }
 
@@ -550,60 +551,104 @@ public class JComboBox extends JComponent implements ItemSelectable,
     return prototypeDisplayValue;
   }
 
-  public void setPrototypeDisplayValue(Object prototypeDisplayValue)
+  public void setPrototypeDisplayValue(Object newPrototypeDisplayValue)
   {
-    this.prototypeDisplayValue = prototypeDisplayValue;
+    prototypeDisplayValue = newPrototypeDisplayValue;
   }
 
   /**
    * This method adds given element to this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
    *
    * @param element element to add
    */
   public void addItem(Object element)
   {
-    ((MutableComboBoxModel) dataModel).addElement(element);
+       if(dataModel instanceof MutableComboBoxModel) {
+               ((MutableComboBoxModel) dataModel).addElement(element);
+       } else {
+               throw new RuntimeException("Unable to add the item because the data model it is not an instance of MutableComboBoxModel.");
+       }
   }
 
   /**
-   * Inserts given element at the specified index to this JComboBox
+   * Inserts given element at the specified index to this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
    *
    * @param element element to insert
    * @param index position where to insert the element
    */
   public void insertItemAt(Object element, int index)
   {
-    ((MutableComboBoxModel) dataModel).insertElementAt(element, index);
+       if(dataModel instanceof MutableComboBoxModel) {
+               ((MutableComboBoxModel) dataModel).insertElementAt(element, index);
+       } else {
+               throw new RuntimeException("Unable to insert the item because the data model it is not an instance of MutableComboBoxModel.");
+       }
   }
 
   /**
    * This method removes given element from this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
    *
    * @param element element to remove
    */
   public void removeItem(Object element)
   {
-    ((MutableComboBoxModel) dataModel).removeElement(element);
+       if(dataModel instanceof MutableComboBoxModel) {
+               ((MutableComboBoxModel) dataModel).removeElement(element);
+       } else {
+               throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel.");
+       }
   }
 
   /**
    * This method remove element location in the specified index in the
    * JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
    *
    * @param index index specifying position of the element to remove
    */
   public void removeItemAt(int index)
   {
-    ((MutableComboBoxModel) dataModel).removeElementAt(index);
+       if(dataModel instanceof MutableComboBoxModel) {
+               ((MutableComboBoxModel) dataModel).removeElementAt(index);
+       } else {
+               throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel.");
+       }
   }
 
   /**
    * This method removes all elements from this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
+   * 
    */
   public void removeAllItems()
   {
-    if (dataModel instanceof DefaultComboBoxModel)
-      ((DefaultComboBoxModel) dataModel).removeAllElements();
+    if (dataModel instanceof DefaultComboBoxModel) {
+       // Uses special method if we have a DefaultComboBoxModel.
+       ((DefaultComboBoxModel) dataModel).removeAllElements();
+    } else if(dataModel instanceof MutableComboBoxModel){
+       // Iterates over all items and removes each.
+       MutableComboBoxModel mcbm = (MutableComboBoxModel) dataModel;
+
+       /* We intentionally remove the items backwards to support
+        * models which shift their content to the beginning (e.g.
+        * linked lists) 
+        */             
+       for(int i=mcbm.getSize()-1; i >= 0; i--) {
+               mcbm.removeElementAt(i);
+       }
+       
+    } else {
+       throw new RuntimeException("Unable to remove the items because the data model it is not an instance of MutableComboBoxModel.");
+    }
+      
   }
 
   /**
@@ -801,8 +846,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public Object[] getSelectedObjects()
   {
-    Object selectedObject = getSelectedItem();
-    return new Object[] { selectedObject };
+    return new Object[] { getSelectedItem() };
   }
 
   /**
@@ -887,8 +931,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
     if (enabled != oldEnabled)
       {
        super.setEnabled(enabled);
-       firePropertyChange(ENABLED_CHANGED_PROPERTY, oldEnabled,
-                          (boolean) enabled);
+       firePropertyChange("enabled", oldEnabled, enabled);
       }
   }
 
@@ -951,7 +994,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public int getItemCount()
   {
-    return ((DefaultComboBoxModel) dataModel).getSize();
+    return dataModel.getSize();
   }
 
   /**
@@ -963,7 +1006,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
    */
   public Object getItemAt(int index)
   {
-    return ((MutableComboBoxModel) dataModel).getElementAt(index);
+    return dataModel.getElementAt(index);
   }
 
   /**
index c22c2b2..8f2bc95 100644 (file)
@@ -1,5 +1,5 @@
 /* JComponent.java -- Every component in swing inherits from this class.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -50,6 +50,7 @@ import java.awt.Image;
 import java.awt.Insets;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.dnd.DropTarget;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ContainerEvent;
@@ -72,6 +73,7 @@ import java.util.Locale;
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleKeyBinding;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleStateSet;
 import javax.swing.border.Border;
@@ -133,6 +135,9 @@ public abstract class JComponent extends Container implements Serializable
     public String getAccessibleDescription() { return null; }
     public AccessibleRole getAccessibleRole() { return null; }
     protected String getBorderTitle(Border value0) { return null; }
+    public String getToolTipText() { return null; }
+    public String getTitledBorderText() { return null; }
+    public AccessibleKeyBinding getAccessibleKeyBinding() { return null; }
   }
 
   /** 
@@ -323,6 +328,8 @@ public abstract class JComponent extends Container implements Serializable
   private InputMap inputMap_whenAncestorOfFocused;
   private InputMap inputMap_whenInFocusedWindow;
   private ActionMap actionMap;
+  /** @since 1.3 */
+  private boolean verifyInputWhenFocusTarget;
   private InputVerifier inputVerifier;
 
   private TransferHandler transferHandler;
@@ -389,6 +396,7 @@ public abstract class JComponent extends Container implements Serializable
   {
     super();
     super.setLayout(new FlowLayout());
+    setDropTarget(new DropTarget());
     defaultLocale = Locale.getDefault();
     debugGraphicsOptions = DebugGraphics.NONE_OPTION;
   }
@@ -421,7 +429,7 @@ public abstract class JComponent extends Container implements Serializable
    * @see #getClientProperties
    * @see #putClientProperty
    */
-  public Object getClientProperty(Object key)
+  public final Object getClientProperty(Object key)
   {
     return getClientProperties().get(key);
   }
@@ -438,7 +446,7 @@ public abstract class JComponent extends Container implements Serializable
    * @see #getClientProperties
    * @see #getClientProperty
    */
-  public void putClientProperty(Object key, Object value)
+  public final void putClientProperty(Object key, Object value)
   {
     getClientProperties().put(key, value);
   }
@@ -1533,7 +1541,23 @@ public abstract class JComponent extends Container implements Serializable
    */
   protected String paramString()
   {
-    return "JComponent";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",alignmentX=").append(getAlignmentX());
+    sb.append(",alignmentY=").append(getAlignmentY());
+    sb.append(",border=");
+    if (getBorder() != null)
+      sb.append(getBorder());
+    sb.append(",maximumSize=");
+    if (getMaximumSize() != null)
+      sb.append(getMaximumSize());
+    sb.append(",minimumSize=");
+    if (getMinimumSize() != null)
+      sb.append(getMinimumSize());
+    sb.append(",preferredSize=");
+    if (getPreferredSize() != null)
+      sb.append(getPreferredSize());
+    return sb.toString();
   }
 
   /**
@@ -2092,9 +2116,14 @@ public abstract class JComponent extends Container implements Serializable
    * @see ComponentUI#getTransferHandler
    */
 
-  void setTransferHandler (TransferHandler newHandler)
+  public void setTransferHandler(TransferHandler newHandler)
   {
+    if (transferHandler == newHandler)
+      return;
+
+    TransferHandler oldHandler = transferHandler;
     transferHandler = newHandler;
+    firePropertyChange("transferHandler", oldHandler, newHandler);
   }
 
   /**
@@ -2225,4 +2254,26 @@ public abstract class JComponent extends Container implements Serializable
     inputVerifier = verifier;
     firePropertyChange("inputVerifier", oldVerifier, verifier);
   }
+
+  /**
+   * @since 1.3
+   */
+  public boolean getVerifyInputWhenFocusTarget()
+  {
+    return verifyInputWhenFocusTarget;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)
+  {
+    if (this.verifyInputWhenFocusTarget == verifyInputWhenFocusTarget)
+      return;
+
+    this.verifyInputWhenFocusTarget = verifyInputWhenFocusTarget;
+    firePropertyChange("verifyInputWhenFocusTarget",
+                      ! verifyInputWhenFocusTarget,
+                      verifyInputWhenFocusTarget);
+  }
 }
index 3b66c2b..8361b20 100644 (file)
@@ -1,5 +1,5 @@
 /* JEditorPane.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -47,6 +47,7 @@ import java.net.URL;
 import javax.accessibility.AccessibleContext;
 import javax.swing.event.HyperlinkEvent;
 import javax.swing.event.HyperlinkListener;
+import javax.swing.text.BadLocationException;
 import javax.swing.text.DefaultEditorKit;
 import javax.swing.text.EditorKit;
 import javax.swing.text.JTextComponent;
@@ -56,29 +57,31 @@ public class JEditorPane extends JTextComponent
 {
   private static final long serialVersionUID = 3140472492599046285L;
   
-  URL page_url;
-  EditorKit kit;
-  String ctype = "text/plain";
+  private URL page;
+  private EditorKit editorKit;
+  
   boolean focus_root;
   boolean manages_focus;
 
   public JEditorPane()
   {
+    setEditorKit(createDefaultEditorKit());
   }
 
   public JEditorPane(String url) throws IOException
   {
-    setPage(url);
+    this(new URL(url));
   }
 
   public JEditorPane(String type, String text)
   {
-    ctype = text;
+    setEditorKit(createEditorKitForContentType(type));
     setText(text);
   }
 
   public JEditorPane(URL url) throws IOException
   {
+    this();
     setPage(url);
   }
 
@@ -110,14 +113,14 @@ public class JEditorPane extends JTextComponent
     return null;
   }
 
-  public String getContentType()
+  public final String getContentType()
   {
-    return ctype;
+    return getEditorKit().getContentType();
   }
 
   public EditorKit getEditorKit()
   {
-    return kit;
+    return editorKit;
   }
 
   public static String getEditorKitClassNameForContentType(String type)
@@ -127,7 +130,7 @@ public class JEditorPane extends JTextComponent
 
   public EditorKit getEditorKitForContentType(String type)
   {
-    return kit;
+    return editorKit;
   }
 
   /**
@@ -150,7 +153,7 @@ public class JEditorPane extends JTextComponent
 
   public URL getPage()
   {
-    return page_url;
+    return page;
   }
 
   protected InputStream getStream(URL page)
@@ -216,7 +219,7 @@ public class JEditorPane extends JTextComponent
   }
 
   /**
-   * Establishes the default bindings of type to classname.  
+   * Establishes the default bindings of type to classname.
    */
   public static void registerEditorKitForContentType(String type,
                                                      String classname,
@@ -240,24 +243,43 @@ public class JEditorPane extends JTextComponent
   {
   }
 
-  public void setContentType(String type)
-  {
-    ctype = type;
-    invalidate();
-    repaint();
-  }
-
-  public void setEditorKit(EditorKit kit)
-  {
-    this.kit = kit;
+  public final void setContentType(String type)
+  {
+    if (editorKit != null
+       && editorKit.getContentType().equals(type))
+      return;
+             
+    EditorKit kit = getEditorKitForContentType(type);
+               
+    if (kit != null)
+      setEditorKit(kit);
+  }
+
+  public void setEditorKit(EditorKit newValue)
+  {
+    if (editorKit == newValue)
+      return;
+       
+    if (editorKit != null)
+      editorKit.deinstall(this);
+                   
+    EditorKit oldValue = editorKit;
+    editorKit = newValue;
+                               
+    if (editorKit != null)
+      {
+       editorKit.install(this);
+       setDocument(editorKit.createDefaultDocument());
+      }
+                                           
+    firePropertyChange("editorKit", oldValue, newValue);
     invalidate();
     repaint();
   }
 
   public void setEditorKitForContentType(String type, EditorKit k)
   {
-    ctype = type;
-    setEditorKit(k);
+    // FIXME: editorKitCache.put(type, kit);
   }
 
   /**
@@ -265,6 +287,7 @@ public class JEditorPane extends JTextComponent
    */
   public void setPage(String url) throws IOException
   {
+    setPage(new URL(url));
   }
 
   /**
@@ -272,6 +295,18 @@ public class JEditorPane extends JTextComponent
    */
   public void setPage(URL page) throws IOException
   {
+    if (page == null)
+      throw new IOException("invalid url");
+
+    try
+      {
+       this.page = page;
+       getEditorKit().read(page.openStream(), getDocument(), 0);
+      }
+    catch (BadLocationException e)
+      {
+       // Ignored. '0' is always a valid offset.
+      }
   }
 
   public void setText(String t)
index f653c70..9b93717 100644 (file)
@@ -522,7 +522,7 @@ public class JFileChooser extends JComponent implements Accessible {
         * @returns int
         */
        public int showOpenDialog(Component parent) {
-               return 0; // TODO
+               return CANCEL_OPTION; // TODO
        } // showOpenDialog()
 
        /**
@@ -531,7 +531,7 @@ public class JFileChooser extends JComponent implements Accessible {
         * @returns int
         */
        public int showSaveDialog(Component parent) {
-               return 0; // TODO
+               return CANCEL_OPTION; // TODO
        } // showSaveDialog()
 
        /**
@@ -541,7 +541,7 @@ public class JFileChooser extends JComponent implements Accessible {
         * @returns int
         */
        public int showDialog(Component parent, String approveButtonText) {
-               return 0; // TODO
+               return CANCEL_OPTION; // TODO
        } // showDialog()
 
        /**
index eaf5355..f544aec 100644 (file)
@@ -59,6 +59,8 @@ public class JFormattedTextField extends JTextField
   {
     private static final long serialVersionUID = -5193212041738979680L;
     
+    private JFormattedTextField textField;
+    
     public AbstractFormatter ()
     {
       //Do nothing here.
@@ -72,7 +74,7 @@ public class JFormattedTextField extends JTextField
 
     protected Action[] getActions ()
     {
-      throw new InternalError ("not implemented");
+      return textField.getActions();
     }
 
     protected DocumentFilter getDocumentFilter ()
@@ -82,32 +84,35 @@ public class JFormattedTextField extends JTextField
 
     protected JFormattedTextField getFormattedTextField ()
     {
-      throw new InternalError ("not implemented");
+      return textField;
     }
 
     protected NavigationFilter getNavigationFilter ()
     {
-      throw new InternalError ("not implemented");
+      return textField.getNavigationFilter();
     }
 
-    public void install (JFormattedTextField ftf)
+    public void install(JFormattedTextField textField)
     {
-      throw new InternalError ("not implemented");
+      if (this.textField != null)
+       uninstall();
+      
+      this.textField = textField;
     }
 
     public void uninstall ()
     {
-      throw new InternalError ("not implemented");
+      this.textField = null;
     }
 
     protected void invalidEdit ()
     {
-      throw new InternalError ("not implemented");
+      textField.invalidEdit();
     }
 
     protected void setEditValid (boolean valid)
     {
-      throw new InternalError ("not implemented");
+      textField.editValid = valid;
     }
 
     public abstract Object stringToValue (String text)
@@ -127,16 +132,34 @@ public class JFormattedTextField extends JTextField
     public abstract AbstractFormatter getFormatter (JFormattedTextField tf);
   }
 
+  static class FormatterFactoryWrapper extends AbstractFormatterFactory
+  {
+    AbstractFormatter formatter;
+
+    public FormatterFactoryWrapper(AbstractFormatter formatter)
+    {
+      this.formatter = formatter;
+    }
+
+    public AbstractFormatter getFormatter(JFormattedTextField tf)
+    {
+      return formatter;
+    }
+  }
+
   public static final int COMMIT = 0;
   public static final int COMMIT_OR_REVERT = 1;
   public static final int REVERT = 2;
   public static final int PERSIST = 3;
 
   private Object value;
+  private int focusLostBehavior = COMMIT_OR_REVERT;
+  private AbstractFormatterFactory formatterFactory;
+  private boolean editValid = true;
   
   public JFormattedTextField ()
   {
-    this((AbstractFormatterFactory) null);
+    this((AbstractFormatterFactory) null, null);
   }
 
   public JFormattedTextField (Format format)
@@ -146,7 +169,7 @@ public class JFormattedTextField extends JTextField
 
   public JFormattedTextField (AbstractFormatter formatter)
   {
-    throw new InternalError ("not implemented");
+    this(new FormatterFactoryWrapper(formatter), null);
   }
 
   public JFormattedTextField (AbstractFormatterFactory factory)
@@ -156,7 +179,8 @@ public class JFormattedTextField extends JTextField
 
   public JFormattedTextField (AbstractFormatterFactory factory, Object value)
   {
-    throw new InternalError ("not implemented");
+    this.formatterFactory = factory;
+    this.value = value;
   }
 
   public JFormattedTextField (Object value)
@@ -175,19 +199,22 @@ public class JFormattedTextField extends JTextField
     throw new InternalError ("not implemented");
   }
 
-  public int getFocusLostBehaviour ()
+  public int getFocusLostBehavior()
   {
-    throw new InternalError ("not implemented");
+    return focusLostBehavior;
   }
 
   public AbstractFormatter getFormatter ()
   {
-    throw new InternalError ("not implemented");
+    if (formatterFactory == null)
+      return null;
+    
+    return formatterFactory.getFormatter(this);
   }
 
   public AbstractFormatterFactory getFormatterFactory ()
   {
-    throw new InternalError ("not implemented");
+    return formatterFactory;
   }
 
   public String getUIClassID ()
@@ -202,12 +229,12 @@ public class JFormattedTextField extends JTextField
 
   protected void invalidEdit ()
   {
-    throw new InternalError ("not implemented");
+    UIManager.getLookAndFeel().provideErrorFeedback(this);
   }
 
   public boolean isEditValid ()
   {
-    throw new InternalError ("not implemented");
+    return editValid;
   }
 
   protected void processFocusEvent (FocusEvent evt)
@@ -215,34 +242,58 @@ public class JFormattedTextField extends JTextField
     throw new InternalError ("not implemented");
   }
 
-  public void setDocument(Document newdoc)
+  public void setDocument(Document newDocument)
   {
-    Document document = getDocument();
+    Document oldDocument = getDocument();
 
-    if (document == newdoc)
+    if (oldDocument == newDocument)
       return;
     
-    setDocument(newdoc);
-    firePropertyChange("document", document, newdoc);
+    super.setDocument(newDocument);
   }
 
-  public void setLostFocusBehavior (int behavior)
+  public void setFocusLostBehavior(int behavior)
   {
-    throw new InternalError ("not implemented");
+    if (behavior != COMMIT
+       && behavior != COMMIT_OR_REVERT
+       && behavior != PERSIST
+       && behavior != REVERT)
+      throw new IllegalArgumentException("invalid behavior");
+
+    this.focusLostBehavior = behavior;
   }
 
   protected void setFormatter (AbstractFormatter formatter)
   {
-    throw new InternalError ("not implemented");
+    AbstractFormatter oldFormatter = null;
+    
+    if (formatterFactory != null)
+      oldFormatter = formatterFactory.getFormatter(this);
+
+    if (oldFormatter == formatter)
+      return;
+
+    setFormatterFactory(new FormatterFactoryWrapper(formatter));
+    firePropertyChange("formatter", oldFormatter, formatter);
   }
 
   public void setFormatterFactory (AbstractFormatterFactory factory)
   {
-    throw new InternalError ("not implemented");
+    if (formatterFactory == factory)
+      return;
+    
+    AbstractFormatterFactory oldFactory = formatterFactory;
+    formatterFactory = factory;
+    firePropertyChange("formatterFactory", oldFactory, factory);
   }
 
   public void setValue (Object newValue)
   {
+    if (value == newValue)
+      return;
+    
+    Object oldValue = value;
     value = newValue;
+    firePropertyChange("value", oldValue, newValue);
   }
 }
index aa641ca..c450d0f 100644 (file)
@@ -1,5 +1,5 @@
 /* JFrame.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -123,7 +123,7 @@ public class JFrame extends Frame
     return rootPane;
   }
 
-  public void setRootPane(JRootPane root)
+  protected void setRootPane(JRootPane root)
   {
     if (rootPane != null)
       remove(rootPane);
@@ -132,7 +132,7 @@ public class JFrame extends Frame
     add(rootPane, BorderLayout.CENTER);
   }
 
-  public JRootPane createRootPane()
+  protected JRootPane createRootPane()
   {
     return new JRootPane();
   }
index ead61f2..dba1546 100644 (file)
@@ -1,5 +1,5 @@
-/* JInternalFrame.java -- 
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+/* JInternalFrame.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -780,9 +780,11 @@ public class JInternalFrame extends JComponent implements Accessible,
    * This method returns null because this must always be the root of a focus
    * traversal.
    *
-   * @return null.
+   * @return always null
+   *
+   * @since 1.4
    */
-  public Container getFocusCycleRootAncestor()
+  public final Container getFocusCycleRootAncestor()
   {
     // as defined.
     return null;
@@ -860,7 +862,7 @@ public class JInternalFrame extends JComponent implements Accessible,
   {
     JDesktopPane pane = getDesktopPane();
     if (pane != null)
-      return pane.getLayer(this).intValue();
+      return pane.getLayer(this);
     return -1;
   }
 
@@ -968,7 +970,7 @@ public class JInternalFrame extends JComponent implements Accessible,
    *
    * @return null.
    */
-  public String getWarningString()
+  public final String getWarningString()
   {
     // as defined.
     return null;
@@ -1019,9 +1021,11 @@ public class JInternalFrame extends JComponent implements Accessible,
   /**
    * This must always return true.
    *
-   * @return True
+   * @return always true
+   *
+   * @since 1.4
    */
-  public boolean isFocusCycleRoot()
+  public final boolean isFocusCycleRoot()
   {
     return true;
   }
@@ -1272,8 +1276,9 @@ public class JInternalFrame extends JComponent implements Accessible,
    */
   public void setDefaultCloseOperation(int operation)
   {
-    if (operation != DO_NOTHING_ON_CLOSE || operation != HIDE_ON_CLOSE
-        || operation != DISPOSE_ON_CLOSE)
+    if (operation != DO_NOTHING_ON_CLOSE
+       && operation != HIDE_ON_CLOSE
+        && operation != DISPOSE_ON_CLOSE)
       throw new Error("Close operation must be one of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE");
     defaultCloseOperation = operation;
   }
index b3d7225..c01d811 100644 (file)
@@ -1,5 +1,5 @@
 /* JLabel.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -92,59 +92,6 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
   private transient int iconTextGap = 4;
 
   /**
-   * Fired in a PropertyChangeEvent when the "disabledIcon" property changes.
-   */
-  public static final String DISABLED_ICON_CHANGED_PROPERTY = "disabledIcon";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "displayedMnemonic" property
-   * changes.
-   */
-  public static final String DISPLAYED_MNEMONIC_CHANGED_PROPERTY = "displayedMnemonic";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "displayedMnemonicIndex" property
-   * changes.
-   */
-  public static final String DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY = "displayedMnemonicIndex";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "horizontalAlignment" property
-   * changes.
-   */
-  public static final String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY = "horizontalAlignment";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "horizontalTextPosition" property
-   * changes.
-   */
-  public static final String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY = "horizontalTextPosition";
-
-  /** Fired in a PropertyChangeEvent when the "icon" property changes. */
-  public static final String ICON_CHANGED_PROPERTY = "icon";
-
-  /** Fired in a PropertyChangeEvent when the "iconTextGap" property changes. */
-  public static final String ICON_TEXT_GAP_CHANGED_PROPERTY = "iconTextGap";
-
-  /** Fired in a PropertyChangeEvent when the "labelFor" property changes. */
-  public static final String LABEL_FOR_CHANGED_PROPERTY = "labelFor";
-
-  /** Fired in a PropertyChangeEvent when the "text" property changes. */
-  public static final String TEXT_CHANGED_PROPERTY = "text";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "verticalAlignment" property
-   * changes.
-   */
-  public static final String VERTICAL_ALIGNMENT_CHANGED_PROPERTY = "verticalAlignment";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "verticalTextPosition" property
-   * changes.
-   */
-  public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY = "verticalTextPosition";
-
-  /**
    * Creates a new horizontally and vertically centered JLabel object with no
    * text and no icon.
    */
@@ -289,7 +236,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
       {
        String oldText = text;
        text = newText;
-       firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, newText);
+       firePropertyChange("text", oldText, newText);
 
        if (text != null && text.length() <= displayedMnemonicIndex)
          setDisplayedMnemonicIndex(text.length() - 1);
@@ -319,7 +266,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
       {
        Icon oldIcon = icon;
        icon = newIcon;
-       firePropertyChange(ICON_CHANGED_PROPERTY, oldIcon, newIcon);
+       firePropertyChange("icon", oldIcon, newIcon);
       }
   }
 
@@ -352,7 +299,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
       {
        Icon oldIcon = disabledIcon;
        disabledIcon = newIcon;
-       firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, oldIcon, newIcon);
+       firePropertyChange("disabledIcon", oldIcon, newIcon);
       }
   }
 
@@ -367,12 +314,12 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
   {
     if (displayedMnemonic != mnemonic)
       {
-       firePropertyChange(DISPLAYED_MNEMONIC_CHANGED_PROPERTY,
+       firePropertyChange("displayedMnemonic",
                           displayedMnemonic, mnemonic);
        displayedMnemonic = mnemonic;
 
        if (text != null)
-         setDisplayedMnemonicIndex(text.indexOf(mnemonic));
+         setDisplayedMnemonicIndex(text.toUpperCase().indexOf(mnemonic));
       }
   }
 
@@ -385,7 +332,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
    */
   public void setDisplayedMnemonic(char mnemonic)
   {
-    setDisplayedMnemonic((int) mnemonic);
+    setDisplayedMnemonic((int) Character.toUpperCase(mnemonic));
   }
 
   /**
@@ -399,7 +346,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
   }
 
   /**
-   * This method sets which character in the text will be  the underlined
+   * This method sets which character in the text will be the underlined
    * character. If the given index is -1, then this indicates  that there is
    * no mnemonic. If the index is less than -1 or if the index is equal to
    * the length, this method will throw an IllegalArgumentException.
@@ -410,19 +357,22 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
    *         length.
    */
   public void setDisplayedMnemonicIndex(int newIndex)
-                                 throws IllegalArgumentException
+    throws IllegalArgumentException
   {
     if (newIndex < -1 || (text != null && newIndex >= text.length()))
       throw new IllegalArgumentException();
 
-    if (text == null || text.charAt(newIndex) != displayedMnemonic)
+    if (newIndex == -1
+        || text == null
+       || text.charAt(newIndex) != displayedMnemonic)
       newIndex = -1;
 
     if (newIndex != displayedMnemonicIndex)
       {
-       firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,
-                          displayedMnemonicIndex, newIndex);
+       int oldIndex = displayedMnemonicIndex;
        displayedMnemonicIndex = newIndex;
+       firePropertyChange("displayedMnemonicIndex",
+                          oldIndex, newIndex);
       }
   }
 
@@ -498,7 +448,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
   {
     if (iconTextGap != newGap)
       {
-       firePropertyChange(ICON_TEXT_GAP_CHANGED_PROPERTY, iconTextGap, newGap);
+       firePropertyChange("iconTextGap", iconTextGap, newGap);
        iconTextGap = newGap;
       }
   }
@@ -523,13 +473,12 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
    */
   public void setVerticalAlignment(int alignment)
   {
-    if (alignment != verticalAlignment)
-      {
-       int oldAlignment = verticalAlignment;
-       verticalAlignment = checkVerticalKey(alignment, "verticalAlignment");
-       firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,
-                          verticalAlignment);
-      }
+    if (alignment == verticalAlignment)
+      return;
+
+    int oldAlignment = verticalAlignment;
+    verticalAlignment = checkVerticalKey(alignment, "verticalAlignment");
+    firePropertyChange("verticalAlignment", oldAlignment, verticalAlignment);
   }
 
   /**
@@ -550,9 +499,12 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
    */
   public void setHorizontalAlignment(int alignment)
   {
+    if (horizontalAlignment == alignment)
+      return;
+    
     int oldAlignment = horizontalAlignment;
     horizontalAlignment = checkHorizontalKey(alignment, "horizontalAlignment");
-    firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,
+    firePropertyChange("horizontalAlignment", oldAlignment,
                        horizontalAlignment);
   }
 
@@ -580,7 +532,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
        int oldPos = verticalTextPosition;
        verticalTextPosition = checkVerticalKey(textPosition,
                                                "verticalTextPosition");
-       firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, oldPos,
+       firePropertyChange("verticalTextPosition", oldPos,
                           verticalTextPosition);
       }
   }
@@ -609,7 +561,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
        int oldPos = horizontalTextPosition;
        horizontalTextPosition = checkHorizontalKey(textPosition,
                                                    "horizontalTextPosition");
-       firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, oldPos,
+       firePropertyChange("horizontalTextPosition", oldPos,
                           horizontalTextPosition);
       }
   }
@@ -665,8 +617,9 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
   {
     if (c != labelFor)
       {
-       firePropertyChange(LABEL_FOR_CHANGED_PROPERTY, labelFor, c);
+       Component oldLabelFor = labelFor;
        labelFor = c;
+       firePropertyChange("labelFor", oldLabelFor, labelFor);
       }
   }
 
index a200f28..cdafd8b 100644 (file)
@@ -89,7 +89,7 @@ import javax.accessibility.Accessible;
  * <p><b>Note:</b> the layer numbering order is the <em>reverse</em> of the
  * component indexing and position order</p>
  *
- * @author Graydon Hoare <graydon@redhat.com>
+ * @author Graydon Hoare (graydon@redhat.com)
  */
 public class JLayeredPane extends JComponent implements Accessible
 {
@@ -122,12 +122,11 @@ public class JLayeredPane extends JComponent implements Accessible
    * @return the layer the component is currently assigned to, in this container.
    * @throws IllegalArgumentException if the component is not a child of this container.
    */
-
-  protected Integer getLayer (Component c)
+  public int getLayer(Component c)
   {
     if (! componentToLayer.containsKey (c))
            throw new IllegalArgumentException ();
-    return (Integer) componentToLayer.get (c);
+    return ((Integer) componentToLayer.get(c)).intValue();
   }
 
   /**
@@ -144,8 +143,7 @@ public class JLayeredPane extends JComponent implements Accessible
    * @throws IllegalArgumentException if layer does not refer to an active layer
    * in this container.
    */
-
-  protected int[] layerToRange (Integer layer)
+  private int[] layerToRange (Integer layer)
   {
     int[] ret = new int[2];
     ret[1] = getComponents ().length;
@@ -175,8 +173,7 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layer the layer number to increment.
    * @see #incrLayer()
    */
-
-  protected void incrLayer(Integer layer)
+  private void incrLayer(Integer layer)
   {
     int sz = 1;
     if (layers.containsKey (layer))
@@ -190,8 +187,7 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layer the layer number to decrement.
    * @see #decrLayer()
    */
-
-  protected void decrLayer(Integer layer)
+  private void decrLayer(Integer layer)
   {
     int sz = 0;
     if (layers.containsKey (layer))
@@ -206,7 +202,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @return the least layer number.
    * @see #lowestLayer()
    */
-
   public int highestLayer()
   {
     if (layers.size() == 0)
@@ -221,7 +216,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @return the least layer number.
    * @see #highestLayer()
    */
-    
   public int lowestLayer()
   {
     if (layers.size() == 0)
@@ -240,7 +234,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * this container.
    * @see #moveToBack()
    */
-
   public void moveToFront(Component c)
   {
     setPosition (c, 0);
@@ -260,7 +253,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * this container.
    * @see #moveToFront()
    */
-
   public void moveToBack(Component c)
   {
     setPosition (c, -1);
@@ -276,11 +268,10 @@ public class JLayeredPane extends JComponent implements Accessible
    * this container.
    * @see #setPosition()
    */
-    
   public int getPosition(Component c)
   {
-    Integer layer = getLayer (c);
-    int[] range = layerToRange (layer);
+    int layer = getLayer (c);
+    int[] range = layerToRange(new Integer(layer));
     int top = range[0];
     int bot = range[1];
     Component[] comps = getComponents ();
@@ -304,33 +295,32 @@ public class JLayeredPane extends JComponent implements Accessible
    * this container.
    * @see #getPosition()
    */
-
   public void setPosition(Component c, int position)
   {
-    Integer layer = getLayer (c);
-    int[] range = layerToRange (layer);
+    int layer = getLayer (c);
+    int[] range = layerToRange(new Integer(layer));
     if (range[0] == range[1])
-           throw new IllegalArgumentException ();
+      throw new IllegalArgumentException ();
 
     int top = range[0];
     int bot = range[1];
     if (position == -1)
-           position = (bot - top) - 1;
+      position = (bot - top) - 1;
     int targ = Math.min(top + position, bot-1);
     int curr = -1;
 
     Component[] comps = getComponents();
     for (int i = top; i < bot; ++i)
-           {
+      {
         if (comps[i] == c)
           {
             curr = i;
             break;
           }
-           }
+      }
     if (curr == -1)
-           // should have found it
-           throw new IllegalArgumentException ();
+      // should have found it
+      throw new IllegalArgumentException();
 
     super.swapComponents (curr, targ);
     revalidate();
@@ -345,7 +335,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layer the layer to return components from.
    * @return the components in the layer.
    */
-
   public Component[] getComponentsInLayer(int layer)
   {
     int[] range = layerToRange (getObjectForLayer (layer));
@@ -369,7 +358,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layer the layer count components in.
    * @return the number of components in the layer.
    */
-
   public int getComponentCountInLayer(int layer)
   {
     int[] range = layerToRange (getObjectForLayer (layer));
@@ -383,7 +371,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * Return a hashtable mapping child components of this container to
    * Integer objects representing the component's layer assignments.
    */
-
   protected Hashtable getComponentToLayer()
   {
     return componentToLayer;
@@ -400,11 +387,10 @@ public class JLayeredPane extends JComponent implements Accessible
    * @throws IllegalArgumentException if the component is not a child of
    * this container.
    */
-
   public int getIndexOf(Component c) 
   {
-    Integer layer = getLayer (c);
-    int[] range = layerToRange (layer);
+    int layer = getLayer (c);
+    int[] range = layerToRange(new Integer(layer));
     Component[] comps = getComponents();
     for (int i = range[0]; i < range[1]; ++i)
            {
@@ -423,7 +409,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layer the layer number as an int.
    * @return the layer number as an Integer, possibly shared.
    */
-
   protected Integer getObjectForLayer(int layer)
   {
     switch (layer)
@@ -462,7 +447,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param position the position in the layer at which to insert a component.
    * @return the index at which to insert the component.
    */
-    
   protected int insertIndexForLayer(int layer, int position)
   {
 
@@ -488,12 +472,11 @@ public class JLayeredPane extends JComponent implements Accessible
    *
    * @param index the index of the child component to remove.
    */
-    
   public void remove (int index)
   {
     Component c = getComponent (index);
-    Integer layer = getLayer (c);
-    decrLayer (layer);
+    int layer = getLayer (c);
+    decrLayer (new Integer(layer));
     componentToLayer.remove (c);
     super.remove (index);
     revalidate();
@@ -506,7 +489,6 @@ public class JLayeredPane extends JComponent implements Accessible
    *
    * @param comp the child to remove.
    */
-       
   public void remove (Component comp)
   {
     remove (getIndexOf (comp));
@@ -523,7 +505,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param c the component to set the layer property for.
    * @param layer the layer number to assign to the component.
    */
-
   public void setLayer(Component c, int layer)
   {
     componentToLayer.put (c, getObjectForLayer (layer));
@@ -536,7 +517,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layer the layer number to assign to the component.
    * @param position the position number to assign to the component.
    */
-
   public void setLayer(Component c,
                        int layer,
                        int position)
@@ -558,7 +538,6 @@ public class JLayeredPane extends JComponent implements Accessible
    * @param layerConstraint an integer specifying the layer to add the component to.
    * @param index an ignored parameter, for compatibility.
    */
-
   protected void addImpl(Component comp, Object layerConstraint, int index) 
   {            
     Integer layer;
index d88a4db..f26fa8a 100644 (file)
@@ -1,5 +1,5 @@
 /* JList.java --
-   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -129,34 +129,6 @@ public class JList extends JComponent implements Accessible, Scrollable
    */
   public static final int HORIZONTAL_WRAP = 2;
 
-  /** Fired in a PropertyChangeEvent when the "cellRenderer" property changes. */
-  public static final String CELL_RENDERER_PROPERTY_CHANGED = "cellRenderer";
-
-  /** Fired in a PropertyChangeEvent when the "fixedCellHeight" property changes. */
-  public static final String FIXED_CELL_HEIGHT_PROPERTY_CHANGED = "fixedCellHeight";
-
-  /** Fired in a PropertyChangeEvent when the "fixedCellWidth" property changes. */
-  public static final String FIXED_CELL_WIDTH_PROPERTY_CHANGED = "fixedCellWidth";
-
-  /** Fired in a PropertyChangeEvent when the "layoutOrientation" property changes. */
-  public static final String LAYOUT_ORIENTATION_PROPERTY_CHANGED = "layoutOrientation";
-
-  /** Fired in a PropertyChangeEvent when the "model" property changes. */
-  public static final String MODEL_PROPERTY_CHANGED = "model";
-
-  /** Fired in a PropertyChangeEvent when the "prototypeCellValue" property changes. */
-  public static final String PROTOTYPE_CELL_VALUE_PROPERTY_CHANGED = "prototypeCellValue";
-
-  /** Fired in a PropertyChangeEvent when the "selectionBackground" property changes. */
-  public static final String SELECTION_BACKGROUND_PROPERTY_CHANGED = "selectionBackground";
-
-  /** Fired in a PropertyChangeEvent when the "selectionForeground" property changes. */
-  public static final String SELECTION_FOREGROUND_PROPERTY_CHANGED = "selectionForeground";
-
-  /** Fired in a PropertyChangeEvent when the "selectionModel" property changes. */
-  public static final String SELECTION_MODEL_PROPERTY_CHANGED = "selectionModel";
-
-
   /**
    * This property indicates whether "drag and drop" functions are enabled
    * on the list.
@@ -187,7 +159,6 @@ public class JList extends JComponent implements Accessible, Scrollable
    * is one of the integer constants {@link #VERTICAL}, {@link
    * #VERTICAL_WRAP}, or {@link #HORIZONTAL_WRAP}. 
    */
-
   int layoutOrientation;
   
   /** This property holds the data elements displayed by the list. */
@@ -250,12 +221,10 @@ public class JList extends JComponent implements Accessible, Scrollable
    */
   int visibleRowCount;
 
-
-
   /**
    * Fire a {@link ListSelectionEvent} to all the registered ListSelectionListeners.
    */
-  void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) 
+  protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) 
   {
     ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex, lastIndex, isAdjusting);
     ListSelectionListener listeners[] = getListSelectionListeners();
@@ -265,7 +234,6 @@ public class JList extends JComponent implements Accessible, Scrollable
       }
   }
 
-
   /**
    * This private listener propagates {@link ListSelectionEvent} events
    * from the list's "selectionModel" property to the list's {@link
@@ -365,12 +333,22 @@ public class JList extends JComponent implements Accessible, Scrollable
     listListener = new ListListener();
 
     setModel(new DefaultListModel());
-    setSelectionModel(new DefaultListSelectionModel());
+    setSelectionModel(createSelectionModel());
 
     updateUI();
   }
 
   /**
+   * Creates the default <code>ListSelectionModel</code>.
+   *
+   * @return the <code>ListSelectionModel</code>
+   */
+  protected ListSelectionModel createSelectionModel()
+  {
+    return new DefaultListSelectionModel();
+  }
+  
+  /**
    * Gets the value of the {@link #fixedCellHeight} property. This property
    * may be <code>-1</code> to indicate that no cell height has been
    * set. This property is also set implicitly when the
@@ -399,9 +377,12 @@ public class JList extends JComponent implements Accessible, Scrollable
    */
   public void setFixedCellHeight(int h)
   {
+    if (fixedCellHeight == h)
+      return;
+
     int old = fixedCellHeight;
     fixedCellHeight = h;
-    firePropertyChange(FIXED_CELL_WIDTH_PROPERTY_CHANGED, old, h);
+    firePropertyChange("fixedCellWidth", old, h);
   }
 
 
@@ -428,17 +409,19 @@ public class JList extends JComponent implements Accessible, Scrollable
    * #prototypeCellValue} property is set, but setting it explicitly
    * overrides the width computed from {@link #prototypeCellValue}.
    *
-   * @see #getFixedCellWidth
+   * @see #getFixedCellHeight
    * @see #getPrototypeCellValue
    */
-  public void setFixedCellWidth(int h)
+  public void setFixedCellWidth(int w)
   {
-    int old = fixedCellHeight;
-    fixedCellHeight = h;
-    firePropertyChange(FIXED_CELL_HEIGHT_PROPERTY_CHANGED, old, h);
+    if (fixedCellWidth == w)
+      return;
+    
+    int old = fixedCellWidth;
+    fixedCellWidth = w;
+    firePropertyChange("fixedCellWidth", old, w);
   }
 
-
   /** 
    * Gets the value of the {@link #visibleRowCount} property. 
    *
@@ -501,6 +484,11 @@ public class JList extends JComponent implements Accessible, Scrollable
     return (ListSelectionListener[]) getListeners(ListSelectionListener.class);
   }
 
+  public int getSelectionMode()
+  {
+    return selectionModel.getSelectionMode();
+  }
+  
   /**
    * Sets the list's "selectionMode" property, which simply mirrors the
    * same property on the list's {@link #selectionModel} property. This
@@ -723,9 +711,12 @@ public class JList extends JComponent implements Accessible, Scrollable
    */
   public void setSelectionBackground(Color c)
   {
+    if (selectionBackground == c)
+      return;
+
     Color old = selectionBackground;
     selectionBackground = c;
-    firePropertyChange(SELECTION_BACKGROUND_PROPERTY_CHANGED, old, c);
+    firePropertyChange("selectionBackground", old, c);
     repaint();
   }
 
@@ -746,9 +737,12 @@ public class JList extends JComponent implements Accessible, Scrollable
    */
   public void setSelectionForeground(Color c)
   {
+    if (selectionForeground == c)
+      return;
+
     Color old = selectionForeground;
     selectionForeground = c;
-    firePropertyChange(SELECTION_FOREGROUND_PROPERTY_CHANGED, old, c);
+    firePropertyChange("selectionForeground", old, c);
   }
 
   /**
@@ -850,13 +844,16 @@ public class JList extends JComponent implements Accessible, Scrollable
   /**
    * Sets the value of the {@link #celLRenderer} property.
    *
-   * @param cellRenderer The new property value
+   * @param renderer The new property value
    */
-  public void setCellRenderer(ListCellRenderer cr)
+  public void setCellRenderer(ListCellRenderer renderer)
   {
+    if (cellRenderer == renderer)
+      return;
+    
     ListCellRenderer old = cellRenderer;
-    cellRenderer = cr;
-    firePropertyChange(CELL_RENDERER_PROPERTY_CHANGED, old, cr);
+    cellRenderer = renderer;
+    firePropertyChange("cellRenderer", old, renderer);
     revalidate();
     repaint();
   }
@@ -878,15 +875,21 @@ public class JList extends JComponent implements Accessible, Scrollable
    *
    * @param model The new property value
    */
-  public void setModel(ListModel m)
+  public void setModel(ListModel model)
   {
-    ListModel old = model;
-    if (old != null)
-      old.removeListDataListener(listListener);
-    model = m;
-    if (model != null)
-      model.addListDataListener(listListener);
-    firePropertyChange(MODEL_PROPERTY_CHANGED, old, m);
+    if (this.model == model)
+      return;
+    
+    if (this.model != null)
+      this.model.removeListDataListener(listListener);
+    
+    ListModel old = this.model;
+    this.model = model;
+    
+    if (this.model != null)
+      this.model.addListDataListener(listListener);
+    
+    firePropertyChange("model", old, model);
     revalidate();
     repaint();
   }
@@ -902,17 +905,23 @@ public class JList extends JComponent implements Accessible, Scrollable
    * {@link #listListener} is unsubscribed from the existing selection
    * model, if it exists, and re-subscribed to the new selection model.
    *
-   * @param l The new property value
+   * @param model The new property value
    */
-  public void setSelectionModel(ListSelectionModel l)
+  public void setSelectionModel(ListSelectionModel model)
   {
+    if (selectionModel == model)
+      return;
+    
+    if (selectionModel != null)
+      selectionModel.removeListSelectionListener(listListener);
+    
     ListSelectionModel old = selectionModel;
-    if (old != null)
-      old.removeListSelectionListener(listListener);
-    selectionModel = l;
+    selectionModel = model;
+    
     if (selectionModel != null)
       selectionModel.addListSelectionListener(listListener);
-    firePropertyChange(SELECTION_MODEL_PROPERTY_CHANGED, old, l);
+    
+    firePropertyChange("selectionModel", old, model);
     revalidate();
     repaint();
   }
@@ -992,6 +1001,9 @@ public class JList extends JComponent implements Accessible, Scrollable
    */
   public void setPrototypeCellValue(Object obj)
   {
+    if (prototypeCellValue == obj)
+      return;
+
     Object old = prototypeCellValue;
     Component comp = getCellRenderer()
       .getListCellRendererComponent(this, obj, 0, false, false); 
@@ -999,7 +1011,7 @@ public class JList extends JComponent implements Accessible, Scrollable
     fixedCellWidth = d.width;
     fixedCellHeight = d.height;
     prototypeCellValue = obj;
-    firePropertyChange(PROTOTYPE_CELL_VALUE_PROPERTY_CHANGED, old, obj);
+    firePropertyChange("prototypeCellValue", old, obj);
   }
 
   public AccessibleContext getAccessibleContext()
@@ -1196,4 +1208,119 @@ public class JList extends JComponent implements Accessible, Scrollable
   {
     return false;
   }
+
+  public int getAnchorSelectionIndex()
+  {
+    return selectionModel.getAnchorSelectionIndex();
+  }
+
+  public int getLeadSelectionIndex()
+  {
+    return selectionModel.getLeadSelectionIndex();
+  }
+
+  public int getMinSelectionIndex()
+  {
+    return selectionModel.getMaxSelectionIndex();
+  }
+
+  public int getMaxSelectionIndex()
+  {
+    return selectionModel.getMaxSelectionIndex();
+  }
+
+  public void clearSelection()
+  {
+    selectionModel.clearSelection();
+  }
+
+  public void setSelectionInterval(int anchor, int lead)
+  {
+    selectionModel.setSelectionInterval(anchor, lead);
+  }
+
+  public void addSelectionInterval(int anchor, int lead)
+  {
+    selectionModel.addSelectionInterval(anchor, lead);
+  }
+
+  public void removeSelectionInterval(int index0, int index1)
+  {
+    selectionModel.removeSelectionInterval(index0, index1);
+  }
+
+  /**
+   * Returns the value of the <code>valueIsAdjusting</code> property.
+   *
+   * @return the value
+   */
+  public boolean getValueIsAdjusting()
+  {
+    return valueIsAdjusting;
+  }
+
+  /**
+   * Sets the <code>valueIsAdjusting</code> property.
+   *
+   * @param isAdjusting the new value
+   */
+  public void setValueIsAdjusting(boolean isAdjusting)
+  {
+    valueIsAdjusting = isAdjusting;
+  }
+
+  /**
+   * Return the value of the <code>dragEnabled</code> property.
+   *
+   * @return the value
+   * 
+   * @since 1.4
+   */
+  public boolean getDragEnabled()
+  {
+    return dragEnabled;
+  }
+
+  /**
+   * Set the <code>dragEnabled</code> property.
+   *
+   * @param enabled new value
+   * 
+   * @since 1.4
+   */
+  public void setDragEnabled(boolean enabled)
+  {
+    dragEnabled = enabled;
+  }
+
+  /**
+   * Returns the layout orientation.
+   *
+   * @return the orientation, one of <code>JList.VERTICAL</code>,
+   * </code>JList.VERTICAL_WRAP</code> and <code>JList.HORIZONTAL_WRAP</code>
+   *
+   * @since 1.4
+   */
+  public int getLayoutOrientation()
+  {
+    return layoutOrientation;
+  }
+
+  /**
+   * Sets the layout orientation.
+   *
+   * @param orientation the orientation to set, one of <code>JList.VERTICAL</code>,
+   * </code>JList.VERTICAL_WRAP</code> and <code>JList.HORIZONTAL_WRAP</code>
+   *
+   * @since 1.4
+   */
+  public void setLayoutOrientation(int orientation)
+  {
+    if (layoutOrientation == orientation)
+      return;
+
+    int old = layoutOrientation;
+    layoutOrientation = orientation;
+    firePropertyChange("layoutOrientation", old, orientation);
+  }
 }
index 812c26b..d9ad317 100644 (file)
@@ -1,5 +1,5 @@
 /* JMenu.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -59,11 +59,9 @@ import javax.swing.event.MenuListener;
 import javax.swing.plaf.MenuItemUI;
 
 /**
- * <p>
  * This class represents a menu that can be added to a menu bar or
  * can be a submenu in some other menu. When JMenu is selected it
  * displays JPopupMenu containing its menu items.
- * </p>
  *
  * <p>
  * JMenu's fires MenuEvents when this menu's selection changes. If this menu
@@ -71,14 +69,10 @@ import javax.swing.plaf.MenuItemUI;
  * deselected or cancelled, then fireMenuDeselectedEvent() or 
  * fireMenuCancelledEvent() is invoked, respectivelly.
  * </p>
- *
  */
 public class JMenu extends JMenuItem implements Accessible, MenuElement
 {
-  static final long serialVersionUID = 4227225638931828014L;
-
-  /** name for the UI delegate for this menu. */
-  private static final String uiClassID = "MenuUI";
+  private static final long serialVersionUID = 4227225638931828014L;
 
   /** A Popup menu associated with this menu, which pops up when menu is selected */
   private JPopupMenu popupMenu = new JPopupMenu();
@@ -107,30 +101,32 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
   }
 
   /**
-   * Creates a new JMenu with the spicified label
+   * Creates a new <code>JMenu</code> with the specified label.
    *
    * @param text label for this menu
    */
   public JMenu(String text)
   {
     super(text);
+    popupMenu.setInvoker(this);
   }
 
   /**
-   * Creates a new JMenu object
+   * Creates a new <code>JMenu</code> object.
    *
-   * @param action Action that  is used to create menu item tha will be
+   * @param action Action that is used to create menu item tha will be
    * added to the menu.
    */
   public JMenu(Action action)
   {
     super(action);
     createActionChangeListener(this);
+    popupMenu.setInvoker(this);
   }
 
   /**
-   * Creates a new JMenu with specified label and an option
-   * for this menu to be tear-off menu
+   * Creates a new <code>JMenu</code> with specified label and an option
+   * for this menu to be tear-off menu.
    *
    * @param text label for this menu
    * @param tearoff true if this menu should be tear-off and false otherwise
@@ -273,7 +269,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
       throw new IllegalArgumentException("index less than zero");
 
     popupMenu.insert(item, index);
-
     return item;
   }
 
@@ -312,7 +307,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
    */
   public String getUIClassID()
   {
-    return uiClassID;
+    return "MenuUI";
   }
 
   /**
@@ -347,7 +342,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
     // display popup associated with this menu 
     if (selected)
       {
-    super.setArmed(true);
+       super.setArmed(true);
        super.setSelected(true);
 
        // FIXME: The popup menu should be shown on the screen after certain
@@ -355,7 +350,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
        // this amount of seconds. 'delay' property is 0 by default.
        if (this.isShowing())
          {
-    fireMenuSelected();
+           fireMenuSelected();
 
            int x = 0;
            int y = 0;
@@ -388,8 +383,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
   /**
    * Checks if PopupMenu associated with this menu is visible
    *
-   * @return true if the popup associated with this menu is currently visible on the screen and
-   * false otherwise.
+   * @return true if the popup associated with this menu is currently visible
+   * on the screen and false otherwise.
    */
   public boolean isPopupMenuVisible()
   {
@@ -528,15 +523,15 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
   }
 
   /**
-   * Returns number of items in the menu
+   * Returns number of items in the menu including separators.
    *
    * @return number of items in the menu
+   *
+   * @see #getMenuComponentCount()
    */
   public int getItemCount()
   {
-    // returns the number of items on 
-    // the menu, including separators.
-    return getComponents().length;
+    return getMenuComponentCount();
   }
 
   /**
@@ -592,10 +587,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
    */
   public boolean isTopLevelMenu()
   {
-    if (getParent() instanceof JMenuBar)
-      return true;
-    else
-      return false;
+    return getParent() instanceof JMenuBar;
   }
 
   /**
@@ -790,7 +782,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
    */
   protected String paramString()
   {
-    return "JMenu";
+    return super.paramString();
   }
 
   public AccessibleContext getAccessibleContext()
index 904ba3b..e14c262 100644 (file)
@@ -1,5 +1,5 @@
-/* JMenuBar.java -- 
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+/* JMenuBar.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -49,7 +49,6 @@ import javax.accessibility.AccessibleContext;
 import javax.swing.plaf.MenuBarUI;
 
 /**
- * <p>
  * JMenuBar is a container for menu's. For a menu bar to be seen on the
  * screen, at least one menu should be added to it. Just like adding
  * components to container, one can use add() to add menu's to the menu bar.
@@ -57,18 +56,9 @@ import javax.swing.plaf.MenuBarUI;
  * The JMenuBar uses selectionModel to keep track of selected menu index.
  * JMenuBar's selectionModel will fire ChangeEvents to its registered 
  * listeners when the selected index changes.
- * </p>
  */
 public class JMenuBar extends JComponent implements Accessible, MenuElement
 {
-  /** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
-  public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
-
-  /** Fired in a PropertyChangeEvent when the "model" changes. */
-  public static final String MODEL_CHANGED_PROPERTY = "model";
-  
-  /** Fired in a PropertyChangeEvent when the "margin" changes. */
-  public static final String MARGIN_CHANGED_PROPERTY = "margin";
   private static final long serialVersionUID = -8191026883931977036L;
 
   /** JMenuBar's model. It keeps track of selected menu's index */
@@ -294,7 +284,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
    * This method does nothing by default. This method is need for the
    * MenuElement interface to be implemented.
    *
-   * @param isIncluded true if menuBar is included in the selection 
+   * @param isIncluded true if menuBar is included in the selection
    * and false otherwise
    */
   public void menuSelectionChanged(boolean isIncluded)
@@ -303,7 +293,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
   }
 
   /**
-   * Paints border of the menu bar, if its borderPainted property is set to 
+   * Paints border of the menu bar, if its borderPainted property is set to
    * true.
    *
    * @param g The graphics context with which to paint the border
@@ -323,7 +313,13 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
    */
   protected String paramString()
   {
-    return "JMenuBar";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(getMargin());
+    sb.append(",paintBorder=").append(isBorderPainted());
+    return sb.toString();
   }
 
   /**
@@ -374,11 +370,11 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
    */
   public void setBorderPainted(boolean b)
   {
-    boolean old = borderPainted;
-    borderPainted = b;
-    if (b != old)
+    if (b != borderPainted)
       {
-       firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
+       boolean old = borderPainted;
+       borderPainted = b;
+       firePropertyChange("borderPainted", old, b);
        revalidate();
        repaint();
       }
@@ -404,14 +400,12 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
    */
   public void setMargin(Insets m)
   {
-    if (m.equals(this.margin))
+    if (m != margin)
       {
-       Insets oldMargin = this.margin;
-       this.margin = m;
-       firePropertyChange(MARGIN_CHANGED_PROPERTY, oldMargin, margin);
+       Insets oldMargin = margin;
+       margin = m;
+       firePropertyChange("margin", oldMargin, margin);
       }
-
-    this.margin = m;
   }
 
   /**
@@ -434,15 +428,11 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
    */
   public void setSelectionModel(SingleSelectionModel model)
   {
-    selectionModel = model;
     if (selectionModel != model)
       {
        SingleSelectionModel oldModel = selectionModel;
-
        selectionModel = model;
-
-       firePropertyChange(MODEL_CHANGED_PROPERTY, oldModel,
-                          this.selectionModel);
+       firePropertyChange("model", oldModel, selectionModel);
       }
   }
 
index 0aaf0c7..0ea38e0 100644 (file)
@@ -1,5 +1,5 @@
 /* JMenuItem.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -60,9 +60,7 @@ import javax.swing.event.MenuKeyEvent;
 import javax.swing.event.MenuKeyListener;
 import javax.swing.plaf.MenuItemUI;
 
-
 /**
- * <p>
  * JMenuItem represents element in the menu. It inherits most of
  * its functionality from AbstractButton, however its behavior somewhat
  * varies from it. JMenuItem fire different kinds of events.
@@ -71,16 +69,12 @@ import javax.swing.plaf.MenuItemUI;
  * fired when menu item is selected. In addition to this events menuItem also
  * fire MenuDragMouseEvent and MenuKeyEvents when mouse is dragged over
  * the menu item or associated key with menu item is invoked respectively.
- * </p>
  */
 public class JMenuItem extends AbstractButton implements Accessible,
                                                          MenuElement
 {
   private static final long serialVersionUID = -1681004643499461044L;
 
-  /** name for the UI delegate for this menuItem. */
-  private static final String uiClassID = "MenuItemUI";
-
   /** Combination of keyboard keys that can be used to activate this menu item */
   private KeyStroke accelerator;
 
@@ -212,7 +206,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
    */
   public String getUIClassID()
   {
-    return uiClassID;
+    return "MenuItemUI";
   }
 
   /**
@@ -325,11 +319,11 @@ public class JMenuItem extends AbstractButton implements Accessible,
        break;
       case MouseEvent.MOUSE_ENTERED:
        if (isRolloverEnabled())
-             model.setRollover(true);
+         model.setRollover(true);
        break;
       case MouseEvent.MOUSE_EXITED:
        if (isRolloverEnabled())
-             model.setRollover(false);
+         model.setRollover(false);
 
        // for JMenu last element on the path is its popupMenu.
        // JMenu shouldn't me disarmed. 
@@ -532,14 +526,14 @@ public class JMenuItem extends AbstractButton implements Accessible,
     Component parent = this.getParent();
     if (changed)
       {
-      model.setArmed(true);
+       model.setArmed(true);
 
        if (parent != null && parent instanceof JPopupMenu)
          ((JPopupMenu) parent).setSelected(this);
       }
     else
       {
-      model.setArmed(false);
+       model.setArmed(false);
 
        if (parent != null && parent instanceof JPopupMenu)
          ((JPopupMenu) parent).getSelectionModel().clearSelection();
@@ -551,7 +545,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
    *
    * @return $MenuElement[]$ Returns array of sub-components for this menu
    *         item. By default menuItem doesn't have any subcomponents and so
-   *             empty array is returned instead.
+   *         empty array is returned instead.
    */
   public MenuElement[] getSubElements()
   {
@@ -644,7 +638,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
    */
   protected String paramString()
   {
-    return "JMenuItem";
+    return super.paramString();
   }
 
   public AccessibleContext getAccessibleContext()
index 2623682..0a00729 100644 (file)
@@ -64,7 +64,7 @@ public class JOptionPane extends JComponent implements Accessible
   {
     /** DOCUMENT ME! */
     private static final long serialVersionUID = 686071432213084821L;
-  
+
     /**
      * Creates a new AccessibleJOptionPane object.
      */
@@ -85,7 +85,7 @@ public class JOptionPane extends JComponent implements Accessible
 
   /** DOCUMENT ME! */
   private static final long serialVersionUID = 5231143276678566796L;
-  
+
   /** The value returned when cancel option is selected. */
   public static final int CANCEL_OPTION = 2;
 
index 133c99a..449aa82 100644 (file)
@@ -47,9 +47,10 @@ import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 
 /**
- * JPasswordField
- * @author     Andrew Selkirk
- * @version    1.0
+ * class JPasswordField
+ * 
+ * @author Andrew Selkirk
+ * @version 1.0
  */
 public class JPasswordField extends JTextField
 {
@@ -69,6 +70,7 @@ public class JPasswordField extends JTextField
 
     /**
      * getAccessibleRole
+     * 
      * @return AccessibleRole
      */
     public AccessibleRole getAccessibleRole()
@@ -83,7 +85,7 @@ public class JPasswordField extends JTextField
   private char echoChar = 0;
 
   /**
-   * Constructor JPasswordField
+   * Creates a <code>JPasswordField</code> object.
    */
   public JPasswordField()
   {
@@ -240,7 +242,7 @@ public class JPasswordField extends JTextField
    */
   public char[] getPassword()
   {
-    return null; // TODO
+    return new char[0]; // TODO
   }
 
   /**
index 76f6362..00998b8 100644 (file)
@@ -1,5 +1,5 @@
-/* JPopupMenu.java
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* JPopupMenu.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,7 +41,6 @@ package javax.swing;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Dimension;
-import java.awt.Graphics;
 import java.awt.GridBagConstraints;
 import java.awt.Insets;
 import java.awt.Panel;
@@ -53,6 +52,7 @@ import java.beans.PropertyChangeListener;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.util.ArrayList;
 import java.util.EventListener;
 
 import javax.accessibility.Accessible;
@@ -92,12 +92,6 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
 {
   private static final long serialVersionUID = -8336996630009646009L;
 
-  /** name for the UI delegate for this menuItem. */
-  private static final String uiClassID = "PopupMenuUI";
-
-  /** Fire a PropertyChangeEvent when the "borderPainted" property changes. */
-  public static final String LABEL_CHANGED_PROPERTY = "label";
-
   /* indicates if popup's menu border should be painted*/
   private boolean borderPainted = true;
 
@@ -142,19 +136,12 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
   /* Field indicating if popup menu is visible or not */
   private boolean visible = false;
   
-  /* Bound Property indicating visibility of the popup menu*/
-  public static final String VISIBLE_CHANGED_PROPERTY = "visible";
-
   /**
    * Creates a new JPopupMenu object.
    */
   public JPopupMenu()
   {
-    updateUI();
-
-    lightWeightPopupEnabled = DefaultLightWeightPopupEnabled;
-    selectionModel = new DefaultSingleSelectionModel();
-    super.setVisible(false);
+    this(null);
   }
 
   /**
@@ -164,7 +151,11 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
    */
   public JPopupMenu(String label)
   {
+    lightWeightPopupEnabled = getDefaultLightWeightPopupEnabled();
     setLabel(label);
+    setSelectionModel(new DefaultSingleSelectionModel());
+    super.setVisible(false);
+    updateUI();
   }
 
   private void readObject(ObjectInputStream stream)
@@ -177,12 +168,12 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
   }
 
   /**
-   * Adds given menu item to the popup menu
-   *
-   * @param item menu item to add to the popup menu
-   *
-   * @return menu item that was added to the popup menu
-   */
+  * Adds given menu item to the popup menu
+  *
+  * @param item menu item to add to the popup menu
+  *
+  * @return menu item that was added to the popup menu
+  */
   public JMenuItem add(JMenuItem item)
   {
     this.insert(item, -1);
@@ -291,18 +282,6 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
   }
 
   /**
-   * Paints popup menu's border if borderPainted is true
-   *
-   * @param graphics graphics context used to paint this popup's menu border.
-   */
-  protected void borderPainted(Graphics graphics)
-  {
-    if (borderPainted)
-      getBorder().paintBorder(this, graphics, 0, 0, getSize(null).width,
-                              getSize(null).height);
-  }
-
-  /**
    * Returns flag indicating if newly created JPopupMenu will use
    * heavyweight or lightweight container to display its menu items
    *
@@ -386,10 +365,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
    */
   public void setSelectionModel(SingleSelectionModel model)
   {
-    if (selectionModel != model)
-      {
-       SingleSelectionModel oldModel = this.selectionModel;
-      }
+       selectionModel = model;
   }
 
   /**
@@ -452,7 +428,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
   /**
    * Sets label for this popup menu. This method fires PropertyChangeEvent
    * when the label property is changed. Please note that most
-   * of the Look & Feel will ignore this property.
+   * of the Look &amp; Feel will ignore this property.
    *
    * @param label label for this popup menu
    */
@@ -461,8 +437,8 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
     if (label != this.label)
       {
        String oldLabel = this.label;
-    this.label = label;
-       firePropertyChange(LABEL_CHANGED_PROPERTY, oldLabel, label);
+       this.label = label;
+       firePropertyChange("label", oldLabel, label);
       }
   }
 
@@ -574,11 +550,14 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
    */
   public void setVisible(boolean visible)
   {
+    if (visible == isVisible())
+      return;
+
     boolean old = isVisible();
     this.visible = visible;
     if (old != isVisible())
       {
-       firePropertyChange(VISIBLE_CHANGED_PROPERTY, old, (boolean) isVisible());
+       firePropertyChange("visible", old, isVisible());
        if (visible)
          {
            firePopupMenuWillBecomeVisible();
@@ -619,11 +598,11 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
              {
                // Subtract insets of the top-level container if popup menu's
                // top-left corner is inside it.
-                   Insets insets = rootContainer.getInsets();
-                   popup.show(popupLocation.x - insets.left,
-                              popupLocation.y - insets.top, size.width,
-                              size.height);
-                 }
+               Insets insets = rootContainer.getInsets();
+               popup.show(popupLocation.x - insets.left,
+                          popupLocation.y - insets.top, size.width,
+                          size.height);
+             }
          }
        else
          {
@@ -791,7 +770,17 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
    */
   protected String paramString()
   {
-    return "JPopupMenu";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",label=");
+    if (getLabel() != null)
+      sb.append(getLabel());
+    sb.append(",lightWeightPopupEnabled=").append(isLightWeightPopupEnabled());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(margin);
+    sb.append(",paintBorder=").append(isBorderPainted());
+    return sb.toString();
   }
 
   /**
@@ -839,19 +828,22 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
   }
 
   /**
-   * Return subcomonents of this popup menu.
+   * Return subcomonents of this popup menu. This method returns only
+   * components that implement the <code>MenuElement</code> interface.
    *
-   * @return Array containing menuItem's of belonging to this popup menu.
+   * @return array of menu items belonging to this popup menu
    */
   public MenuElement[] getSubElements()
   {
     Component[] items = getComponents();
-    MenuElement[] subElements = new MenuElement[items.length];
+    ArrayList subElements = new ArrayList();
 
     for (int i = 0; i < items.length; i++)
-      subElements[i] = (MenuElement) items[i];
+      if (items[i] instanceof MenuElement)
+       subElements.add(items[i]);
 
-    return subElements;
+    return (MenuElement[])
+      subElements.toArray(new MenuElement[subElements.size()]);
   }
 
   /**
@@ -1038,14 +1030,6 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
       this.setBounds(x, y, width, height);
       this.show();
     }
-
-    /**
-     * Hides JWindow with menu item's from the screen.
-     */
-    public void hide()
-    {
-      super.hide();
-    }
   }
 
   /**
index 3c40847..cf93349 100644 (file)
@@ -1,5 +1,5 @@
 /* JProgressBar.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.Graphics;
@@ -48,14 +49,11 @@ import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.plaf.ProgressBarUI;
 
-
 /**
- * <p>
  * The ProgressBar is a widget that displays in two modes. In 
  * determinate mode, it displays fills a percentage of its bar
  * based on its current value. In indeterminate mode, it creates
  * box and bounces it between its bounds.
- * </p>
  *
  * <p>
  * JProgressBars have the following properties:
@@ -171,21 +169,6 @@ public class JProgressBar extends JComponent implements SwingConstants,
 
   private static final long serialVersionUID = 1980046021813598781L;
   
-  /** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
-  public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
-  
-  /** Fired in a PropertyChangeEvent when the "orientation" property changes. */
-  public static final String ORIENTATION_CHANGED_PROPERTY = "orientation";
-  
-  /** Fired in a PropertyChangeEvent when the "string" property changes. */
-  public static final String STRING_CHANGED_PROPERTY = "string";
-  
-  /** Fired in a PropertyChangeEvent when the "stringPainted" property changes. */
-  public static final String STRING_PAINTED_CHANGED_PROPERTY = "stringPainted";
-  
-  /** Fired in a PropertyChangeEvent when the "indeterminate" property changes. */
-  public static final String INDETERMINATE_CHANGED_PROPERTY = "indeterminate";
-
   /** Whether the ProgressBar is determinate. */
   private transient boolean indeterminate = false;
 
@@ -331,7 +314,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
       {
        int oldOrientation = this.orientation;
        this.orientation = orientation;
-       firePropertyChange(ORIENTATION_CHANGED_PROPERTY, oldOrientation,
+       firePropertyChange("orientation", oldOrientation,
                           this.orientation);
       }
   }
@@ -357,7 +340,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
       {
        boolean oldPainted = paintString;
        paintString = painted;
-       firePropertyChange(STRING_PAINTED_CHANGED_PROPERTY, oldPainted,
+       firePropertyChange("stringPainted", oldPainted,
                           paintString);
       }
   }
@@ -394,7 +377,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
       {
        String oldString = progressString;
        progressString = string;
-       firePropertyChange(STRING_CHANGED_PROPERTY, oldString, progressString);
+       firePropertyChange("string", oldString, progressString);
       }
   }
 
@@ -435,7 +418,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
       {
        boolean oldPainted = paintBorder;
        paintBorder = painted;
-       firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, oldPainted,
+       firePropertyChange("borderPainted", oldPainted,
                           paintBorder);
       }
   }
@@ -641,7 +624,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
       {
        boolean olddeter = indeterminate;
        indeterminate = newValue;
-       firePropertyChange(INDETERMINATE_CHANGED_PROPERTY, olddeter,
+       firePropertyChange("indeterminate", olddeter,
                           indeterminate);
       }
   }
index 4f067c9..1457507 100644 (file)
@@ -100,7 +100,7 @@ public class JRootPane extends JComponent
     protected RootLayout()
     {
     }
-    
+
     /**
      * DOCUMENT ME!
      *
@@ -230,8 +230,8 @@ public class JRootPane extends JComponent
            {
              glassPane.setBounds(0, 0, containerSize.width,
                                  containerSize.height);
-           contentPane.setBounds(0, 0, containerSize.width,
-                                 containerSize.height);
+             contentPane.setBounds(0, 0, containerSize.width,
+                                   containerSize.height);
            }
 
          layeredPane.setSize(containerSize.width, containerSize.height);
@@ -333,6 +333,11 @@ public class JRootPane extends JComponent
   protected Container contentPane;
 
   protected JButton defaultButton;
+
+  /**
+   * @since 1.4
+   */
+  private int windowDecorationStyle = NONE;
   
   /**
    * DOCUMENT ME!
@@ -341,8 +346,20 @@ public class JRootPane extends JComponent
    */
   public void setJMenuBar(JMenuBar m)
   {
+    JLayeredPane jlPane = getLayeredPane();
+    if (menuBar != null)
+      jlPane.remove(menuBar);
     menuBar = m;
-    getLayeredPane().add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
+    if (menuBar != null)
+      jlPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
+  }
+
+  /**
+   * @deprecated Replaced by <code>setJMenuBar()</code>
+   */
+  public void setMenuBar(JMenuBar m)
+  {
+    setJMenuBar(m);
   }
 
   /**
@@ -356,6 +373,14 @@ public class JRootPane extends JComponent
   }
 
   /**
+   * @deprecated Replaced by <code>getJMenuBar()</code>
+   */
+  public JMenuBar getMenuBar()
+  {
+    return getJMenuBar();
+  }
+
+  /**
    * DOCUMENT ME!
    *
    * @return DOCUMENT ME!
@@ -569,4 +594,32 @@ public class JRootPane extends JComponent
     defaultButton = newButton;
     firePropertyChange("defaultButton", oldButton, newButton);
   }
+
+  /**
+   * @since 1.4
+   */
+  public int getWindowDecorationStyle()
+  {
+    return windowDecorationStyle;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public void setWindowDecorationStyle(int style)
+  {
+    if (style != NONE
+       && style != FRAME
+       && style != INFORMATION_DIALOG
+       && style != ERROR_DIALOG
+       && style != COLOR_CHOOSER_DIALOG
+       && style != FILE_CHOOSER_DIALOG
+       && style != QUESTION_DIALOG
+       && style != WARNING_DIALOG)
+      throw new IllegalArgumentException("invalid style");
+    
+    int oldStyle = windowDecorationStyle;
+    windowDecorationStyle = style;
+    firePropertyChange("windowDecorationStyle", oldStyle, style);
+  }
 }
index b755c6f..0ed7679 100644 (file)
@@ -1,5 +1,5 @@
 /* JScrollBar.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.Adjustable;
@@ -47,11 +48,8 @@ import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleStateSet;
 import javax.accessibility.AccessibleValue;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 import javax.swing.plaf.ScrollBarUI;
 
-
 /**
  * The JScrollBar. Two buttons control how the values that the 
  * scroll bar can take. You can also drag the thumb or click the track
@@ -154,18 +152,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
 
   private static final long serialVersionUID = -8195169869225066566L;
   
-  /** Fired in a PropertyChangeEvent when the "blockIncrement" changes. */
-  public static final String BLOCK_INCREMENT_CHANGED_PROPERTY = "blockIncrement";
-
-  /** Fired in a PropertyChangeEvent when the "model" changes. */
-  public static final String MODEL_CHANGED_PROPERTY = "model";
-
-  /** Fired in a PropertyChangeEvent when the "orientation" changes. */
-  public static final String ORIENTATION_CHANGED_PROPERTY = "orientation";
-
-  /** Fired in a PropertyChangeEvent when the "unitIncrement" changes. */
-  public static final String UNIT_INCREMENT_CHANGED_PROPERTY = "unitIncrement";
-
   /** How much the thumb moves when moving in a block. */
   protected int blockIncrement = 10;
 
@@ -178,12 +164,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
   /** How much the thumb moves when moving in a unit. */
   protected int unitIncrement = 1;
 
-  /** The ChangeListener that listens to the model. */
-  private transient ChangeListener changeListener;
-
-  /** The ChangeEvent that's fired. */
-  private transient ChangeEvent changeEvent;
-
   /** 
    * Creates a new horizontal JScrollBar object with a minimum
    * of 0, a maxmium of 100, a value of 0 and an extent of 10.
@@ -223,8 +203,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
       throw new IllegalArgumentException(orientation
                                          + " is not a legal orientation");
     this.orientation = orientation;
-    changeListener = createChangeListener();
-    model.addChangeListener(changeListener);
     updateUI();
   }
 
@@ -297,7 +275,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
       {
        int oldOrientation = this.orientation;
        this.orientation = orientation;
-       firePropertyChange(ORIENTATION_CHANGED_PROPERTY, oldOrientation,
+       firePropertyChange("orientation", oldOrientation,
                           this.orientation);
       }
   }
@@ -325,9 +303,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
       {
        BoundedRangeModel oldModel = model;
        model = newModel;
-       oldModel.removeChangeListener(changeListener);
-       model.addChangeListener(changeListener);
-       firePropertyChange(MODEL_CHANGED_PROPERTY, oldModel, model);
+       firePropertyChange("model", oldModel, model);
       }
   }
 
@@ -356,7 +332,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
       {
        int oldInc = this.unitIncrement;
        this.unitIncrement = unitIncrement;
-       firePropertyChange(UNIT_INCREMENT_CHANGED_PROPERTY, oldInc,
+       firePropertyChange("unitIncrement", oldInc,
                           this.unitIncrement);
       }
   }
@@ -386,7 +362,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
       {
        int oldInc = this.blockIncrement;
        this.blockIncrement = blockIncrement;
-       firePropertyChange(BLOCK_INCREMENT_CHANGED_PROPERTY, oldInc,
+       firePropertyChange("blockIncrement", oldInc,
                           this.blockIncrement);
       }
   }
@@ -558,70 +534,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
   }
 
   /**
-   * This method creates a new ChangeListener.
-   *
-   * @return A new ChangeListener.
-   */
-  private ChangeListener createChangeListener()
-  {
-    return new ChangeListener()
-      {
-       public void stateChanged(ChangeEvent e)
-       {
-         fireStateChanged();
-       }
-      };
-  }
-
-  /**
-   * This method is called whenever the model fires a ChangeEvent. It should
-   * propagate the ChangeEvent to its listeners with a new ChangeEvent that
-   * identifies the scroll bar as the source.
-   */
-  private void fireStateChanged()
-  {
-    Object[] changeListeners = listenerList.getListenerList();
-    if (changeEvent == null)
-      changeEvent = new ChangeEvent(this);
-    for (int i = changeListeners.length - 2; i >= 0; i -= 2)
-      {
-       if (changeListeners[i] == ChangeListener.class)
-         ((ChangeListener) changeListeners[i + 1]).stateChanged(changeEvent);
-      }
-  }
-
-  /**
-   * This method adds a ChangeListener to the scroll bar.
-   *
-   * @param listener The listener to add.
-   */
-  public void addChangeListener(ChangeListener listener)
-  {
-    listenerList.add(ChangeListener.class, listener);
-  }
-
-  /**
-   * This method removes a ChangeListener from the scroll bar.
-   *
-   * @param listener The listener to remove.
-   */
-  public void removeChangeListener(ChangeListener listener)
-  {
-    listenerList.remove(ChangeListener.class, listener);
-  }
-
-  /**
-   * This method returns an array of all ChangeListeners listening to this
-   * scroll bar.
-   *
-   * @return An array of ChangeListeners listening to this scroll bar.
-   */
-  public ChangeListener[] getChangeListeners()
-  {
-    return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
-  }
-
-  /**
    * This method adds an AdjustmentListener to the scroll bar.
    *
    * @param listener The listener to add.
index 01131b7..dfe5a76 100644 (file)
@@ -1,5 +1,5 @@
 /* JScrollPane.java -- 
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -99,18 +99,6 @@ public class JScrollPane
   boolean wheelScrollingEnabled;
   ChangeListener scrollListener;  
 
-  public static final String COLUMN_HEADER_CHANGED_PROPERTY = "columnHeader";
-  public static final String COMPONENT_ORIENTATION_CHANGED_PROPERTY = "componentOrientation";
-  public static final String HORIZONTAL_SCROLLBAR_CHANGED_PROPERTY = "horizontalScrollBar";
-  public static final String HORIZONTAL_SCROLLBAR_POLICY_CHANGED_PROPERTY = "horizontalScrollBarPolicy";
-  public static final String LAYOUT_CHANGED_PROPERTY = "layout";
-  public static final String ROW_HEADER_CHANGED_PROPERTY = "rowHeader";
-  public static final String VERTICAL_SCROLLBAR_CHANGED_PROPERTY = "verticalScrollBar";
-  public static final String VERTICAL_SCROLLBAR_POLICY_CHANGED_PROPERTY = "verticalScrollBarPolicy";
-  public static final String VIEWPORT_CHANGED_PROPERTY = "viewport";
-  public static final String VIEWPORT_BORDER_CHANGED_PROPERTY = "viewportBorder";
-  public static final String WHEEL_SCROLLING_ENABLED_CHANGED_PROPERTY = "wheelScrollingEnabled";
-
   public JViewport getColumnHeader()
   {
     return columnHeader;
@@ -247,17 +235,20 @@ public class JScrollPane
   {
     ComponentOrientation old = super.getComponentOrientation();
     super.setComponentOrientation(co);
-    firePropertyChange(COMPONENT_ORIENTATION_CHANGED_PROPERTY, old, co);
+    firePropertyChange("componentOrientation", old, co);
     sync();
   }
 
   public void setColumnHeader(JViewport h)
   {
+    if (columnHeader == h)
+      return;
+    
     JViewport old = columnHeader;
     removeNonNull(old);
     columnHeader = h;
     addNonNull(h);
-    firePropertyChange(COLUMN_HEADER_CHANGED_PROPERTY, old, h);
+    firePropertyChange("columnHeader", old, h);
     sync();
   }
 
@@ -327,11 +318,14 @@ public class JScrollPane
 
   public void setHorizontalScrollBar(JScrollBar h)
   {
+    if (horizontalScrollBar == h)
+      return;
+
     JScrollBar old = horizontalScrollBar;
     removeNonNull(old);
     horizontalScrollBar = h;
     addNonNull(h);
-    firePropertyChange(HORIZONTAL_SCROLLBAR_CHANGED_PROPERTY, old, h);
+    firePropertyChange("horizontalScrollBar", old, h);
     sync();
 
     if (old != null)
@@ -349,14 +343,18 @@ public class JScrollPane
   }
 
   public void setHorizontalScrollBarPolicy(int h)
-  {    
+  {
+    if (horizontalScrollBarPolicy == h)
+      return;
+    
     if (h != HORIZONTAL_SCROLLBAR_AS_NEEDED
         && h != HORIZONTAL_SCROLLBAR_NEVER
         && h != HORIZONTAL_SCROLLBAR_ALWAYS)
       throw new IllegalArgumentException("unknown horizontal scrollbar policy");    
+
     int old = horizontalScrollBarPolicy;
     horizontalScrollBarPolicy = h;
-    firePropertyChange(HORIZONTAL_SCROLLBAR_POLICY_CHANGED_PROPERTY, old, h);
+    firePropertyChange("horizontalScrollBarPolicy", old, h);
     sync();
   }
 
@@ -366,17 +364,20 @@ public class JScrollPane
     ScrollPaneLayout tmp = (ScrollPaneLayout) l;
     super.setLayout(l);
     tmp.syncWithScrollPane(this);
-    firePropertyChange(LAYOUT_CHANGED_PROPERTY, old, l);
+    firePropertyChange("layout", old, l);
     sync();
   }
 
   public void setRowHeader(JViewport v)
   {
+    if (rowHeader == v)
+      return;
+    
     JViewport old = rowHeader;
     removeNonNull(old);
     rowHeader = v;
     addNonNull(v);
-    firePropertyChange(ROW_HEADER_CHANGED_PROPERTY, old, v);
+    firePropertyChange("rowHeader", old, v);
     sync();
   }
 
@@ -390,11 +391,14 @@ public class JScrollPane
 
   public void setVerticalScrollBar(JScrollBar v)
   {
+    if (verticalScrollBar == v)
+      return;
+    
     JScrollBar old = verticalScrollBar;
     removeNonNull(old);
     verticalScrollBar = v;
     addNonNull(v);
-    firePropertyChange(VERTICAL_SCROLLBAR_CHANGED_PROPERTY, old, v);
+    firePropertyChange("verticalScrollBar", old, v);
     sync();
 
     if (old != null)
@@ -413,26 +417,36 @@ public class JScrollPane
 
   public void setVerticalScrollBarPolicy(int v)
   {
+    if (verticalScrollBarPolicy == v)
+      return;
+    
     if (v != VERTICAL_SCROLLBAR_AS_NEEDED
         && v != VERTICAL_SCROLLBAR_NEVER
         && v != VERTICAL_SCROLLBAR_ALWAYS)
       throw new IllegalArgumentException("unknown vertical scrollbar policy");    
+    
     int old = verticalScrollBarPolicy;
     verticalScrollBarPolicy = v;
-    firePropertyChange(VERTICAL_SCROLLBAR_POLICY_CHANGED_PROPERTY, old, v);
+    firePropertyChange("verticalScrollBarPolicy", old, v);
     sync();
   }
 
   public void setWheelScrollingEnabled(boolean b)
   {
+    if (wheelScrollingEnabled == b)
+      return;
+    
     boolean old = wheelScrollingEnabled;
     wheelScrollingEnabled = b;
-    firePropertyChange(WHEEL_SCROLLING_ENABLED_CHANGED_PROPERTY, old, b);
+    firePropertyChange("wheelScrollingEnabled", old, b);
     sync();
   }
 
   public void setViewport(JViewport v)
   {
+    if (viewport == v)
+      return;
+    
     JViewport old = viewport;
     removeNonNull(old);
     if (old != null)
@@ -443,15 +457,18 @@ public class JScrollPane
     addNonNull(v);
     revalidate();
     repaint();
-    firePropertyChange(VIEWPORT_CHANGED_PROPERTY, old, v);
+    firePropertyChange("viewport", old, v);
     sync();
   }
 
   public void setViewportBorder(Border b)
   {
+    if (viewportBorder == b)
+      return;
+    
     Border old = viewportBorder;
     viewportBorder = b;
-    firePropertyChange(VIEWPORT_BORDER_CHANGED_PROPERTY, old, b);
+    firePropertyChange("viewportBorder", old, b);
     sync();
   }
     
@@ -588,7 +605,7 @@ public class JScrollPane
     return new ScrollBar(SwingConstants.VERTICAL);
   }
     
-  public JViewport createViewport()
+  protected JViewport createViewport()
   {
     return new JViewport();
   }
@@ -624,7 +641,7 @@ public class JScrollPane
     super.setUI(ui);
   }
 
-  class ScrollBar 
+  protected class ScrollBar 
     extends JScrollBar
     implements UIResource
   {
@@ -660,8 +677,5 @@ public class JScrollPane
                                               direction);
         }
     }
-
-
   }
-  
 }
index 0bc013c..cfe7880 100644 (file)
@@ -1,5 +1,5 @@
 /* JSlider.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.Dimension;
@@ -54,14 +55,11 @@ import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.plaf.SliderUI;
 
-
 /**
- * <p>
  * The JSlider is a Swing component that allows selection of a value within a
  * range by adjusting a thumb in a track. The values for the minimum,
  * maximum, extent and value are stored in a {@link
  * DefaultBoundedRangeModel}.
- * </p>
  * 
  * <p>
  * JSliders have the following properties:
@@ -114,7 +112,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
                                                    MenuContainer, Serializable
 {
   /** DOCUMENT ME! */
-  static final long serialVersionUID = -1441275936141218479L;
+  private static final long serialVersionUID = -1441275936141218479L;
 
   /**
    * DOCUMENT ME!
@@ -206,36 +204,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
     }
   }
 
-  /** Fired in a PropertyChangeEvent when the "inverted" property changes. */
-  public static final String INVERTED_CHANGED_PROPERTY = "inverted";
-
-  /** Fired in a PropertyChangeEvent when the "labelTable" property changes. */
-  public static final String LABEL_TABLE_CHANGED_PROPERTY = "labelTable";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "majorTickSpacing" property
-   * changes.
-   */
-  public static final String MAJOR_TICK_SPACING_CHANGED_PROPERTY = "majorTickSpacing";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "minorTickSpacing" property
-   * changes.
-   */
-  public static final String MINOR_TICK_SPACING_CHANGED_PROPERTY = "minorTickSpacing";
-
-  /** Fired in a PropertyChangeEvent when the "model" property changes. */
-  public static final String MODEL_CHANGED_PROPERTY = "model";
-
-  /** Fired in a PropertyChangeEvent when the "orientation" property changes. */
-  public static final String ORIENTATION_CHANGED_PROPERTY = "orientation";
-
-  /** Fired in a PropertyChangeEvent when the "paintLabels" property changes. */
-  public static final String PAINT_LABELS_CHANGED_PROPERTY = "paintLabels";
-
-  /** Fired in a PropertyChangeEvent when the "paintTicks" property changes. */
-  public static final String PAINT_TICKS_CHANGED_PROPERTY = "paintTicks";
-  
   /** Whether or not this slider paints its ticks. */
   private transient boolean paintTicks = false;
 
@@ -515,7 +483,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
        sliderModel = model;
        oldModel.removeChangeListener(changeListener);
        sliderModel.addChangeListener(changeListener);
-       firePropertyChange(MODEL_CHANGED_PROPERTY, oldModel, sliderModel);
+       firePropertyChange("model", oldModel, sliderModel);
       }
   }
 
@@ -624,7 +592,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        int oldOrientation = this.orientation;
        this.orientation = orientation;
-       firePropertyChange(ORIENTATION_CHANGED_PROPERTY, oldOrientation,
+       firePropertyChange("orientation", oldOrientation,
                           this.orientation);
       }
   }
@@ -650,7 +618,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        Dictionary oldTable = labelTable;
        labelTable = table;
-       firePropertyChange(LABEL_TABLE_CHANGED_PROPERTY, oldTable, labelTable);
+       firePropertyChange("labelTable", oldTable, labelTable);
       }
   }
 
@@ -751,7 +719,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        boolean oldInverted = isInverted;
        isInverted = inverted;
-       firePropertyChange(INVERTED_CHANGED_PROPERTY, oldInverted, isInverted);
+       firePropertyChange("inverted", oldInverted, isInverted);
       }
   }
 
@@ -777,7 +745,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        int oldSpacing = majorTickSpacing;
        majorTickSpacing = spacing;
-       firePropertyChange(MAJOR_TICK_SPACING_CHANGED_PROPERTY, oldSpacing,
+       firePropertyChange("majorTickSpacing", oldSpacing,
                           majorTickSpacing);
       }
   }
@@ -804,7 +772,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        int oldSpacing = minorTickSpacing;
        minorTickSpacing = spacing;
-       firePropertyChange(MINOR_TICK_SPACING_CHANGED_PROPERTY, oldSpacing,
+       firePropertyChange("minorTickSpacing", oldSpacing,
                           minorTickSpacing);
       }
   }
@@ -864,8 +832,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        boolean oldPaintTicks = paintTicks;
        paintTicks = paint;
-       firePropertyChange(PAINT_TICKS_CHANGED_PROPERTY, oldPaintTicks,
-                          paintTicks);
+       firePropertyChange("paintTicks", oldPaintTicks, paintTicks);
       }
   }
 
@@ -910,8 +877,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
       {
        boolean oldPaintLabels = paintLabels;
        paintLabels = paint;
-       firePropertyChange(PAINT_LABELS_CHANGED_PROPERTY, oldPaintLabels,
-                          paintLabels);
+       firePropertyChange("paintLabels", oldPaintLabels, paintLabels);
       }
   }
 
index 271c511..fbf2bbf 100644 (file)
@@ -1,5 +1,5 @@
 /* JSpinner.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -50,7 +50,6 @@ import java.text.ParseException;
 import javax.swing.border.EtchedBorder;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
-import javax.swing.event.EventListenerList;
 import javax.swing.plaf.SpinnerUI;
 
 
@@ -59,7 +58,8 @@ import javax.swing.plaf.SpinnerUI;
  * way to manipulate the value.
  *
  * @author Ka-Hing Cheung
- * @version 1.0
+ * 
+ * @since 1.4
  */
 public class JSpinner extends JComponent
 {
@@ -286,9 +286,6 @@ public class JSpinner extends JComponent
   private JComponent editor;
 
   /** DOCUMENT ME! */
-  private EventListenerList listenerList = new EventListenerList();
-
-  /** DOCUMENT ME! */
   private ChangeListener listener = new ChangeListener()
     {
       public void stateChanged(ChangeEvent evt)
index 25733df..748ee21 100644 (file)
@@ -1,5 +1,5 @@
 /* JTabbedPane.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -56,10 +56,8 @@ import javax.swing.plaf.TabbedPaneUI;
 import javax.swing.plaf.UIResource;
 
 /**
- * <p>
  * This is a container for components. One component is displayed at a time.
  * Users can switch between components by clicking on tabs.
- * </p>
  * 
  * <p>
  * Tabs can be oriented in several ways. They can be above, below, left and
@@ -520,32 +518,18 @@ public class JTabbedPane extends JComponent implements Serializable,
      *         or equal to title.length.
      */
     public void setDisplayedMnemonicIndex(int index)
-                                   throws IllegalArgumentException
+      throws IllegalArgumentException
     {
       if (index < -1 || title != null && index >= title.length())
        throw new IllegalArgumentException();
 
-      if (title == null || title.charAt(index) != mnemonicKey)
+      if (title == null || mnemonicKey == 0 || title.charAt(index) != mnemonicKey)
        index = -1;
 
       underlinedChar = index;
     }
   }
 
-  /** Fired in a PropertyChangeEvent when the "model" property changes. */
-  public static final String MODEL_CHANGED_PROPERTY = "model";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "tabPlacement" property changes.
-   */
-  public static final String TAB_PLACEMENT_CHANGED_PROPERTY = "tabPlacement";
-
-  /**
-   * Fired in a PropertyChangeEvent when the "tabLayoutPolicy" property
-   * changes.
-   */
-  public static final String TAB_LAYOUT_POLICY_CHANGED_PROPERTY = "tabLayoutPolicy";
-
   /** The changeEvent used to fire changes to listeners. */
   protected ChangeEvent changeEvent;
 
@@ -739,7 +723,7 @@ public class JTabbedPane extends JComponent implements Serializable,
        this.model.removeChangeListener(changeListener);
        this.model = model;
        this.model.addChangeListener(changeListener);
-       firePropertyChange(MODEL_CHANGED_PROPERTY, oldModel, this.model);
+       firePropertyChange("model", oldModel, this.model);
       }
   }
 
@@ -770,8 +754,7 @@ public class JTabbedPane extends JComponent implements Serializable,
       {
        int oldPlacement = this.tabPlacement;
        this.tabPlacement = tabPlacement;
-       firePropertyChange(TAB_PLACEMENT_CHANGED_PROPERTY, oldPlacement,
-                          this.tabPlacement);
+       firePropertyChange("tabPlacement", oldPlacement, this.tabPlacement);
       }
   }
 
@@ -802,8 +785,7 @@ public class JTabbedPane extends JComponent implements Serializable,
       {
        int oldPolicy = layoutPolicy;
        layoutPolicy = tabLayoutPolicy;
-       firePropertyChange(TAB_LAYOUT_POLICY_CHANGED_PROPERTY, oldPolicy,
-                          layoutPolicy);
+       firePropertyChange("tabLayoutPolicy", oldPolicy, layoutPolicy);
       }
   }
 
index ae2c4af..ca38aa0 100644 (file)
@@ -1,5 +1,5 @@
 /* JTable.java -- 
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,9 +41,10 @@ package javax.swing;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Dimension;
+import java.awt.Point;
 import java.awt.Rectangle;
-import java.util.Vector;
 import java.util.Hashtable;
+import java.util.Vector;
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
@@ -113,14 +114,35 @@ public class JTable extends JComponent
   /**
    * A table mapping {@link java.lang.Class} objects to 
    * {@link TableCellEditor} objects. This table is consulted by the 
-   * 
+   * FIXME
    */
   protected Hashtable defaultEditorsByColumnClass;
+
+  /**
+   * A table mapping {@link java.lang.Class} objects to 
+   * {@link TableCellEditor} objects. This table is consulted by the 
+   * FIXME
+   */
   protected Hashtable defaultRenderersByColumnClass;
+
+  /**
+   * The column that is edited, -1 if the table is not edited currently.
+   */
   protected int editingColumn;
+
+  /**
+   * The row that is edited, -1 if the table is not edited currently.
+   */
   protected int editingRow;
 
   /**
+   * The component that is used for editing.
+   * <code>null</code> if the table is not editing currently.
+   *
+   */
+  protected transient Component editorComp;
+
+  /**
    * Whether or not the table should automatically compute a matching
    * {@link TableColumnModel} and assign it to the {@link #columnModel}
    * property when the {@link #dataModel} property is changed. 
@@ -163,8 +185,8 @@ public class JTable extends JComponent
    * 
    * @see #setRowMargin()
    * @see #getRowHeight()
-   * @see #getInterCellSpacing()
-   * @see #setInterCellSpacing()
+   * @see #getIntercellSpacing()
+   * @see #setIntercellSpacing()
    * @see TableColumnModel#getColumnMargin()
    * @see TableColumnModel#setColumnMargin()
    */
@@ -257,7 +279,7 @@ public class JTable extends JComponent
    * @see #setDragEnabled()
    * @see #getDragEnabled()
    */
-  protected boolean dragEnabled;
+  private boolean dragEnabled;
 
   /**
    * The color to paint the grid lines of the table, when either {@link
@@ -275,7 +297,7 @@ public class JTable extends JComponent
    * @see #setPreferredScrollableViewportSize()
    * @see #getPreferredScrollableViewportSize()
    */
-  protected Dimension preferredScrollableViewportSize;
+  protected Dimension preferredViewportSize;
 
   /**
    * The color to paint the background of selected cells. Fires a property
@@ -285,7 +307,7 @@ public class JTable extends JComponent
    * @see #setSelectionBackground()
    * @see #getSelectionBackground()
    */
-  Color selectionBackground;
+  protected Color selectionBackground;
 
   /**
    * The name carried in property change events when the {@link
@@ -301,7 +323,7 @@ public class JTable extends JComponent
    * @see #setSelectionForeground()
    * @see #getSelectionForeground()
    */
-  Color selectionForeground;
+  protected Color selectionForeground;
 
   /**
    * The name carried in property change events when the
@@ -386,11 +408,17 @@ public class JTable extends JComponent
   public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm)
   {
     this.dataModel = dm == null ? createDefaultDataModel() : dm;
-    setSelectionModel(sm == null ? createDefaultListSelectionModel() : sm);
+    setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);
 
     this.columnModel = cm;
+    initializeLocalVars();
+    updateUI();
+  }    
+
+  protected void initializeLocalVars()
+  {
     this.autoCreateColumnsFromModel = false;
-    if (cm == null)
+    if (columnModel == null)
       {
         this.autoCreateColumnsFromModel = true;
         createColumnsFromModel();
@@ -398,7 +426,10 @@ public class JTable extends JComponent
     this.columnModel.addColumnModelListener(this);
     
     this.defaultRenderersByColumnClass = new Hashtable();
+    createDefaultRenderers();
+
     this.defaultEditorsByColumnClass = new Hashtable();
+    createDefaultEditors();
 
     this.autoResizeMode = AUTO_RESIZE_ALL_COLUMNS;
     this.rowHeight = 16;
@@ -407,12 +438,13 @@ public class JTable extends JComponent
     // this.accessibleContext = new AccessibleJTable();
     this.cellEditor = null;
     this.dragEnabled = false;
-    this.preferredScrollableViewportSize = new Dimension(450,400);
+    this.preferredViewportSize = new Dimension(450,400);
     this.showHorizontalLines = true;
     this.showVerticalLines = true;
-    setInterCellSpacing(new Dimension(1,1));
-    setTableHeader(new JTableHeader(columnModel));
-    updateUI();
+    this.editingColumn = -1;
+    this.editingRow = -1;
+    setIntercellSpacing(new Dimension(1,1));
+    setTableHeader(createDefaultTableHeader());
   }
 
   /**
@@ -426,6 +458,27 @@ public class JTable extends JComponent
     this(new DefaultTableModel(data, columnNames));
   }
 
+  public void addColumn(TableColumn column)
+  {
+    if (column.getHeaderValue() == null)
+      {
+       String name = getColumnName(column.getModelIndex());
+       column.setHeaderValue(name);
+      }
+    
+    columnModel.addColumn(column);
+  }
+
+  protected void createDefaultEditors()
+  {
+    //FIXME: Create the editor object.
+  }
+
+  protected void createDefaultRenderers()
+  {
+    //FIXME: Create the renderer object.
+  }
+  
   /**
    * @deprecated 1.0.2, replaced by <code>new JScrollPane(JTable)</code>
    */
@@ -433,7 +486,7 @@ public class JTable extends JComponent
   {
     return new JScrollPane(table);
   }
+
   protected TableColumnModel createDefaultColumnModel()
   {
     return new DefaultTableColumnModel();
@@ -444,11 +497,16 @@ public class JTable extends JComponent
     return new DefaultTableModel();
   }
 
-  protected ListSelectionModel createDefaultListSelectionModel()
+  protected ListSelectionModel createDefaultSelectionModel()
   {
     return new DefaultListSelectionModel();
   }
 
+  protected JTableHeader createDefaultTableHeader()
+  {
+    return new JTableHeader(columnModel);
+  }
   private void createColumnsFromModel()
   {
     if (dataModel == null)
@@ -514,6 +572,58 @@ public class JTable extends JComponent
     repaint();
   }
 
+ /**
+   * Returns index of the column that contains specified point 
+   * or -1 if this table doesn't contain this point.
+   *
+   * @param point point to identify the column
+   * @return index of the column that contains specified point or 
+   * -1 if this table doesn't contain this point.
+   */
+  public int columnAtPoint(Point point)
+  {
+    int x0 = getLocation().x;
+    int ncols = getColumnCount();
+    Dimension gap = getIntercellSpacing();
+    TableColumnModel cols = getColumnModel();
+    int x = point.x;
+    
+    for (int i = 0; i < ncols; ++i)
+      {
+        int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : gap.width);
+        if (0 <= x && x < width)
+          return i;
+        x -= width;  
+      }
+    
+    return -1;
+  }
+
+  /**
+   * Returns index of the row that contains specified point or 
+   * -1 if this table doesn't contain this point.
+   *
+   * @param point point to identify the row
+   * @return index of the row that contains specified point or 
+   * -1 if this table doesn't contain this point.
+   */
+  public int rowAtPoint(Point point)
+  {
+    int y0 = getLocation().y;
+    int nrows = getRowCount();
+    Dimension gap = getIntercellSpacing();
+    int height = getRowHeight() + (gap == null ? 0 : gap.height);
+    int y = point.y;
+    
+    for (int i = 0; i < nrows; ++i)
+      {
+        if (0 <= y && y < height)
+          return i;
+        y -= height;
+      }
+      
+    return -1;
+  }
 
   /** 
    * Calculate the visible rectangle for a particular row and column. The
@@ -656,6 +766,7 @@ public class JTable extends JComponent
       return (TableCellEditor) defaultEditorsByColumnClass.get(columnClass);
     else
       {
+       // FIXME: We have at least an editor for Object.class in our defaults.
         TableCellEditor r = new DefaultCellEditor(new JTextField());
         defaultEditorsByColumnClass.put(columnClass, r);
         return r;
@@ -729,7 +840,7 @@ public class JTable extends JComponent
     
     return renderer.getTableCellRendererComponent(this,
                                                   dataModel.getValueAt(row, 
-                                                                       convertColumnIndexToView(column)),
+                                                                      convertColumnIndexToModel(column)),
                                                   isSelected,
                                                   false, // hasFocus
                                                   row, column);
@@ -808,13 +919,13 @@ public class JTable extends JComponent
 
   /**
    * Get the value of the {@link #columnCount} property by
-   * delegation to the @{link #dataModel} field.
+   * delegation to the @{link #columnModel} field.
    *
    * @return The current value of the columnCount property
    */
   public int getColumnCount()
   {
-    return dataModel.getColumnCount();
+    return columnModel.getColumnCount();    
   }
 
   /**
@@ -863,11 +974,11 @@ public class JTable extends JComponent
             break;
             
           case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
-            sum = hi - lo;
+            sum = hi - lo + 1;
             break;
             
           case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:        
-            for (int i = lo; i < hi; ++i)
+            for (int i = lo; i <= hi; ++i)
               if (lsm.isSelectedIndex(i))        
                 ++sum;
             break;
@@ -894,12 +1005,12 @@ public class JTable extends JComponent
             break;      
       
           case ListSelectionModel.SINGLE_INTERVAL_SELECTION:            
-            for (int i = lo; i < hi; ++i)
+            for (int i = lo; i <= hi; ++i)
               ret[j++] = i;
             break;
             
           case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:        
-            for (int i = lo; i < hi; ++i)
+            for (int i = lo; i <= hi; ++i)
               if (lsm.isSelectedIndex(i))        
                 ret[j++] = i;
             break;
@@ -1003,23 +1114,23 @@ public class JTable extends JComponent
   }
 
   /**
-   * Get the value of the {@link #interCellSpacing} property.
+   * Get the value of the {@link #intercellSpacing} property.
    *
    * @return The current value of the property
    */
-  public Dimension getInterCellSpacing()
+  public Dimension getIntercellSpacing()
   {
     return new Dimension(columnModel.getColumnMargin(), rowMargin);
   }
 
   /**
-   * Get the value of the {@link #preferredScrollableViewportSize} property.
+   * Get the value of the {@link #preferredViewportSize} property.
    *
    * @return The current value of the property
    */
   public Dimension getPreferredScrollableViewportSize()
   {
-    return preferredScrollableViewportSize;
+    return preferredViewportSize;
   }
 
   /**
@@ -1073,6 +1184,27 @@ public class JTable extends JComponent
   }
 
   /**
+   * Removes specified column from displayable columns of this table.
+   *
+   * @param column column to removed
+   */
+  public void removeColumn(TableColumn column)
+  {    
+    columnModel.removeColumn(column);
+  }
+
+  /**
+   * Moves column at the specified index to new given location.
+   *
+   * @param column index of the column to move
+   * @param targetColumn index specifying new location of the column
+   */ 
+  public void moveColumn(int column,int targetColumn) 
+  {
+    columnModel.moveColumn(column, targetColumn);
+  }
+
+  /**
    * Set the value of the {@link #autoCreateColumnsFromModel} property.
    *
    * @param a The new value of the autoCreateColumnsFromModel property
@@ -1101,6 +1233,9 @@ public class JTable extends JComponent
    */ 
   public void setRowHeight(int r)
   {
+    if (rowHeight < 1)
+      throw new IllegalArgumentException();
+    
     rowHeight = r;
     revalidate();
     repaint();
@@ -1246,13 +1381,16 @@ public class JTable extends JComponent
 
   /**
    * Set the value of the {@link #selectionMode} property by
-   * delegation to the {@link #selectionModel} field.
+   * delegation to the {@link #selectionModel} field. The same selection
+   * mode is set for row and column selection models.
    *
    * @param s The new value of the property
    */ 
   public void setSelectionMode(int s)
-  {
-    selectionModel.setSelectionMode(s);
+  { 
+    selectionModel.setSelectionMode(s);    
+    columnModel.getSelectionModel().setSelectionMode(s);
+    
     repaint();
   }
 
@@ -1297,11 +1435,11 @@ public class JTable extends JComponent
   }
 
   /**
-   * Set the value of the {@link #interCellSpacing} property.
+   * Set the value of the {@link #intercellSpacing} property.
    *
-   * @param i The new value of the interCellSpacing property
+   * @param i The new value of the intercellSpacing property
    */ 
-  public void setInterCellSpacing(Dimension i)
+  public void setIntercellSpacing(Dimension i)
   {
     rowMargin = i.height;
     columnModel.setColumnMargin(i.width);
@@ -1309,13 +1447,13 @@ public class JTable extends JComponent
   }
 
   /**
-   * Set the value of the {@link #preferredScrollableViewportSize} property.
+   * Set the value of the {@link #preferredViewportSize} property.
    *
-   * @param p The new value of the preferredScrollableViewportSize property
+   * @param p The new value of the preferredViewportSize property
    */ 
   public void setPreferredScrollableViewportSize(Dimension p)
   {
-    preferredScrollableViewportSize = p;
+    preferredViewportSize = p;
     revalidate();
     repaint();
   }
@@ -1551,11 +1689,17 @@ public class JTable extends JComponent
       }
   }
   
+  /**
+   * @deprecated Replaced by <code>doLayout()</code>
+   */
   public void sizeColumnsToFit(boolean lastColumnOnly)
   {
     doLayout();
   }
 
+  /**
+   * Obsolete since JDK 1.4. Please use <code>doLayout()</code>.
+   */
   public void sizeColumnsToFit(int resizingColumn)
   {
     doLayout();
@@ -1593,4 +1737,141 @@ public class JTable extends JComponent
     repaint();
   }
 
+  public Class getColumnClass(int column)
+  {
+    return dataModel.getColumnClass(column);
+  }
+  
+  public String getColumnName(int column)
+  {
+    return dataModel.getColumnName(column);
+  }
+
+  public int getEditingColumn()
+  {
+    return editingColumn;
+  }
+
+  public void setEditingColumn(int column)
+  {
+    editingColumn = column;
+  }
+  
+  public int getEditingRow()
+  {
+    return editingRow;
+  }
+
+  public void setEditingRow(int column)
+  {
+    editingRow = column;
+  }
+  
+  public Component getEditorComponent()
+  {
+    return editorComp;
+  }
+  
+  public boolean isEditing()
+  {
+    return editorComp != null;
+  }
+
+  public void setDefaultEditor(Class columnClass, TableCellEditor editor)
+  {
+    if (editor != null)
+      defaultEditorsByColumnClass.put(columnClass, editor);
+    else
+      defaultEditorsByColumnClass.remove(columnClass);
+  }
+
+  public void addColumnSelectionInterval(int index0, int index1)
+  {
+    if ((index0 < 0 || index0 > (getColumnCount()-1)
+         || index1 < 0 || index1 > (getColumnCount()-1)))
+      throw new IllegalArgumentException("Column index out of range.");
+    
+    getColumnModel().getSelectionModel().addSelectionInterval(index0, index1);
+  }
+  
+  public void addRowSelectionInterval(int index0, int index1)
+  {            
+    if ((index0 < 0 || index0 > (getRowCount()-1)
+         || index1 < 0 || index1 > (getRowCount()-1)))
+      throw new IllegalArgumentException("Row index out of range.");
+       
+    getSelectionModel().addSelectionInterval(index0, index1);
+  }
+  
+  public void setColumnSelectionInterval(int index0, int index1)
+  {
+    if ((index0 < 0 || index0 > (getColumnCount()-1)
+         || index1 < 0 || index1 > (getColumnCount()-1)))
+      throw new IllegalArgumentException("Column index out of range.");
+
+    getColumnModel().getSelectionModel().setSelectionInterval(index0, index1);
+  }
+  
+  public void setRowSelectionInterval(int index0, int index1)
+  {    
+    if ((index0 < 0 || index0 > (getRowCount()-1)
+         || index1 < 0 || index1 > (getRowCount()-1)))
+      throw new IllegalArgumentException("Row index out of range.");
+
+    getSelectionModel().setSelectionInterval(index0, index1);
+  }
+  
+  public void removeColumnSelectionInterval(int index0, int index1)  
+  {
+    if ((index0 < 0 || index0 > (getColumnCount()-1)
+         || index1 < 0 || index1 > (getColumnCount()-1)))
+      throw new IllegalArgumentException("Column index out of range.");
+
+    getColumnModel().getSelectionModel().removeSelectionInterval(index0, index1);
+  }
+  
+  public void removeRowSelectionInterval(int index0, int index1)
+  {
+    if ((index0 < 0 || index0 > (getRowCount()-1)
+         || index1 < 0 || index1 > (getRowCount()-1)))
+      throw new IllegalArgumentException("Row index out of range.");
+
+    getSelectionModel().removeSelectionInterval(index0, index1);
+  }
+  
+  public boolean isColumnSelected(int column)
+  {
+    return getColumnModel().getSelectionModel().isSelectedIndex(column);
+  }
+
+  public boolean isRowSelected(int row)
+  {
+    return getSelectionModel().isSelectedIndex(row);
+  }
+
+  public boolean isCellSelected(int row, int column)
+  {
+    return isRowSelected(row) && isColumnSelected(column);
+  }
+  
+  public void selectAll()
+  {
+    setColumnSelectionInterval(0, getColumnCount() - 1);
+    setRowSelectionInterval(0, getRowCount() - 1);
+  }
+
+  public Object getValueAt(int row, int column)
+  {
+    return dataModel.getValueAt(row, convertColumnIndexToModel(column));
+  }
+
+  public void setValueAt(Object value, int row, int column)
+  {
+    dataModel.setValueAt(value, row, convertColumnIndexToModel(column));
+  }
+
+  public TableColumn getColumn(Object identifier)
+  {
+    return columnModel.getColumn(columnModel.getColumnIndex(identifier));
+  }
 }
index 5fe104b..d87655b 100644 (file)
@@ -1,5 +1,5 @@
 /* JTextField.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.Dimension;
@@ -46,10 +47,11 @@ import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 
 import javax.accessibility.AccessibleStateSet;
+import javax.swing.Action;
 import javax.swing.text.Document;
 import javax.swing.text.JTextComponent;
 import javax.swing.text.PlainDocument;
-
+import javax.swing.text.TextAction;
 
 public class JTextField extends JTextComponent
   implements SwingConstants
@@ -80,12 +82,25 @@ public class JTextField extends JTextComponent
 
   private static final long serialVersionUID = 353853209832607592L;
 
+  private static final Action[] actions;
+
   public static final String notifyAction = "notify-field-accept";
   
+  static
+  {
+    actions = new Action[1];
+    actions[0] = new TextAction(notifyAction)
+      {
+       public void actionPerformed(ActionEvent event)
+       {
+         JTextField textField = (JTextField) event.getSource();
+         textField.fireActionPerformed();
+       }
+      };
+  }
+  
   private int columns;
-
   private int align;
-
   private int scrollOffset;
 
   /** @since 1.3 */
@@ -272,19 +287,10 @@ public class JTextField extends JTextComponent
 
   public Dimension getPreferredSize()
   {
-    Dimension size;
-    FontMetrics fm = getFontMetrics(getFont());
-    int fontHeight = fm.getMaxAscent() + fm.getMaxDescent();
-    int columnWidth = fm.charWidth('m');
-    
+    Dimension size = super.getPreferredSize();
+
     if (columns != 0)
-      {
-       size = new Dimension(columns * columnWidth + 4, fontHeight + 4);
-      }
-    else
-      {
-       size = new Dimension(10, 10);
-      }
+      size.width = columns * getColumnWidth();
 
     return size;
   }
@@ -309,9 +315,15 @@ public class JTextField extends JTextComponent
     scrollOffset = offset;
   }
 
+  public Action[] getActions()
+  {
+    return TextAction.augmentList(super.getActions(), actions);
+  }
+
   public void postActionEvent()
   {
-    ActionEvent event = new ActionEvent(this, 0, actionCommand);
+    String command = actionCommand != null ? actionCommand : getText();
+    ActionEvent event = new ActionEvent(this, 0, command);
     ActionListener[] listeners = getActionListeners();
 
     for (int index = 0; index < listeners.length; ++index)
@@ -358,17 +370,9 @@ public class JTextField extends JTextComponent
   /**
    * @since 1.3
    */
-  public String getActionCommand()
-  {
-    return actionCommand;
-  }
-
-  /**
-   * @since 1.3
-   */
   public void setActionCommand(String command)
   {
-    this.actionCommand = command;
+    actionCommand = command;
   }
 
   /**
index db8bb56..55f4c15 100644 (file)
@@ -1,5 +1,5 @@
 /* JToolBar.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -100,7 +100,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
     }
   }
 
-       /**
+  /**
    * This is the private JToolBar layout manager.
    */
   private class DefaultToolBarLayout implements LayoutManager
@@ -110,7 +110,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
      *
      * @param name The name of the component added.
      * @param comp The component that was added.
-        */
+     */
     public void addLayoutComponent(String name, Component comp)
     {
       // Do nothing.
@@ -142,7 +142,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
       Dimension tdims = c.getSize();
       int start = 0;
       Dimension pref;
-    
+
       if (getOrientation() == SwingUtilities.HORIZONTAL)
         {
          start += insets.left;
@@ -194,14 +194,14 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
       return preferredLayoutSize(parent);
     }
 
-               /**
+    /**
      * This method returns the preferred size of the given container given the
      * child components.
      *
      * @param parent The container to measure.
      *
      * @return The preferred size of the given container.
-                */
+     */
     public Dimension preferredLayoutSize(Container parent)
     {
       int orientation = getOrientation();
@@ -259,23 +259,23 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
       return new Dimension(w, h);
     }
 
-               /**
+    /**
      * This method is called when the given component  is removed from the
      * container.
      *
      * @param comp The component removed.
-                */
+     */
     public void removeLayoutComponent(Component comp)
     {
       // Do nothing.
     }
   }
 
-               /**
+  /**
    * This is an extension of JSeparator used in toolbars. Unlike JSeparator,
    * nothing is painted for this Separator, it is only blank space that
    * separates components.
-                */
+   */
   public static class Separator extends JSeparator
   {
     /** DOCUMENT ME! */
@@ -299,70 +299,70 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
       setPreferredSize(size);
     } // Separator()
 
-               /**
+    /**
      * This method returns the String ID of the UI class of  Separator.
      *
      * @return The UI class' String ID.
-                */
+     */
     public String getUIClassID()
     {
       return "ToolBarSeparatorUI";
-               } // getUIClassID()
+    } // getUIClassID()
 
-               /**
+    /**
      * This method returns the preferred size of the Separator.
      *
      * @return The preferred size of the Separator.
-                */
+     */
     public Dimension getPreferredSize()
     {
       return super.getPreferredSize();
-               } // getPreferredSize()
+    } // getPreferredSize()
 
-               /**
+    /**
      * This method returns the maximum size of the Separator.
      *
      * @return The maximum size of the Separator.
-                */
+     */
     public Dimension getMaximumSize()
     {
       return super.getPreferredSize();
-               } // getMaximumSize()
+    } // getMaximumSize()
 
-               /**
+    /**
      * This method returns the minimum size of the Separator.
      *
      * @return The minimum size of the Separator.
-                */
+     */
     public Dimension getMinimumSize()
     {
       return super.getPreferredSize();
-               } // getMinimumSize()
+    } // getMinimumSize()
 
-               /**
+    /**
      * This method returns the size of the Separator.
      *
      * @return The size of the Separator.
-                */
+     */
     public Dimension getSeparatorSize()
     {
       return super.getPreferredSize();
-               } // getSeparatorSize()
+    } // getSeparatorSize()
 
-               /**
+    /**
      * This method sets the size of the Separator.
      *
      * @param size The new size of the Separator.
-                */
+     */
     public void setSeparatorSize(Dimension size)
     {
       setPreferredSize(size);
-               } // setSeparatorSize()
-       } // Separator
+    } // setSeparatorSize()
+  } // Separator
 
   /** DOCUMENT ME! */
-    private static final long serialVersionUID = -1269915519555129643L;
-    
+  private static final long serialVersionUID = -1269915519555129643L;
+
   /** Whether the JToolBar paints its border. */
   private transient boolean paintBorder = true;
 
@@ -376,150 +376,135 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
   private transient boolean rollover;
 
   /** The orientation of the JToolBar. */
-       private int orientation = HORIZONTAL;
+  private int orientation = HORIZONTAL;
 
-  /** Fired in a PropertyChangeEvent when the orientation property changes. */
-       public static final String ORIENTATION_CHANGED_PROPERTY = "orientation";
-
-  /** Fired in a PropertyChangeEvent when the floatable property changes. */
-  public static final String FLOATABLE_CHANGED_PROPERTY = "floatable";
-
-  /** Fired in a PropertyChangeEvent when the borderPainted property changes. */
-  public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
-
-  /** Fired in a PropertyChangeEvent when the margin property changes. */
-  public static final String MARGIN_CHANGED_PROPERTY = "margin";
-
-  /** Fired in a PropertyChangeEvent when the rollover property changes. */
-  public static final String ROLLOVER_CHANGED_PROPERTY = "rollover";
-
-       /**
+  /**
    * This method creates a new JToolBar object with horizontal orientation
    * and no name.
-        */
+   */
   public JToolBar()
   {
     this(null, HORIZONTAL);
-       } // JToolBar()
+  } // JToolBar()
 
-       /**
+  /**
    * This method creates a new JToolBar with the given orientation and  no
    * name.
    *
-        * @param orientation JToolBar orientation (HORIZONTAL or VERTICAL)
-        */
+   * @param orientation JToolBar orientation (HORIZONTAL or VERTICAL)
+   */
   public JToolBar(int orientation)
   {
-          this(null, orientation);
-       } // JToolBar()
+    this(null, orientation);
+  } // JToolBar()
 
-       /**
+  /**
    * This method creates a new JToolBar object with the given name and
    * horizontal orientation.
    *
-        * @param name Name assigned to undocked tool bar.
-        */
+   * @param name Name assigned to undocked tool bar.
+   */
   public JToolBar(String name)
   {
-          this(name, HORIZONTAL);
-       } // JToolBar()
+    this(name, HORIZONTAL);
+  } // JToolBar()
 
-       /**
+  /**
    * This method creates a new JToolBar object with the given name and
    * orientation.
    *
-        * @param name Name assigned to undocked tool bar.
-        * @param orientation JToolBar orientation (HORIZONTAL or VERTICAL)
-        */
+   * @param name Name assigned to undocked tool bar.
+   * @param orientation JToolBar orientation (HORIZONTAL or VERTICAL)
+   */
   public JToolBar(String name, int orientation)
   {
-               setName(name);
+    setName(name);
     setOrientation(orientation);
     setLayout(new DefaultToolBarLayout());
     revalidate();
-                updateUI();    
-       } // JToolBar()
+    updateUI();
+  } // JToolBar()
 
-       /**
+  /**
    * This method adds a new JButton that performs the given Action to the
    * JToolBar.
    *
    * @param action The Action to add to the JToolBar.
    *
    * @return The JButton that wraps the Action.
-        */
+   */
   public JButton add(Action action)
   {
     JButton b = createActionComponent(action);
     add(b);
     return b;
-       } // add()
+  } // add()
 
-       /**
+  /**
    * This method paints the border if the borderPainted property is true.
    *
    * @param graphics The graphics object to paint with.
-        */
+   */
   protected void paintBorder(Graphics graphics)
   {
     if (paintBorder && isFloatable())
       super.paintBorder(graphics);
-       } // paintBorder()
+  } // paintBorder()
 
-       /**
+  /**
    * This method returns the UI class used to paint this JToolBar.
    *
    * @return The UI class for this JToolBar.
-        */
+   */
   public ToolBarUI getUI()
   {
-               return (ToolBarUI) ui;
-       } // getUI()
+    return (ToolBarUI) ui;
+  } // getUI()
 
-       /**
+  /**
    * This method sets the UI used with the JToolBar.
    *
    * @param ui The UI used with the JToolBar.
-        */
+   */
   public void setUI(ToolBarUI ui)
   {
-               super.setUI(ui);
-       } // setUI()
+    super.setUI(ui);
+  } // setUI()
 
-       /**
+  /**
    * This method resets the UI used to the Look and Feel defaults.
-        */
+   */
   public void updateUI()
   {
-          setUI((ToolBarUI)UIManager.getUI(this));
+    setUI((ToolBarUI) UIManager.getUI(this));
     revalidate();
     repaint();
-       } // updateUI()
+  } // updateUI()
 
-       /**
+  /**
    * This method returns the String identifier for the UI class to the used
    * with the JToolBar.
    *
    * @return The String identifier for the UI class.
-        */
+   */
   public String getUIClassID()
   {
     return "ToolBarUI";
-       } // getUIClassID()
+  } // getUIClassID()
 
-       /**
+  /**
    * This method sets the rollover property for the JToolBar. In rollover
    * mode, JButtons inside the JToolBar will only display their borders when
    * the mouse is moving over them.
    *
    * @param b The new rollover property.
-        */
+   */
   public void setRollover(boolean b)
   {
     if (b != rollover)
       {
        rollover = b;
-       firePropertyChange(ROLLOVER_CHANGED_PROPERTY, ! rollover, rollover);
+       firePropertyChange("rollover", ! rollover, rollover);
        revalidate();
        repaint();
       }
@@ -553,37 +538,37 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
        return i;
 
     return -1;
-       } // getComponentIndex()
+  } // getComponentIndex()
 
-       /**
+  /**
    * This method returns the component at the given index.
    *
    * @param index The index of the component.
    *
    * @return The component at the given index.
-        */
+   */
   public Component getComponentAtIndex(int index)
   {
     return getComponent(index);
-       } // getComponentAtIndex()
+  } // getComponentAtIndex()
 
-       /**
+  /**
    * This method returns the margin property.
    *
    * @return The margin property.
-        */
+   */
   public Insets getMargin()
   {
     return margin;
-       } // getMargin()
+  } // getMargin()
 
-       /**
+  /**
    * This method sets the margin property. The margin property determines the
    * extra space between the children components of the JToolBar and the
    * border.
    *
    * @param margin The margin property.
-        */
+   */
   public void setMargin(Insets margin)
   {
     if ((this.margin != null && margin == null)
@@ -595,142 +580,141 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
       {
        Insets oldMargin = this.margin;
        this.margin = margin;
-       firePropertyChange(MARGIN_CHANGED_PROPERTY, oldMargin, this.margin);
+       firePropertyChange("margin", oldMargin, this.margin);
        revalidate();
        repaint();
       }
-       } // setMargin()
+  } // setMargin()
 
-       /**
+  /**
    * This method returns the borderPainted property.
    *
    * @return The borderPainted property.
-        */
+   */
   public boolean isBorderPainted()
   {
     return paintBorder;
-       } // isBorderPainted()
+  } // isBorderPainted()
 
-       /**
+  /**
    * This method sets the borderPainted property. If set to false, the border
    * will not be painted.
    *
    * @param painted Whether the border will be painted.
-        */
+   */
   public void setBorderPainted(boolean painted)
   {
     if (painted != paintBorder)
       {
        paintBorder = painted;
-       firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, ! paintBorder,
+       firePropertyChange("borderPainted", ! paintBorder,
                           paintBorder);
        repaint();
       }
-       } // setBorderPainted()
+  } // setBorderPainted()
 
-       /**
+  /**
    * This method returns the floatable property.
    *
    * @return The floatable property.
-        */
+   */
   public boolean isFloatable()
   {
     return floatable;
-       } // isFloatable()
+  } // isFloatable()
 
-       /**
+  /**
    * This method sets the floatable property. If set to false, the JToolBar
    * cannot be dragged.
    *
    * @param floatable Whether the JToolBar can be dragged.
-        */
+   */
   public void setFloatable(boolean floatable)
   {
     if (floatable != this.floatable)
       {
        this.floatable = floatable;
-       firePropertyChange(FLOATABLE_CHANGED_PROPERTY, ! floatable, floatable);
+       firePropertyChange("floatable", ! floatable, floatable);
       }
-       } // setFloatable()
+  } // setFloatable()
 
-       /**
+  /**
    * This method returns the orientation of the JToolBar.
    *
    * @return The orientation of the JToolBar.
-        */
+   */
   public int getOrientation()
   {
     return orientation;
-       } // getOrientation()
+  } // getOrientation()
 
-       /**
+  /**
    * This method sets the layout manager to be used with the JToolBar.
    *
    * @param mgr The Layout Manager used with the JToolBar.
-        */
+   */
   public void setLayout(LayoutManager mgr)
   {
-           super.setLayout(mgr);
+    super.setLayout(mgr);
     revalidate();
     repaint();
-       } // setLayout()
+  } // setLayout()
 
-       /**
+  /**
    * This method sets the orientation property for JToolBar.
    *
    * @param orientation The new orientation for JToolBar.
    *
    * @throws IllegalArgumentException If the orientation is not HORIZONTAL or
    *         VERTICAL.
-        */
+   */
   public void setOrientation(int orientation)
   {
-               if (orientation != HORIZONTAL && orientation != VERTICAL)
+    if (orientation != HORIZONTAL && orientation != VERTICAL)
       throw new IllegalArgumentException(orientation
                                          + " is not a legal orientation");
-           if (orientation != this.orientation)
-           {
-               int oldOrientation = this.orientation;
-               this.orientation = orientation;
-               firePropertyChange(ORIENTATION_CHANGED_PROPERTY, oldOrientation,
-                       this.orientation);
+    if (orientation != this.orientation)
+      {
+       int oldOrientation = this.orientation;
+       this.orientation = orientation;
+       firePropertyChange("orientation", oldOrientation, this.orientation);
        revalidate();
        repaint();
-           }
-       } // setOrientation()
+      }
+  } // setOrientation()
 
-       /**
+  /**
    * This method adds a Separator of default size to the JToolBar.
-        */
+   */
   public void addSeparator()
   {
     add(new Separator());
-       } // addSeparator()
+  } // addSeparator()
 
-       /**
+  /**
    * This method adds a Separator with the given size to the JToolBar.
    *
    * @param size The size of the Separator.
-        */
+   */
   public void addSeparator(Dimension size)
   {
     add(new Separator(size));
-       } // addSeparator()
+  } // addSeparator()
 
-       /**
+  /**
    * This method is used to create JButtons which can be added to the JToolBar
    * for the given action.
    *
    * @param action The action to create a JButton for.
    *
    * @return The JButton created from the action.
-        */
+   */
   protected JButton createActionComponent(Action action)
   {
     return new JButton(action);
-       } // createActionComponent()
+  } // createActionComponent()
 
-       /**
+  /**
    * This method creates a pre-configured PropertyChangeListener which updates
    * the control as changes are made to the Action. However, this is no
    * longer the recommended way of adding Actions to Containers. As such,
@@ -739,36 +723,36 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
    * @param button The JButton to configure a PropertyChangeListener for.
    *
    * @return null.
-        */
+   */
   protected PropertyChangeListener createActionChangeListener(JButton button)
   {
     // XXX: As specified, this returns null. But seems kind of strange, usually deprecated methods don't just return null, verify!
     return null;
-       } // createActionChangeListener()
+  } // createActionChangeListener()
 
-       /**
+  /**
    * This method overrides Container's addImpl method. If a JButton is added,
    * it is disabled.
    *
    * @param component The Component to add.
    * @param constraints The Constraints placed on the component.
    * @param index The index to place the Component at.
-  */
+   */
   protected void addImpl(Component component, Object constraints, int index)
   {
     // XXX: Sun says disable button but test cases show otherwise.
     super.addImpl(component, constraints, index);
   } // addImpl()
 
-       /**
+  /**
    * This method returns a String description of the JToolBar.
    *
    * @return A String description of the JToolBar.
-        */
+   */
   protected String paramString()
   {
     return "JToolBar";
-       } // paramString()
+  } // paramString()
 
   /**
    * getAccessibleContext
@@ -779,7 +763,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
   {
     if (accessibleContext == null)
       accessibleContext = new AccessibleJToolBar();
-    
+
     return accessibleContext;
   }
 }
index 8d52257..353547c 100644 (file)
@@ -53,10 +53,10 @@ import javax.swing.event.TreeSelectionEvent;
 import javax.swing.event.TreeSelectionListener;
 import javax.swing.event.TreeWillExpandListener;
 import javax.swing.plaf.TreeUI;
-import javax.swing.tree.ExpandVetoException;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeCellRenderer;
 import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.ExpandVetoException;
 import javax.swing.tree.TreeCellEditor;
 import javax.swing.tree.TreeCellRenderer;
 import javax.swing.tree.TreeModel;
@@ -70,14 +70,11 @@ public class JTree extends JComponent
 {
   private static final long serialVersionUID = 7559816092864483649L;
 
-  public static final String ANCHOR_SELECTION_PATH_PROPERTY = "anchorSelectionPath";
   public static final String CELL_EDITOR_PROPERTY = "cellEditor";
   public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
   public static final String EDITABLE_PROPERTY = "editable";
-  public static final String EXPANDS_SELECTED_PATHS_PROPERTY = "expandsSelectedPaths";
   public static final String INVOKES_STOP_CELL_EDITING_PROPERTY = "invokesStopCellEditing";
   public static final String LARGE_MODEL_PROPERTY = "largeModel";
-  public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
   public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
   public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
   public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
@@ -87,18 +84,40 @@ public class JTree extends JComponent
   public static final String TREE_MODEL_PROPERTY = "model";
   public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
 
-  protected TreeCellEditor cellEditor;
-  protected TreeCellRenderer cellRenderer;
+  /** @since 1.3 */
+  public static final String ANCHOR_SELECTION_PATH_PROPERTY = "anchorSelectionPath";
+  /** @since 1.3 */
+  public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
+  /** @since 1.3 */
+  public static final String EXPANDS_SELECTED_PATHS_PROPERTY = "expandsSelectedPaths";
+
+  private static final Object EXPANDED = new Object();
+  private static final Object COLLAPSED = new Object();
+  
+  private boolean dragEnabled;
+  private boolean expandsSelectedPaths;
+  private TreePath anchorSelectionPath;
+  private TreePath leadSelectionPath;
+
+  /*
+   * This contains the state of all nodes in the tree. Al/ entries map the
+   * TreePath of a note to to its state. Valid states are EXPANDED and
+   * COLLAPSED.  Nodes not in this Hashtable are assumed state COLLAPSED.
+   */
+  private Hashtable nodeStates;
+
+  protected transient TreeCellEditor cellEditor;
+  protected transient TreeCellRenderer cellRenderer;
   protected boolean editable;
   protected boolean invokesStopCellEditing;
   protected boolean largeModel;
   protected boolean rootVisible;
   protected int rowHeight;
   protected boolean scrollsOnExpand;
-  protected TreeSelectionModel selectionModel;
+  protected transient TreeSelectionModel selectionModel;
   protected boolean showsRootHandles;
   protected int toggleClickCount;
-  protected TreeModel treeModel;
+  protected transient TreeModel treeModel;
   protected int visibleRowCount;
 
   /**
@@ -178,6 +197,13 @@ public class JTree extends JComponent
   {
     protected Object childValue;
     protected boolean loadedChildren;
+
+    /**
+     * Currently not set or used by this class.
+     * It might be set and used in later versions of this class.
+     */
+    protected boolean hasChildren;
+    
     public DynamicUtilTreeNode(Object value,
                                Object children) 
     {
@@ -247,6 +273,39 @@ public class JTree extends JComponent
     }
   }
 
+  public int getRowForPath(TreePath path)
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      return ui.getRowForPath(this, path);
+
+    return -1;
+  }
+  
+  public TreePath getPathForRow(int row)
+  {
+    TreeUI ui = getUI();
+    return ui != null ? ui.getPathForRow(this, row) : null;
+  }
+
+  protected TreePath[] getPathBetweenRows(int index0, int index1)
+  {
+    TreeUI ui = getUI();
+    
+    if (ui == null)
+      return null;
+    
+    int minIndex = Math.min(index0, index1);
+    int maxIndex = Math.max(index0, index1);
+    TreePath[] paths = new TreePath[maxIndex - minIndex + 1];
+    
+    for (int i = minIndex; i <= maxIndex; ++i)
+      paths[i - minIndex] = ui.getPathForRow(this, i);
+
+    return paths;
+  }
+  
   /**
    * Creates a new <code>TreeModel</code> object.
    *
@@ -517,7 +576,12 @@ public class JTree extends JComponent
    */
   public void setModel(TreeModel model)
   {
+    if (treeModel == model)
+      return;
+
+    TreeModel oldValue = treeModel;
     treeModel = model;
+    firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
   }
 
   /**
@@ -544,7 +608,7 @@ public class JTree extends JComponent
 
     boolean oldValue = editable;
     editable = flag;
-    firePropertyChange("editable", oldValue, editable);
+    firePropertyChange(EDITABLE_PROPERTY, oldValue, editable);
   }
 
   /**
@@ -560,7 +624,12 @@ public class JTree extends JComponent
 
   public void setRootVisible(boolean flag)
   {
+    if (rootVisible == flag)
+      return;
+    
+    boolean oldValue = rootVisible;
     rootVisible = flag;
+    firePropertyChange(ROOT_VISIBLE_PROPERTY, oldValue, flag);
   }
 
   public boolean getShowsRootHandles()
@@ -570,7 +639,12 @@ public class JTree extends JComponent
 
   public void setShowsRootHandles(boolean flag)
   {
+    if (showsRootHandles == flag)
+      return;
+
+    boolean oldValue = showsRootHandles;
     showsRootHandles = flag;
+    firePropertyChange(SHOWS_ROOT_HANDLES_PROPERTY, oldValue, flag);
   }
 
   public TreeCellEditor getCellEditor()
@@ -580,7 +654,12 @@ public class JTree extends JComponent
 
   public void setCellEditor(TreeCellEditor editor)
   {
+    if (cellEditor == editor)
+      return;
+
+    TreeCellEditor oldValue = cellEditor;
     cellEditor = editor;
+    firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
   }
   
   public TreeCellRenderer getCellRenderer()
@@ -590,7 +669,12 @@ public class JTree extends JComponent
   
   public void setCellRenderer(TreeCellRenderer newRenderer)
   {
+    if (cellRenderer == newRenderer)
+      return;
+
+    TreeCellRenderer oldValue = cellRenderer;
     cellRenderer = newRenderer;
+    firePropertyChange(CELL_RENDERER_PROPERTY, oldValue, newRenderer);
   }
 
   public TreeSelectionModel getSelectionModel()
@@ -600,7 +684,12 @@ public class JTree extends JComponent
 
   public void setSelectionModel(TreeSelectionModel model)
   {
+    if (selectionModel == model)
+      return;
+    
+    TreeSelectionModel oldValue = selectionModel;
     selectionModel = model;
+    firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model);
   }
 
   public int getVisibleRowCount()
@@ -610,7 +699,12 @@ public class JTree extends JComponent
 
   public void setVisibleRowCount(int rows)
   {
+    if (visibleRowCount == rows)
+      return;
+
+    int oldValue = visibleRowCount;
     visibleRowCount = rows;
+    firePropertyChange(VISIBLE_ROW_COUNT_PROPERTY, oldValue, rows);
   }
 
   public boolean isLargeModel()
@@ -620,7 +714,12 @@ public class JTree extends JComponent
 
   public void setLargeModel(boolean large)
   {
+    if (largeModel == large)
+      return;
+
+    boolean oldValue = largeModel;
     largeModel = large;
+    firePropertyChange(LARGE_MODEL_PROPERTY, oldValue, large);
   }
 
   public int getRowHeight()
@@ -630,7 +729,17 @@ public class JTree extends JComponent
 
   public void setRowHeight(int height)
   {
+    if (rowHeight == height)
+      return;
+    
+    int oldValue = rowHeight;
     rowHeight = height;
+    firePropertyChange(ROW_HEIGHT_PROPERTY, oldValue, height);
+  }
+
+  public boolean isFixedRowHeight()
+  {
+    return rowHeight > 0;
   }
 
   public boolean getInvokesStopCellEditing()
@@ -640,7 +749,12 @@ public class JTree extends JComponent
 
   public void setInvokesStopCellEditing(boolean invoke)
   {
+    if (invokesStopCellEditing == invoke)
+     return;
+
+    boolean oldValue = invokesStopCellEditing;
     invokesStopCellEditing = invoke;
+    firePropertyChange(INVOKES_STOP_CELL_EDITING_PROPERTY, oldValue, invoke);
   }
 
   /**
@@ -656,9 +770,32 @@ public class JTree extends JComponent
    */
   public void setToggleClickCount(int count)
   {
+    if (toggleClickCount == count)
+      return;
+    
+    int oldValue = toggleClickCount;
     toggleClickCount = count;
+    firePropertyChange(TOGGLE_CLICK_COUNT_PROPERTY, oldValue, count);
+  }
+
+  public void scrollPathToVisible(TreePath path)
+  {
+    if (path == null)
+      return;
+
+    Rectangle rect = getPathBounds(path);
+
+    if (rect == null)
+      return;
+
+    scrollRectToVisible(rect);
   }
 
+  public void scrollRowToVisible(int row)
+  {
+    scrollPathToVisible(getPathForRow(row));
+  }
+  
   public boolean getScrollsOnExpand()
   {
     return scrollsOnExpand;
@@ -666,6 +803,590 @@ public class JTree extends JComponent
 
   public void setScrollsOnExpand(boolean scroll)
   {
+    if (scrollsOnExpand == scroll)
+      return;
+
+    boolean oldValue = scrollsOnExpand;
     scrollsOnExpand = scroll;
+    firePropertyChange(SCROLLS_ON_EXPAND_PROPERTY, oldValue, scroll);
+  }
+
+  public void setSelectionPath(TreePath path)
+  {
+    selectionModel.setSelectionPath(path);
+  }
+
+  public void setSelectionPaths(TreePath[] paths)
+  {
+    selectionModel.setSelectionPaths(paths);
+  }
+  
+  public void setSelectionRow(int row)
+  {
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      selectionModel.setSelectionPath(path);
+  }
+
+  public void setSelectionRows(int[] rows)
+  {
+    // Make sure we have an UI so getPathForRow() does not return null.
+    if (rows == null || getUI() == null)
+      return;
+
+    TreePath[] paths = new TreePath[rows.length];
+
+    for (int i = rows.length - 1; i >= 0; --i)
+      paths[i] = getPathForRow(rows[i]);
+
+    setSelectionPaths(paths);
+  }
+
+  public void setSelectionInterval(int index0, int index1)
+  {
+    TreePath[] paths = getPathBetweenRows(index0, index1);
+
+    if (paths != null)
+      setSelectionPaths(paths);
+  }
+
+  public void addSelectionPath(TreePath path)
+  {
+    selectionModel.addSelectionPath(path);
+  }
+
+  public void addSelectionPaths(TreePath[] paths)
+  {
+    selectionModel.addSelectionPaths(paths);
+  }
+
+  public void addSelectionRow(int row)
+  {
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      selectionModel.addSelectionPath(path);
+  }
+
+  public void addSelectionRows(int[] rows)
+  {
+    // Make sure we have an UI so getPathForRow() does not return null.
+    if (rows == null || getUI() == null)
+      return;
+
+    TreePath[] paths = new TreePath[rows.length];
+
+    for (int i = rows.length - 1; i >= 0; --i)
+      paths[i] = getPathForRow(rows[i]);
+
+    addSelectionPaths(paths);
+  }
+
+  public void addSelectionInterval(int index0, int index1)
+  {
+    TreePath[] paths = getPathBetweenRows(index0, index1);
+
+    if (paths != null)
+      addSelectionPaths(paths);
+  }
+
+  public void removeSelectionPath(TreePath path)
+  {
+    selectionModel.removeSelectionPath(path);
+  }
+
+  public void removeSelectionPaths(TreePath[] paths)
+  {
+    selectionModel.removeSelectionPaths(paths);
+  }
+
+  public void removeSelectionRow(int row)
+  {
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      selectionModel.removeSelectionPath(path);
+  }
+
+  public void removeSelectionRows(int[] rows)
+  {
+    // Make sure we have an UI so getPathForRow() does not return null.
+    if (rows == null || getUI() == null)
+      return;
+
+    TreePath[] paths = new TreePath[rows.length];
+
+    for (int i = rows.length - 1; i >= 0; --i)
+      paths[i] = getPathForRow(rows[i]);
+
+    removeSelectionPaths(paths);
+  }
+
+  public void removeSelectionInterval(int index0, int index1)
+  {
+    TreePath[] paths = getPathBetweenRows(index0, index1);
+
+    if (paths != null)
+      removeSelectionPaths(paths);
+  }
+
+  public void clearSelection()
+  {
+    selectionModel.clearSelection();
+  }
+  
+  public TreePath getLeadSelectionPath()
+  {
+    return leadSelectionPath;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public void setLeadSelectionPath(TreePath path)
+  {
+    if (leadSelectionPath == path)
+      return;
+
+    TreePath oldValue = leadSelectionPath;
+    leadSelectionPath = path;
+    firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path);
+  }
+
+  /**
+   * @since 1.3
+   */
+  public TreePath getAnchorSelectionPath()
+  {
+    return anchorSelectionPath;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public void setAnchorSelectionPath(TreePath path)
+  {
+    if (anchorSelectionPath == path)
+      return;
+
+    TreePath oldValue = anchorSelectionPath;
+    anchorSelectionPath = path;
+    firePropertyChange(ANCHOR_SELECTION_PATH_PROPERTY, oldValue, path);
+  }
+
+  public int getLeadSelectionRow()
+  {
+    return selectionModel.getLeadSelectionRow();
+  }
+
+  public int getMaxSelectionRow()
+  {
+    return selectionModel.getMaxSelectionRow();
+  }
+
+  public int getMinSelectionRow()
+  {
+    return selectionModel.getMinSelectionRow();
+  }
+
+  public int getSelectionCount()
+  {
+    return selectionModel.getSelectionCount();
+  }
+
+  public TreePath getSelectionPath()
+  {
+    return selectionModel.getSelectionPath();
+  }
+
+  public TreePath[] getSelectionPaths()
+  {
+    return selectionModel.getSelectionPaths();
+  }
+
+  public int[] getSelectionRows()
+  {
+    return selectionModel.getSelectionRows();
+  }
+
+  public boolean isPathSelected(TreePath path)
+  {
+    return selectionModel.isPathSelected(path);
+  }
+
+  public boolean isRowSelected(int row)
+  {
+    return selectionModel.isRowSelected(row);
+  }
+
+  public boolean isSelectionEmpty()
+  {
+    return selectionModel.isSelectionEmpty();
+  }
+  
+  /**
+   * Return the value of the <code>dragEnabled</code> property.
+   *
+   * @return the value
+   * 
+   * @since 1.4
+   */
+  public boolean getDragEnabled()
+  {
+    return dragEnabled;
+  }
+
+  /**
+   * Set the <code>dragEnabled</code> property.
+   *
+   * @param enabled new value
+   * 
+   * @since 1.4
+   */
+  public void setDragEnabled(boolean enabled)
+  {
+    dragEnabled = enabled;
+  }
+
+  public int getRowCount()
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      return ui.getRowCount(this);
+    
+    return 0;
+  }
+  
+  public void collapsePath(TreePath path)
+  {
+    setExpandedState(path, false);
+  }
+  
+  public void collapseRow(int row)
+  {
+    if (row < 0 || row >= getRowCount())
+      return;
+
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      collapsePath(path);
+  }
+
+  public void expandPath(TreePath path)
+  {
+    // Don't expand if last path component is a leaf node.
+    if ((path == null)
+        || (treeModel.isLeaf(path.getLastPathComponent())))
+      return;
+
+    setExpandedState(path, true);
+  }
+  
+  public void expandRow(int row)
+  {
+    if (row < 0 || row >= getRowCount())
+      return;
+
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      expandPath(path);
+  }
+
+  public boolean isCollapsed(TreePath path)
+  {
+    return ! isExpanded(path);
+  }
+
+  public boolean isCollapsed(int row)
+  {
+    if (row < 0 || row >= getRowCount())
+      return false;
+
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      return isCollapsed(path);
+
+    return false;
+  }
+
+  public boolean isExpanded(TreePath path)
+  {
+    if (path == null)
+      return false;
+
+    Object state = nodeStates.get(path);
+
+    if ((state == null) || (state != EXPANDED))
+      return false;
+
+    TreePath parent = path.getParentPath();
+
+    if (parent != null)
+      return isExpanded(parent);
+    
+    return true;
+  }
+  
+  public boolean isExpanded(int row)
+  {
+    if (row < 0 || row >= getRowCount())
+      return false;
+
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      return isExpanded(path);
+
+    return false;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public boolean getExpandsSelectedPaths()
+  {
+    return expandsSelectedPaths;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public void setExpandsSelectedPaths(boolean flag)
+  {
+    if (expandsSelectedPaths == flag)
+      return;
+
+    boolean oldValue = expandsSelectedPaths;
+    expandsSelectedPaths = flag;
+    firePropertyChange(EXPANDS_SELECTED_PATHS_PROPERTY, oldValue, flag);
+  }
+
+  public Rectangle getPathBounds(TreePath path)
+  {
+    TreeUI ui = getUI();
+
+    if (ui == null)
+      return null;
+
+    return ui.getPathBounds(this, path);
+  }
+
+  public Rectangle getRowBounds(int row)
+  {
+    TreePath path = getPathForRow(row);
+
+    if (path != null)
+      return getPathBounds(path);
+
+    return null;
+  }
+
+  public boolean isEditing()
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      return ui.isEditing(this);
+
+    return false;
+  }
+
+  public boolean stopEditing()
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      return ui.stopEditing(this);
+
+   return false;
+  }
+
+  public void cancelEditing()
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      ui.cancelEditing(this);
+  }
+
+  public void startEditingAtPath(TreePath path)
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      ui.startEditingAtPath(this, path);
+  }
+
+  public TreePath getEditingPath()
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      return ui.getEditingPath(this);
+
+    return null;
+  }
+
+  public TreePath getPathForLocation(int x, int y)
+  {
+    TreePath path = getClosestPathForLocation(x, y);
+
+    if (path != null)
+      {
+        Rectangle rect = getPathBounds(path);
+
+        if ((rect != null) && rect.contains(x, y))
+          return path;
+      }
+
+    return null;
+  }
+
+  public int getRowForLocation(int x, int y)
+  {
+    TreePath path = getPathForLocation(x, y);
+
+    if (path != null)
+      return getRowForPath(path);
+
+    return -1;
+  }
+  
+  public TreePath getClosestPathForLocation(int x, int y)
+  {
+    TreeUI ui = getUI();
+
+    if (ui != null)
+      return ui.getClosestPathForLocation(this, x, y);
+    
+    return null;
+  }
+
+  public int getClosestRowForLocation(int x, int y)
+  {
+    TreePath path = getClosestPathForLocation(x, y);
+
+    if (path != null)
+      return getRowForPath(path);
+
+    return -1;
+  }
+
+  public Object getLastSelectedPathComponent()
+  {
+    TreePath path = getSelectionPath();
+
+    if (path != null)
+      return path.getLastPathComponent();
+
+    return null;
+  }
+
+  private void checkExpandParents(TreePath path)
+    throws ExpandVetoException
+  {
+    TreePath parent = path.getParentPath();
+
+    if (parent != null)
+      checkExpandParents(parent);
+
+    fireTreeWillExpand(path);
+  }
+
+  private void doExpandParents(TreePath path, boolean state)
+  {
+    TreePath parent = path.getParentPath();
+
+    if (isExpanded(parent))
+      return;
+    
+    if (parent != null)
+      doExpandParents(parent, false);
+
+    nodeStates.put(path, state ? EXPANDED : COLLAPSED);
+  }
+  
+  protected void setExpandedState(TreePath path, boolean state)
+  {
+    if (path == null)
+      return;
+
+    TreePath parent = path.getParentPath();
+
+    try
+      {
+       while (parent != null)
+         checkExpandParents(parent);
+      }
+    catch (ExpandVetoException e)
+      {
+       // Expansion vetoed.
+       return;
+      }
+
+    doExpandParents(path, state);
+  }
+
+  protected void clearToggledPaths()
+  {
+    nodeStates.clear();
+  }
+
+  protected Enumeration getDescendantToggledPaths(TreePath parent)
+  {
+    if (parent == null)
+      return null;
+
+    Enumeration nodes = nodeStates.keys();
+    Vector result = new Vector();
+
+    while (nodes.hasMoreElements())
+      {
+        TreePath path = (TreePath) nodes.nextElement();
+
+        if (path.isDescendant(parent))
+          result.addElement(path);
+      }
+    
+    return result.elements();
+  }
+
+  public boolean hasBeenExpanded(TreePath path)
+  {
+    if (path == null)
+      return false;
+
+    return nodeStates.get(path) != null;
+  }
+
+  public boolean isVisible(TreePath path)
+  {
+    if (path == null)
+      return false;
+
+    TreePath parent = path.getParentPath();
+
+    if (parent == null)
+      return true; // Is root node.
+
+    return isExpanded(parent);
+  }
+
+  public void makeVisible(TreePath path)
+  {
+    if (path == null)
+      return;
+
+    expandPath(path.getParentPath());
+  }
+
+  public boolean isPathEditable(TreePath path)
+  {    
+    return isEditable();
   }
 }
index 9b26c8b..657f192 100644 (file)
@@ -1,5 +1,5 @@
 /* JViewport.java -- 
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,6 +45,7 @@ import java.awt.Insets;
 import java.awt.Point;
 import java.awt.Rectangle;
 
+import javax.swing.border.Border;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.plaf.ViewportUI;
@@ -157,12 +158,23 @@ public class JViewport extends JComponent
     fireStateChanged();
   }
 
+  /**
+   * Returns the viewSize when set, or the preferred size of the set
+   * Component view.  If no viewSize and no Component view is set an
+   * empty Dimension is returned.
+   */
   public Dimension getViewSize()
   {
     if (isViewSizeSet)
       return viewSize;
     else
-      return getView().getSize();
+      {
+       Component view = getView();
+       if (view != null)
+         return view.getPreferredSize();
+       else
+         return new Dimension();
+      }
   }
 
 
@@ -281,7 +293,7 @@ public class JViewport extends JComponent
       fireStateChanged();
   }
     
-  public void addImpl(Component comp, Object constraints, int index)
+  protected void addImpl(Component comp, Object constraints, int index)
   {
     if (getComponentCount() > 0)
       remove(getComponents()[0]);
@@ -374,4 +386,10 @@ public class JViewport extends JComponent
   {
     super.setUI(ui);
   }
+
+  public final void setBorder(Border border)
+  {
+    if (border != null)
+      throw new IllegalArgumentException();
+  }
 }
index 3601b69..94efa3a 100644 (file)
@@ -1,5 +1,5 @@
 /* JWindow.java --
-   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -44,10 +44,10 @@ import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
 import java.awt.LayoutManager;
 import java.awt.Window;
 import java.awt.event.KeyEvent;
-import java.awt.event.WindowEvent;
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
@@ -62,180 +62,144 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
 {
   private static final long serialVersionUID = 5420698392125238833L;
   
-  public static final int HIDE_ON_CLOSE = 0;
-  public static final int EXIT_ON_CLOSE = 1;
-  public static final int DISPOSE_ON_CLOSE = 2;
-  public static final int DO_NOTHING_ON_CLOSE  = 3;
-
-    protected  AccessibleContext accessibleContext;
-
-    private int close_action = EXIT_ON_CLOSE;    
-    
-    
-    /***************************************************
-     *
-     *
-     *  constructors
-     *
-     *
-     *************/
-
-    public JWindow()
-    {      
-      super(SwingUtilities.getOwnerFrame());
-    }
-
-    // huuu ?
-    public JWindow(Frame f)
-    {
-       super(f);
-    }
-    
-    /***************************************************
-     *
-     *
-     *  methods, this part is shared with JDialog, JFrame
-     *
-     *
-     *************/
+  protected JRootPane rootPane;
+  protected boolean rootPaneCheckingEnabled;
+  protected AccessibleContext accessibleContext;
 
+  public JWindow()
+  {
+    super(SwingUtilities.getOwnerFrame());
+    windowInit();
+  }
+
+  public JWindow(GraphicsConfiguration gc)
+  {
+    super(SwingUtilities.getOwnerFrame(), gc);
+    windowInit();
+  }
   
-    private boolean checking;
-    protected  JRootPane         rootPane;
-
-    
-    protected  void frameInit()
-    {
-      super.setLayout(new BorderLayout(1, 1));
-      getRootPane(); // will do set/create
-    }
-  
+  public JWindow(Frame owner)
+  {
+    super(owner);
+    windowInit();
+  }
+
+  public JWindow(Window owner)
+  {
+    super(owner);
+    windowInit();
+  }
+
+  public JWindow(Window owner, GraphicsConfiguration gc)
+  {
+    super(owner, gc);
+    windowInit();
+  }
+
+  protected void windowInit()
+  {
+    super.setLayout(new BorderLayout(1, 1));
+    getRootPane(); // will do set/create
+  }
+
   public Dimension getPreferredSize()
   {
-    Dimension d = super.getPreferredSize();
-    return d;
+    return super.getPreferredSize();
   }
 
-  public  void setLayout(LayoutManager manager)
-  {    super.setLayout(manager);  }
+  public void setLayout(LayoutManager manager)
+  {
+    super.setLayout(manager);
+  }
 
-    public void setLayeredPane(JLayeredPane layeredPane) 
-    {   getRootPane().setLayeredPane(layeredPane);   }
-  
-    public JLayeredPane getLayeredPane()
-    {   return getRootPane().getLayeredPane();     }
-  
-    public JRootPane getRootPane()
-    {
-       if (rootPane == null)
-           setRootPane(createRootPane());
-       return rootPane;          
-    }
-
-    public void setRootPane(JRootPane root)
-    {
-       if (rootPane != null)
-           remove(rootPane);
-           
-       rootPane = root; 
-       add(rootPane, BorderLayout.CENTER);
-    }
-
-    public JRootPane createRootPane()
-    {   return new JRootPane();    }
-
-    public Container getContentPane()
-    {    return getRootPane().getContentPane();     }
-
-    public void setContentPane(Container contentPane)
-    {    getRootPane().setContentPane(contentPane);    }
-  
-    public Component getGlassPane()
-    {    return getRootPane().getGlassPane();   }
-  
-    public void setGlassPane(Component glassPane)
-    {   getRootPane().setGlassPane(glassPane);   }
+  public void setLayeredPane(JLayeredPane layeredPane)
+  {
+    getRootPane().setLayeredPane(layeredPane);
+  }
 
-    
-    protected  void addImpl(Component comp, Object constraints, int index)
-    {  super.addImpl(comp, constraints, index);    }
+  public JLayeredPane getLayeredPane()
+  {
+    return getRootPane().getLayeredPane();
+  }
+
+  public JRootPane getRootPane()
+  {
+    if (rootPane == null)
+      setRootPane(createRootPane());
+    return rootPane;
+  }
 
+  protected void setRootPane(JRootPane root)
+  {
+    if (rootPane != null)
+      remove(rootPane);
 
-    public void remove(Component comp)
-    {   getContentPane().remove(comp);  }
-  
-    protected  boolean isRootPaneCheckingEnabled()
-    {    return checking;        }
+    rootPane = root;
+    add(rootPane, BorderLayout.CENTER);
+  }
 
+  protected JRootPane createRootPane()
+  {
+    return new JRootPane();
+  }
 
-    protected  void setRootPaneCheckingEnabled(boolean enabled)
-    { checking = enabled;  }
+  public Container getContentPane()
+  {
+    return getRootPane().getContentPane();
+  }
 
+  public void setContentPane(Container contentPane)
+  {
+    getRootPane().setContentPane(contentPane);
+  }
 
-    public void update(Graphics g)
-    {   paint(g);  }
+  public Component getGlassPane()
+  {
+    return getRootPane().getGlassPane();
+  }
 
-    protected  void processKeyEvent(KeyEvent e)
-    {  super.processKeyEvent(e);    }
+  public void setGlassPane(Component glassPane)
+  {
+    getRootPane().setGlassPane(glassPane);
+  }
 
-    /////////////////////////////////////////////////////////////////////////////////
-  
-    public AccessibleContext getAccessibleContext()
-    {    return null;  }
-  
-    int getDefaultCloseOperation()
-    {    return close_action;   }    
-    
-    protected  String paramString()
-    {   return "JWindow";     }
-
-
-    protected  void processWindowEvent(WindowEvent e)
-    {
-       //      System.out.println("PROCESS_WIN_EV-1: " + e);
-       super.processWindowEvent(e); 
-       //      System.out.println("PROCESS_WIN_EV-2: " + e);
-       switch (e.getID())
-           {
-           case WindowEvent.WINDOW_CLOSING:
-               {
-                   switch(close_action)
-                       {
-                       case EXIT_ON_CLOSE:
-                           {
-                               System.out.println("user requested exit on close");
-                               System.exit(1);
-                               break;
-                           }
-                       case DISPOSE_ON_CLOSE:
-                           {
-                               System.out.println("user requested dispose on close");
-                               dispose();
-                               break;
-                           }
-                       case HIDE_ON_CLOSE:
-                           {
-                               setVisible(false);
-                               break;
-                           }
-                       case DO_NOTHING_ON_CLOSE:
-                           break;
-                       }
-                   break;
-               }
-               
-           case WindowEvent.WINDOW_CLOSED:
-           case WindowEvent.WINDOW_OPENED:
-           case WindowEvent.WINDOW_ICONIFIED:
-           case WindowEvent.WINDOW_DEICONIFIED:
-           case WindowEvent.WINDOW_ACTIVATED:
-           case WindowEvent.WINDOW_DEACTIVATED:
-               break;
-           }
-    }   
-
-    void setDefaultCloseOperation(int operation)
-    {  close_action = operation;   }
+  protected void addImpl(Component comp, Object constraints, int index)
+  {
+    super.addImpl(comp, constraints, index);
+  }
+
+  public void remove(Component comp)
+  {
+    getContentPane().remove(comp);
+  }
 
+  protected boolean isRootPaneCheckingEnabled()
+  {
+    return rootPaneCheckingEnabled;
+  }
+
+  protected void setRootPaneCheckingEnabled(boolean enabled)
+  {
+    rootPaneCheckingEnabled = enabled;
+  }
+
+  public void update(Graphics g)
+  {
+    paint(g);
+  }
+
+  protected void processKeyEvent(KeyEvent e)
+  {
+    super.processKeyEvent(e);
+  }
+
+  public AccessibleContext getAccessibleContext()
+  {
+    return null;
+  }
+
+  protected String paramString()
+  {
+    return "JWindow";
+  }
 }
index afdbae8..239c8dd 100644 (file)
@@ -1,5 +1,5 @@
 /* KeyStroke.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
 import java.awt.AWTKeyStroke;
@@ -45,12 +46,15 @@ public class KeyStroke
   extends AWTKeyStroke
   implements Serializable
 {
-  static final long serialVersionUID = -9060180771037902530L;
-  private KeyStroke() {
+  private static final long serialVersionUID = -9060180771037902530L;
+  
+  // Called by java.awt.AWTKeyStroke.registerSubclass via reflection.
+  private KeyStroke()
+  {
   }
   
-  protected KeyStroke(char keyChar, int keyCode, int modifiers,
-                      boolean onKeyRelease)
+  private KeyStroke(char keyChar, int keyCode, int modifiers,
+                    boolean onKeyRelease)
   {
     super(keyChar, keyCode, modifiers, onKeyRelease);
   }
@@ -92,9 +96,22 @@ public class KeyStroke
     return (KeyStroke) getAWTKeyStroke(keyCode, modifiers);
   }
 
+  /**
+   * Returns the KeyStroke according to <code>getAWTKeyStroke()</code>.
+   * But it returns null instead of throwing
+   * <code>IllegalArugmentException</code> when
+   * the keystoke sequence cannot be parsed from the given string.
+   */
   public static KeyStroke getKeyStroke(String str) 
   {
-    return (KeyStroke) getAWTKeyStroke(str);
+    try
+      {
+       return (KeyStroke) getAWTKeyStroke(str);
+      }
+    catch (IllegalArgumentException iae)
+      {
+       return null;
+      }
   }
 
   public static KeyStroke getKeyStrokeForEvent(KeyEvent event) 
@@ -1,5 +1,5 @@
-/* DefaultCellRenderer.java -- 
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* LayoutFocusTraversalPolicy.java --
+   Copyright (C) 200 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,40 +35,53 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
-package javax.swing;
 
-// this is what SUN basically told us to do so:
-// no icon though as that's not implemented yet....
+package javax.swing;
 
 import java.awt.Component;
+import java.io.Serializable;
+import java.util.Comparator;
 
-public class DefaultCellRenderer extends JLabel implements ListCellRenderer 
+/**
+ * @author Graydon Hoare
+ * @author Michael Koch
+ * 
+ * @since 1.4
+ */
+public class LayoutFocusTraversalPolicy 
+  extends SortingFocusTraversalPolicy
+  implements Serializable
 {
-    public Component getListCellRendererComponent(JList list,
-                                                 Object value,           
-                                                 int index,            
-                                                 boolean isSelected,     
-                                                 boolean cellHasFocus)   
+  private static class LayoutComparator
+    implements Comparator
+  {
+    public LayoutComparator()
     {
-       String s = value.toString();
-       setText(s);     
-
-       //      System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + s);
-
+      // Do nothing here.
+    }
+    
+    public int compare(Object o1, Object o2)
+    {
+      Component comp1 = (Component) o1;
+      Component comp2 = (Component) o2;
 
-       if (isSelected) 
-           {
-               setBackground(list.getSelectionBackground());
-               setForeground(list.getSelectionForeground());
-           }
-       else 
-           {
-               setBackground(list.getBackground());
-               setForeground(list.getForeground());
-           }
+      int x1 = comp1.getX();
+      int y1 = comp1.getY();
+      int x2 = comp2.getX();
+      int y2 = comp2.getY();
+      
+      if (x1 == x2 && y1 == y2)
+       return 0;
+      
+      if ((y1 < y2) || ((y1 == y2) && (x1 < x2)))
+       return -1;
 
-       setEnabled(list.isEnabled());
-       setFont(list.getFont());
-       return this;
+      return 1;
     }
+  }
+  
+  public LayoutFocusTraversalPolicy()
+  {
+    super(new LayoutComparator());
+  }
 }
index 3a56a11..a250838 100644 (file)
@@ -58,6 +58,12 @@ public abstract class LookAndFeel
 
   public abstract String getDescription();
 
+  public static Object getDesktopPropertyValue(String systemPropertyName, Object fallbackValue)
+  {
+    Object value = Toolkit.getDefaultToolkit().getDesktopProperty(systemPropertyName);
+    return value != null ? value : fallbackValue;
+  }
+  
   public abstract String getID();
 
   public abstract String getName();
index 2e93c01..f78e214 100644 (file)
@@ -271,10 +271,10 @@ public class MenuSelectionManager
        MenuElement[] subComponents = ((MenuElement) mouseOverMenuComp)
                                      .getSubElements();
 
-    for (int i = 0; i < subComponents.length; i++)
-      {
-         subComponents[i].processMouseEvent(event, path, manager);
-      }
+       for (int i = 0; i < subComponents.length; i++)
+        {
+             subComponents[i].processMouseEvent(event, path, manager);
+        }
        */
       }
   }
index 1e1d4ae..706ffe2 100644 (file)
@@ -51,7 +51,7 @@ import java.io.Serializable;
 public class OverlayLayout
   implements LayoutManager2, Serializable
 {
-  static final long serialVersionUID = 18082829169631543L;
+  private static final long serialVersionUID = 18082829169631543L;
 
        //-------------------------------------------------------------
        // Variables --------------------------------------------------
index 1c9208e..c29ba78 100644 (file)
@@ -263,7 +263,7 @@ public class RepaintManager
         && ancestor instanceof JComponent
         && ((JComponent) ancestor).isValidateRoot())
       component = (JComponent) ancestor;
-    
+
     if (invalidComponents.contains(component))
       return;
 
index 0da8f18..a0461b4 100644 (file)
@@ -57,7 +57,7 @@ import javax.swing.border.Border;
 public class ScrollPaneLayout
   implements LayoutManager, ScrollPaneConstants, Serializable
 {
-  static final long serialVersionUID = -4480022884523193743L;
+  private static final long serialVersionUID = -4480022884523193743L;
 
   public static class UIResource extends ScrollPaneLayout 
     implements javax.swing.plaf.UIResource {
@@ -240,7 +240,7 @@ public class ScrollPaneLayout
 
             if (viewportBorder != null)
               {
-              viewportInsets = viewportBorder.getBorderInsets(parent);
+                viewportInsets = viewportBorder.getBorderInsets(parent);
                 if (viewportInsets != null)
                   viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right,
                                              viewportInsets.top + viewportInsets.bottom);
@@ -311,19 +311,19 @@ public class ScrollPaneLayout
 
             if (viewportBorder != null)
               {
-              viewportInsets = viewportBorder.getBorderInsets(parent);
+                viewportInsets = viewportBorder.getBorderInsets(parent);
                 if (viewportInsets != null)
                   viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right,
                                              viewportInsets.top + viewportInsets.bottom);
               }
-
+            
             if (insets != null)
               insetsSize.setSize(insets.left + insets.right,
                                  insets.top + insets.bottom);
 
             maybeSetMinimumSize(colHead, columnHeaderSize);
             maybeSetMinimumSize(rowHead, rowHeaderSize);
-
+            
             if (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)
               maybeSetMinimumSize(vsb, verticalScrollBarSize);
 
@@ -420,7 +420,7 @@ public class ScrollPaneLayout
             
             if (!showVsb)
               x3 = x4;
-
+            
             if (!showHsb)
               y3 = y4;
 
@@ -438,7 +438,7 @@ public class ScrollPaneLayout
             if (showVsb)
               {
                 vsb.setVisible(true);
-             vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2));
+                vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2));
               }
             else if (vsb != null)
               vsb.setVisible(false);
@@ -446,7 +446,7 @@ public class ScrollPaneLayout
             if (showHsb)
               {
                 hsb.setVisible(true);
-              hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3));
+                hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3));
               }
             else if (hsb != null)
               hsb.setVisible(false);
index eb641fb..dd34d9c 100644 (file)
@@ -47,7 +47,7 @@ import java.io.Serializable;
  */
 public class SizeRequirements implements Serializable
 {
-  static final long serialVersionUID = 9217749429906736553L;
+  private static final long serialVersionUID = 9217749429906736553L;
 
        //-------------------------------------------------------------
        // Variables --------------------------------------------------
diff --git a/libjava/javax/swing/SortingFocusTraversalPolicy.java b/libjava/javax/swing/SortingFocusTraversalPolicy.java
new file mode 100644 (file)
index 0000000..07a4e65
--- /dev/null
@@ -0,0 +1,333 @@
+/* SortingFocusTraversalPolicy.java --
+   Copyright (C) 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+/**
+ * @author Graydon Hoare
+ * @author Michael Koch
+ * 
+ * @since 1.4
+ */
+public class SortingFocusTraversalPolicy 
+  extends InternalFrameFocusTraversalPolicy
+{
+  /**
+   * The comparator used to sort elements in the focus traversal cycle
+   * managed by this class.
+   */
+  Comparator comparator;
+
+  /**
+   * <p>Whether or not to perform an "implicit DownCycle" when selecting
+   * successor components within a focus cycle.</p>
+   *
+   * <p>When this is true, requesting the "next" component following a
+   * component which is a focus cycle root (and, necessarily, a container)
+   * will enter the focus cycle root of that container, and return its
+   * default focus.</p>
+   *
+   * <p>When this property is false, requesting the "next" component will
+   * simply advance within the containing focus cycle, subject to the
+   * {@link #comparator} order and the {@link #accept} judgment.</p>
+   *
+   * @see #getNextFocusableComponent
+   */
+  boolean implicitDownCycleTraversal = true;
+  
+  /**
+   * Creates a new <code>SortingFocusTraversalPolicy</code> with no
+   * comparator set.
+   */
+  protected SortingFocusTraversalPolicy()
+  {
+    // Do nothing here.
+  }
+
+  /**
+   * Creates a new <code>SortingFocusTraversalPolicy</code> with the given
+   * comparator set.
+   *
+   * @param the comparator to set
+   */
+  public SortingFocusTraversalPolicy(Comparator comparator)
+  {
+    this.comparator = comparator;
+  }
+
+  /**
+   * Decide whether a component is an acceptable focus owner. 
+   *
+   * @param comp The component which is a candidate for focus ownership.
+   *
+   * @return true if the component is focusable, displayable, visible, and
+   * enabled; otherwise false
+   */
+  protected boolean accept(Component comp)
+  {
+    return (comp.isVisible()
+           && comp.isDisplayable()
+           && comp.isEnabled()
+           && comp.isFocusable());
+  }
+
+  /**
+   * Get the current value of the {@link #comparator} property.
+   *
+   * @return the current value of the property
+   * 
+   * @see #setComparator
+   */
+  protected Comparator getComparator()
+  {
+    return comparator;
+  }
+
+  /**
+   * Set the current value of the {@link #comparator} property.
+   *
+   * @param comparator the new value of the property
+   * 
+   * @see #getComparator
+   */
+  protected void setComparator(Comparator comparator)
+  {
+    this.comparator = comparator;
+  }
+
+  private TreeSet getSortedCycle(Container root, TreeSet set)
+  {
+    if (set == null)
+      set = (getComparator() == null 
+             ? new TreeSet()
+             : new TreeSet(getComparator()));
+    
+    if (root != null) 
+      {
+        Component[] comps = root.getComponents();
+        for (int i = 0; i < comps.length; ++i)
+          {
+            Component c = comps[i];
+            if (accept(c))
+              set.add(c);
+            if (c instanceof Container)
+              getSortedCycle((Container) c, set);
+          }
+      }
+    return set;
+  }
+
+  /**
+   * Return the component which follows the specified component in this
+   * focus cycle, relative to the order imposed by {@link
+   * #comparator}. Candidate components are only considered if they are
+   * accepted by the {@link #accept} method.
+   *
+   * If {@link #getImplicitDownCycleTraversal} is <code>true</code> and the
+   * <code>comp</code> is a focus cycle root, an "implicit DownCycle"
+   * occurs and the method returns the
+   * <code>getDefaultComponent(comp)</code>.
+   * 
+   * @param root the focus cycle root to search for a successor within
+   * @param comp the component to search for the successor of
+   *
+   * @return the component following the specified component under
+   * the specified root, or null if no such component is found
+   * 
+   * @throws IllegalArgumentException if either argument is null, or
+   * if the root is not a focus cycle root of the component
+   */
+  public Component getComponentAfter(Container root, 
+                                     Component comp)
+  {
+    if (comp == null || root == null || !comp.isFocusCycleRoot(root))
+      throw new IllegalArgumentException();
+
+    if (getImplicitDownCycleTraversal() 
+        && comp instanceof Container
+        && ((Container)comp).isFocusCycleRoot())
+      {
+        return getDefaultComponent((Container) comp);
+      }
+
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    while (i.hasNext())
+      {
+        Component c = (Component) i.next();
+        if (c != null && c.equals(comp))
+          {
+            if (i.hasNext())
+              return (Component) i.next();
+            break;
+          }
+      }
+    return null;
+  }
+
+
+  /**
+   * Return the component which precedes the specified component in this
+   * focus cycle, relative to the order imposed by {@link
+   * #comparator}. Candidate components are only considered if they are
+   * accepted by the {@link #accept} method.
+   * 
+   * @param root the focus cycle root to search for a predecessor within
+   * @param comp the component to search for the predecessor of
+   *
+   * @return the component preceding the specified component under the
+   * specified root, or null if no such component is found
+   * 
+   * @throws IllegalArgumentException if either argument is null, or
+   * if the root is not a focus cycle root of the component
+   */
+  public Component getComponentBefore(Container root, 
+                                      Component comp)
+  {
+    if (comp == null || root == null || !comp.isFocusCycleRoot(root))
+      throw new IllegalArgumentException();
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    Component prev = null;
+    while (i.hasNext())
+      {
+        Component c = (Component) i.next();
+        if (c != null && c.equals(comp))
+          break;
+        prev = c;
+      }
+    return prev;
+  }
+
+  /**
+   * Return the default component of <code>root</code>, which is by default
+   * the same as the first component, returned by {@link
+   * #getFirstComponent}.
+   *
+   * @param root the focus cycle root to return the default component of
+   *
+   * @return the default focus component for <code>root</code>
+   *
+   * @throws IllegalArgumentException if root is null
+   */
+  public Component getDefaultComponent(Container root)
+  {
+    return getFirstComponent(root);
+  }
+
+  /** 
+   * Return the first focusable component of the focus cycle root
+   * <code>comp</code> under the ordering imposed by the {@link
+   * #comparator} property. Candidate components are only considered if
+   * they are accepted by the {@link #accept} method.
+   *
+   * @param root the focus cycle root to search for the first component of
+   *
+   * @return the first component under <code>root</code>, or null if
+   * no components are found.
+   *
+   * @throws IllegalArgumentException if root is null
+   */
+  public Component getFirstComponent(Container root)
+  {
+    if (root == null)
+      throw new IllegalArgumentException();
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    if (i.hasNext())
+      return (Component) i.next();
+    return null;
+  }
+  
+  /** 
+   * Return the last focusable component of the focus cycle root
+   * <code>comp</code> under the ordering imposed by the {@link
+   * #comparator} property. Candidate components are only considered if
+   * they are accepted by the {@link #accept} method.
+   *
+   * @param root the focus cycle root to search for the last component of
+   *
+   * @return the last component under <code>root</code>, or null if
+   * no components are found.
+   *
+   * @throws IllegalArgumentException if root is null
+   */
+  public Component getLastComponent(Container root)
+  {
+    if (root == null)
+      throw new IllegalArgumentException();
+    TreeSet set = getSortedCycle(root, null);
+    Iterator i = set.iterator();
+    Component last = null;
+    while (i.hasNext())
+      last = (Component) i.next();
+    return last;
+  }
+
+  /**
+   * Return the current value of the {@link implicitDownCycleTraversal}
+   * property.
+   *
+   * @return the current value of the property
+   * 
+   * @see setImplicitDownCycleTraversal
+   */
+  public boolean getImplicitDownCycleTraversal()
+  {
+    return implicitDownCycleTraversal;
+  }
+
+  /**
+   * Set the current value of the {@link implicitDownCycleTraversal}
+   * property.
+   *
+   * @param down the new value of the property
+   * 
+   * @see getImplicitDownCycleTraversal
+   */
+  public void setImplicitDownCycleTraversal(boolean down)
+  {
+    implicitDownCycleTraversal = down;
+  }
+}
index feacf4f..8e98742 100644 (file)
@@ -1,5 +1,5 @@
 /* SwingUtilities.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,15 +42,14 @@ import java.applet.Applet;
 import java.awt.Component;
 import java.awt.ComponentOrientation;
 import java.awt.Container;
-import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Frame;
 import java.awt.Graphics;
 import java.awt.Insets;
+import java.awt.KeyboardFocusManager;
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Shape;
-import java.awt.Toolkit;
 import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
@@ -58,6 +57,8 @@ import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.lang.reflect.InvocationTargetException;
 
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleStateSet;
 import javax.swing.plaf.ActionMapUIResource;
 import javax.swing.plaf.InputMapUIResource;
 
@@ -67,8 +68,10 @@ import javax.swing.plaf.InputMapUIResource;
  * regions which need painting.
  *
  * @author Graydon Hoare (graydon@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  */
-public class SwingUtilities implements SwingConstants
+public class SwingUtilities
+  implements SwingConstants
 {
   /** 
    * This frame should be used as parent for JWindow or JDialog 
@@ -129,6 +132,152 @@ public class SwingUtilities implements SwingConstants
   }
 
   /**
+   * Returns the focus owner or <code>null</code> if <code>comp</code> is not
+   * the focus owner or a parent of it.
+   * 
+   * @param comp the focus owner or a parent of it
+   * 
+   * @return the focus owner, or <code>null</code>
+   * 
+   * @deprecated 1.4 Replaced by
+   * <code>KeyboardFocusManager.getFocusOwner()</code>.
+   */
+  public static Component findFocusOwner(Component comp)
+  {
+    // Get real focus owner.
+    Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager()
+                                              .getFocusOwner();
+
+    // Check if comp is the focus owner or a parent of it.
+    Component tmp = focusOwner;
+    
+    while (tmp != null)
+      {
+       if (tmp == comp)
+         return focusOwner;
+
+       tmp = tmp.getParent();
+      }
+    
+    return null;
+  }
+  
+  /**
+   * Returns the <code>Accessible</code> child of the specified component
+   * which appears at the supplied <code>Point</code>.  If there is no
+   * child located at that particular pair of co-ordinates, null is returned
+   * instead.
+   *
+   * @param c the component whose children may be found at the specified
+   *          point.
+   * @param p the point at which to look for the existence of children
+   *          of the specified component.
+   * @return the <code>Accessible</code> child at the point, <code>p</code>,
+   *         or null if there is no child at this point.
+   * @see javax.accessibility.AccessibleComponent#getAccessibleAt
+   */
+  public static Accessible getAccessibleAt(Component c, Point p)
+  {
+    return c.getAccessibleContext().getAccessibleComponent().getAccessibleAt(p);
+  }
+
+  /**
+   * <p>
+   * Returns the <code>Accessible</code> child of the specified component
+   * that has the supplied index within the parent component.  The indexing
+   * of the children is zero-based, making the first child have an index of
+   * 0.
+   * </p>
+   * <p>
+   * Caution is advised when using this method, as its operation relies
+   * on the behaviour of varying implementations of an abstract method.
+   * For greater surety, direct use of the AWT component implementation
+   * of this method is advised.
+   * </p>
+   *
+   * @param c the component whose child should be returned.
+   * @param i the index of the child within the parent component.
+   * @return the <code>Accessible</code> child at index <code>i</code>
+   *         in the component, <code>c</code>.
+   * @see javax.accessibility.AccessibleContext#getAccessibleChild
+   * @see java.awt.Component.AccessibleAWTComponent#getAccessibleChild
+   */
+  public static Accessible getAccessibleChild(Component c, int i)
+  {
+    return c.getAccessibleContext().getAccessibleChild(i);
+  }
+
+  /**
+   * <p>
+   * Returns the number of <code>Accessible</code> children within
+   * the supplied component.
+   * </p>
+   * <p>
+   * Caution is advised when using this method, as its operation relies
+   * on the behaviour of varying implementations of an abstract method.
+   * For greater surety, direct use of the AWT component implementation
+   * of this method is advised.
+   * </p>
+   *
+   * @param c the component whose children should be counted.
+   * @return the number of children belonging to the component,
+   *         <code>c</code>.
+   * @see javax.accessibility.AccessibleContext#getAccessibleChildrenCount
+   * @see java.awt.Component.AccessibleAWTComponent#getAccessibleChildrenCount
+   */
+  public static int getAccessibleChildrenCount(Component c)
+  {
+    return c.getAccessibleContext().getAccessibleChildrenCount();
+  }
+
+  /**
+   * <p>
+   * Returns the zero-based index of the specified component
+   * within its parent.  If the component doesn't have a parent,
+   * -1 is returned.
+   * </p>
+   * <p>
+   * Caution is advised when using this method, as its operation relies
+   * on the behaviour of varying implementations of an abstract method.
+   * For greater surety, direct use of the AWT component implementation
+   * of this method is advised.
+   * </p>
+   *
+   * @param c the component whose parental index should be found.
+   * @return the index of the component within its parent, or -1
+   *         if the component doesn't have a parent.
+   * @see javax.accessibility.AccessibleContext#getAccessibleIndexInParent
+   * @see java.awt.Component.AccessibleAWTComponent#getAccessibleIndexInParent
+   */
+  public static int getAccessibleIndexInParent(Component c)
+  {
+    return c.getAccessibleContext().getAccessibleIndexInParent();
+  }
+
+  /**
+   * <p>
+   * Returns a set of <code>AccessibleState</code>s, which represent
+   * the state of the supplied component.
+   * </p>
+   * <p>
+   * Caution is advised when using this method, as its operation relies
+   * on the behaviour of varying implementations of an abstract method.
+   * For greater surety, direct use of the AWT component implementation
+   * of this method is advised.
+   * </p>
+   *
+   * @param c the component whose accessible state should be retrieved.
+   * @return a set of <code>AccessibleState</code> objects, which represent
+   *         the state of the supplied component.
+   * @see javax.accessibility.AccessibleContext#getAccessibleStateSet
+   * @see java.awt.Component.AccessibleAWTComponent#getAccessibleStateSet
+   */
+  public static AccessibleStateSet getAccessibleStateSet(Component c)
+  {
+    return c.getAccessibleContext().getAccessibleStateSet();
+  }
+
+  /**
    * Calculates the bounds of a component in the component's own coordinate
    * space. The result has the same height and width as the component's
    * bounds, but its location is set to (0,0).
@@ -144,22 +293,6 @@ public class SwingUtilities implements SwingConstants
   }
 
   /**
-   * Returns the font metrics object for a given font. The metrics can be
-   * used to calculate crude bounding boxes and positioning information,
-   * for laying out components with textual elements.
-   *
-   * @param font The font to get metrics for
-   *
-   * @return The font's metrics
-   *
-   * @see java.awt.font.GlyphMetrics
-   */
-  public static FontMetrics getFontMetrics(Font font)
-  {
-    return Toolkit.getDefaultToolkit().getFontMetrics(font);
-  }
-
-  /**
    * If <code>comp</code> is a RootPaneContainer, return its JRootPane.
    * Otherwise call <code>getAncestorOfClass(JRootPane.class, a)</code>.
    *
index afdf4f3..0906b8d 100644 (file)
@@ -72,6 +72,14 @@ public class Timer implements Serializable
   /** DOCUMENT ME! */
   private Waker waker;
 
+  private Runnable drainer = new Runnable() 
+    {
+      public void run()
+      {
+        drainEvents();
+      }
+    };
+
   /**
    * DOCUMENT ME!
    */
@@ -81,14 +89,7 @@ public class Timer implements Serializable
       {
        queue++;
        if (queue == 1)
-         SwingUtilities.invokeLater(new Runnable()
-             {
-               public void run()
-               {
-                 drainEvents();
-               }
-             });
-
+         SwingUtilities.invokeLater(drainer);
       }
   }
 
index 16b5016..9d6fa4e 100644 (file)
@@ -35,44 +35,119 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing;
 
-import java.io.Serializable;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
-import java.awt.datatransfer.*;
+import java.io.Serializable;
 
 public class TransferHandler implements Serializable
 {
+  static class TransferAction extends AbstractAction
+  {
+    private String command;
+
+    public TransferAction(String command)
+    {
+      this.command = command;
+    }
+    
+    public void actionPerformed(ActionEvent event)
+    {
+      JComponent component = (JComponent) event.getSource();
+      TransferHandler transferHandler = component.getTransferHandler();
+      Clipboard clipboard = getClipboard(component);
+
+      if (command.equals(COMMAND_COPY))
+       transferHandler.exportToClipboard(component, clipboard, COPY);
+      else if (command.equals(COMMAND_CUT))
+       transferHandler.exportToClipboard(component, clipboard, MOVE);
+      else if (command.equals(COMMAND_PASTE))
+       {
+         Transferable transferable = clipboard.getContents(null);
+
+         if (transferable != null)
+           transferHandler.importData(component, transferable);
+       }
+    }
+  
+    private static Clipboard getClipboard(JComponent component)
+    {
+      SecurityManager sm = System.getSecurityManager();
+    
+      if (sm != null)
+       {
+         try
+           {
+             sm.checkSystemClipboardAccess();
+
+             // We may access system clipboard.
+             return component.getToolkit().getSystemClipboard();
+           }
+         catch (SecurityException e)
+           {
+             // We may not access system clipboard.
+           }
+       }
+    
+      // Create VM-local clipboard if non exists yet.
+      if (clipboard == null)
+        clipboard = new Clipboard("Clipboard");
+
+      return clipboard;
+    }
+  }
+  
   private static final long serialVersionUID = -7908749299918704233L;
 
+  private static final String COMMAND_COPY = "copy";
+  private static final String COMMAND_CUT = "cut";
+  private static final String COMMAND_PASTE = "paste";
+  
   public static final int NONE = 0;
   public static final int COPY = 1;
   public static final int MOVE = 2;
   public static final int COPY_OR_MOVE = 3;
 
-  static Action getCopyAction ()
+  private static Action copyAction = new TransferAction(COMMAND_COPY);
+  private static Action cutAction = new TransferAction(COMMAND_CUT);
+  private static Action pasteAction = new TransferAction(COMMAND_PASTE);
+  
+  /**
+   * Clipboard if system clipboard may not be used.
+   */
+  private static Clipboard clipboard;
+  
+  private int sourceActions;
+  private Icon visualRepresentation;
+  
+  public static Action getCopyAction()
   {
-    return null;
+    return copyAction;
   }
 
-  static Action getCutAction ()
+  public static Action getCutAction()
   {
-    return null;
+    return cutAction;
   }
 
-  static Action getPasteAction ()
+  public static Action getPasteAction()
   {
-    return null;
+    return pasteAction;
   }
 
-
   protected TransferHandler()
   {
-    // Do nothing here.
+    this.sourceActions = NONE;
   }
 
   public TransferHandler(String property)
   {
+    this.sourceActions = property != null ? COPY : NONE;
   }
 
   public boolean canImport (JComponent c, DataFlavor[] flavors)
@@ -80,7 +155,7 @@ public class TransferHandler implements Serializable
     return false;
   }
 
-  public Transferable createTransferable(JComponent c) 
+  protected Transferable createTransferable(JComponent c) 
   {
     return null;
   }
@@ -99,17 +174,16 @@ public class TransferHandler implements Serializable
 
   public int getSourceActions (JComponent c)
   {
-    return 0;
+    return sourceActions;
   }
 
   public Icon getVisualRepresentation (Transferable t)
   {
-    return null;
+    return visualRepresentation;
   }
 
   public boolean importData (JComponent c, Transferable t) 
   {
     return false;
   }
-
 }
index c32cebd..a2deae4 100644 (file)
@@ -1,5 +1,5 @@
 /* UIDefaults.java -- database for all settings and interface bindings.
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -57,8 +57,8 @@ import javax.swing.plaf.ComponentUI;
 
 /**
  * UIDefaults is a database where all settings and interface bindings are
- * stored into. An PLAF implementation fills one of these (see for example
- * plaf/basic/BasicLookAndFeel.java) with "ButtonUI" -> new BasicButtonUI().
+ * stored into. A PLAF implementation fills one of these (see for example
+ * plaf/basic/BasicLookAndFeel.java) with "ButtonUI" -&gt; new BasicButtonUI().
  *
  * @author Ronald Veldema (rveldema@cs.vu.nl)
  */
@@ -68,7 +68,7 @@ public class UIDefaults extends Hashtable
   private Locale defaultLocale;
   private PropertyChangeSupport propertyChangeSupport;
 
-  public interface ActiveValue
+  public static interface ActiveValue
   {
     Object createValue(UIDefaults table);
   }
@@ -92,7 +92,7 @@ public class UIDefaults extends Hashtable
     }
   }
 
-  public interface LazyValue
+  public static interface LazyValue
   {
     Object createValue(UIDefaults table);
   }
@@ -110,9 +110,9 @@ public class UIDefaults extends Hashtable
             try
               {
                 return Class
-                  .forName (className)
-                  .getConstructor (new Class[] {})
-                  .newInstance (new Object[] {});
+                  .forName(className)
+                  .getConstructor(new Class[] {})
+                  .newInstance(new Object[] {});
               }
             catch (Exception e)
               {
@@ -145,54 +145,54 @@ public class UIDefaults extends Hashtable
         };
     }
     
-    public ProxyLazyValue (String c, Object[] os)
+    public ProxyLazyValue(String c, Object[] os)
     {
       final String className = c;
       final Object[] objs = os;
       final Class[] clss = new Class[objs.length];
       for (int i = 0; i < objs.length; ++i)
         {
-          clss[i] = objs[i].getClass ();
+          clss[i] = objs[i].getClass();
         }      
-      inner = new LazyValue ()
+      inner = new LazyValue()
         { 
-          public Object createValue (UIDefaults table) 
+          public Object createValue(UIDefaults table) 
           {            
             try
               {
                 return Class
-                  .forName (className)
-                  .getConstructor (clss)
-                  .newInstance (objs);
-    }
+                  .forName(className)
+                  .getConstructor(clss)
+                  .newInstance(objs);
+             }
             catch (Exception e)
-    {
+             {
                 return null;
               }
           }
         };
     }
 
-    public ProxyLazyValue (String c, String m, Object[] os)
+    public ProxyLazyValue(String c, String m, Object[] os)
     {
       final String className = c;
       final String methodName = m;
       final Object[] objs = os;
       final Class[] clss = new Class[objs.length];
       for (int i = 0; i < objs.length; ++i)
-    {
-          clss[i] = objs[i].getClass ();
-    }
-      inner = new LazyValue ()
+       {
+          clss[i] = objs[i].getClass();
+       }
+      inner = new LazyValue()
         { 
-    public Object createValue(UIDefaults table)
-    {
+         public Object createValue(UIDefaults table)
+         {
             try 
               {
                 return Class
-                  .forName (className)
-                  .getMethod (methodName, clss)
-                  .invoke (null, objs);
+                  .forName(className)
+                  .getMethod(methodName, clss)
+                  .invoke(null, objs);
               }
             catch (Exception e)
               {
@@ -202,9 +202,9 @@ public class UIDefaults extends Hashtable
         };
     }
     
-    public Object createValue (UIDefaults table)
+    public Object createValue(UIDefaults table)
     {
-      return inner.createValue (table);
+      return inner.createValue(table);
     }
   }
 
@@ -212,46 +212,46 @@ public class UIDefaults extends Hashtable
 
   public UIDefaults()
   {
-    bundles = new LinkedList ();
-    defaultLocale = Locale.getDefault ();
+    bundles = new LinkedList();
+    defaultLocale = Locale.getDefault();
     propertyChangeSupport = new PropertyChangeSupport(this);
   }
 
   public UIDefaults(Object[] entries)
   {
     this();
-
-    for (int i = 0; (2*i+1) < entries.length; ++i)
-        put (entries[2*i], entries[2*i+1]);
-      }
+    
+    for (int i = 0; (2 * i + 1) < entries.length; ++i)
+      put(entries[2 * i], entries[2 * i + 1]);
+  }
 
   public Object get(Object key)
   {
-    return this.get (key, getDefaultLocale ());
+    return this.get(key, getDefaultLocale());
   }
 
-  public Object get (Object key, Locale loc)
+  public Object get(Object key, Locale loc)
   {
     Object obj = null;
 
-    if (super.containsKey (key))
+    if (super.containsKey(key))
       {
-        obj = super.get (key);
+        obj = super.get(key);
       }
     else if (key instanceof String)
       {
         String keyString = (String) key;
-        ListIterator i = bundles.listIterator (0);
-        while (i.hasNext ())
-  {
-            String bundle_name = (String) i.next ();
+        ListIterator i = bundles.listIterator(0);
+        while (i.hasNext())
+         {
+            String bundle_name = (String) i.next();
             ResourceBundle res =
-              ResourceBundle.getBundle (bundle_name, loc);
+              ResourceBundle.getBundle(bundle_name, loc);
             if (res != null)
               {
                 try 
                   {                    
-                    obj = res.getObject (keyString);
+                    obj = res.getObject(keyString);
                     break;
                   }
                 catch (MissingResourceException me)
@@ -271,14 +271,14 @@ public class UIDefaults extends Hashtable
 
     if (obj instanceof LazyValue)
       {
-        Object resolved = ((LazyValue)obj).createValue (this);
-        super.remove (key);
-        super.put (key, resolved);
+        Object resolved = ((LazyValue) obj).createValue(this);
+        super.remove(key);
+        super.put(key, resolved);
         return resolved;
       }
     else if (obj instanceof ActiveValue)
       {
-        return ((ActiveValue)obj).createValue (this);
+        return ((ActiveValue) obj).createValue(this);
       }    
 
     return obj;
@@ -286,19 +286,23 @@ public class UIDefaults extends Hashtable
 
   public Object put(Object key, Object value)
   {
-    Object old = super.put (key, value);
+    Object old;
+    if (value != null)
+      old = super.put(key, value);
+    else
+      old = super.remove(key);
     if (key instanceof String && old != value)
-      firePropertyChange ((String) key, old, value);
+      firePropertyChange((String) key, old, value);
     return old;
   }
 
   public void putDefaults(Object[] entries)
   {
-    for (int i = 0; (2*i+1) < entries.length; ++i)
+    for (int i = 0; (2 * i + 1) < entries.length; ++i)
   {
-        super.put (entries[2*i], entries[2*i+1]);
+        super.put(entries[2 * i], entries[2 * i + 1]);
       }
-    firePropertyChange ("UIDefaults", null, null);
+    firePropertyChange("UIDefaults", null, null);
   }
 
   public Font getFont(Object key)
@@ -454,20 +458,20 @@ public class UIDefaults extends Hashtable
       {
         getUIError ("failed to locate createUI method on " + cls.toString ());
         return null;
-  }
+      }
 
     try
-  {
+      {
         return (ComponentUI) factory.invoke (null, new Object[] { target });
-  }
+      }
     catch (java.lang.reflect.InvocationTargetException ite)
-       {
+      {
         getUIError ("InvocationTargetException ("+ ite.getTargetException() 
                    +") calling createUI(...) on " + cls.toString ());
         return null;        
-       }
+      }
     catch (Exception e)
-  {
+      {
         getUIError ("exception calling createUI(...) on " + cls.toString ());
         return null;        
       }
@@ -496,12 +500,12 @@ public class UIDefaults extends Hashtable
 
   public void addResourceBundle(String name)
   {
-    bundles.addFirst (name);
+    bundles.addFirst(name);
   }
 
   public void removeResourceBundle(String name)
   {
-    bundles.remove (name);
+    bundles.remove(name);
   }
 
   public void setDefaultLocale(Locale loc)
index 9722129..dfc6a82 100644 (file)
@@ -1,5 +1,5 @@
 /* UIManager.java -- 
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -94,7 +94,7 @@ public class UIManager implements Serializable
    *
    * @param listener the listener to add
    */
-  public static void addPropertyChangeListener (PropertyChangeListener listener)
+  public static void addPropertyChangeListener(PropertyChangeListener listener)
   {
     // FIXME
   }
@@ -104,7 +104,7 @@ public class UIManager implements Serializable
    *
    * @param listener the listener to remove
    */
-  public static void removePropertyChangeListener (PropertyChangeListener listener)
+  public static void removePropertyChangeListener(PropertyChangeListener listener)
   {
     // FIXME
   }
@@ -116,7 +116,7 @@ public class UIManager implements Serializable
    *
    * @since 1.4
    */
-  public static PropertyChangeListener[] getPropertyChangeListeners ()
+  public static PropertyChangeListener[] getPropertyChangeListeners()
   {
     // FIXME
     throw new Error ("Not implemented");
index 4738bac..3abf31d 100644 (file)
@@ -52,7 +52,7 @@ import java.io.Serializable;
  */
 public class ViewportLayout implements LayoutManager, Serializable
 {
-  static final long serialVersionUID = -788225906076097229L;
+  private static final long serialVersionUID = -788225906076097229L;
 
   public ViewportLayout() 
   {
@@ -63,17 +63,25 @@ public class ViewportLayout implements LayoutManager, Serializable
   public void removeLayoutComponent(Component c) 
   {
   }
+
   public Dimension preferredLayoutSize(Container parent) 
   {
     JViewport vp = (JViewport)parent;
     Component view = vp.getView();
+    if (view != null)
       return view.getPreferredSize();
+    else
+      return new Dimension();
   }
+
   public Dimension minimumLayoutSize(Container parent) 
   {
     JViewport vp = (JViewport)parent;
     Component view = vp.getView();
-    return view.getMinimumSize();
+    if (view != null)
+      return view.getMinimumSize();
+    else
+      return new Dimension();
   }
 
   /**
@@ -113,6 +121,9 @@ public class ViewportLayout implements LayoutManager, Serializable
     JViewport port = (JViewport) parent;    
     Component view = port.getView();
 
+    if (view == null)
+      return;
+
     // These dimensions and positions are in *view space*.  Do not mix
     // variables in here from port space (eg. parent.getBounds()). This
     // function should be entirely in view space, because the methods on
index 6002854..9f85164 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultRGHChooserPanel.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -57,7 +57,7 @@ import javax.swing.event.ChangeListener;
  * This is the default RGB panel for the JColorChooser. The color is selected
  * using three sliders that represent the RGB values.
  */
-public class DefaultRGBChooserPanel extends AbstractColorChooserPanel
+class DefaultRGBChooserPanel extends AbstractColorChooserPanel
 {
   /**
    * This class handles the slider value changes for all three sliders.
index 7e5a4ef..20a72f4 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultSwatchChooserPanel.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -432,7 +432,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
   /**
    * This class is the recent swatch panel. It holds recently selected colors.
    */
-  public static class RecentSwatchPanel extends SwatchPanel
+  static class RecentSwatchPanel extends SwatchPanel
   {
     /** The array for storing recently stored colors. */
     Color[] colors;
index 23caed0..b94b5f8 100644 (file)
@@ -1,5 +1,5 @@
 /* MouseInputAdapter.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -44,72 +44,76 @@ import java.awt.event.MouseEvent;
  * MouseInputAdapter
  * @author Andrew Selkirk
  */
-public class MouseInputAdapter extends         Object
-                                                               implements      MouseInputListener {
-
-       //-------------------------------------------------------------
-       // Initialization ---------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * Constructor MouseInputAdapter
-        */
-       public MouseInputAdapter() {
-       } // MouseInputAdapter()
-
-
-       //-------------------------------------------------------------
-       // Methods ----------------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * Mouse clicked
-        * @param event Mouse event
-        */
-       public void mouseClicked(MouseEvent event) {
-       } // mouseClicked()
-
-       /**
-        * Mouse dragged
-        * @param event Mouse event
-        */
-       public void mouseDragged(MouseEvent event) {
-       } // mouseDragged()
-
-       /**
-        * Mouse entered
-        * @param event Mouse event
-        */
-       public void mouseEntered(MouseEvent event) {
-       } // mouseEntered()
-
-       /**
-        * Mouse exited
-        * @param event Mouse event
-        */
-       public void mouseExited(MouseEvent event) {
-       } // mouseExited()
-
-       /**
-        * Mouse moved
-        * @param event Mouse event
-        */
-       public void mouseMoved(MouseEvent event) {
-       } // mouseMoved()
-
-       /**
-        * Mouse pressed
-        * @param event Mouse event
-        */
-       public void mousePressed(MouseEvent event) {
-       } // mousePressed()
-
-       /**
-        * Mouse released
-        * @param event Mouse event
-        */
-       public void mouseReleased(MouseEvent event) {
-       } // mouseReleased()
-
-
-} // MouseInputAdapterEvent
+public abstract class MouseInputAdapter implements MouseInputListener
+{
+  /**
+   * Constructor MouseInputAdapter
+   */
+  public MouseInputAdapter()
+  {
+    // Do nothing here.
+  }
+
+  /**
+   * Mouse clicked
+   * @param event Mouse event
+   */
+  public void mouseClicked(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+
+  /**
+   * Mouse dragged
+   * @param event Mouse event
+   */
+  public void mouseDragged(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+
+  /**
+   * Mouse entered
+   * @param event Mouse event
+   */
+  public void mouseEntered(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+
+  /**
+   * Mouse exited
+   * @param event Mouse event
+   */
+  public void mouseExited(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+
+  /**
+   * Mouse moved
+   * @param event Mouse event
+   */
+  public void mouseMoved(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+
+  /**
+   * Mouse pressed
+   * @param event Mouse event
+   */
+  public void mousePressed(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+
+  /**
+   * Mouse released
+   * @param event Mouse event
+   */
+  public void mouseReleased(MouseEvent event)
+  {
+    // Do nothing by default.
+  }
+}
index 2b4be67..48451c2 100644 (file)
@@ -1,4 +1,4 @@
-/* BasicButtonListener.java
+/* BasicButtonListener.java --
    Copyright (C) 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.plaf.basic;
 
 import java.awt.event.ActionEvent;
@@ -58,12 +59,19 @@ public class BasicButtonListener
   implements MouseListener, MouseMotionListener, FocusListener, 
              ChangeListener, PropertyChangeListener
 {
+  public BasicButtonListener(AbstractButton b)
+  {
+    // Do nothing here.
+  }
+  
   public void propertyChange(PropertyChangeEvent e)
   {
   }
+  
   protected void checkOpacity(AbstractButton b) 
   {    
   }
+  
   public void focusGained(FocusEvent e) 
   {    
     if (e.getSource() instanceof AbstractButton)
@@ -86,6 +94,7 @@ public class BasicButtonListener
           button.repaint();   
       }
   }
+  
   public void installKeyboardActions(JComponent c)
   {
     c.getActionMap().put("pressed", 
@@ -114,20 +123,25 @@ public class BasicButtonListener
                            }
                        });    
   }
+  
   public void uninstallKeyboardActions(JComponent c)
   {
     c.getActionMap().put("pressed", null);
     c.getActionMap().put("released", null);
   }
+  
   public void stateChanged(ChangeEvent e)
   {
   }
+  
   public void mouseMoved(MouseEvent e)
   {
   }
+  
   public void mouseDragged(MouseEvent e)
   {
   }
+  
   public void mouseClicked(MouseEvent e)
   {
   }
@@ -152,7 +166,6 @@ public class BasicButtonListener
       }
   }
 
-
   /**
    * Accept a mouse release event and set the button's 
    * "pressed" property to <code>true</code>, if the model
@@ -175,7 +188,6 @@ public class BasicButtonListener
       }
   }
 
-
   /**
    * Accept a mouse enter event and set the button's "rollover" property to
    * <code>true</code>, if the button's "rolloverEnabled" property is
index ed04d28..ed352e7 100644 (file)
@@ -1,5 +1,5 @@
-/* BasicButtonUI.java
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* BasicButtonUI.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.plaf.basic;
 
 import java.awt.Color;
@@ -133,10 +134,10 @@ public class BasicButtonUI extends ButtonUI
 
   protected BasicButtonListener createButtonListener(AbstractButton b)
   {
-    return new BasicButtonListener();
+    return new BasicButtonListener(b);
   }
 
-  public void installListeners(AbstractButton b)
+  protected void installListeners(AbstractButton b)
   {
     listener = createButtonListener(b);
     b.addChangeListener(listener);
@@ -146,7 +147,7 @@ public class BasicButtonUI extends ButtonUI
     b.addMouseMotionListener(listener);
   }
 
-  public void uninstallListeners(AbstractButton b)
+  protected void uninstallListeners(AbstractButton b)
   {
     b.removeChangeListener(listener);
     b.removePropertyChangeListener(listener);
index a0cf5a4..5d7bbcd 100644 (file)
@@ -98,7 +98,7 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
    */
   public void processMouseEvent(JMenuItem item, MouseEvent e,
                                 MenuElement[] path,
-                         MenuSelectionManager manager)
+                                MenuSelectionManager manager)
   {
   }
 }
index b306af7..a55e13c 100644 (file)
@@ -46,7 +46,6 @@ import java.awt.event.FocusListener;
 import javax.swing.ComboBoxEditor;
 import javax.swing.JTextField;
 import javax.swing.border.EmptyBorder;
-import javax.swing.plaf.UIResource;
 
 /**
  * This is a component that is responsible for displaying/editting  selected
index 5dc0f48..9f61e0d 100644 (file)
@@ -50,7 +50,6 @@ import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.border.Border;
 import javax.swing.border.EmptyBorder;
-import javax.swing.plaf.UIResource;
 
 /**
  * This class is renderer for the combo box. 
index 3ba13a2..9044ed7 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicComboBoxUI.java --
-   Copyright (C) 2004  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -80,6 +80,7 @@ import javax.swing.plaf.ComponentUI;
  * UI Delegate for JComboBox
  *
  * @author Olga Rodimina
+ * @author Robert Schuster
  */
 public class BasicComboBoxUI extends ComboBoxUI
 {
@@ -783,22 +784,25 @@ public class BasicComboBoxUI extends ComboBoxUI
       {
        Object currentValue = comboBox.getSelectedItem();
        boolean isPressed = arrowButton.getModel().isPressed();
-       if (currentValue != null)
-         {
-           Component comp = comboBox.getRenderer()
+
+       /* Gets the component to be drawn for the current value.
+        * If there is currently no selected item we will take an empty
+        * String as replacement.
+        */
+       Component comp = comboBox.getRenderer()
                                     .getListCellRendererComponent(listBox,
-                                                                  currentValue,
+                                                                  (currentValue != null ? currentValue : ""),
                                                                   -1,
                                                                   isPressed,
                                                                   hasFocus);
-           if (! comboBox.isEnabled())
+       if (! comboBox.isEnabled())
              comp.setEnabled(false);
 
-           g.translate(borderInsets.left, borderInsets.top);
+       g.translate(borderInsets.left, borderInsets.top);
            comp.setBounds(0, 0, bounds.width, bounds.height);
            comp.paint(g);
            g.translate(-borderInsets.left, -borderInsets.top);
-         }
+           
        comboBox.revalidate();
       }
     else
@@ -1142,7 +1146,7 @@ public class BasicComboBoxUI extends ComboBoxUI
      */
     public void propertyChange(PropertyChangeEvent e)
     {
-      if (e.getPropertyName().equals(JComboBox.ENABLED_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("enabled"))
         {
          arrowButton.setEnabled(comboBox.isEnabled());
 
@@ -1150,7 +1154,7 @@ public class BasicComboBoxUI extends ComboBoxUI
            comboBox.getEditor().getEditorComponent().setEnabled(comboBox
                                                                 .isEnabled());
         }
-      else if (e.getPropertyName().equals(JComboBox.EDITABLE_CHANGED_PROPERTY))
+      else if (e.getPropertyName().equals("editable"))
         {
          if (comboBox.isEditable())
            {
@@ -1166,7 +1170,7 @@ public class BasicComboBoxUI extends ComboBoxUI
          comboBox.revalidate();
          comboBox.repaint();
         }
-      else if (e.getPropertyName().equals(JComboBox.MODEL_CHANGED_PROPERTY))
+      else if (e.getPropertyName().equals("dataModel"))
         {
          // remove ListDataListener from old model and add it to new model
          ComboBoxModel oldModel = (ComboBoxModel) e.getOldValue();
index bec7f05..2acc21f 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicComboPopup.java --
-   Copyright (C) 2004  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -938,13 +938,13 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
 
     public void propertyChange(PropertyChangeEvent e)
     {
-      if (e.getPropertyName().equals(JComboBox.RENDERER_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("renderer"))
         {
          list.setCellRenderer((ListCellRenderer) e.getNewValue());
          revalidate();
          repaint();
         }
-      if (e.getPropertyName().equals(JComboBox.MODEL_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("dataModel"))
         {
          list.setModel((ComboBoxModel) e.getNewValue());
          revalidate();
@@ -1,5 +1,5 @@
-/* GtkArgList.java
-   Copyright (C) 1999 Free Software Foundation, Inc.
+/* BasicEditorPaneUI.java -- 
+   Copyright (C) 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -36,40 +36,33 @@ obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
-package gnu.java.awt.peer.gtk;
-import java.util.Vector;
+package javax.swing.plaf.basic;
 
-public class GtkArgList extends Vector
-{
-  void add (GtkArg arg)
-  {
-    addElement (arg);
-  }
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.text.Element;
+import javax.swing.text.PlainView;
+import javax.swing.text.View;
 
-  void add (String name, boolean value)
-  {
-    addElement (new GtkArg (name, Boolean.valueOf(value)));
-  }
-    
-  void add (String name, int value)
+public class BasicEditorPaneUI extends BasicTextUI
+{
+  public static ComponentUI createUI(JComponent comp)
   {
-    addElement (new GtkArg (name, new Integer (value)));
+    return new BasicEditorPaneUI();
   }
 
-  void add (String name, float value)
+  public BasicEditorPaneUI()
   {
-    addElement (new GtkArg (name, new Float (value)));
+    // Do nothing here.
   }
 
-  void add (String name, Object value)
+  public View create(Element elem)
   {
-    addElement (new GtkArg (name, value));
+    return new PlainView(elem);
   }
 
-  synchronized void setArgs (GtkComponentPeer cp)
+  protected String getPropertyPrefix()
   {
-    for (int i = 0; i < elementCount; i++)
-      cp.set ((GtkArg)elementData[i]);
+    return "EditorPane";
   }
 }
-  
index 36bb4ec..fd2832a 100644 (file)
@@ -288,6 +288,14 @@ public class BasicInternalFrameTitlePane extends JComponent
   protected class TitlePaneLayout implements LayoutManager
   {
     /**
+     * Creates a new <code>TitlePaneLayout</code> object.
+     */
+    public TitlePaneLayout()
+    {
+      // Do nothing.
+    }
+
+    /**
      * This method is called when adding a Component to the Container.
      *
      * @param name The name to reference the added Component by.
index 990a3e3..594bb7e 100644 (file)
@@ -821,7 +821,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
       if (e instanceof MouseEvent)
         {
          MouseEvent me = SwingUtilities.convertMouseEvent(frame.getRootPane()
-                                                                .getGlassPane(),
+                                                               .getGlassPane(),
                                                           (MouseEvent) e,
                                                           frame.getRootPane()
                                                                .getGlassPane());
@@ -1105,7 +1105,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
 
        installDefaults();
        installListeners();
-       installComponents();    
+       installComponents();
        installKeyboardActions();
 
        frame.setOpaque(true);
@@ -1122,7 +1122,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
   public void uninstallUI(JComponent c)
   {
     uninstallKeyboardActions();
-    uninstallComponents();    
+    uninstallComponents();
     uninstallListeners();
     uninstallDefaults();
 
index 46d012d..b278f1f 100644 (file)
@@ -176,12 +176,12 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
     if (icon != null)
       icon.paintIcon(b, g, ir.x, ir.y);
     if (text != null && ! text.equals(""))
-    {
-      if (b.isEnabled())
-        paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
-      else
-        paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
-    }
+      {
+       if (b.isEnabled())
+         paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+       else
+         paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+      }
     g.setFont(saved_font);
   }
 
index 50bbb81..b394217 100644 (file)
@@ -686,7 +686,7 @@ public class BasicListUI extends ListUI
       {
         Rectangle bounds = getCellBounds(list, row, row);
         if (bounds.intersects(clip))
-        paintCell(g, row, bounds, render, model, sel, lead);
+          paintCell(g, row, bounds, render, model, sel, lead);
       }
   }
 
index a1920fb..bed2d05 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicMenuBarUI.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -294,9 +294,9 @@ public class BasicMenuBarUI extends MenuBarUI
      */
     public void propertyChange(PropertyChangeEvent e)
     {
-      if (e.getPropertyName().equals(JMenuBar.BORDER_PAINTED_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("borderPainted"))
        menuBar.repaint();
-      if (e.getPropertyName().equals(JMenuBar.MARGIN_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("margin"))
        menuBar.repaint();
     }
   }
index da3f559..ff48a74 100644 (file)
@@ -619,9 +619,9 @@ public class BasicMenuItemUI extends MenuItemUI
                                                       textRect.y
                                                       + fm.getAscent());
        else
-    BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
-                                  textRect.y + fm.getAscent());
-  }
+         BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
+                                       textRect.y + fm.getAscent());
+      }
   }
 
   /**
@@ -760,7 +760,7 @@ public class BasicMenuItemUI extends MenuItemUI
     FontMetrics fm = g.getFontMetrics(acceleratorFont);
 
     if (menuItem.isEnabled())
-    g.setColor(acceleratorForeground);
+      g.setColor(acceleratorForeground);
     else
       // FIXME: should fix this to use 'disabledForeground', but its
       // default value in BasicLookAndFeel is null.
index 98af954..7cd16f9 100644 (file)
@@ -299,7 +299,7 @@ public class BasicMenuUI extends BasicMenuItemUI
        if (i) if this menu is a submenu in some other menu
           (ii) or if this menu is in a menu bar and some other menu in a menu bar was just
                selected. (If nothing was selected, menu should be pressed before
-               it will be selected)      
+               it will be selected)
       */
       JMenu menu = (JMenu) menuItem;
       if (! menu.isTopLevelMenu()
@@ -328,15 +328,15 @@ public class BasicMenuUI extends BasicMenuItemUI
       MenuSelectionManager manager = MenuSelectionManager.defaultManager();
       JMenu menu = (JMenu) menuItem;
       manager.processMouseEvent(e);
-      
+
       // Menu should be displayed when the menu is pressed only if 
       // it is top-level menu
       if (menu.isTopLevelMenu())
         {
          if (menu.getPopupMenu().isVisible())
-             // If menu is visible and menu button was pressed.. 
-             // then need to cancel the menu
-             manager.clearSelectedPath();
+           // If menu is visible and menu button was pressed.. 
+           // then need to cancel the menu
+           manager.clearSelectedPath();
          else
            {
              // Display the menu
index 609fd11..7d5e014 100644 (file)
@@ -847,17 +847,17 @@ public class BasicOptionPaneUI extends OptionPaneUI
     addIcon(messageArea);
 
     JPanel rightSide = new JPanel()
-    {
-    public Dimension getPreferredSize()
-    {
+      {
+       public Dimension getPreferredSize()
+       {
          int w = Math.max(optionPane.getSize().width, minimumWidth);
-      Insets i = optionPane.getInsets();
-      Dimension orig = super.getPreferredSize();
-      Dimension value = new Dimension(w - i.left - i.right - iconSize,
-                                      orig.height);
-      return value;
-    }
-    };    
+         Insets i = optionPane.getInsets();
+         Dimension orig = super.getPreferredSize();
+         Dimension value = new Dimension(w - i.left - i.right - iconSize,
+                                         orig.height);
+         return value;
+       }
+      };
     rightSide.setLayout(new GridBagLayout());
     GridBagConstraints con = createConstraints();
 
index 9398ab8..1feb2c4 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicProgressBarUI.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -103,7 +103,7 @@ public class BasicProgressBarUI extends ProgressBarUI
     {
       // Only need to listen for indeterminate changes.
       // All other things are done on a repaint.
-      if (e.getPropertyName().equals(JProgressBar.INDETERMINATE_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("inderterminate"))
        if (((Boolean) e.getNewValue()).booleanValue())
          startAnimationTimer();
        else
@@ -467,7 +467,7 @@ public class BasicProgressBarUI extends ProgressBarUI
   /**
    * This method increments the animation index.
    */
-  public void incrementAnimationIndex()
+  protected void incrementAnimationIndex()
   {
     animationIndex++;
     //numFrames is like string length, it should be named numFrames or something
index 3b17f36..55cfdc0 100644 (file)
@@ -66,11 +66,11 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
   /**
     * Factory method to create a BasicRadioButtonMenuItemUI for the given {@link
     * JComponent}, which should be a JRadioButtonMenuItem.
-   *
+    *
     * @param b The {@link JComponent} a UI is being created for.
-   *
+    *
     * @return A BasicRadioButtonMenuItemUI for the {@link JComponent}.
-   */
+    */
   public static ComponentUI createUI(JComponent b)
   {
     return new BasicRadioButtonMenuItemUI();
@@ -96,7 +96,7 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
    */
   public void processMouseEvent(JMenuItem item, MouseEvent e,
                                 MenuElement[] path,
-                         MenuSelectionManager manager)
+                                MenuSelectionManager manager)
   {
   }
 }
index 110200e..4923b90 100644 (file)
@@ -49,17 +49,17 @@ import javax.swing.plaf.RootPaneUI;
 public class BasicRootPaneUI extends RootPaneUI
   implements PropertyChangeListener
 {
-    public static ComponentUI createUI(JComponent x) 
-    {
-        return new BasicRootPaneUI();
-    }
+  public static ComponentUI createUI(JComponent x) 
+  {
+    return new BasicRootPaneUI();
+  }
 
-    public void installUI(JComponent c)
-    {
-      c.setOpaque(true);
+  public void installUI(JComponent c)
+  {
+    c.setOpaque(true);
     c.setBackground(UIManager.getColor("control"));
-      super.installUI(c);
-    }
+    super.installUI(c);
+  }
 
   public void propertyChange(PropertyChangeEvent event)
   {
index 446726e..36939b2 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicScrollBarUI.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -142,13 +142,13 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
      */
     public void propertyChange(PropertyChangeEvent e)
     {
-      if (e.getPropertyName().equals(JScrollBar.MODEL_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("model"))
         {
          ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener);
          scrollbar.getModel().addChangeListener(modelListener);
          getThumbBounds();
         }
-      else if (e.getPropertyName().equals(JScrollBar.ORIENTATION_CHANGED_PROPERTY))
+      else if (e.getPropertyName().equals("orientation"))
         {
          incrButton.removeMouseListener(buttonListener);
          decrButton.removeMouseListener(buttonListener);
index 4d70412..b4618b2 100644 (file)
@@ -53,11 +53,11 @@ import javax.swing.plaf.ScrollPaneUI;
 public class BasicScrollPaneUI extends ScrollPaneUI
   implements ScrollPaneConstants
 {
-
-    public static ComponentUI createUI(final JComponent c) 
-    {
-       return new BasicScrollPaneUI();
-    }
+  
+  public static ComponentUI createUI(final JComponent c) 
+  {
+    return new BasicScrollPaneUI();
+  }
 
   protected void installDefaults(JScrollPane p)
   {
@@ -77,9 +77,9 @@ public class BasicScrollPaneUI extends ScrollPaneUI
     p.setBorder(null);
   }
     
-    public void installUI(final JComponent c) 
-    {
-       super.installUI(c);
+  public void installUI(final JComponent c) 
+  {
+    super.installUI(c);
     this.installDefaults((JScrollPane)c);
   }
 
@@ -87,29 +87,29 @@ public class BasicScrollPaneUI extends ScrollPaneUI
   {
     super.uninstallUI(c);
     this.uninstallDefaults((JScrollPane)c);
-    }
-    
+  }
+
     
-    public Dimension getMinimumSize(JComponent c) 
-    {
-       JScrollPane p = (JScrollPane ) c;
-        ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout();
-        return sl.minimumLayoutSize(c);
-    }
-
-    public Dimension getPreferredSize(JComponent c) 
-    {
-       JScrollPane p = (JScrollPane ) c;
-        ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout();
-        return sl.preferredLayoutSize(c);
-    }
-
-
-    public void paint(Graphics g, JComponent c)
-    {      
-      // do nothing; the normal painting-of-children algorithm, along with
-      // ScrollPaneLayout, does all the relevant work.
-    }
+  public Dimension getMinimumSize(JComponent c) 
+  {
+    JScrollPane p = (JScrollPane ) c;
+    ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout();
+    return sl.minimumLayoutSize(c);
+  }
+
+  public Dimension getPreferredSize(JComponent c) 
+  {
+    JScrollPane p = (JScrollPane ) c;
+    ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout();
+    return sl.preferredLayoutSize(c);
+  }
+
+
+  public void paint(Graphics g, JComponent c)
+  {      
+    // do nothing; the normal painting-of-children algorithm, along with
+    // ScrollPaneLayout, does all the relevant work.
+  }
 }
 
 
index 648e332..a08acc9 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicSliderUI.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -139,7 +139,7 @@ public class BasicSliderUI extends SliderUI
   /**
    * Helper class that listens to the {@link JSlider}'s model for changes.
    */
-  protected class ChangeHandler implements ChangeListener
+  public class ChangeHandler implements ChangeListener
   {
     /**
      * Called when the slider's model has been altered. The UI delegate should
@@ -182,7 +182,7 @@ public class BasicSliderUI extends SliderUI
   /**
    * Helper class that listens for focus events.
    */
-  protected class FocusHandler implements FocusListener
+  public class FocusHandler implements FocusListener
   {
     /**
      * Called when the {@link JSlider} has gained focus.  It should repaint
@@ -211,7 +211,7 @@ public class BasicSliderUI extends SliderUI
    * Helper class that listens for changes to the properties of the {@link
    * JSlider}.
    */
-  protected class PropertyChangeHandler implements PropertyChangeListener
+  public class PropertyChangeHandler implements PropertyChangeListener
   {
     /**
      * Called when one of the properties change. The UI should recalculate any
@@ -222,15 +222,15 @@ public class BasicSliderUI extends SliderUI
     public void propertyChange(PropertyChangeEvent e)
     {
       // Check for orientation changes.
-      if (e.getPropertyName().equals(JSlider.ORIENTATION_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("orientation"))
        recalculateIfOrientationChanged();
-      else if (e.getPropertyName().equals(JSlider.MODEL_CHANGED_PROPERTY))
-      {
-        BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
-       oldModel.removeChangeListener(changeListener);
-       slider.getModel().addChangeListener(changeListener);
-       calculateThumbLocation();
-      }
+      else if (e.getPropertyName().equals("model"))
+        {
+         BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
+         oldModel.removeChangeListener(changeListener);
+         slider.getModel().addChangeListener(changeListener);
+         calculateThumbLocation();
+        }
 
       // elif the componentOrientation changes (this is a bound property,
       // just undocumented) we change leftToRightCache. In Sun's 
@@ -247,7 +247,7 @@ public class BasicSliderUI extends SliderUI
    * for listening to the timer and moving the thumb in the proper direction
    * every interval.
    */
-  protected class ScrollListener implements ActionListener
+  public class ScrollListener implements ActionListener
   {
     /** Indicates which direction the thumb should scroll. */
     private transient int direction;
@@ -346,15 +346,15 @@ public class BasicSliderUI extends SliderUI
       currentMouseX = e.getX();
       currentMouseY = e.getY();
       if (slider.getValueIsAdjusting())
-      {
-        int value;
-        if (slider.getOrientation() == JSlider.HORIZONTAL)
-         value = valueForXPosition(currentMouseX) - offset;
-       else
-         value = valueForYPosition(currentMouseY) - offset;
-       
-       slider.setValue(value);
-      }
+        {
+         int value;
+         if (slider.getOrientation() == JSlider.HORIZONTAL)
+           value = valueForXPosition(currentMouseX) - offset;
+         else
+           value = valueForYPosition(currentMouseY) - offset;
+
+         slider.setValue(value);
+        }
     }
 
     /**
@@ -391,7 +391,7 @@ public class BasicSliderUI extends SliderUI
        value = findClosestTick(value);
 
       // If the thumb is hit, then we don't need to set the timers to move it. 
-      if (!thumbRect.contains(e.getPoint()))
+      if (! thumbRect.contains(e.getPoint()))
         {
          // The mouse has hit some other part of the slider.
          // The value moves no matter where in the slider you hit.
@@ -403,8 +403,8 @@ public class BasicSliderUI extends SliderUI
       else
         {
          slider.setValueIsAdjusting(true);
-          offset = value - slider.getValue();
-       }
+         offset = value - slider.getValue();
+        }
     }
 
     /**
@@ -419,11 +419,11 @@ public class BasicSliderUI extends SliderUI
       currentMouseY = e.getY();
 
       if (slider.getValueIsAdjusting())
-      {
-        slider.setValueIsAdjusting(false);
-       if (slider.getSnapToTicks())
-         slider.setValue(findClosestTick(slider.getValue()));
-      }
+        {
+         slider.setValueIsAdjusting(false);
+         if (slider.getSnapToTicks())
+           slider.setValue(findClosestTick(slider.getValue()));
+        }
       if (scrollTimer != null)
        scrollTimer.stop();
     }
@@ -862,22 +862,22 @@ public class BasicSliderUI extends SliderUI
   public Dimension getPreferredHorizontalSize()
   {
     Insets insets = slider.getInsets();
-    
+
     // The width should cover all the labels (which are usually the
     // deciding factor of the width)
     int width = getWidthOfWidestLabel() * (slider.getLabelTable() == null ? 0
                                                                           : slider.getLabelTable()
                                                                                   .size());
-    
+
     // If there are not enough labels.
     // This number is pretty much arbitrary, but it looks nice.
     if (width < 200)
       width = 200;
-    
+
     // We can only draw inside of the focusRectangle, so we have to
     // pad it with insets.
     width += insets.left + insets.right + focusInsets.left + focusInsets.right;
-      
+
     // Height is determined by the thumb, the ticks and the labels.
     int height = thumbHeight;
 
@@ -887,10 +887,10 @@ public class BasicSliderUI extends SliderUI
 
     if (slider.getPaintLabels())
       height += getHeightOfTallestLabel();
-    
+
     height += insets.top + insets.bottom + focusInsets.top
     + focusInsets.bottom;
-             
+
     return new Dimension(width, height);
   }
 
@@ -903,19 +903,19 @@ public class BasicSliderUI extends SliderUI
   public Dimension getPreferredVerticalSize()
   {
     Insets insets = slider.getInsets();
-    
+
     int height = getHeightOfTallestLabel() * (slider.getLabelTable() == null
                                               ? 0 : slider.getLabelTable()
                                                           .size());
-    
+
     if (height < 200)
       height = 200;
-      
+
     height += insets.top + insets.bottom + focusInsets.top
     + focusInsets.bottom;
 
     int width = thumbHeight;
-    
+
     if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0
         || slider.getMinorTickSpacing() > 0)
       width += tickHeight;
@@ -924,7 +924,7 @@ public class BasicSliderUI extends SliderUI
       width += getWidthOfWidestLabel();
 
     width += insets.left + insets.right + focusInsets.left + focusInsets.right;
-            
+
     return new Dimension(width, height);
   }
 
@@ -960,7 +960,7 @@ public class BasicSliderUI extends SliderUI
    * @return The dimensions of the preferred size.
    */
   public Dimension getPreferredSize(JComponent c)
-  {   
+  {
     if (slider.getOrientation() == JSlider.HORIZONTAL)
       return getPreferredHorizontalSize();
     else
@@ -1000,22 +1000,22 @@ public class BasicSliderUI extends SliderUI
     else
       return getPreferredVerticalSize();
   }
-  
+
   /**
    * This method calculates all the sizes of the rectangles by delegating to
    * the helper methods calculateXXXRect.
    */
-   protected void calculateGeometry()
-   {
-     calculateFocusRect();
-     calculateContentRect();
-     calculateThumbSize();
-     calculateTrackBuffer();
-     calculateTrackRect();
-     calculateTickRect();
-     calculateLabelRect();
-     calculateThumbLocation();
-   }
+  protected void calculateGeometry()
+  {
+    calculateFocusRect();
+    calculateContentRect();
+    calculateThumbSize();
+    calculateTrackBuffer();
+    calculateTrackRect();
+    calculateTickRect();
+    calculateLabelRect();
+    calculateThumbLocation();
+  }
 
   /**
    * This method calculates the size and position of the focusRect. This
@@ -1412,7 +1412,7 @@ public class BasicSliderUI extends SliderUI
     leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT;
     // FIXME: This next line is only here because the above line is here.
     calculateThumbLocation();
-    
+
     if (slider.getPaintTrack())
       paintTrack(g);
     if (slider.getPaintTicks())
@@ -1573,8 +1573,8 @@ public class BasicSliderUI extends SliderUI
          {
            double loc = tickRect.x;
            double increment = (max == min) ? 0
-                                        : majorSpace * (double) tickRect.width / (max
-                                        - min);
+                                           : majorSpace * (double) tickRect.width / (max
+                                           - min);
            if (drawInverted())
              {
                loc += tickRect.width;
@@ -1590,8 +1590,8 @@ public class BasicSliderUI extends SliderUI
          {
            double loc = tickRect.height + tickRect.y;
            double increment = (max == min) ? 0
-                                        : -majorSpace * (double) tickRect.height / (max
-                                        - min);
+                                           : -majorSpace * (double) tickRect.height / (max
+                                           - min);
            if (drawInverted())
              {
                loc = tickRect.y;
@@ -1610,8 +1610,8 @@ public class BasicSliderUI extends SliderUI
          {
            double loc = tickRect.x;
            double increment = (max == min) ? 0
-                                        : minorSpace * (double) tickRect.width / (max
-                                        - min);
+                                           : minorSpace * (double) tickRect.width / (max
+                                           - min);
            if (drawInverted())
              {
                loc += tickRect.width;
@@ -1627,8 +1627,8 @@ public class BasicSliderUI extends SliderUI
          {
            double loc = tickRect.height + tickRect.y;
            double increment = (max == min) ? 0
-                                        : -minorSpace * (double) tickRect.height / (max
-                                        - min);
+                                           : -minorSpace * (double) tickRect.height / (max
+                                           - min);
            if (drawInverted())
              {
                loc = tickRect.y;
@@ -1800,13 +1800,13 @@ public class BasicSliderUI extends SliderUI
     Dimension dim = label.getPreferredSize();
     int w = (int) dim.getWidth();
     int h = (int) dim.getHeight();
-    
+
     int max = slider.getMaximum();
     int min = slider.getMinimum();
 
     if (value > max || value < min)
       return;
-    
+
     //           value
     //             |
     //        ------------
@@ -2027,7 +2027,7 @@ public class BasicSliderUI extends SliderUI
   protected void scrollDueToClickInTrack(int dir)
   {
     scrollTimer.stop();
-  
+
     scrollListener.setDirection(dir);
     scrollListener.setScrollByBlock(true);
 
index 1ee1bb6..987f86b 100644 (file)
@@ -160,6 +160,7 @@ public class BasicSplitPaneDivider extends Container
    */
   private transient int currentDividerLocation = 1;
 
+  /** DOCUMENT ME! */
   private transient Border tmpBorder = new Border()
     {
       public Insets getBorderInsets(Component c)
index 7073086..a533f08 100644 (file)
@@ -1,5 +1,5 @@
-/* BasicTabbedPaneUI.java
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* BasicTabbedPaneUI.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.plaf.basic;
 
 import java.awt.Color;
@@ -75,7 +76,6 @@ import javax.swing.plaf.TabbedPaneUI;
 import javax.swing.plaf.UIResource;
 import javax.swing.text.View;
 
-
 /**
  * This is the Basic Look and Feel's UI delegate for JTabbedPane.
  */
@@ -84,7 +84,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
   /**
    * A helper class that handles focus.
    */
-  protected class FocusHandler extends FocusAdapter
+  public class FocusHandler extends FocusAdapter
   {
     /**
      * This method is called when the component gains focus.
@@ -112,7 +112,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
    * sets the index appropriately. In SCROLL_TAB_MODE, this class also
    * handles the mouse clicks on the scrolling buttons.
    */
-  protected class MouseHandler extends MouseAdapter
+  public class MouseHandler extends MouseAdapter
   {
     /**
      * This method is called when the mouse is pressed. The index cannot
@@ -184,13 +184,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
      */
     public void propertyChange(PropertyChangeEvent e)
     {
-      if (e.getPropertyName().equals(JTabbedPane.TAB_LAYOUT_POLICY_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("tabLayoutPolicy"))
         {
          layoutManager = createLayoutManager();
 
          tabPane.setLayout(layoutManager);
         }
-      else if (e.getPropertyName().equals(JTabbedPane.TAB_PLACEMENT_CHANGED_PROPERTY)
+      else if (e.getPropertyName().equals("tabPlacement")
                && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
         {
          incrButton = createIncreaseButton();
@@ -1459,7 +1459,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
    *
    * @return A layout manager given the tab layout policy.
    */
-  public LayoutManager createLayoutManager()
+  protected LayoutManager createLayoutManager()
   {
     if (tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT)
       return new TabbedPaneLayout();
index ea7dfc0..ebc702a 100644 (file)
@@ -191,8 +191,8 @@ public class BasicTableHeaderUI
     int spacing = 0;
 
     if (header.getTable() != null 
-        && header.getTable().getInterCellSpacing() != null)
-      spacing = header.getTable().getInterCellSpacing().width;
+        && header.getTable().getIntercellSpacing() != null)
+      spacing = header.getTable().getIntercellSpacing().width;
     
     for (int i = 0; i < ncols; ++i)      
       {
index eb0054b..9be6d60 100644 (file)
@@ -104,45 +104,12 @@ public class BasicTableUI
   {
     Point begin, curr;
 
-    private int getRowForPoint(Point p)
-    {      
-      int y0 = table.getLocation().y;
-      int nrows = table.getRowCount();
-      Dimension gap = table.getInterCellSpacing();
-      int height = table.getRowHeight() + (gap == null ? 0 : gap.height);
-      int y = p.y;
-      for (int i = 0; i < nrows; ++i)
-        {
-          if (0 <= y && y < height)
-            return i;
-          y -= height;
-        }
-      return -1;
-    }
-
-    private int getColForPoint(Point p)
-    {
-      int x0 = table.getLocation().x;
-      int ncols = table.getColumnCount();
-      Dimension gap = table.getInterCellSpacing();
-      TableColumnModel cols = table.getColumnModel();      
-      int x = p.x;
-      for (int i = 0; i < ncols; ++i)
-        {
-          int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : gap.width);
-          if (0 <= x && x < width)
-            return i;
-          x -= width;
-        }
-      return -1;
-    }
-
     private void updateSelection()
     {
       if (table.getRowSelectionAllowed())
         {
-          int lo_row = getRowForPoint(begin);
-          int hi_row  = getRowForPoint(curr);
+          int lo_row = table.rowAtPoint(begin);
+          int hi_row  = table.rowAtPoint(curr);
           ListSelectionModel rowModel = table.getSelectionModel();
           if (lo_row != -1 && hi_row != -1)
             rowModel.setSelectionInterval(lo_row, hi_row);
@@ -150,8 +117,8 @@ public class BasicTableUI
 
       if (table.getColumnSelectionAllowed())
         {
-          int lo_col = getColForPoint(begin);
-          int hi_col = getColForPoint(curr);
+          int lo_col = table.columnAtPoint(begin);
+          int hi_col = table.columnAtPoint(curr);
           ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
           if (lo_col != -1 && hi_col != -1)
             colModel.setSelectionInterval(lo_col, hi_col);
@@ -294,7 +261,7 @@ public class BasicTableUI
     int x = x0;
     int y = y0;
 
-    Dimension gap = table.getInterCellSpacing();
+    Dimension gap = table.getIntercellSpacing();
     int ymax = clip.y + clip.height;
     int xmax = clip.x + clip.width;
 
index 615c74b..ac20a0a 100644 (file)
@@ -38,23 +38,22 @@ exception statement from your version. */
 
 package javax.swing.plaf.basic;
 
-import java.beans.PropertyChangeEvent;
-
 import javax.swing.JComponent;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.text.Element;
 import javax.swing.text.PlainView;
 import javax.swing.text.View;
 
-public class BasicTextPaneUI extends BasicTextUI
+public class BasicTextPaneUI extends BasicEditorPaneUI
 {
-  public static ComponentUI createUI(JComponent comp)
+  public BasicTextPaneUI()
   {
-    return new BasicTextPaneUI();
+    // Do nothing here.
   }
 
-  public BasicTextPaneUI()
+  public static ComponentUI createUI(JComponent comp)
   {
+    return new BasicTextPaneUI();
   }
 
   public View create(Element elem)
index b3d03db..a94ca2b 100644 (file)
@@ -1,5 +1,5 @@
-/* BasicTextUI.java
-   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+/* BasicTextUI.java --
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -94,7 +94,7 @@ public abstract class BasicTextUI extends TextUI
     {
     }
   }
-
+  
   private class RootView extends View
   {
     private View view;
@@ -104,6 +104,8 @@ public abstract class BasicTextUI extends TextUI
       super(null);
     }
 
+    // View methods.
+
     public ViewFactory getViewFactory()
     {
       // FIXME: Handle EditorKit somehow.
@@ -111,8 +113,8 @@ public abstract class BasicTextUI extends TextUI
     }
 
     public void setView(View v)
-      {
-          if (view != null)
+    {
+      if (view != null)
        view.setParent(null);
       
       if (v != null)
@@ -122,17 +124,17 @@ public abstract class BasicTextUI extends TextUI
     }
 
     public Container getContainer()
-              {
+    {
       return textComponent;
     }
-
+    
     public float getPreferredSpan(int axis)
     {
       if (view != null)
        return view.getPreferredSpan(axis);
 
       return Integer.MAX_VALUE;
-              }
+    }
 
     public void paint(Graphics g, Shape s)
     {
@@ -140,9 +142,12 @@ public abstract class BasicTextUI extends TextUI
        view.paint(g, s);
     }
 
-    protected Rectangle modelToView(int position, Shape a, Position.Bias bias)
+    public Shape modelToView(int position, Shape a, Position.Bias bias)
       throws BadLocationException
     {
+      if (view == null)
+       return null;
+      
       return ((PlainView) view).modelToView(position, a, bias).getBounds();
     }
   }
@@ -183,7 +188,7 @@ public abstract class BasicTextUI extends TextUI
   {
     return textComponent;
   }
-
+  
   public void installUI(final JComponent c)
   {
     super.installUI(c);
@@ -327,11 +332,12 @@ public abstract class BasicTextUI extends TextUI
     rootView.setView(null);
 
     textComponent.removePropertyChangeListener(updateHandler);
-    textComponent = null;
 
     uninstallDefaults();
     uninstallListeners();
     uninstallKeyboardActions();
+
+    textComponent = null;
   }
 
   protected void uninstallDefaults()
@@ -360,7 +366,7 @@ public abstract class BasicTextUI extends TextUI
 
     return new Dimension((int) w, (int) h);
   }
-
+  
   public final void paint(Graphics g, JComponent c)
   {
     paintSafely(g);
@@ -442,13 +448,13 @@ public abstract class BasicTextUI extends TextUI
 
   public View create(Element elem)
   {
-    // subclasses have to implement this to get this functionality
+    // Subclasses have to implement this to get this functionality.
     return null;
   }
 
   public View create(Element elem, int p0, int p1)
   {
-    // subclasses have to implement this to get this functionality
+    // Subclasses have to implement this to get this functionality.
     return null;
   }
   
index 8315fc0..fad0108 100644 (file)
@@ -1,5 +1,5 @@
 /* BasicToolBarUI.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -92,40 +92,40 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
   private static Border rolloverBorder;
 
   /** The last known BorderLayout constraint before floating. */
-    protected String constraintBeforeFloating;
+  protected String constraintBeforeFloating;
 
   /** The last known orientation of the JToolBar before floating. */
   private int lastGoodOrientation;
 
   /** The color of the border when it is dockable. */
-    protected Color dockingBorderColor;
+  protected Color dockingBorderColor;
 
   /** The background color of the JToolBar when it is dockable. */
-    protected Color dockingColor;
+  protected Color dockingColor;
 
   /** The docking listener responsible for mouse events on the JToolBar. */
-    protected MouseInputListener dockingListener;
+  protected MouseInputListener dockingListener;
 
   /** The window used for dragging the JToolBar. */
-    protected BasicToolBarUI.DragWindow dragWindow;
+  protected BasicToolBarUI.DragWindow dragWindow;
 
   /** The color of the border when it is not dockable. */
-    protected Color floatingBorderColor;
+  protected Color floatingBorderColor;
 
   /** The background color of the JToolBar when it is not dockable. */
-    protected Color floatingColor;
+  protected Color floatingColor;
 
   /** The index of the focused component. */
-    protected int focusedCompIndex;
+  protected int focusedCompIndex;
 
   /** The PropertyChangeListener for the JToolBar. */
-    protected PropertyChangeListener propertyListener;
+  protected PropertyChangeListener propertyListener;
 
   /** The JToolBar this UI delegate is responsible for. */
-    protected JToolBar toolBar;
+  protected JToolBar toolBar;
 
   /** The Container listener for the JToolBar. */
-    protected ContainerListener toolBarContListener;
+  protected ContainerListener toolBarContListener;
 
   /** The Focus listener for the JToolBar. */
   protected FocusListener toolBarFocusListener;
@@ -152,11 +152,11 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
   private transient int cachedOrientation;
 
   /**
-   * This method creates a new BasicToolBarUI object for the given JToolBar.
+   * This method creates a new <code>BasicToolBarUI</code> object for the given JToolBar.
    */
   public BasicToolBarUI()
   {
-    super();
+    // Do nothing here.
   }
 
   /**
@@ -168,13 +168,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return Whether the JToolBar can dock.
    */
-  protected boolean canDock(Component c, Point p)
-    {
-    if (areaOfClick(c, p) != -1)
-      return true;
-
-       return false;
-    }
+  public boolean canDock(Component c, Point p)
+  {
+    return areaOfClick(c, p) != -1;
+  }
 
   /**
    * This helper method returns the position of the JToolBar if it can dock.
@@ -219,10 +216,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return A new DockingListener for the JToolBar.
    */
-    protected MouseInputListener createDockingListener()
-    {
+  protected MouseInputListener createDockingListener()
+  {
     return new DockingListener(toolBar);
-    }
+  }
 
   /**
    * This method creates a new DragWindow for the given JToolBar.
@@ -231,10 +228,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return A new DragWindow.
    */
-    protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar)
-    {
+  protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar)
+  {
     return new DragWindow();
-    }
+  }
 
   /**
    * This method creates a new floating frame for the JToolBar. By default,
@@ -245,11 +242,11 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return A new floating frame.
    */
-    protected JFrame createFloatingFrame(JToolBar toolbar)
-    {
+  protected JFrame createFloatingFrame(JToolBar toolbar)
+  {
     // FIXME: Though deprecated, this should still work.
-      return null;
-    }
+    return null;
+  }
 
   /**
    * This method creates a new floating window for the JToolBar. This is the
@@ -259,21 +256,21 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return A new floating window.
    */
-    protected RootPaneContainer createFloatingWindow(JToolBar toolbar)
-    {
+  protected RootPaneContainer createFloatingWindow(JToolBar toolbar)
+  {
     // This one is used by default though.
     return new ToolBarDialog();
-    }
+  }
 
   /**
    * This method creates a new WindowListener for the JToolBar.
    *
    * @return A new WindowListener.
    */
-    protected WindowListener createFrameListener()
-    {
+  protected WindowListener createFrameListener()
+  {
     return new FrameListener();
-    }
+  }
 
   /**
    * This method creates a new nonRolloverBorder for JButtons when the
@@ -281,20 +278,20 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return A new NonRolloverBorder.
    */
-    protected Border createNonRolloverBorder()
-    {
+  protected Border createNonRolloverBorder()
+  {
     return new EtchedBorderUIResource();
-    }
+  }
 
   /**
    * This method creates a new PropertyChangeListener for the JToolBar.
    *
    * @return A new PropertyChangeListener.
    */
-    protected PropertyChangeListener createPropertyListener()
-    {
+  protected PropertyChangeListener createPropertyListener()
+  {
     return new PropertyListener();
-    }
+  }
 
   /**
    * This method creates a new rollover border for JButtons when the
@@ -302,8 +299,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @return A new rollover border.
    */
-    protected Border createRolloverBorder()
-    {
+  protected Border createRolloverBorder()
+  {
     return new EtchedBorderUIResource()
       {
        public void paintBorder(Component c, Graphics g, int x, int y,
@@ -316,27 +313,27 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
            }
        }
       };
-    }
+  }
 
   /**
    * This method creates a new Container listener for the JToolBar.
    *
    * @return A new Container listener.
    */
-    protected ContainerListener createToolBarContListener()
-    {
+  protected ContainerListener createToolBarContListener()
+  {
     return new ToolBarContListener();
-    }
+  }
 
   /**
    * This method creates a new FocusListener for the JToolBar.
    *
    * @return A new FocusListener for the JToolBar.
    */
-    protected FocusListener createToolBarFocusListener()
-    {
+  protected FocusListener createToolBarFocusListener()
+  {
     return new ToolBarFocusListener();
-    }
+  }
 
   /**
    * This method creates a new UI delegate for the given JComponent.
@@ -357,8 +354,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param position The mouse cursor coordinates relative to the JToolBar.
    * @param origin The screen position of the JToolBar.
    */
-    protected void dragTo(Point position, Point origin)
-    {
+  protected void dragTo(Point position, Point origin)
+  {
     int loc = areaOfClick(origParent,
                           SwingUtilities.convertPoint(toolBar, position,
                                                       origParent));
@@ -390,7 +387,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
       {
        w = cachedBounds.height;
        h = cachedBounds.width;
-    }
+      }
 
     Point p = dragWindow.getOffset();
     Insets insets = toolBar.getInsets();
@@ -414,8 +411,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param origin The screen position of the JToolBar before the drag session
    *        started.
    */
-    protected void floatAt(Point position, Point origin)
-    {
+  protected void floatAt(Point position, Point origin)
+  {
     Point p = new Point(position);
     int aoc = areaOfClick(origParent,
                           SwingUtilities.convertPoint(toolBar, p, origParent));
@@ -434,7 +431,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
       {
        floatFrame.hide();
        newParent = origParent;
-    }
+      }
 
     String constraint;
     switch (aoc)
@@ -499,9 +496,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return The docking color.
    */
   public Color getDockingColor()
-    {
-       return dockingColor;
-    }
+  {
+    return dockingColor;
+  }
 
   /**
    * This method returns the Color which is displayed when over a floating
@@ -510,9 +507,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return The color which is displayed when over a floating area.
    */
   public Color getFloatingColor()
-    {
-       return floatingColor;
-    }
+  {
+    return floatingColor;
+  }
 
   /**
    * This method returns the maximum size of the given JComponent for this UI.
@@ -522,9 +519,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return The maximum size for this UI.
    */
   public Dimension getMaximumSize(JComponent c)
-    {
+  {
     return getPreferredSize(c);
-    }
+  }
 
   /**
    * This method returns the minimum size of the given JComponent for this UI.
@@ -534,9 +531,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return The minimum size for this UI.
    */
   public Dimension getMinimumSize(JComponent c)
-    {
+  {
     return getPreferredSize(c);
-    }
+  }
 
   /**
    * This method returns the preferred size of the given JComponent for this
@@ -547,15 +544,15 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return The preferred size for this UI.
    */
   public Dimension getPreferredSize(JComponent c)
-    {
+  {
     return toolBar.getLayout().preferredLayoutSize(c);
-    }
+  }
 
   /**
    * This method installs the needed components for the JToolBar.
    */
-    protected void installComponents()
-    {
+  protected void installComponents()
+  {
     floatFrame = (Window) createFloatingWindow(toolBar);
 
     dragWindow = createDragWindow(toolBar);
@@ -569,13 +566,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
     borders = new Hashtable();
 
     fillHashtable();
-    }
+  }
 
   /**
    * This method installs the defaults as specified by the look and feel.
    */
-    protected void installDefaults()
-    {
+  protected void installDefaults()
+  {
     UIDefaults defaults = UIManager.getLookAndFeelDefaults();
 
     toolBar.setBorder(new ToolBarBorder());
@@ -588,24 +585,24 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
 
     floatingBorderColor = defaults.getColor("ToolBar.floatingForeground");
     floatingColor = defaults.getColor("ToolBar.floatingBackground");
-    }
+  }
 
   /**
    * This method installs the keyboard actions for the JToolBar as specified
    * by the look and feel.
    */
-    protected void installKeyboardActions()
-    {
+  protected void installKeyboardActions()
+  {
     // FIXME: implement.
-    }
+  }
 
   /**
    * This method installs listeners for the JToolBar.
    *
    * @param toolbar The JToolBar to register listeners for.
    */
-    protected void installListeners(JToolBar toolbar)
-    {
+  protected void installListeners(JToolBar toolbar)
+  {
     dockingListener = createDockingListener();
     toolBar.addMouseListener(dockingListener);
     toolBar.addMouseMotionListener(dockingListener);
@@ -630,13 +627,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param c The JComponent whose children need to have non rollover borders
    *        installed.
    */
-    protected void installNonRolloverBorders(JComponent c)
-    {
+  protected void installNonRolloverBorders(JComponent c)
+  {
     Component[] components = toolBar.getComponents();
 
     for (int i = 0; i < components.length; i++)
       setBorderToNonRollover(components[i]);
-    }
+  }
 
   /**
    * This method installs normal (or their original) borders for each
@@ -645,13 +642,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param c The JComponent whose children need to have their original
    *        borders installed.
    */
-    protected void installNormalBorders(JComponent c)
-    {
+  protected void installNormalBorders(JComponent c)
+  {
     Component[] components = toolBar.getComponents();
 
     for (int i = 0; i < components.length; i++)
       setBorderToNormal(components[i]);
-    }
+  }
 
   /**
    * This method install rollover borders for each component inside the given
@@ -660,13 +657,13 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param c The JComponent whose children need to have rollover borders
    *        installed.
    */
-    protected void installRolloverBorders(JComponent c)
-    {
+  protected void installRolloverBorders(JComponent c)
+  {
     Component[] components = toolBar.getComponents();
 
     for (int i = 0; i < components.length; i++)
       setBorderToRollover(components[i]);
-    }
+  }
 
   /**
    * This method fills the borders hashtable with a list of components that
@@ -694,20 +691,20 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @param c The JComponent to install a UI for.
    */
-    public void installUI(JComponent c)
-    {
-       super.installUI(c);
+  public void installUI(JComponent c)
+  {
+    super.installUI(c);
 
-       if (c instanceof JToolBar)
-       {
-           toolBar = (JToolBar) c;
-           toolBar.setOpaque(true);
+    if (c instanceof JToolBar)
+      {
+       toolBar = (JToolBar) c;
+       toolBar.setOpaque(true);
        installDefaults();
        installComponents();
-           installListeners(toolBar);
+       installListeners(toolBar);
        installKeyboardActions();
-       }
-    }
+      }
+  }
 
   /**
    * This method returns whether the JToolBar is floating.
@@ -715,9 +712,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return Whether the JToolBar is floating.
    */
   public boolean isFloating()
-    {
+  {
     return floatFrame.isVisible();
-    }
+  }
 
   /**
    * This method returns whether rollover borders have been set.
@@ -725,9 +722,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @return Whether rollover borders have been set.
    */
   public boolean isRolloverBorders()
-    {
+  {
     return toolBar.isRollover();
-    }
+  }
 
   /**
    * This method navigates in the given direction giving focus to the next
@@ -735,10 +732,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @param direction The direction to give focus to.
    */
-    protected void navigateFocusedComp(int direction)
-    {
+  protected void navigateFocusedComp(int direction)
+  {
     // FIXME: Implement.
-    }
+  }
 
   /**
    * This method sets the border of the given component to a non rollover
@@ -746,45 +743,45 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    *
    * @param c The Component whose border needs to be set.
    */
-    protected void setBorderToNonRollover(Component c)
-    {
+  protected void setBorderToNonRollover(Component c)
+  {
     if (c instanceof JButton)
       {
        JButton b = (JButton) c;
        b.setRolloverEnabled(false);
        b.setBorder(nonRolloverBorder);
       }
-    }
+  }
 
   /**
    * This method sets the border of the given component to its original value.
    *
    * @param c The Component whose border needs to be set.
    */
-    protected void setBorderToNormal(Component c)
-    {
+  protected void setBorderToNormal(Component c)
+  {
     if (c instanceof JButton)
       {
        JButton b = (JButton) c;
        Border border = (Border) borders.get(b);
        b.setBorder(border);
       }
-    }
+  }
 
   /**
    * This method sets the border of the given component to a rollover border.
    *
    * @param c The Component whose border needs to be set.
    */
-    protected void setBorderToRollover(Component c)
-    {
+  protected void setBorderToRollover(Component c)
+  {
     if (c instanceof JButton)
       {
        JButton b = (JButton) c;
        b.setRolloverEnabled(true);
        b.setBorder(rolloverBorder);
       }
-    }
+  }
 
   /**
    * This method sets the docking color.
@@ -792,9 +789,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param c The docking color.
    */
   public void setDockingColor(Color c)
-    {
-       dockingColor = c;
-    }
+  {
+    dockingColor = c;
+  }
 
   /**
    * This method sets the floating property for the JToolBar.
@@ -816,9 +813,9 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param c The floating color.
    */
   public void setFloatingColor(Color c)
-    {
+  {
     floatingColor = c;
-    }
+  }
 
   /**
    * This method sets the floating location of the JToolBar.
@@ -866,7 +863,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * This method uninstall UI installed components from the JToolBar.
    */
   protected void uninstallComponents()
-    {
+  {
     installNormalBorders(toolBar);
     borders = null;
     rolloverBorder = null;
@@ -890,21 +887,21 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
     dockingColor = null;
     floatingBorderColor = null;
     floatingColor = null;
-    }
+  }
 
   /**
    * This method uninstalls keyboard actions installed by the UI.
    */
   protected void uninstallKeyboardActions()
-    {
+  {
     // FIXME: implement.
-    }
+  }
 
   /**
    * This method uninstalls listeners installed by the UI.
    */
   protected void uninstallListeners()
-    {
+  {
     toolBar.removeFocusListener(toolBarFocusListener);
     toolBarFocusListener = null;
 
@@ -917,7 +914,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
     toolBar.removeMouseMotionListener(dockingListener);
     toolBar.removeMouseListener(dockingListener);
     dockingListener = null;
-    }
+  }
 
   /**
    * This method uninstalls the UI.
@@ -925,7 +922,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * @param c The JComponent that is having this UI removed.
    */
   public void uninstallUI(JComponent c)
-    {
+  {
     uninstallKeyboardActions();
     uninstallListeners();
     uninstallComponents();
@@ -937,7 +934,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
    * This is the MouseHandler class that allows the user to drag the JToolBar
    * in and out of the parent and dock it if it can.
    */
-  protected class DockingListener implements MouseInputListener
+  public class DockingListener implements MouseInputListener
   {
     /** Whether the JToolBar is being dragged. */
     protected boolean isDragging;
@@ -1032,7 +1029,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
         {
          if (e.getX() > insets.left)
            return;
-    }
+        }
       else
         {
          if (e.getY() > insets.top)
@@ -1221,7 +1218,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
     public void propertyChange(PropertyChangeEvent e)
     {
       // FIXME: need name properties so can change floatFrame title.
-      if (e.getPropertyName().equals(JToolBar.ROLLOVER_CHANGED_PROPERTY))
+      if (e.getPropertyName().equals("rollover"))
        setRolloverBorders(toolBar.isRollover());
     }
   }
index 93e3900..db74f06 100644 (file)
@@ -45,14 +45,13 @@ import java.awt.Graphics;
 import java.awt.Rectangle;
 
 import javax.swing.JComponent;
+import javax.swing.JTree;
 import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.plaf.ComponentUI;
-import javax.swing.JTree;
 import javax.swing.plaf.TreeUI;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
 
 /**
  * A delegate providing the user interface for <code>JTree</code>
diff --git a/libjava/javax/swing/plaf/metal/DefaultMetalTheme.java b/libjava/javax/swing/plaf/metal/DefaultMetalTheme.java
new file mode 100644 (file)
index 0000000..7c91eaa
--- /dev/null
@@ -0,0 +1,143 @@
+/* DefaultMetalTheme.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Font;
+
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.FontUIResource;
+
+public class DefaultMetalTheme extends MetalTheme
+{
+  private static final ColorUIResource PRIMARY1 =
+    new ColorUIResource(102, 102, 153);
+  private static final ColorUIResource PRIMARY2 =
+    new ColorUIResource(153, 153, 204);
+  private static final ColorUIResource PRIMARY3 = 
+    new ColorUIResource(204, 204, 255);
+  private static final ColorUIResource SECONDARY1 = 
+    new ColorUIResource(102, 102, 102);
+  private static final ColorUIResource SECONDARY2 = 
+    new ColorUIResource(153, 153, 153);
+  private static final ColorUIResource SECONDARY3 = 
+    new ColorUIResource(204, 204, 204);
+  
+  private static final FontUIResource CONTROL_TEXT_FONT =
+    new FontUIResource("Dialog", Font.BOLD, 12);
+  private static final FontUIResource MENU_TEXT_FONT =
+    new FontUIResource("Dialog", Font.BOLD, 12);
+  private static final FontUIResource SUB_TEXT_FONT =
+    new FontUIResource("Dialog", Font.PLAIN, 10);
+  private static final FontUIResource SYSTEM_TEXT_FONT =
+    new FontUIResource("Dialog", Font.PLAIN, 12);
+  private static final FontUIResource USER_TEXT_FONT =
+    new FontUIResource("Dialog", Font.PLAIN, 12);
+  private static final FontUIResource WINDOW_TITLE_FONT =
+    new FontUIResource("Dialog", Font.BOLD, 12);
+  
+  public DefaultMetalTheme()
+  {
+    // Do nothing here.
+  }
+
+  public String getName()
+  {
+    return "Steel";
+  }
+
+  protected ColorUIResource getPrimary1()
+  {
+    return PRIMARY1;
+  }
+
+  protected ColorUIResource getPrimary2()
+  {
+    return PRIMARY2;
+  }
+
+  protected ColorUIResource getPrimary3()
+  {
+    return PRIMARY3;
+  }
+
+  protected ColorUIResource getSecondary1()
+  {
+    return SECONDARY1;
+  }
+
+  protected ColorUIResource getSecondary2()
+  {
+    return SECONDARY2;
+  }
+
+  protected ColorUIResource getSecondary3()
+  {
+    return SECONDARY3;
+  }
+
+  public FontUIResource getControlTextFont()
+  {
+    return CONTROL_TEXT_FONT;
+  }
+
+  public FontUIResource getMenuTextFont()
+  {
+    return MENU_TEXT_FONT;
+  }
+  
+  public FontUIResource getSubTextFont()
+  {
+    return SUB_TEXT_FONT;
+  }
+  
+  public FontUIResource getSystemTextFont()
+  {
+    return SYSTEM_TEXT_FONT;
+  }
+  
+  public FontUIResource getUserTextFont()
+  {
+    return USER_TEXT_FONT;
+  }
+  
+  public FontUIResource getWindowTitleFont()
+  {
+    return WINDOW_TITLE_FONT;
+  }
+}
index fb6f27b..b332050 100644 (file)
@@ -36,35 +36,275 @@ obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
-
 package javax.swing.plaf.metal;
 
 import javax.swing.UIDefaults;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.plaf.basic.BasicLookAndFeel;
 
 public class MetalLookAndFeel extends BasicLookAndFeel
 {         
   private static final long serialVersionUID = 6680646159193457980L;
-  
-     public boolean isNativeLookAndFeel()        { return true; }
-     public boolean isSupportedLookAndFeel()     { return true; }
-     public String getDescription()              { return "Metal look and feel"; }
-     public String getID()                       { return "MetalLookAndFeel"; }
-     public String getName()                     { return "MetalLookAndFeel"; }
-     
-     
-     UIDefaults LAF_defaults;
-     
-     public MetalLookAndFeel()
-     {
-     }
-
-     public UIDefaults getDefaults()
-        {
-          if (LAF_defaults == null)
-            LAF_defaults = super.getDefaults();
-            
-            //      Returns the default values for this look and feel. 
-            return LAF_defaults;
-        }
- }
+  private static MetalTheme theme;
+  private UIDefaults LAF_defaults;
+
+  public MetalLookAndFeel()
+  {
+    createDefaultTheme();
+  }
+
+  protected void createDefaultTheme()
+  {
+    setCurrentTheme(new DefaultMetalTheme());
+  }
+
+  public boolean isNativeLookAndFeel()
+  {
+    return true;
+  }
+
+  public boolean isSupportedLookAndFeel()
+  {
+    return true;
+  }
+
+  public String getDescription()
+  {
+    return "Metal look and feel";
+  }
+
+  public String getID()
+  {
+    return "MetalLookAndFeel";
+  }
+
+  public String getName()
+  {
+    return "MetalLookAndFeel";
+  }
+
+  public UIDefaults getDefaults()
+  {
+    if (LAF_defaults == null)
+      LAF_defaults = super.getDefaults();
+
+    // Returns the default values for this look and feel. 
+    return LAF_defaults;
+  }
+
+  public static ColorUIResource getAcceleratorForeground()
+  {
+    return theme.getAcceleratorForeground();
+  }
+
+  public static ColorUIResource getAcceleratorSelectedForeground()
+  {
+    return theme.getAcceleratorSelectedForeground();
+  }
+
+  public static ColorUIResource getBlack()
+  {
+    return theme.getBlack();
+  }
+
+  public static ColorUIResource getControl()
+  {
+    return theme.getControl();
+  }
+
+  public static ColorUIResource getControlDarkShadow()
+  {
+    return theme.getControlDarkShadow();
+  }
+
+  public static ColorUIResource getControlDisabled()
+  {
+    return theme.getControlDisabled();
+  }
+
+  public static ColorUIResource getControlHighlight()
+  {
+    return theme.getControlHighlight();
+  }
+
+  public static ColorUIResource getControlInfo()
+  {
+    return theme.getControlInfo();
+  }
+
+  public static ColorUIResource getControlShadow()
+  {
+    return theme.getControlShadow();
+  }
+
+  public static ColorUIResource getControlTextColor()
+  {
+    return theme.getControlTextColor();
+  }
+
+  public static FontUIResource getControlTextFont()
+  {
+    return theme.getControlTextFont();
+  }
+
+  public static ColorUIResource getDesktopColor()
+  {
+    return theme.getDesktopColor();
+  }
+
+  public static ColorUIResource getFocusColor()
+  {
+    return theme.getFocusColor();
+  }
+
+  public static ColorUIResource getHighlightedTextColor()
+  {
+    return theme.getHighlightedTextColor();
+  }
+
+  public static ColorUIResource getInactiveControlTextColor()
+  {
+    return theme.getInactiveControlTextColor();
+  }
+
+  public static ColorUIResource getInactiveSystemTextColor()
+  {
+    return theme.getInactiveSystemTextColor();
+  }
+
+  public static ColorUIResource getMenuBackground()
+  {
+    return theme.getMenuBackground();
+  }
+
+  public static ColorUIResource getMenuDisabledForeground()
+  {
+    return theme.getMenuDisabledForeground();
+  }
+
+  public static ColorUIResource getMenuForeground()
+  {
+    return theme.getMenuForeground();
+  }
+
+  public static ColorUIResource getMenuSelectedBackground()
+  {
+    return theme.getMenuSelectedBackground();
+  }
+
+  public static ColorUIResource getMenuSelectedForeground()
+  {
+    return theme.getMenuSelectedForeground();
+  }
+
+  public static FontUIResource getMenuTextFont()
+  {
+    return theme.getMenuTextFont();
+  }
+
+  public static ColorUIResource getPrimaryControl()
+  {
+    return theme.getPrimaryControl();
+  }
+
+  public static ColorUIResource getPrimaryControlDarkShadow()
+  {
+    return theme.getPrimaryControlDarkShadow();
+  }
+
+  public static ColorUIResource getPrimaryControlHighlight()
+  {
+    return theme.getPrimaryControlHighlight();
+  }
+
+  public static ColorUIResource getPrimaryControlInfo()
+  {
+    return theme.getPrimaryControlInfo();
+  }
+
+  public static ColorUIResource getPrimaryControlShadow()
+  {
+    return theme.getPrimaryControlShadow();
+  }
+
+  public static ColorUIResource getSeparatorBackground()
+  {
+    return theme.getSeparatorBackground();
+  }
+
+  public static ColorUIResource getSeparatorForeground()
+  {
+    return theme.getSeparatorForeground();
+  }
+
+  public static FontUIResource getSubTextFont()
+  {
+    return theme.getSubTextFont();
+  }
+
+  public static ColorUIResource getSystemTextColor()
+  {
+    return theme.getSystemTextColor();
+  }
+
+  public static FontUIResource getSystemTextFont()
+  {
+    return theme.getSystemTextFont();
+  }
+
+  public static ColorUIResource getTextHighlightColor()
+  {
+    return theme.getTextHighlightColor();
+  }
+
+  public static ColorUIResource getUserTextColor()
+  {
+    return theme.getUserTextColor();
+  }
+
+  public static FontUIResource getUserTextFont()
+  {
+    return theme.getUserTextFont();
+  }
+
+  public static ColorUIResource getWhite()
+  {
+    return theme.getWhite();
+  }
+
+  public static ColorUIResource getWindowBackground()
+  {
+    return theme.getWindowBackground();
+  }
+
+  public static ColorUIResource getWindowTitleBackground()
+  {
+    return theme.getWindowTitleBackground();
+  }
+
+  public static FontUIResource getWindowTitleFont()
+  {
+    return theme.getWindowTitleFont();
+  }
+
+  public static ColorUIResource getWindowTitleForeground()
+  {
+    return theme.getWindowTitleForeground();
+  }
+
+  public static ColorUIResource getWindowTitleInactiveBackground()
+  {
+    return theme.getWindowTitleInactiveBackground();
+  }
+
+  public static ColorUIResource getWindowTitleInactiveForeground()
+  {
+    return theme.getWindowTitleInactiveForeground();
+  }
+
+  public static void setCurrentTheme(MetalTheme theme)
+  {
+    MetalLookAndFeel.theme = theme;
+  }
+}
diff --git a/libjava/javax/swing/plaf/metal/MetalTheme.java b/libjava/javax/swing/plaf/metal/MetalTheme.java
new file mode 100644 (file)
index 0000000..970f830
--- /dev/null
@@ -0,0 +1,259 @@
+/* MetalTheme.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+
+import javax.swing.UIDefaults;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.FontUIResource;
+
+public abstract class MetalTheme
+{
+  private ColorUIResource BLACK = new ColorUIResource(Color.BLACK);
+  private ColorUIResource WHITE = new ColorUIResource(Color.WHITE);
+
+  public MetalTheme()
+  {
+    // Do nothing here.
+  }
+
+  public abstract String getName();
+
+  public void addCustomEntriesToTable(UIDefaults table)
+  {
+    // Do nothing here.
+    // This method needs to be overloaded to actuall do something.
+  }
+
+  public ColorUIResource getAcceleratorForeground()
+  {
+    return getPrimary1();
+  }
+
+  public ColorUIResource getAcceleratorSelectedForeground()
+  {
+    return getBlack();
+  }
+  
+  public ColorUIResource getControl()
+  {
+    return getSecondary3();
+  }
+
+  public ColorUIResource getControlDarkShadow()
+  {
+    return getSecondary1();
+  }
+
+  public ColorUIResource getControlDisabled()
+  {
+    return getSecondary2();
+  }
+
+  public ColorUIResource getControlHighlight()
+  {
+    return getWhite();
+  }
+
+  public ColorUIResource getControlInfo()
+  {
+    return getBlack();
+  }
+
+  public ColorUIResource getControlShadow()
+  {
+    return getSecondary2();
+  }
+
+  public ColorUIResource getControlTextColor()
+  {
+    return getControlInfo();
+  }
+
+  public ColorUIResource getDesktopColor()
+  {
+    return getPrimary2();
+  }
+
+  public ColorUIResource getFocusColor()
+  {
+    return getPrimary2();
+  }
+
+  public ColorUIResource getHighlightedTextColor()
+  {
+    return getControlTextColor();
+  }
+
+  public ColorUIResource getInactiveControlTextColor()
+  {
+    return getControlDisabled();
+  }
+
+  public ColorUIResource getInactiveSystemTextColor()
+  {
+    return getSecondary2();
+  }
+
+  public ColorUIResource getMenuBackground()
+  {
+    return getSecondary3();
+  }
+
+  public ColorUIResource getMenuDisabledForeground()
+  {
+    return getSecondary3();
+  }
+
+  public ColorUIResource getMenuForeground()
+  {
+    return getBlack();
+  }
+
+  public ColorUIResource getMenuSelectedBackground()
+  {
+    return getPrimary2();
+  }
+
+  public ColorUIResource getMenuSelectedForeground()
+  {
+    return getBlack();
+  }
+
+  public ColorUIResource getPrimaryControl()
+  {
+    return getPrimary3();
+  }
+
+  public ColorUIResource getPrimaryControlDarkShadow()
+  {
+    return getPrimary1();
+  }
+
+  public ColorUIResource getPrimaryControlHighlight()
+  {
+    return getWhite();
+  }
+
+  public ColorUIResource getPrimaryControlInfo()
+  {
+    return getBlack();
+  }
+
+  public ColorUIResource getPrimaryControlShadow()
+  {
+    return getPrimary2();
+  }
+
+  public ColorUIResource getSeparatorBackground()
+  {
+    return getWhite();
+  }
+
+  public ColorUIResource getSeparatorForeground()
+  {
+    return getPrimary1();
+  }
+
+  public ColorUIResource getSystemTextColor()
+  {
+    return getBlack();
+  }
+
+  public ColorUIResource getTextHighlightColor()
+  {
+    return getPrimary3();
+  }
+
+  public ColorUIResource getUserTextColor()
+  {
+    return getBlack();
+  }
+  
+  public ColorUIResource getWindowBackground()
+  {
+    return getWhite();
+  }
+
+  public ColorUIResource getWindowTitleBackground()
+  {
+    return getPrimary3();
+  }
+
+  public ColorUIResource getWindowTitleForeground()
+  {
+    return getBlack();
+  }
+
+  public ColorUIResource getWindowTitleInactiveBackground()
+  {
+    return getSecondary3();
+  }
+
+  public ColorUIResource getWindowTitleInactiveForeground()
+  {
+    return getBlack();
+  }
+
+  protected ColorUIResource getBlack()
+  {
+    return BLACK;
+  }
+
+  protected ColorUIResource getWhite()
+  {
+    return WHITE;
+  }
+
+  protected abstract ColorUIResource getPrimary1();
+  protected abstract ColorUIResource getPrimary2();
+  protected abstract ColorUIResource getPrimary3();
+  protected abstract ColorUIResource getSecondary1();
+  protected abstract ColorUIResource getSecondary2();
+  protected abstract ColorUIResource getSecondary3();
+
+  public abstract FontUIResource getControlTextFont();
+  public abstract FontUIResource getMenuTextFont();
+  public abstract FontUIResource getSubTextFont();
+  public abstract FontUIResource getSystemTextFont();
+  public abstract FontUIResource getUserTextFont();
+  public abstract FontUIResource getWindowTitleFont();
+}
index ac5edb9..790d045 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultTableCellRenderer.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -199,8 +199,8 @@ public class DefaultTableCellRenderer extends JLabel
    * <p>This method needs to be overridden in a subclass to actually
    * do something.</p>
    */
-  public void firePropertyChange(String propertyName, Object oldValue,
-                                 Object newValue)
+  protected void firePropertyChange(String propertyName, Object oldValue,
+                                    Object newValue)
   {
     // Does nothing.
   }
index b66b695..3a8b1a3 100644 (file)
@@ -66,37 +66,37 @@ public class DefaultTableColumnModel
   private static final long serialVersionUID = 6580012493508960512L;
 
   /**
-   * tableColumns
+   * Columns that this model keeps track of.
    */
   protected Vector tableColumns;
 
   /**
-   * selectionModel
+   * Selection Model that keeps track of columns selection
    */
   protected ListSelectionModel selectionModel;
 
   /**
-   * columnMargin
+   * Space between two columns. By default it is set to 1
    */
   protected int columnMargin;
 
   /**
-   * listenerList
+   * listenerList keeps track of all listeners registered with this model
    */
   protected EventListenerList listenerList = new EventListenerList();
 
   /**
-   * changeEvent
+   * changeEvent is fired when change occurs in one of the columns properties
    */
   protected transient ChangeEvent changeEvent = new ChangeEvent(this);
 
   /**
-   * columnSelectionAllowed
+   * Indicates whether columns can be selected 
    */
   protected boolean columnSelectionAllowed;
 
   /**
-   * totalColumnWidth
+   * Total width of all the columns in this model
    */
   protected int totalColumnWidth;
 
@@ -106,103 +106,116 @@ public class DefaultTableColumnModel
   public DefaultTableColumnModel()
   {
     tableColumns = new Vector();
-    setSelectionModel(new DefaultListSelectionModel());
+    setSelectionModel(createSelectionModel());
     columnMargin = 1;
     columnSelectionAllowed = false;
   }
 
   /**
-   * addColumn
-   * @param value0 TODO
+   * addColumn adds column to the model. This method fires ColumnAdded 
+   * event to model's registered TableColumnModelListeners.
+   *
+   * @param col column to add
    */
   public void addColumn(TableColumn col)
   {
     tableColumns.add(col);
     invalidateWidthCache();
+    fireColumnAdded(new TableColumnModelEvent(this,0,tableColumns.size()));
   }
 
   /**
-   * removeColumn
-   * @param value0 TODO
+   * removeColumn removes table column from the model. This method fires 
+   * ColumnRemoved event to model's registered TableColumnModelListeners.
+   *
+   * @param col column to be removed
    */
   public void removeColumn(TableColumn col)
   {
+    int index = getColumnIndex(col);
+    fireColumnRemoved(new TableColumnModelEvent(this,index,0));    
     tableColumns.remove(col);
     invalidateWidthCache();
   }
 
   /**
-   * moveColumn
-   * @param value0 TODO
-   * @param value1 TODO
+   * moveColumn moves column at index i to index j. This method fires
+   * ColumnMoved event to model's registered TableColumnModelListeners.
+   *
+   * @param i index of the column that will be moved
+   * @param j index of column's new location
    */
   public void moveColumn(int i, int j)
   {
     Object tmp = tableColumns.get(i);
     tableColumns.set(i, tableColumns.get(j));
     tableColumns.set(j, tmp);
+    fireColumnAdded(new TableColumnModelEvent(this,i,j));
   }
 
   /**
-   * setColumnMargin
-   * @param value0 TODO
+   * setColumnMargin sets margin of the columns.
+   * @param m new column margin
    */
   public void setColumnMargin(int m)
   {
     columnMargin = m;
+    fireColumnMarginChanged();
   }
 
-       /**
-        * getColumnCount
-   * @return int
-        */
+  /**
+   * getColumnCount returns number of columns in the model
+   * @return int number of columns in the model
+   */
   public int getColumnCount()
   {
     return tableColumns.size();
   }
 
-       /**
-        * getColumns
+  /**
+   * getColumns
    * @return Enumeration
-        */
+   */
   public Enumeration getColumns()
   {
     return tableColumns.elements();
   }
 
-       /**
-        * getColumnIndex
-        * @param value0 TODO
-   * @return int
+  /**
+   * getColumnIndex returns index of the specified column
+   *
+   * @param identifier identifier of the column
+   * @return int index of the given column
    */
-  public int getColumnIndex(Object obj)
+  public int getColumnIndex(Object identifier)
   {
-    return tableColumns.indexOf(obj, 0);
+    return tableColumns.indexOf(identifier, 0);
   }
 
-       /**
-        * getColumn
-        * @param value0 TODO
-   * @return TableColumn
+  /**
+   * getColumn returns column at the specified index
+   * @param i index of the column 
+   * @return TableColumn column at the specified index
    */
   public TableColumn getColumn(int i)
   {
     return (TableColumn) tableColumns.get(i);
   }
 
-       /**
-        * getColumnMargin
-   * @return int
-        */
+  /**
+   * getColumnMargin returns column margin
+   * @return int column margin
+   */
   public int getColumnMargin()
   {
     return columnMargin;
   }
 
-       /**
-        * getColumnIndexAtX
-        * @param value0 TODO
-   * @return int
+  /**
+   * getColumnIndexAtX returns column that contains specified x-coordinate.
+   * @param x x-coordinate that column should contain
+   * @return int index of the column that contains specified x-coordinate relative
+   * to this column model
    */
   public int getColumnIndexAtX(int x)
   {    
@@ -217,10 +230,12 @@ public class DefaultTableColumnModel
     return -1;
   }
 
-       /**
-        * getTotalColumnWidth
-   * @return int
-        */
+  /**
+   * getTotalColumnWidth returns total width of all the columns including
+   * column's margins.
+   *
+   * @return total width of all the columns
+   */
   public int getTotalColumnWidth()
   {
     if (totalColumnWidth == -1)
@@ -229,8 +244,10 @@ public class DefaultTableColumnModel
   }
 
   /**
-   * setSelectionModel
-   * @param model TODO
+   * setSelectionModel sets selection model that will be used by this ColumnTableModel
+   * to keep track of currently selected columns
+   *
+   * @param model new selection model
    * @exception IllegalArgumentException if model is null
    */
   public void setSelectionModel(ListSelectionModel model)
@@ -242,53 +259,124 @@ public class DefaultTableColumnModel
     selectionModel.addListSelectionListener(this);
   }
 
-       /**
-        * getSelectionModel
-   * @return ListSelectionModel
-        */
+  /**
+   * getSelectionModel returns selection model
+   * @return ListSelectionModel selection model
+   */
   public ListSelectionModel getSelectionModel()
   {
     return selectionModel;
   }
 
   /**
-   * setColumnSelectionAllowed
-   * @param value0 TODO
+   * setColumnSelectionAllowed sets whether column selection is allowed
+   * or not.
+   *
+   * @param flag true if column selection is allowed and false otherwise
    */
-  public void setColumnSelectionAllowed(boolean a)
+  public void setColumnSelectionAllowed(boolean flag)
   {
-    columnSelectionAllowed = a;
+    columnSelectionAllowed = flag;
   }
 
-       /**
-        * getColumnSelectionAllowed
-   * @return boolean
-        */
+  /**
+   * getColumnSelectionAllowed indicates whether column selection is 
+   * allowed or not.
+   *
+   * @return boolean true if column selection is allowed and false otherwise.
+   */
   public boolean getColumnSelectionAllowed()
   {
     return columnSelectionAllowed;
   }
 
-       /**
-        * getSelectedColumns
-   * @return int[]
-        */
+  /**
+   * getSelectedColumns returns array containing indexes of currently 
+   * selected columns
+   *
+   * @return int[] array containing indexes of currently selected columns
+   */
   public int[] getSelectedColumns()
   {
-               return null; // TODO
+    // FIXME: Implementation of this method was taken from private method 
+    // JTable.getSelections(), which is used in various places in JTable
+    // including selected row calculations and cannot be simply removed.
+    // This design should be improved to illuminate duplication of code.
+    
+    ListSelectionModel lsm = this.selectionModel;    
+    int sz = getSelectedColumnCount();
+    int [] ret = new int[sz];
+
+    int lo = lsm.getMinSelectionIndex();
+    int hi = lsm.getMaxSelectionIndex();
+    int j = 0;
+    java.util.ArrayList ls = new java.util.ArrayList();
+    if (lo != -1 && hi != -1)
+      {
+        switch (lsm.getSelectionMode())
+          {
+          case ListSelectionModel.SINGLE_SELECTION:
+            ret[0] = lo;
+            break;      
+      
+          case ListSelectionModel.SINGLE_INTERVAL_SELECTION:            
+            for (int i = lo; i <= hi; ++i)
+              ret[j++] = i;
+            break;
+            
+          case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:        
+            for (int i = lo; i <= hi; ++i)
+              if (lsm.isSelectedIndex(i))        
+                ret[j++] = i;
+            break;
+          }
+      }
+    return ret;
   }
 
-       /**
-        * getSelectedColumnCount
-   * @return int
-        */
+  /**
+   * getSelectedColumnCount returns number of currently selected columns
+   * @return int number of currently selected columns
+   */
   public int getSelectedColumnCount()
   {
-               return 0; // TODO
+    // FIXME: Implementation of this method was taken from private method 
+    // JTable.countSelections(), which is used in various places in JTable
+    // including selected row calculations and cannot be simply removed.
+    // This design should be improved to illuminate duplication of code.
+   
+    ListSelectionModel lsm = this.selectionModel;
+    int lo = lsm.getMinSelectionIndex();
+    int hi = lsm.getMaxSelectionIndex();
+    int sum = 0;
+    
+    if (lo != -1 && hi != -1)
+      {
+        switch (lsm.getSelectionMode())
+          {
+          case ListSelectionModel.SINGLE_SELECTION:
+            sum = 1;
+            break;
+            
+          case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
+            sum = hi - lo + 1;
+            break;
+            
+          case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:        
+            for (int i = lo; i <= hi; ++i)
+              if (lsm.isSelectedIndex(i))        
+                ++sum;
+            break;
+          }
+      }
+     
+     return sum;
   }
 
   /**
-   * addColumnModelListener
+   * addColumnModelListener adds specified listener to the model's
+   * listener list
+   *
    * @param listener the listener to add
    */
   public void addColumnModelListener(TableColumnModelListener listener)
@@ -297,7 +385,9 @@ public class DefaultTableColumnModel
   }
 
   /**
-   * removeColumnModelListener
+   * removeColumnModelListener removes specified listener from the model's 
+   * listener list.
+   *
    * @param listener the listener to remove
    */
   public void removeColumnModelListener(TableColumnModelListener listener)
@@ -315,35 +405,53 @@ public class DefaultTableColumnModel
   }      
 
   /**
-   * fireColumnAdded
-   * @param value0 TODO
+   * fireColumnAdded fires TableColumnModelEvent to registered 
+   * TableColumnModelListeners to indicate that column was added
+   *
+   * @param e TableColumnModelEvent
    */
-  protected void fireColumnAdded(TableColumnModelEvent value0)
-  {
-               // TODO
+  protected void fireColumnAdded(TableColumnModelEvent e)
+  {    
+    TableColumnModelListener[] listeners = getColumnModelListeners();
+
+    for (int i=0; i< listeners.length; i++)
+      listeners[i].columnAdded(e);        
   }
 
-       /**
-        * fireColumnRemoved
-        * @param value0 TODO
-        */
-  protected void fireColumnRemoved(TableColumnModelEvent value0)
+  /**
+   * fireColumnAdded fires TableColumnModelEvent to registered 
+   * TableColumnModelListeners to indicate that column was removed
+   *
+   * @param e TableColumnModelEvent
+   */
+  protected void fireColumnRemoved(TableColumnModelEvent e)
   {
-               // TODO
+    TableColumnModelListener[] listeners = getColumnModelListeners();
+
+    for (int i=0; i< listeners.length; i++)
+      listeners[i].columnRemoved(e);        
   }
 
-       /**
-        * fireColumnMoved
-        * @param value0 TODO
-        */
-  protected void fireColumnMoved(TableColumnModelEvent value0)
+  /**
+   * fireColumnAdded fires TableColumnModelEvent to registered 
+   * TableColumnModelListeners to indicate that column was moved
+   *
+   * @param e TableColumnModelEvent
+   */
+  protected void fireColumnMoved(TableColumnModelEvent e)
   {
-               // TODO
+    TableColumnModelListener[] listeners = getColumnModelListeners();
+
+    for (int i=0; i< listeners.length; i++)
+      listeners[i].columnMoved(e);        
   }
 
   /**
-   * fireColumnSelectionChanged
-   * @param value0 TODO
+   * fireColumnSelectionChanged fires TableColumnModelEvent to model's
+   * registered TableColumnModelListeners to indicate that different column 
+   * was selected.
+   *
+   * @param evt ListSelectionEvent
    */
   protected void fireColumnSelectionChanged(ListSelectionEvent evt)
   {
@@ -352,54 +460,66 @@ public class DefaultTableColumnModel
       ((TableColumnModelListener)listeners[i]).columnSelectionChanged(evt);
   }
 
-       /**
-        * fireColumnMarginChanged
-        */
+  /**
+   * fireColumnMarginChanged fires TableColumnModelEvent to model's
+   * registered TableColumnModelListeners to indicate that column margin
+   * was changed.
+   */
   protected void fireColumnMarginChanged()
   {
-               // TODO
+    EventListener [] listeners = getListeners(TableColumnModelListener.class);
+    for (int i = 0; i < listeners.length; ++i)
+      ((TableColumnModelListener)listeners[i]).columnMarginChanged(changeEvent);
   }
 
-       /**
-        * getListeners
-        * @param value0 TODO
-   * @return EventListener[]
+  /**
+   * getListeners returns currently registered listeners with this model.
+   * @param listenerType type of listeners to return
+   *
+   * @return EventListener[] array of model's listeners of the specified type
    */
-  public EventListener[] getListeners(Class klass)
+  public EventListener[] getListeners(Class listenerType)
   {
-    return listenerList.getListeners(klass);
+    return listenerList.getListeners(listenerType);
   }
 
-       /**
-        * propertyChange
-        * @param value0 TODO
-        */
-  public void propertyChange(PropertyChangeEvent value0)
+  /**
+   * propertyChange handles changes occuring in the properties of the
+   * model's columns. 
+   *
+   * @param evt PropertyChangeEvent
+   */
+  public void propertyChange(PropertyChangeEvent evt)
   {
-               // TODO
+    if (evt.getPropertyName().equals(TableColumn.COLUMN_WIDTH_PROPERTY))
+       invalidateWidthCache(); 
   }
 
-       /**
-        * valueChanged
-        * @param value0 TODO
-        */
-  public void valueChanged(ListSelectionEvent value0)
+  /**
+   * valueChanged handles changes in the selectionModel.
+   * @param e ListSelectionEvent
+   */
+  public void valueChanged(ListSelectionEvent e)
   {
-    fireColumnSelectionChanged(value0);
+    fireColumnSelectionChanged(e);
   }
 
-       /**
-        * createSelectionModel
-   * @return ListSelectionModel
-        */
+  /**
+   * createSelectionModel creates selection model that will keep track
+   * of currently selected column(s)
+   *
+   * @return ListSelectionModel selection model of the columns
+   */
   protected ListSelectionModel createSelectionModel()
-  {
-               return null; // TODO
+  {    
+    return new DefaultListSelectionModel();
   }
 
-       /**
-        * recalcWidthCache
-        */
+  /**
+   * recalcWidthCache calculates total width of the columns.
+   * If the current cache of the total width is in invalidated state, 
+   * then width is recalculated. Otherwise nothing is done.
+   */
   protected void recalcWidthCache()
   {
     if (totalColumnWidth == -1)
@@ -412,9 +532,9 @@ public class DefaultTableColumnModel
       }
   }
 
-       /**
-        * invalidateWidthCache
-        */
+  /**
+   * invalidateWidthCache
+   */
   private void invalidateWidthCache()
   {
     totalColumnWidth = -1;
index dd8e3b8..aab4202 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultTableModel.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -44,15 +44,19 @@ import java.util.Vector;
 import javax.swing.event.TableModelEvent;
 
 /**
- * DefaultTableModel
+ * A two dimensional data structure used to store <code>Object</code> 
+ * instances, usually for display in a <code>JTable</code> component.
+ * 
  * @author     Andrew Selkirk
  */
 public class DefaultTableModel extends AbstractTableModel
   implements Serializable
 {
   static final long serialVersionUID = 6680042567037222321L;
+
   /**
-   * dataVector
+   * Storage for the rows in the table (each row is itself 
+   * a <code>Vector</code>).
    */
   protected Vector dataVector;
 
@@ -62,7 +66,7 @@ public class DefaultTableModel extends AbstractTableModel
   protected Vector columnIdentifiers;
 
   /**
-   * Constructor DefaultTableModel
+   * Creates an empty table with zero rows and zero columns.
    */
   public DefaultTableModel() 
   {
@@ -70,9 +74,11 @@ public class DefaultTableModel extends AbstractTableModel
   }
   
   /**
-   * Constructor DefaultTableModel
-   * @param value0 TODO
-   * @param value1 TODO
+   * Creates a new table with the specified number of rows and columns.
+   * All cells in the table are initially empty (set to <code>null</code>).
+   * 
+   * @param numRows  the number of rows.
+   * @param numColumns  the number of columns.
    */
   public DefaultTableModel(int numRows, int numColumns) 
   {
@@ -81,20 +87,28 @@ public class DefaultTableModel extends AbstractTableModel
     for (int i = 0; i < numColumns; i++) 
       {
         defaultNames.add(super.getColumnName(i));
+      }          
+    for (int r = 0; r < numRows; r++) 
+      {
         Vector tmp = new Vector(numColumns);
         tmp.setSize(numColumns);
         data.add(tmp);
-      }          
-    setDataVector(defaultNames, data);
+      }
+    setDataVector(data, defaultNames);
   }
   
   /**
-   * Constructor DefaultTableModel
-   * @param value0 TODO
-   * @param value1 TODO
+   * Creates a new table with the specified column names and number of
+   * rows.  The number of columns is determined by the number of column
+   * names supplied.
+   *   
+   * @param columnNames the column names.
+   * @param numRows the number of rows.
    */
   public DefaultTableModel(Vector columnNames, int numRows) 
   {
+    if (numRows < 0)
+      throw new IllegalArgumentException("numRows < 0");
     Vector data = new Vector();
     int numColumns = 0;
 
@@ -111,9 +125,10 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * Constructor DefaultTableModel
-   * @param value0 TODO
-   * @param value1 TODO
+   * Creates a new table with the specified column names and row count.
+   * 
+   * @param columnNames the column names.
+   * @param numRows the number of rows.
    */
   public DefaultTableModel(Object[] columnNames, int numRows) 
   {
@@ -121,9 +136,10 @@ public class DefaultTableModel extends AbstractTableModel
   }
   
   /**
-   * Constructor DefaultTableModel
-   * @param value0 TODO
-   * @param value1 TODO
+   * Creates a new table with the specified data values and column names.
+   * 
+   * @param data the data values.
+   * @param columnNames the column names.
    */
   public DefaultTableModel(Vector data, Vector columnNames) 
   {
@@ -131,9 +147,10 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * Constructor DefaultTableModel
-   * @param value0 TODO
-   * @param value1 TODO
+   * Creates a new table with the specified data values and column names.
+   * 
+   * @param data the data values.
+   * @param columnNames the column names.
    */
   public DefaultTableModel(Object[][] data, Object[] columnNames) 
   {
@@ -141,8 +158,9 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * getDataVector
-   * @returns Vector
+   * Returns the vector containing the row data for the table.
+   * 
+   * @returns The data vector.
    */
   public Vector getDataVector() 
   {
@@ -150,9 +168,16 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * setDataVector
-   * @param value0 TODO
-   * @param value1 TODO
+   * Sets the data and column identifiers for the table.  The data vector
+   * contains a <code>Vector</code> for each row in the table - if the
+   * number of objects in each row does not match the number of column
+   * names specified, the row data is truncated or expanded (by adding
+   * <code>null</code> values) as required.
+   * 
+   * @param data the data for the table (a vector of row vectors).
+   * @param columnNames the column names.
+   * 
+   * @throws NullPointerException if either argument is <code>null</code>.
    */
   public void setDataVector(Vector data, Vector columnNames) 
   {
@@ -164,9 +189,12 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * setDataVector
-   * @param value0 TODO
-   * @param value1 TODO
+   * Sets the data and column identifiers for the table.
+   * 
+   * @param data the data for the table.
+   * @param columnNames the column names.
+   * 
+   * @throws NullPointerException if either argument is <code>null</code>.
    */
   public void setDataVector(Object[][] data, Object[] columnNames) 
   {
@@ -175,8 +203,11 @@ public class DefaultTableModel extends AbstractTableModel
   }
   
   /**
-   * newDataAvailable
-   * @param value0 TODO
+   * Sends the specified <code>event</code> to all registered listeners.
+   * This method is equivalent to 
+   * {@link AbstractTableModel#fireTableChanged(TableModelEvent)}.
+   * 
+   * @param event the event.
    */
   public void newDataAvailable(TableModelEvent event) 
   {
@@ -184,8 +215,11 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * newRowsAdded
-   * @param value0 TODO
+   * Sends the specified <code>event</code> to all registered listeners.
+   * This method is equivalent to 
+   * {@link AbstractTableModel#fireTableChanged(TableModelEvent)}.
+   * 
+   * @param event the event.
    */
   public void newRowsAdded(TableModelEvent event) 
   {
@@ -193,8 +227,11 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * rowsRemoved
-   * @param value0 TODO
+   * Sends the specified <code>event</code> to all registered listeners.
+   * This method is equivalent to 
+   * {@link AbstractTableModel#fireTableChanged(TableModelEvent)}.
+   * 
+   * @param event the event.
    */
   public void rowsRemoved(TableModelEvent event) 
   {
@@ -202,18 +239,26 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * setColumnIdentifiers
-   * @param value0 TODO
+   * Sets the column identifiers, updates the data rows (truncating
+   * or padding each row with <code>null</code> values) to match the 
+   * number of columns, and sends a {@link TableModelEvent} to all
+   * registered listeners.
+   * 
+   * @param columnIdentifiers the column identifiers.
    */
   public void setColumnIdentifiers(Vector columnIdentifiers) 
   {
     this.columnIdentifiers = columnIdentifiers;
-    setColumnCount(columnIdentifiers.size());
+    setColumnCount((columnIdentifiers == null ? 0 : columnIdentifiers.size()));
   }
   
   /**
-   * setColumnIdentifiers
-   * @param value0 TODO
+   * Sets the column identifiers, updates the data rows (truncating
+   * or padding each row with <code>null</code> values) to match the 
+   * number of columns, and sends a {@link TableModelEvent} to all
+   * registered listeners.
+   * 
+   * @param columnIdentifiers the column identifiers.
    */
   public void setColumnIdentifiers(Object[] columnIdentifiers) 
   {
@@ -221,8 +266,9 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * setNumRows
-   * @param value0 TODO
+   * This method is obsolete, use {@link #setRowCount(int)} instead.
+   * 
+   * @param numRows the number of rows.
    */
   public void setNumRows(int numRows) 
   {
@@ -230,18 +276,40 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * setRowCount
-   * @param value0 TODO
+   * Sets the number of rows in the table.  If <code>rowCount</code> is less
+   * than the current number of rows in the table, rows are discarded.
+   * If <code>rowCount</code> is greater than the current number of rows in
+   * the table, new (empty) rows are added.
+   * 
+   * @param the row count.
    */
   public void setRowCount(int rowCount) 
   {
-    dataVector.setSize(rowCount);
-    fireTableDataChanged();
+    int existingRowCount = dataVector.size();
+    if (rowCount < existingRowCount) 
+    {
+      dataVector.setSize(rowCount);
+      fireTableRowsDeleted(rowCount,existingRowCount-1);      
+    }
+    else 
+    {
+      int rowsToAdd = rowCount - existingRowCount;
+      for (int i = 0; i < rowsToAdd; i++) 
+        {
+          Vector tmp = new Vector();
+          tmp.setSize(columnIdentifiers.size());
+          dataVector.add(tmp);
+        } 
+      fireTableRowsInserted(existingRowCount,rowCount-1);
+    }
   }
 
   /**
-   * setColumnCount
-   * @param value0 TODO
+   * Sets the number of columns in the table.  Existing rows are truncated
+   * or padded with <code>null</code> values to match the new column count.
+   * A {@link TableModelEvent} is sent to all registered listeners.
+   * 
+   * @param columnCount the column count.
    */
   public void setColumnCount(int columnCount) 
   {
@@ -249,13 +317,16 @@ public class DefaultTableModel extends AbstractTableModel
       {
         ((Vector) dataVector.get(i)).setSize(columnCount);
       }
-    columnIdentifiers.setSize(columnCount);
+    if (columnIdentifiers != null)  
+      columnIdentifiers.setSize(columnCount);
     fireTableDataChanged();
   }
 
   /**
-   * addColumn
-   * @param value0 TODO
+   * Adds a column with the specified name to the table.  All cell values
+   * for the column are initially set to <code>null</code>.
+   * 
+   * @param columnName the column name (<code>null</code> permitted).
    */
   public void addColumn(Object columnName) 
   {
@@ -263,21 +334,52 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * addColumn
-   * @param value0 TODO
-   * @param value1 TODO
+   * Adds a column with the specified name and data values to the table.  
+   * 
+   * @param columnName the column name (<code>null</code> permitted).
+   * @param columnData the column data.
    */
   public void addColumn(Object columnName, Vector columnData) 
   {
-    addColumn(columnName, columnData == null ? null : columnData.toArray());
+    Object[] dataArray = null;
+    if (columnData != null) 
+    {
+      int rowCount = dataVector.size();
+      if (columnData.size() < rowCount)
+        columnData.setSize(rowCount);
+      dataArray = columnData.toArray();
+    }
+    addColumn(columnName, dataArray);
   }
 
   /**
-   * addColumn
-   * @param value0 TODO
-   * @param value1 TODO
+   * Adds a column with the specified name and data values to the table.
+   * 
+   * @param columnName the column name (<code>null</code> permitted).
+   * @param columnData the column data.
    */
   public void addColumn(Object columnName, Object[] columnData) {
+    if (columnData != null)
+    {
+      // check columnData array for cases where the number of items
+      // doesn't match the number of rows in the existing table
+      if (columnData.length > dataVector.size()) 
+      {
+        int rowsToAdd = columnData.length - dataVector.size();
+        for (int i = 0; i < rowsToAdd; i++) 
+        {
+          Vector tmp = new Vector();
+          tmp.setSize(columnIdentifiers.size());
+          dataVector.add(tmp);
+        }
+      }
+      else if (columnData.length < dataVector.size())
+      {
+        Object[] tmp = new Object[dataVector.size()];
+        System.arraycopy(columnData, 0, tmp, 0, columnData.length);
+        columnData = tmp;
+      }
+    }
     for (int i = 0; i < dataVector.size(); ++i)
       {
         ((Vector) dataVector.get(i)).add(columnData == null ? null : columnData[i]);
@@ -287,62 +389,79 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * addRow
-   * @param value0 TODO
+   * Adds a new row containing the specified data to the table and sends a
+   * {@link TableModelEvent} to all registered listeners.
+   * 
+   * @param rowData the row data (<code>null</code> permitted).
    */
   public void addRow(Vector rowData) {
     dataVector.add(rowData);
-    fireTableDataChanged();
+    newRowsAdded(new TableModelEvent(
+      this, dataVector.size(), dataVector.size(), -1, TableModelEvent.INSERT)
+    );
   }
 
   /**
-   * addRow
-   * @param value0 TODO
+   * Adds a new row containing the specified data to the table and sends a
+   * {@link TableModelEvent} to all registered listeners.
+   * 
+   * @param rowData the row data (<code>null</code> permitted).
    */
   public void addRow(Object[] rowData) {
     addRow(convertToVector(rowData));
   }
 
   /**
-   * insertRow
-   * @param value0 TODO
-   * @param value1 TODO
+   * Inserts a new row into the table.
+   * 
+   * @param row the row index.
+   * @param rowData the row data.
    */
   public void insertRow(int row, Vector rowData) {
     dataVector.add(row, rowData);
-    fireTableDataChanged();
+    fireTableRowsInserted(row,row);
   }
 
   /**
-   * insertRow
-   * @param value0 TODO
-   * @param value1 TODO
+   * Inserts a new row into the table.
+   * 
+   * @param row the row index.
+   * @param rowData the row data.
    */
   public void insertRow(int row, Object[] rowData) {
     insertRow(row, convertToVector(rowData));
   }
 
   /**
-   * moveRow
-   * @param value0 TODO
-   * @param value1 TODO
-   * @param value2 TODO
+   * Moves the rows from <code>startIndex</code> to <code>endIndex</code>
+   * (inclusive) to the specified row.
+   * 
+   * @param startIndex the start row.
+   * @param endIndex the end row.
+   * @param toIndex the row to move to.
    */
   public void moveRow(int startIndex, int endIndex, int toIndex) {
-    for (int index = 0; index < (endIndex - startIndex); index++) {
-      Vector vector = (Vector) dataVector.remove(startIndex);
-      dataVector.add(toIndex, vector);
+    Vector removed = new Vector();
+    for (int i = endIndex; i >= startIndex; i--)
+    {
+      removed.add(this.dataVector.remove(i));
+    }
+    for (int i = 0; i <= endIndex - startIndex; i++) 
+    {
+      dataVector.insertElementAt(removed.get(i), toIndex);  
     }
     fireTableDataChanged();
   }
 
   /**
-   * removeRow
-   * @param value0 TODO
+   * Removes a row from the table and sends a {@link TableModelEvent} to
+   * all registered listeners.
+   * 
+   * @param row the row index.
    */
   public void removeRow(int row) {
     dataVector.remove(row);
-    fireTableDataChanged();
+    fireTableRowsDeleted(row,row);
   }
 
   /**
@@ -354,63 +473,86 @@ public class DefaultTableModel extends AbstractTableModel
   }
 
   /**
-   * getColumnCount
-   * @returns int
+   * Returns the number of columns in the model.
+   * 
+   * @return The column count.
    */
   public int getColumnCount() {
-    return columnIdentifiers.size();
+    return (columnIdentifiers == null ? 0 : columnIdentifiers.size());
   }
 
   /**
-   * getColumnName
-   * @param value0 TODO
-   * @returns String
+   * Returns the name of the specified column.
+   * 
+   * @param column the column index.
+   * 
+   * @returns The column name.
    */
   public String getColumnName(int column) {
-    // Check for Column
-    if (columnIdentifiers == null || column >= getColumnCount()) {
-      return super.getColumnName(column);
+    String result = "";
+    if (columnIdentifiers == null) 
+      result = super.getColumnName(column);
+    else 
+    {
+      if (column < getColumnCount())
+      {  
+        Object id = columnIdentifiers.get(column);
+        if (id != null) 
+          result = id.toString();
+        else
+          result = super.getColumnName(column);
+      }
     }
-          
-    // Return Column name
-    return (String) columnIdentifiers.get(column);          
+    return result;
   }
 
   /**
-   * isCellEditable
-   * @param value0 TODO
-   * @param value1 TODO
-   * @returns boolean
+   * Returns <code>true</code> if the specified cell can be modified, and
+   * <code>false</code> otherwise.  For this implementation, the method
+   * always returns <code>true</code>.
+   * 
+   * @param row the row index.
+   * @param column the column index.
+   * 
+   * @returns <code>true</code> in all cases.
    */
   public boolean isCellEditable(int row, int column) {
     return true;
   }
 
   /**
-   * getValueAt
-   * @param value0 TODO
-   * @param value1 TODO
-   * @returns Object
+   * Returns the value at the specified cell in the table.
+   * 
+   * @param row the row index.
+   * @param column the column index.
+   * 
+   * @returns The value (<code>Object</code>, possibly <code>null</code>) at 
+   *          the specified cell in the table.
    */
   public Object getValueAt(int row, int column) {
     return ((Vector) dataVector.get(row)).get(column);
   }
 
   /**
-   * setValueAt
-   * @param value0 TODO
-   * @param value1 TODO
-   * @param value2 TODO
+   * Sets the value for the specified cell in the table and sends a 
+   * {@link TableModelEvent} to all registered listeners.
+   * 
+   * @param value the value (<code>Object</code>, <code>null</code> permitted).
+   * @param row the row index.
+   * @param column the column index.
    */
   public void setValueAt(Object value, int row, int column) {
     ((Vector) dataVector.get(row)).set(column, value);
-    fireTableDataChanged();
+    fireTableCellUpdated(row,column);
   }
 
   /**
-   * convertToVector
-   * @param value0 TODO
-   * @returns Vector
+   * Converts the data array to a <code>Vector</code>.
+   * 
+   * @param data the data array (<code>null</code> permitted).
+   * 
+   * @returns A vector (or <code>null</code> if the data array 
+   *          is <code>null</code>).
    */
   protected static Vector convertToVector(Object[] data) {
     if (data == null)
@@ -422,9 +564,12 @@ public class DefaultTableModel extends AbstractTableModel
   }
   
   /**
-   * convertToVector
-   * @param value0 TODO
-   * @returns Vector
+   * Converts the data array to a <code>Vector</code> of rows.
+   * 
+   * @param the data array (<code>null</code> permitted).
+   * 
+   * @returns A vector (or <code>null</code> if the data array 
+   *          is <code>null</code>.
    */
   protected static Vector convertToVector(Object[][] data) {
     if (data == null)
index 95ff920..0f538ed 100644 (file)
@@ -1,5 +1,5 @@
 /* JTableHeader.java --
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -70,6 +70,11 @@ public class JTableHeader extends JComponent
     protected class AccessibleJTableHeaderEntry extends AccessibleContext
       implements Accessible, AccessibleComponent
     {
+      public AccessibleJTableHeaderEntry(int c, JTableHeader p, JTable t) 
+      {
+        throw new Error("not implemented");
+      }
+      
       public void addFocusListener(FocusListener l)
       {
         throw new Error("not implemented");
@@ -616,4 +621,11 @@ public class JTableHeader extends JComponent
     setUI((TableHeaderUI) UIManager.getUI(this));
   }
 
+  public int columnAtPoint(Point point)
+  {
+    if (getBounds().contains(point))
+      return columnModel.getColumnIndexAtX(point.x);
+    
+    return -1;
+  }
 }
index 0aaad8b..c2de7f0 100644 (file)
@@ -141,81 +141,87 @@ public class TableColumn
   private SwingPropertyChangeSupport changeSupport =
     new SwingPropertyChangeSupport(this);
 
-       /**
-        * Constructor TableColumn
-        */
+  /**
+   * Constructor TableColumn
+   */
   public TableColumn()
   {
-               this(0, 75, null, null);
+    this(0, 75, null, null);
   }
 
-       /**
-        * Constructor TableColumn
-        * @param modelIndex TODO
-        */
+  /**
+   * Constructor TableColumn
+   * 
+   * @param modelIndex the index of the column in the model
+   */
   public TableColumn(int modelIndex)
   {
-               this(modelIndex, 75, null, null);
+    this(modelIndex, 75, null, null);
   }
 
-       /**
-        * Constructor TableColumn
-        * @param modelIndex TODO
-        * @param width TODO
-        */
+  /**
+   * Constructor TableColumn
+   * 
+   * @param modelIndex the index of the column in the model
+   * @param width the width
+   */
   public TableColumn(int modelIndex, int width)
   {
-               this(modelIndex, width, null, null);
+    this(modelIndex, width, null, null);
   }
 
-       /**
-        * Constructor TableColumn
-        * @param modelIndex TODO
-        * @param width TODO
-        * @param cellRenderer TODO
-        * @param cellEditor TODO
-        */
-       public TableColumn(int modelIndex, int width,
+  /**
+   * Constructor TableColumn
+   * 
+   * @param modelIndex the index of the column in the model
+   * @param width the width
+   * @param cellRenderer the cell renderer
+   * @param cellEditor the cell editor
+   */
+  public TableColumn(int modelIndex, int width,
                      TableCellRenderer cellRenderer, TableCellEditor cellEditor)
   {
-               this.modelIndex = modelIndex;
-               this.width = width;
-               this.preferredWidth = width;
-               this.cellRenderer = cellRenderer;
-               this.cellEditor = cellEditor;
-               this.headerValue = null;
-               this.identifier = null;
-  }
-
-       /**
-        * firePropertyChange
-        * @param property TODO
-        * @param oldValue TODO
-        * @param newValue TODO
-        */
+    this.modelIndex = modelIndex;
+    this.width = width;
+    this.preferredWidth = width;
+    this.cellRenderer = cellRenderer;
+    this.cellEditor = cellEditor;
+    this.headerValue = null;
+    this.identifier = null;
+  }
+
+  /**
+   * firePropertyChange
+   * 
+   * @param property the name of the property
+   * @param oldValue the old value
+   * @param newValue the new value
+   */
   private void firePropertyChange(String property, Object oldValue,
                                   Object newValue)
   {
-               changeSupport.firePropertyChange(property, oldValue, newValue);
+    changeSupport.firePropertyChange(property, oldValue, newValue);
   }
 
-       /**
-        * firePropertyChange
-        * @param property TODO
-        * @param oldValue TODO
-        * @param newValue TODO
-        */
+  /**
+   * firePropertyChange
+   * 
+   * @param property the name of the property
+   * @param oldValue the old value
+   * @param newValue the new value
+   */
   private void firePropertyChange(String property, int oldValue, int newValue)
   {
-               firePropertyChange(property, new Integer(oldValue), new Integer(newValue));
+    firePropertyChange(property, new Integer(oldValue), new Integer(newValue));
   }
 
-       /**
-        * firePropertyChange
-        * @param property TODO
-        * @param oldValue TODO
-        * @param newValue TODO
-        */
+  /**
+   * firePropertyChange
+   * 
+   * @param property the name of the property 
+   * @param oldValue the old value
+   * @param newValue the new value
+   */
   private void firePropertyChange(String property, boolean oldValue,
                                   boolean newValue)
   {
@@ -225,73 +231,75 @@ public class TableColumn
 
   /**
    * setModelIndex
-   * @param modelIndex TODO
+   * 
+   * @param modelIndex the index to set
    */
   public void setModelIndex(int modelIndex)
   {
-               this.modelIndex = modelIndex;
+    this.modelIndex = modelIndex;
   }
 
-       /**
-        * getModelIndex
-   * @return int
-        */
+  /**
+   * getModelIndex
+   * 
+   * @return the model index
+   */
   public int getModelIndex()
   {
-               return modelIndex;
+    return modelIndex;
   }
 
-       /**
-        * setIdentifier
-        * @param identifier TODO
-        */
+  /**
+   * setIdentifier
+   * 
+   * @param identifier the identifier
+   */
   public void setIdentifier(Object identifier)
   {
-               this.identifier = identifier;
+    this.identifier = identifier;
   }
 
-       /**
-        * getIdentifier
-   * @return Object
-        */
+  /**
+   * getIdentifier
+   * 
+   * @return the identifier
+   */
   public Object getIdentifier()
   {
     if (identifier == null)
-                       return getHeaderValue();
-               return identifier;
+      return getHeaderValue();
+    return identifier;
   }
 
-       /**
-        * setHeaderValue
-        * @param headerValue TODO
-        */
+  /**
+   * setHeaderValue
+   * 
+   * @param headerValue the value of the header
+   */
   public void setHeaderValue(Object headerValue)
   {
-               // Variables
-               Object  oldValue;
-
-               // Get Old Value
-               oldValue = this.headerValue;
-
-               // Set Propeprty
-               this.headerValue = headerValue;
-
-               // Notify Listeners of change
+    if (this.headerValue == headerValue)
+      return;
+    
+    Object oldValue = this.headerValue;
+    this.headerValue = headerValue;
     firePropertyChange(HEADER_VALUE_PROPERTY, oldValue, headerValue);
   }
 
-       /**
-        * getHeaderValue
-   * @return Object
-        */
+  /**
+   * getHeaderValue
+   * 
+   * @return the value of the header
+   */
   public Object getHeaderValue()
   {
-               return headerValue;
+    return headerValue;
   }
 
   /**
    * setHeaderRenderer
-   * @param headerRenderer TODO
+   * 
+   * @param headerRenderer the renderer to se
    */
   public void setHeaderRenderer(TableCellRenderer renderer)
   {
@@ -304,18 +312,19 @@ public class TableColumn
                       oldRenderer, headerRenderer);
   }
 
-       /**
-        * getHeaderRenderer
+  /**
+   * getHeaderRenderer
    * @return TableCellRenderer
-        */
+   */
   public TableCellRenderer getHeaderRenderer()
   {
-               return headerRenderer;
+    return headerRenderer;
   }
 
   /**
    * setCellRenderer
-   * @param cellRenderer TODO
+   * 
+   * @param cellRenderer the cell renderer
    */
   public void setCellRenderer(TableCellRenderer renderer)
   {
@@ -328,36 +337,40 @@ public class TableColumn
                       oldRenderer, cellRenderer);
   }
 
-       /**
-        * getCellRenderer
-   * @return TableCellRenderer
-        */
+  /**
+   * getCellRenderer
+   * 
+   * @return the cell renderer
+   */
   public TableCellRenderer getCellRenderer()
   {
-               return cellRenderer;
+    return cellRenderer;
   }
 
-       /**
-        * setCellEditor
-        * @param cellEditor TODO
-        */
+  /**
+   * setCellEditor
+   * 
+   * @param cellEditor the cell editor
+   */
   public void setCellEditor(TableCellEditor cellEditor)
   {
-               this.cellEditor = cellEditor;
+    this.cellEditor = cellEditor;
   }
 
-       /**
-        * getCellEditor
-   * @return TableCellEditor
-        */
+  /**
+   * getCellEditor
+   * 
+   * @return the cell editor
+   */
   public TableCellEditor getCellEditor()
   {
-               return cellEditor;
+    return cellEditor;
   }
 
   /**
    * setWidth
-   * @param newWidth TODO
+   * 
+   * @param newWidth the width
    */
   public void setWidth(int newWidth)
   {
@@ -376,102 +389,112 @@ public class TableColumn
     firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, width);
   }
 
-       /**
-        * getWidth
+  /**
+   * getWidth
+   * 
    * @return int
-        */
+   */
   public int getWidth()
   {
-               return width;
+    return width;
   }
 
-       /**
-        * setPreferredWidth
-        * @param preferredWidth TODO
-        */
+  /**
+   * setPreferredWidth
+   * 
+   * @param preferredWidth the preferred width
+   */
   public void setPreferredWidth(int preferredWidth)
   {
     if (preferredWidth < minWidth)
-                       this.preferredWidth = minWidth;
+      this.preferredWidth = minWidth;
     else if (preferredWidth > maxWidth)
-                       this.preferredWidth = maxWidth;
+      this.preferredWidth = maxWidth;
     else
-                       this.preferredWidth = preferredWidth;
+      this.preferredWidth = preferredWidth;
   }
 
-       /**
-        * getPreferredWidth
-   * @return int
-        */
+  /**
+   * getPreferredWidth
+   * 
+   * @return the preferred width
+   */
   public int getPreferredWidth()
   {
-               return preferredWidth;
+    return preferredWidth;
   }
 
-       /**
-        * setMinWidth
-        * @param minWidth TODO
-        */
+  /**
+   * setMinWidth
+   * 
+   * @param minWidth the minium width
+   */
   public void setMinWidth(int minWidth)
   {
-               this.minWidth = minWidth;
-               setWidth(getWidth());
-               setPreferredWidth(getPreferredWidth());
+    this.minWidth = minWidth;
+    setWidth(getWidth());
+    setPreferredWidth(getPreferredWidth());
   }
 
-       /**
-        * getMinWidth
-   * @return int
-        */
+  /**
+   * getMinWidth
+   * 
+   * @return the minimum width
+   */
   public int getMinWidth()
   {
-               return minWidth;
+    return minWidth;
   }
 
-       /**
-        * setMaxWidth
-        * @param maxWidth TODO
-        */
+  /**
+   * setMaxWidth
+   * 
+   * @param maxWidth the maximum width
+   */
   public void setMaxWidth(int maxWidth)
   {
-               this.maxWidth = maxWidth;
-               setWidth(getWidth());
-               setPreferredWidth(getPreferredWidth());
+    this.maxWidth = maxWidth;
+    setWidth(getWidth());
+    setPreferredWidth(getPreferredWidth());
   }
 
-       /**
-        * getMaxWidth
-   * @return int
-        */
+  /**
+   * getMaxWidth
+   * @return the maximim width
+   */
   public int getMaxWidth()
   {
-               return maxWidth;
+    return maxWidth;
   }
 
-       /**
-        * setResizable
-        * @param isResizable TODO
-        */
+  /**
+   * setResizable
+   * 
+   * @param isResizable <code>true</code> if this column is resizable,
+   * <code>false</code> otherwise
+   */
   public void setResizable(boolean isResizable)
   {
-               this.isResizable = isResizable;
+    this.isResizable = isResizable;
   }
 
-       /**
-        * getResizable
-   * @return boolean
-        */
+  /**
+   * getResizable
+   * 
+   * @return <code>true</code> if this column is resizable,
+   * <code>false</code> otherwise
+   */
   public boolean getResizable()
   {
-               return isResizable;
+    return isResizable;
   }
 
-       /**
-        * sizeWidthToFit
-        */
+  /**
+   * sizeWidthToFit
+   */
   public void sizeWidthToFit()
   {
-               // TODO
+    // TODO
   }
 
   /**
@@ -481,7 +504,7 @@ public class TableColumn
    */
   public void disableResizedPosting()
   {
-               // Does nothing
+    // Does nothing
   }
 
   /**
@@ -491,25 +514,25 @@ public class TableColumn
    */
   public void enableResizedPosting()
   {
-               // Does nothing
+    // Does nothing
   }
 
-       /**
-        * addPropertyChangeListener
+  /**
+   * addPropertyChangeListener
    * @param listener the listener to all
-        */
+   */
   public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
   {
-               changeSupport.addPropertyChangeListener(listener);
+    changeSupport.addPropertyChangeListener(listener);
   }
 
-       /**
-        * removePropertyChangeListener
+  /**
+   * removePropertyChangeListener
    * @param listener the listener to remove
-        */
+   */
   public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
   {
-               changeSupport.removePropertyChangeListener(listener);
+    changeSupport.removePropertyChangeListener(listener);
   }
 
   /**
@@ -523,9 +546,9 @@ public class TableColumn
   /**
    * createDefaultHeaderRenderer
    * @return TableCellRenderer
-        */
+   */
   protected TableCellRenderer createDefaultHeaderRenderer()
   {
-               return new DefaultTableCellRenderer();
+    return new DefaultTableCellRenderer();
   }
 }
index b825ca0..1c036d8 100644 (file)
@@ -49,118 +49,118 @@ import javax.swing.event.TableColumnModelListener;
  */
 public interface TableColumnModel
 {
-       /**
-        * addColumn
-        * @param column TableColumn
-        */
-       void addColumn(TableColumn column);
-
-       /**
-        * removeColumn
-        * @param column TableColumn
-        */
-       void removeColumn(TableColumn column);
-
-       /**
-        * moveColumn
-        * @param columnIndex Index of column to move
-        * @param newIndex New index of column
-        */
-       void moveColumn(int columnIndex, int newIndex);
-
-       /**
-        * setColumnMargin
-        * @param margin Margin of column
-        */
-       void setColumnMargin(int margin);
-
-       /**
-        * getColumnCount
+  /**
+   * addColumn
+   * @param column TableColumn
+   */
+  void addColumn(TableColumn column);
+
+  /**
+   * removeColumn
+   * @param column TableColumn
+   */
+  void removeColumn(TableColumn column);
+
+  /**
+   * moveColumn
+   * @param columnIndex Index of column to move
+   * @param newIndex New index of column
+   */
+  void moveColumn(int columnIndex, int newIndex);
+
+  /**
+   * setColumnMargin
+   * @param margin Margin of column
+   */
+  void setColumnMargin(int margin);
+
+  /**
+   * getColumnCount
    * @return Column count
-        */
-       int getColumnCount();
+   */
+  int getColumnCount();
 
-       /**
-        * getColumns
+  /**
+   * getColumns
    * @return Enumeration of columns
-        */
-       Enumeration getColumns();
-
-       /**
-        * getColumnIndex
-        * @param columnIdentifier Column id
-        */
-       int getColumnIndex(Object columnIdentifier);
-
-       /**
-        * getColumn
-        * @param columnIndex Index of column
-        */
-       TableColumn getColumn(int columnIndex);
-
-       /**
-        * getColumnMargin
+   */
+  Enumeration getColumns();
+
+  /**
+   * getColumnIndex
+   * @param columnIdentifier Column id
+   */
+  int getColumnIndex(Object columnIdentifier);
+
+  /**
+   * getColumn
+   * @param columnIndex Index of column
+   */
+  TableColumn getColumn(int columnIndex);
+
+  /**
+   * getColumnMargin
    * @return Column margin
-        */
-       int getColumnMargin();
+   */
+  int getColumnMargin();
 
-       /**
-        * getColumnIndexAtX
+  /**
+   * getColumnIndexAtX
    * @return Column index as position x
-        */
-       int getColumnIndexAtX(int xPosition);
+   */
+  int getColumnIndexAtX(int xPosition);
 
-       /**
-        * getTotalColumnWidth
+  /**
+   * getTotalColumnWidth
    * @return Total column width
-        */
-       int getTotalColumnWidth();
+   */
+  int getTotalColumnWidth();
 
-       /**
-        * setColumnSelectionAllowed
-        * @param value Set column selection
-        */
-       void setColumnSelectionAllowed(boolean value);
+  /**
+   * setColumnSelectionAllowed
+   * @param value Set column selection
+   */
+  void setColumnSelectionAllowed(boolean value);
 
-       /**
-        * getColumnSelectionAllowed
+  /**
+   * getColumnSelectionAllowed
    * @return true if column selection allowed, false otherwise
-        */
-       boolean getColumnSelectionAllowed();
+   */
+  boolean getColumnSelectionAllowed();
 
-       /**
-        * getSelectedColumns
+  /**
+   * getSelectedColumns
    * @return Selected columns
-        */
-       int[] getSelectedColumns();
+   */
+  int[] getSelectedColumns();
 
-       /**
-        * getSelectedColumnCount
+  /**
+   * getSelectedColumnCount
    * @return Count of selected columns
-        */
-       int getSelectedColumnCount();
-
-       /**
-        * setSelectionModel
-        * @param model ListSelectionModel
-        */
-       void setSelectionModel(ListSelectionModel model);
-
-       /**
-        * getSelectionModel
-        * @param column TableColumn
-        */
-       ListSelectionModel getSelectionModel();
-
-       /**
-        * addColumnModelListener
-        * @param listener TableColumnModelListener
-        */
-       void addColumnModelListener(TableColumnModelListener listener);
-
-       /**
-        * removeColumnModelListener
-        * @param listener TableColumnModelListener
-        */
-       void removeColumnModelListener(TableColumnModelListener listener);
+   */
+  int getSelectedColumnCount();
+
+  /**
+   * setSelectionModel
+   * @param model ListSelectionModel
+   */
+  void setSelectionModel(ListSelectionModel model);
+
+  /**
+   * getSelectionModel
+   * @param column TableColumn
+   */
+  ListSelectionModel getSelectionModel();
+
+  /**
+   * addColumnModelListener
+   * @param listener TableColumnModelListener
+   */
+  void addColumnModelListener(TableColumnModelListener listener);
+
+  /**
+   * removeColumnModelListener
+   * @param listener TableColumnModelListener
+   */
+  void removeColumnModelListener(TableColumnModelListener listener);
 }
index a4732d0..591ce43 100644 (file)
@@ -1,5 +1,5 @@
 /* TableModel.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,72 +39,96 @@ package javax.swing.table;
 
 import javax.swing.event.TableModelListener;
 
-
 /**
- * TableModel public interface
+ * A <code>TableModel</code> is a two dimensional data structure that 
+ * can store arbitrary <code>Object</code> instances, usually for the
+ * purpose of display in a {@link JTable} component.  Individual objects
+ * can be accessed by specifying the row index and column index for 
+ * the object.  Each column in the model has a name associated with it.
+ * <p>
+ * The {@link DefaultTableModel} class provides one implementation of
+ * this interface.
+ * 
  * @author Andrew Selkirk
  */
 public interface TableModel
 {
-       /**
-        * getRowCount
-   * @return row count
-        */
-       int getRowCount();
-
-       /**
-        * getColumnCount
-   * @return column count
-        */
-       int getColumnCount();
-
-       /**
-        * getColumnName
-        * @param columnIndex Column index
-   * @return Column name
-        */
-       String getColumnName(int columnIndex);
-
-       /**
-        * getColumnClass
-        * @param columnIndex Column index
-   * @return Column class
-        */
-       Class getColumnClass(int columnIndex);
-
-       /**
-        * isCellEditable
-        * @param rowIndex Row index
-        * @param columnIndex Column index
-   * @return true if editable, false otherwise
-        */
-       boolean isCellEditable(int rowIndex, int columnIndex);
-
-       /**
-        * getValueAt
-        * @param rowIndex Row index
-        * @param columnIndex Column index
-   * @return Value at specified indices
-        */
-       Object getValueAt(int rowIndex, int columnIndex);
-
-       /**
-        * setValueAt
-        * @param aValue Value to set
-        * @param rowIndex Row index
-        * @param columnIndex Column index
-        */
-       void setValueAt(Object aValue, int rowIndex, int columnIndex);
-
-       /**
-        * addTableModelListener
-        * @param listener TableModelListener
-        */
-       void addTableModelListener(TableModelListener listener);
-
-       /**
-        * removeTableModelListener
-        * @param listener TableModelListener
-        */
-       void removeTableModelListener(TableModelListener listener);
+  /**
+   * Returns the number of rows in the model.
+   * 
+   * @return The row count.
+   */
+  int getRowCount();
+
+  /**
+   * Returns the number of columns in the model.
+   * 
+   * @return The column count
+   */
+  int getColumnCount();
+
+  /**
+   * Returns the name of a column in the model.
+   * 
+   * @param columnIndex the column index.
+   * 
+   * @return The column name.
+   */
+  String getColumnName(int columnIndex);
+
+  /**
+   * Returns the <code>Class</code> for all <code>Object</code> instances
+   * in the specified column.  
+   * 
+   * @param columnIndex the column index.
+   * 
+   * @return The class.
+   */
+  Class getColumnClass(int columnIndex);
+
+  /**
+   * Returns <code>true</code> if the cell is editable, and <code>false</code>
+   * otherwise.
+   * 
+   * @param rowIndex the row index.
+   * @param columnIndex the column index.
+   * 
+   * @return <code>true</code> if editable, <code>false</code> otherwise.
+   */
+  boolean isCellEditable(int rowIndex, int columnIndex);
+
+  /**
+   * Returns the value (<code>Object</code>) at a particular cell in the
+   * table.
+   * 
+   * @param rowIndex the row index.
+   * @param columnIndex the column index.
+   * 
+   * @return The value at the specified cell.
+   */
+  Object getValueAt(int rowIndex, int columnIndex);
+
+  /**
+   * Sets the value at a particular cell in the table.  
+   * 
+   * @param aValue the value (<code>null</code> permitted).
+   * @param rowIndex the row index.
+   * @param columnIndex the column index.
+   */
+  void setValueAt(Object aValue, int rowIndex, int columnIndex);
+
+  /**
+   * Adds a listener to the model.  The listener will receive notification
+   * of updates to the model.
+   * 
+   * @param listener the listener.
+   */
+  void addTableModelListener(TableModelListener listener);
+
+  /**
+   * Removes a listener from the model.
+   * 
+   * @param listener the listener.
+   */
+  void removeTableModelListener(TableModelListener listener);
 }
index f579fbb..a2c3fa6 100644 (file)
@@ -1,5 +1,5 @@
 /* AbstractDocument.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,8 +38,8 @@ exception statement from your version. */
 
 package javax.swing.text;
 
+import java.io.PrintStream;
 import java.io.Serializable;
-import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.EventListener;
@@ -59,7 +59,9 @@ public abstract class AbstractDocument
   implements Document, Serializable
 {
   private static final long serialVersionUID = -116069779446114664L;
+  
   protected static final String BAD_LOCATION = "document location failure";
+  
   public static final String BidiElementName = "bidi level";
   public static final String ContentElementName = "content";
   public static final String ParagraphElementName = "paragraph";
@@ -68,6 +70,8 @@ public abstract class AbstractDocument
 
   Content content;
   AttributeContext context;
+  DocumentFilter documentFilter;
+  
   protected EventListenerList listenerList = new EventListenerList();
 
   protected AbstractDocument(Content doc)
@@ -139,7 +143,7 @@ public abstract class AbstractDocument
   protected void fireUndoableEditUpdate(UndoableEditEvent event)
   {
     UndoableEditListener[] listeners = getUndoableEditListeners();
-    
+
     for (int index = 0; index < listeners.length; ++index)
       listeners[index].undoableEditHappened(event);
   }
@@ -187,7 +191,7 @@ public abstract class AbstractDocument
 
   public int getLength()
   {
-    return content.length();
+    return content.length() - 1;
   }
 
   public EventListener[] getListeners(Class listenerType)
@@ -219,9 +223,9 @@ public abstract class AbstractDocument
   }
 
   public String getText(int offset, int length) throws BadLocationException
-      {
-       return content.getString(offset, length);
-      }
+  {
+    return content.getString(offset, length);
+  }
 
   public void getText(int offset, int length, Segment segment)
     throws BadLocationException
@@ -372,6 +376,27 @@ public abstract class AbstractDocument
   {
   }
 
+  /**
+   * @since 1.4
+   */
+  public DocumentFilter getDocumentFilter()
+  {
+    return documentFilter;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public void setDocumentFilter(DocumentFilter filter)
+  {
+    this.documentFilter = filter;
+  }
+
+  public void dump(PrintStream out)
+  {
+    ((AbstractElement) getDefaultRootElement()).dump(out, 0);
+  }
+
   public interface AttributeContext
   {
     AttributeSet addAttribute(AttributeSet old, Object name, Object value);
@@ -415,7 +440,6 @@ public abstract class AbstractDocument
     AttributeSet attributes;
 
     Element element_parent;
-    Vector element_children;
 
     TreeNode tree_parent;
     Vector tree_children;
@@ -428,15 +452,9 @@ public abstract class AbstractDocument
 
     // TreeNode implementation
 
-    public Enumeration children()
-    {
-      return Collections.enumeration(tree_children);
-    }
+    public abstract Enumeration children();
       
-    public boolean getAllowsChildren()
-    {
-      return true;
-    }
+    public abstract boolean getAllowsChildren();
       
     public TreeNode getChildAt(int index)
     {
@@ -553,10 +571,7 @@ public abstract class AbstractDocument
       return AbstractDocument.this;
     }
       
-    public Element getElement(int index)
-    {
-      return (Element) element_children.get(index);
-    }
+    public abstract Element getElement(int index);
       
     public String getName()
     {
@@ -575,13 +590,49 @@ public abstract class AbstractDocument
     public abstract int getElementIndex(int offset);
       
     public abstract int getStartOffset();
+
+    private void dumpElement(PrintStream stream, String indent, Element element)
+    {
+      System.out.println(indent + "<" + element.getName() +">");
+      
+      if (element.isLeaf())
+       {
+         int start = element.getStartOffset();
+         int end = element.getEndOffset();
+         String text = "";
+         try
+           {
+             text = getContent().getString(start, end - start);
+           }
+         catch (BadLocationException e)
+           {
+           }
+         System.out.println(indent + "  ["
+                            + start + ","
+                            + end + "]["
+                            + text + "]");
+       }
+      else
+       {
+         for (int i = 0; i < element.getElementCount(); ++i)
+           dumpElement(stream, indent + "  ", element.getElement(i));
+       }
+    }
+    
+    public void dump(PrintStream stream, int indent)
+    {
+      String indentStr = "";
+      for (int i = 0; i < indent; ++i)
+       indentStr += "  ";
+      dumpElement(stream, indentStr, this);
+    }
   }
 
   public class BranchElement extends AbstractElement
   {
     private static final long serialVersionUID = -8595176318868717313L;
     
-    private Vector children = new Vector();
+    private Element[] children = new Element[0];
 
     public BranchElement(Element parent, AttributeSet attributes)
     {
@@ -590,7 +641,15 @@ public abstract class AbstractDocument
 
     public Enumeration children()
     {
-      return children.elements();
+      if (children.length == 0)
+        return null;
+
+      Vector tmp = new Vector();
+
+      for (int index = 0; index < children.length; ++index)
+       tmp.add(children[index]);
+      
+      return tmp.elements();
     }
 
     public boolean getAllowsChildren()
@@ -600,43 +659,46 @@ public abstract class AbstractDocument
 
     public Element getElement(int index)
     {
-      if (index < 0 || index >= children.size())
+      if (index < 0 || index >= children.length)
        return null;
 
-      return (Element) children.get(index);
+      return children[index];
     }
 
     public int getElementCount()
     {
-      return children.size();
+      return children.length;
     }
 
     public int getElementIndex(int offset)
     {
-      if (children.size() == 0)
-       return 0;
-      
-      Element element = positionToElement(offset);
+      // XXX: There is surely a better algorithm
+      // as beginning from first element each time.
+      for (int index = 0; index < children.length; ++index)
+        {
+         Element elem = children[index];
 
-      if (element == null)
-       return 0;
-      
-      return children.indexOf(element);
+         if ((elem.getStartOffset() <= offset)
+             && (offset < elem.getEndOffset()))
+           return index;
+        }
+
+      return 0;
     }
 
     public int getEndOffset()
     {
-      return ((Element) children.lastElement()).getEndOffset();
+      return children[children.length - 1].getEndOffset();
     }
 
     public String getName()
     {
-      return "AbstractDocument.BranchElement";
+      return ParagraphElementName;
     }
 
     public int getStartOffset()
     {
-      return ((Element) children.firstElement()).getStartOffset();
+      return children[0].getStartOffset();
     }
 
     public boolean isLeaf()
@@ -648,9 +710,9 @@ public abstract class AbstractDocument
     {
       // XXX: There is surely a better algorithm
       // as beginning from first element each time.
-      for (int index = 0; index < children.size(); ++index)
+      for (int index = 0; index < children.length; ++index)
         {
-         Element elem = (Element) children.get(index);
+         Element elem = children[index];
 
          if ((elem.getStartOffset() <= position)
              && (position < elem.getEndOffset()))
@@ -660,18 +722,22 @@ public abstract class AbstractDocument
       return null;
     }
 
-    public void replace(int offset, int length, Element[] elems)
+    public void replace(int offset, int length, Element[] elements)
     {
-      for (int index = 0; index < length; ++index)
-       children.removeElementAt(offset);
-
-      for (int index = 0; index < elems.length; ++index)
-       children.add(offset + index, elems[index]);
+      Element[] target = new Element[children.length - length
+                                    + elements.length];
+      System.arraycopy(children, 0, target, 0, offset);
+      System.arraycopy(elements, 0, target, offset, elements.length);
+      System.arraycopy(children, offset + length, target,
+                      offset + elements.length,
+                      children.length - offset - length);
+      children = target;
     }
 
     public String toString()
     {
-      return getName() + ": " + "content";
+      return ("BranchElement(" + getName() + ") "
+             + getStartOffset() + "," + getEndOffset() + "\n");
     }
   }
 
@@ -782,7 +848,7 @@ public abstract class AbstractDocument
       return false;
     }
 
-    public Element getElement()
+    public Element getElement(int index)
     {
       return null;
     }
@@ -804,7 +870,7 @@ public abstract class AbstractDocument
 
     public String getName()
     {
-      return "AbstractDocument.LeafElement";
+      return ContentElementName;
     }
 
     public int getStartOffset()
@@ -819,7 +885,8 @@ public abstract class AbstractDocument
 
     public String toString()
     {
-      return getName() + ": " + "content";
+      return ("LeafElement(" + getName() + ") "
+             + getStartOffset() + "," + getEndOffset() + "\n");
     }
   }
 }
index 0e3be20..ecec707 100644 (file)
@@ -1,5 +1,5 @@
-/* DefaultEditorKit.java -- 
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* DefaultEditorKit.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,14 +40,16 @@ package javax.swing.text;
 
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
+import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
 
 import javax.swing.Action;
-import javax.swing.JEditorPane;
 
 public class DefaultEditorKit extends EditorKit
 {
@@ -84,6 +86,7 @@ public class DefaultEditorKit extends EditorKit
     {
       super(cutAction);
     }
+
     public void actionPerformed(ActionEvent event)
     {
     }
@@ -96,6 +99,7 @@ public class DefaultEditorKit extends EditorKit
     {
       super(defaultKeyTypedAction);
     }
+
     public void actionPerformed(ActionEvent event)
     {
       JTextComponent t = getTextComponent(event);
@@ -123,6 +127,7 @@ public class DefaultEditorKit extends EditorKit
     {
       super(insertBreakAction);
     }
+
     public void actionPerformed(ActionEvent event)
     {
     }
@@ -147,6 +152,7 @@ public class DefaultEditorKit extends EditorKit
     {
       super(insertTabAction);
     }
+
     public void actionPerformed(ActionEvent event)
     {
     }
@@ -159,6 +165,7 @@ public class DefaultEditorKit extends EditorKit
     {
       super(pasteAction);
     }
+
     public void actionPerformed(ActionEvent event)
     {
     }
@@ -328,17 +335,6 @@ public class DefaultEditorKit extends EditorKit
     },
   };
 
-  /**
-   * Called when the kit is being removed from the JEditorPane.
-   */
-  public void deinstall(JEditorPane c)
-    {
-    }
-
-  public void install(JEditorPane c)
-    {
-    }
-
   public Caret createCaret()
   {
     return new DefaultCaret();
@@ -355,32 +351,47 @@ public class DefaultEditorKit extends EditorKit
   }
 
   public String getContentType()
-    {
-       return "text/plain";
-    }
-    
+  {
+    return "text/plain";
+  }
+  
   public ViewFactory getViewFactory()
-    {
-       return null;
-    }
+  {
+    return null;
+  }
 
-  public void read(InputStream in, Document doc, int pos)
+  public void read(InputStream in, Document document, int offset)
     throws BadLocationException, IOException
-    {
-    }
+  {
+    read(new InputStreamReader(in), document, offset);
+  }
 
-  public void read(Reader in, Document doc, int pos)
+  public void read(Reader in, Document document, int offset)
     throws BadLocationException, IOException
-    {
-    }
+  {
+    BufferedReader reader = new BufferedReader(in);
+
+    String line;
+    StringBuffer content = new StringBuffer();
 
-  public void write(OutputStream out, Document doc, int pos, int len)
+    while ((line = reader.readLine()) != null)
+      {
+       content.append(line);
+       content.append("\n");
+      }
+    
+    document.insertString(offset, content.toString(),
+                         SimpleAttributeSet.EMPTY);
+  }
+
+  public void write(OutputStream out, Document document, int offset, int len)
     throws BadLocationException, IOException
-    {
-    }
+  {
+    write(new OutputStreamWriter(out), document, offset, len);
+  }
 
-  public void write(Writer out, Document doc, int pos, int len)
+  public void write(Writer out, Document document, int offset, int len)
     throws BadLocationException, IOException
-    {
-    }
+  {
+  }
 }
diff --git a/libjava/javax/swing/text/DefaultStyledDocument.java b/libjava/javax/swing/text/DefaultStyledDocument.java
new file mode 100644 (file)
index 0000000..83da23a
--- /dev/null
@@ -0,0 +1,195 @@
+/* DefaultStyledDocument.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.Serializable;
+
+/**
+ * @author Michael Koch (konqueror@gmx.de)
+ */
+public class DefaultStyledDocument extends AbstractDocument
+  implements StyledDocument
+{
+  public class ElementBuffer
+    implements Serializable
+  {
+    private Element root;
+    
+    public ElementBuffer(Element root)
+    {
+      this.root = root;
+    }
+
+    public Element getRootElement()
+    {
+      return root;
+    }
+  }
+  
+  public static final int BUFFER_SIZE_DEFAULT = 4096;
+
+  protected DefaultStyledDocument.ElementBuffer buffer;
+  
+  public DefaultStyledDocument()
+  {
+    this(new GapContent(BUFFER_SIZE_DEFAULT), new StyleContext());
+  }
+
+  public DefaultStyledDocument(StyleContext context)
+  {
+    this(new GapContent(BUFFER_SIZE_DEFAULT), context);
+  }
+
+  public DefaultStyledDocument(AbstractDocument.Content content,
+                              StyleContext context)
+  {
+    super(content, context);
+    buffer = new ElementBuffer(createDefaultRoot());
+    setLogicalStyle(0, context.getStyle(StyleContext.DEFAULT_STYLE));
+  }
+
+  public Style addStyle(String nm, Style parent)
+  {
+    StyleContext context = (StyleContext) getAttributeContext();
+    return context.addStyle(nm, parent);
+  }
+  
+  protected AbstractDocument.AbstractElement createDefaultRoot()
+  {
+    Element[] tmp;
+    BranchElement section = new BranchElement(null, null);
+    
+    BranchElement paragraph = new BranchElement(section, null);
+    tmp = new Element[1];
+    tmp[0] = paragraph;
+    section.replace(0, 0, tmp);
+
+    LeafElement leaf = new LeafElement(paragraph, null, 0, 1);
+    tmp = new Element[1];
+    tmp[0] = leaf;
+    paragraph.replace(0, 0, tmp);
+    
+    return section;
+  }
+  
+  public Element getCharacterElement(int position)
+  {
+    Element element = getDefaultRootElement();
+
+    while (! element.isLeaf())
+      {
+       int index = element.getElementIndex(position);
+       element = element.getElement(index);
+      }
+    
+    return element;
+  }
+  
+  public Color getBackground(AttributeSet attributes)
+  {
+    StyleContext context = (StyleContext) getAttributeContext();
+    return context.getBackground(attributes);
+  }
+  
+  public Element getDefaultRootElement()
+  {
+    return buffer.getRootElement();
+  }
+  
+  public Font getFont(AttributeSet attributes)
+  {
+    StyleContext context = (StyleContext) getAttributeContext();
+    return context.getFont(attributes);
+  }
+  
+  public Color getForeground(AttributeSet attributes)
+  {
+    StyleContext context = (StyleContext) getAttributeContext();
+    return context.getForeground(attributes);
+  }
+  
+  public Style getLogicalStyle(int position)
+  {
+    Element paragraph = getParagraphElement(position);
+    AttributeSet attributes = paragraph.getAttributes();
+    return (Style) attributes.getResolveParent();
+  }
+  
+  public Element getParagraphElement(int position)
+  {
+    Element element = getCharacterElement(position);
+    return element.getParentElement();
+  }
+
+  public Style getStyle(String nm)
+  {
+    StyleContext context = (StyleContext) getAttributeContext();
+    return context.getStyle(nm);
+  }
+
+  public void removeStyle(String nm)
+  {
+    StyleContext context = (StyleContext) getAttributeContext();
+    context.removeStyle(nm);
+  }
+
+  public void setCharacterAttributes(int offset, int length,
+                                    AttributeSet attributes,
+                                    boolean replace)
+  {
+    // FIXME: Implement me.
+    throw new Error("not implemented");
+  }
+  
+  public void setLogicalStyle(int position, Style style)
+  {
+    // FIXME: Implement me.
+    throw new Error("not implemented");
+  }
+
+  public void setParagraphAttributes(int offset, int length,
+                                    AttributeSet attributes,
+                                    boolean replace)
+  {
+    // FIXME: Implement me.
+    throw new Error("not implemented");
+  }
+}
index efca965..5d89a11 100644 (file)
@@ -1,4 +1,4 @@
-/* EditorKit.java -- 
+/* EditorKit.java --
    Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -54,31 +54,31 @@ public abstract class EditorKit
   private static final long serialVersionUID = -5044124649345887822L;
   
   public EditorKit()
-    {
-    }
+  {
+  }
 
   public Object clone()
-    {
+  {
     try
       {
        return super.clone();
-    }
+      }
     catch (CloneNotSupportedException e)
-    {
+      {
        return null;
-    }
+      }
   }
 
   /**
    * Called when the kit is being removed from the JEditorPane.
    */
   public void deinstall(JEditorPane c)
-    {
-    }
+  {
+  }
 
   public void install(JEditorPane c)
   {
-}
+  }
 
   public abstract Caret createCaret();
   public abstract Document createDefaultDocument();
index 5826128..44a8dcb 100644 (file)
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.text;
 
 import java.io.Serializable;
@@ -57,6 +58,7 @@ public class GapContent
 
   public GapContent(int size)
   {
+    buf.append("\n");
   }
 
   public Position createPosition(final int offset) throws BadLocationException
index 0bca84b..dee496d 100644 (file)
@@ -44,8 +44,15 @@ import java.awt.Dimension;
 import java.awt.Insets;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.event.ActionEvent;
 import java.awt.event.InputMethodListener;
 import java.awt.event.KeyEvent;
+import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Hashtable;
 
@@ -61,6 +68,7 @@ import javax.swing.JComponent;
 import javax.swing.JViewport;
 import javax.swing.KeyStroke;
 import javax.swing.Scrollable;
+import javax.swing.TransferHandler;
 import javax.swing.UIManager;
 import javax.swing.event.CaretEvent;
 import javax.swing.event.CaretListener;
@@ -546,7 +554,92 @@ public abstract class JTextComponent extends JComponent
     {
       parent = p;
     }
+  }
+
+  class DefaultTransferHandler
+    extends TransferHandler
+  {
+    public boolean canImport(JComponent component, DataFlavor[] flavors)
+    {
+      JTextComponent textComponent = (JTextComponent) component;
+      
+      if (! (textComponent.isEnabled()
+            && textComponent.isEditable()
+            && flavors != null))
+        return false;
+
+      for (int i = 0; i < flavors.length; ++i)
+       if (flavors[i].equals(DataFlavor.stringFlavor))
+          return true;
+
+      return false;
+    }
+    
+    public void exportToClipboard(JComponent component, Clipboard clipboard,
+                                 int action)
+    {
+      JTextComponent textComponent = (JTextComponent) component;
+      int start = textComponent.getSelectionStart();
+      int end = textComponent.getSelectionEnd();
 
+      if (start == end)
+       return;
+
+      try
+       {
+         // Copy text to clipboard.
+         String data = textComponent.getDocument().getText(start, end);
+         StringSelection selection = new StringSelection(data);
+         clipboard.setContents(selection, null);
+
+         // Delete selected text on cut action.
+         if (action == MOVE)
+           doc.remove(start, end - start);
+       }
+      catch (BadLocationException e)
+       {
+         // Ignore this and do nothing.
+       }
+    }
+    
+    public int getSourceActions()
+    {
+      return NONE;
+    }
+
+    public boolean importData(JComponent component, Transferable transferable)
+    {
+      DataFlavor flavor = null;
+      DataFlavor[] flavors = transferable.getTransferDataFlavors();
+
+      if (flavors == null)
+       return false;
+
+      for (int i = 0; i < flavors.length; ++i)
+       if (flavors[i].equals(DataFlavor.stringFlavor))
+          flavor = flavors[i];
+      
+      if (flavor == null)
+       return false;
+
+      try
+       {
+         JTextComponent textComponent = (JTextComponent) component;
+         String data = (String) transferable.getTransferData(flavor);
+         textComponent.replaceSelection(data);
+         return true;
+       }
+      catch (IOException e)
+       {
+         // Ignored.
+       }
+      catch (UnsupportedFlavorException e)
+       {
+         // Ignored.
+       }
+
+      return false;
+    }
   }
 
   private static final long serialVersionUID = -8796518220218978795L;
@@ -554,8 +647,11 @@ public abstract class JTextComponent extends JComponent
   public static final String DEFAULT_KEYMAP = "default";
   public static final String FOCUS_ACCELERATOR_KEY = "focusAcceleratorKey";
   
+  private static DefaultTransferHandler defaultTransferHandler;
   private static Hashtable keymaps = new Hashtable();
   private Keymap keymap;
+  private char focusAccelerator = '\0';
+  private NavigationFilter navigationFilter;
   
   /**
    * Get a Keymap from the global keymap table, by name.
@@ -875,6 +971,7 @@ public abstract class JTextComponent extends JComponent
       }
     catch (BadLocationException e)
       {
+       // This can never happen.
       }
   }
 
@@ -1369,4 +1466,67 @@ public abstract class JTextComponent extends JComponent
   {
     dragEnabled = enabled;
   }
+
+  public void copy()
+  {
+    doTransferAction("copy", TransferHandler.getCopyAction());
+  }
+
+  public void cut()
+  {
+    doTransferAction("cut", TransferHandler.getCutAction());
+  }
+
+  public void paste()
+  {
+    doTransferAction("paste", TransferHandler.getPasteAction());
+  }
+
+  private void doTransferAction(String name, Action action)
+  {
+    // Install default TransferHandler if none set.
+    if (getTransferHandler() == null)
+      {
+       if (defaultTransferHandler == null)
+         defaultTransferHandler = new DefaultTransferHandler();
+       
+       setTransferHandler(defaultTransferHandler);
+      }
+
+    // Perform action.
+    ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
+                                       action.getValue(Action.NAME).toString());
+    action.actionPerformed(event);
+  }
+
+  public void setFocusAccelerator(char newKey)
+  {
+    if (focusAccelerator == newKey)
+      return;
+
+    char oldKey = focusAccelerator;
+    focusAccelerator = newKey;
+    firePropertyChange(FOCUS_ACCELERATOR_KEY, oldKey, newKey);
+  }
+  
+  public char getFocusAccelerator()
+  {
+    return focusAccelerator;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public NavigationFilter getNavigationFilter()
+  {
+    return navigationFilter;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public void setNavigationFilter(NavigationFilter filter)
+  {
+    navigationFilter = filter;
+  }
 }
index f9db041..ad18350 100644 (file)
@@ -56,6 +56,16 @@ public class PasswordView extends FieldView
     super(elem);
   }
 
+  /**
+   * Draws one echo character at a given position.
+   *
+   * @param g the <code>Graphics</code> object to draw to
+   * @param x the x-position
+   * @param y the y-position
+   * @param ch the echo character
+   *
+   * @return the next x position right of the drawn character
+   */
   protected int drawEchoCharacter(Graphics g, int x, int y, char ch)
   {
     // Update font metrics.
@@ -79,6 +89,17 @@ public class PasswordView extends FieldView
     return ch;
   }
 
+  /**
+   * Draws selected text at a given position.
+   *
+   * @param g the <code>Graphics</code> object to draw to
+   * @param x the x-position
+   * @param y the y-position
+   * @param p0 the position of the first character to draw
+   * @param p1 the position of the first character not to draw
+   *
+   * @return the next x position right of the drawn character
+   */
   protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
     throws BadLocationException
   {
@@ -107,6 +128,17 @@ public class PasswordView extends FieldView
     return x + len * metrics.charWidth(ch);
   }
 
+  /**
+   * Draws unselected text at a given position.
+   *
+   * @param g the <code>Graphics</code> object to draw to
+   * @param x the x-position
+   * @param y the y-position
+   * @param p0 the position of the first character to draw
+   * @param p1 the position of the first character not to draw
+   *
+   * @return the next x position right of the drawn character
+   */
   protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
     throws BadLocationException
   {
index 2280870..64e9c8a 100644 (file)
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.text;
 
 import java.util.ArrayList;
@@ -61,7 +62,7 @@ public class PlainDocument extends AbstractDocument
     rootElement = createDefaultRoot();
   }
 
-  protected void reindex()
+  private void reindex()
   {
     Element[] lines;
     try 
@@ -70,24 +71,23 @@ public class PlainDocument extends AbstractDocument
 
         ArrayList elts = new ArrayList();
         int j = 0;
-        for (int i = str.indexOf('\n', 0); i != -1; i = str.indexOf('\n', i+1))
+        for (int i = str.indexOf('\n', 0); i != -1; i = str.indexOf('\n', i + 1))
           {
-            elts.add(createLeafElement(rootElement, null, j, i));
-            j = i;
+            elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY, j, i + 1));
+            j = i + 1;
           }
         
         if (j < content.length())
-          elts.add(createLeafElement(rootElement, null, j, content.length()));
+          elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY, j, content.length()));
         
         lines = new Element[elts.size()];
         for (int i = 0; i < elts.size(); ++i)
           lines[i] = (Element) elts.get(i);
-        
       }
     catch (BadLocationException e)
       {
         lines = new Element[1];
-        lines[0] = createLeafElement(rootElement, null, 0, 1);
+        lines[0] = createLeafElement(rootElement, SimpleAttributeSet.EMPTY, 0, 1);
       }
 
     ((BranchElement) rootElement).replace(0, rootElement.getElementCount(), lines);
@@ -95,19 +95,28 @@ public class PlainDocument extends AbstractDocument
 
   protected AbstractDocument.AbstractElement createDefaultRoot()
   {
-    rootElement = createBranchElement(null, null);
-    reindex();
-    return (AbstractElement) rootElement;
+    BranchElement root =
+      (BranchElement) createBranchElement(null, SimpleAttributeSet.EMPTY);
+
+    Element[] array = new Element[1];
+    array[0] = createLeafElement(root, SimpleAttributeSet.EMPTY, 0, 1);
+    root.replace(0, 0, array);
+    
+    return root;
   }
 
-  protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)
+  protected void insertUpdate(DefaultDocumentEvent event, AttributeSet attributes)
   {
     reindex();
+
+    super.insertUpdate(event, attributes);
   }
 
-  protected void removeUpdate(DefaultDocumentEvent chng)
+  protected void removeUpdate(DefaultDocumentEvent event)
   {
     reindex();
+
+    super.removeUpdate(event);
   }
 
   public Element getDefaultRootElement()
@@ -117,6 +126,7 @@ public class PlainDocument extends AbstractDocument
 
   public Element getParagraphElement(int pos)
   {
-    return null;
+    Element root = getDefaultRootElement();
+    return root.getElement(root.getElementIndex(pos));
   }
 }
index bcec353..c852c1d 100644 (file)
@@ -1,5 +1,5 @@
 /* PlainView.java -- 
-   Copyright (C) 2004  Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -46,7 +46,6 @@ import java.awt.Graphics;
 import java.awt.Rectangle;
 import java.awt.Shape;
 
-
 public class PlainView extends View
   implements TabExpander
 {
@@ -93,6 +92,9 @@ public class PlainView extends View
   public Shape modelToView(int position, Shape a, Position.Bias b)
     throws BadLocationException
   {
+    // Ensure metrics are up-to-date.
+    updateMetrics();
+    
     Document document = getDocument();
 
     // Get rectangle of the line containing position.
@@ -115,13 +117,14 @@ public class PlainView extends View
     return rect;
   }
   
-  public void drawLine(int lineIndex, Graphics g, int x, int y)
+  protected void drawLine(int lineIndex, Graphics g, int x, int y)
   {
     try
       {
        metrics = g.getFontMetrics();
        // FIXME: Selected text are not drawn yet.
-       drawUnselectedText(g, x, y, 0, getDocument().getLength());
+       Element line = getDocument().getDefaultRootElement().getElement(lineIndex);
+       drawUnselectedText(g, x, y, line.getStartOffset(), line.getEndOffset());
        //drawSelectedText(g, , , , );
       }
     catch (BadLocationException e)
@@ -150,6 +153,9 @@ public class PlainView extends View
 
   public void paint(Graphics g, Shape s)
   {
+    // Ensure metrics are up-to-date.
+    updateMetrics();
+    
     JTextComponent textComponent = (JTextComponent) getContainer();
 
     g.setFont(textComponent.getFont());
@@ -159,10 +165,18 @@ public class PlainView extends View
     Rectangle rect = s.getBounds();
 
     // FIXME: Text may be scrolled.
-    drawLine(0, g, rect.x, rect.y);
+    Document document = textComponent.getDocument();
+    Element root = document.getDefaultRootElement();
+    int y = rect.y;
+    
+    for (int i = 0; i < root.getElementCount(); i++)
+      {
+       drawLine(i, g, rect.x, y);
+       y += metrics.getHeight();
+      }
   }
 
-  public int getTabSize()
+  protected int getTabSize()
   {
     return 8;
   }
index 64a91f2..2fe2bd3 100644 (file)
@@ -40,8 +40,8 @@ package javax.swing.text;
 
 public interface Position
 {
-    static class Bias
-    {
+  static class Bias
+  {
     public static final Bias Backward = new Bias("backward");
     public static final Bias Forward = new Bias("forward");
 
@@ -56,7 +56,7 @@ public interface Position
     {
       return name;
     }
-    }
+  }
     
-    int getOffset();
+  int getOffset();
 }
index 218768e..3b1d9e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Segment.java -- 
+/* Segment.java --
    Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -59,13 +59,13 @@ public class Segment
     this.offset = offset;
     this.count = count;
   }
-    
-    public Object clone()
-    {
+  
+  public Object clone()
+  {
     try
       {
-           return super.clone();
-       }
+       return super.clone();
+      }
     catch (CloneNotSupportedException e)
       {
        return null;
diff --git a/libjava/javax/swing/text/StringContent.java b/libjava/javax/swing/text/StringContent.java
new file mode 100644 (file)
index 0000000..f470ddd
--- /dev/null
@@ -0,0 +1,304 @@
+/* StringContent.java --
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.io.Serializable;
+import java.util.Vector;
+import java.util.Iterator;
+
+import javax.swing.undo.UndoableEdit;
+import javax.swing.undo.AbstractUndoableEdit;
+import javax.swing.undo.CannotUndoException;
+import javax.swing.undo.CannotRedoException;
+
+/**
+ * An implementation of the <code>AbstractDocument.Content</code>
+ * interface useful for small documents or debugging. The character
+ * content is a simple character array. It's not really efficient.
+ * 
+ * <p>Do not use this class for large size.</p>
+ */
+public final class StringContent implements AbstractDocument.Content, Serializable
+{
+  private char[] content;
+
+  private int count;
+
+  private Vector positions = new Vector();
+
+  private class InsertUndo extends AbstractUndoableEdit
+  {
+    private int start;
+    
+    private int length;
+
+    private String redoContent;
+
+    public InsertUndo(int start, int length)
+    {
+      super();
+      this.start = start;
+      this.length = length;
+    }
+
+    public void undo()
+    {
+      super.undo();
+      try
+        {
+          StringContent.this.checkLocation(this.start, this.length);
+          this.redoContent = new String(StringContent.this.content, this.start, this.length);
+          StringContent.this.remove(this.start, this.length);
+        }
+      catch (BadLocationException b)
+        {
+          throw new CannotUndoException();
+        }
+    }
+    
+    public void redo()
+    {
+      super.redo();
+      try
+        {
+          StringContent.this.insertString(this.start, this.redoContent);
+        }
+      catch (BadLocationException b)
+        {
+          throw new CannotRedoException();
+        }
+    }
+  }
+
+  private class RemoveUndo extends AbstractUndoableEdit
+  {
+    private int start;
+
+    private String undoString;
+
+    public RemoveUndo(int start, String str)
+    {
+      super();
+      this.start = start;
+      this.undoString = str;
+    }
+
+    public void undo()
+    {
+      super.undo();
+      try
+        {
+          StringContent.this.insertString(this.start, this.undoString);
+        }
+      catch (BadLocationException bad)
+        {
+          throw new CannotUndoException();
+        }
+    }
+
+    public void redo()
+    {
+      super.redo();
+      try
+        {
+          int end = this.undoString.length();
+          StringContent.this.remove(this.start, end);
+        }
+      catch (BadLocationException bad)
+        {
+          throw new CannotRedoException();
+        }
+    }
+  }
+
+  private class StickyPosition implements Position
+  {
+    private int offset = -1;
+
+    public StickyPosition(int offset)
+    {
+      this.offset = offset;
+    }
+
+    private void setOffset(int offset)
+    {
+      this.offset = this.offset >= 0 ? offset : -1;
+    }
+
+    /**
+     * Should be >=0.
+     */
+    public int getOffset()
+    {
+      return offset < 0 ? 0 : offset;
+    }
+  }
+
+  public StringContent()
+  {
+    this(1);
+  }
+
+  public StringContent(int initialLength)
+  {
+    super();
+    if (initialLength < 1)
+      initialLength = 1;
+    this.content = new char[initialLength];
+    this.content[0] = '\n';
+    this.count = 1;
+  }
+
+  protected Vector getPositionsInRange(Vector v,
+                                       int offset,
+                                       int length)
+  {
+    Vector refPos = new Vector();
+    Iterator iter = this.positions.iterator();
+    while(iter.hasNext())
+      {
+        Position p = (Position)iter.next();
+        if ((offset <= p.getOffset())
+            && (p.getOffset() <= (offset + length)))
+          refPos.add(p);
+      }
+    return refPos;
+  }
+
+  public Position createPosition(int offset) throws BadLocationException
+  {
+    if (offset < this.count || offset > this.count)
+      checkLocation(offset, 0);
+    StickyPosition sp = new StickyPosition(offset);
+    this.positions.add(sp);
+    return sp;
+  }
+  
+  public int length()
+  {
+    return this.count;
+  }
+  
+  public UndoableEdit insertString(int where, String str)
+    throws BadLocationException
+  {
+    checkLocation(where, 0);
+    if (where == this.count)
+      throw new BadLocationException("Invalid location", 1);
+    if (str == null)
+      throw new NullPointerException();
+    char[] insert = str.toCharArray();
+    char[] temp = new char[this.content.length + insert.length];
+    this.count += insert.length;
+    // Copy array and insert the string.
+    if (where > 0)
+      System.arraycopy(this.content, 0, temp, 0, where);
+    System.arraycopy(insert, 0, temp, where, insert.length);
+    System.arraycopy(this.content, where, temp, (where + insert.length), (temp.length - where - insert.length));
+    if (this.content.length < temp.length)
+      this.content = new char[temp.length];
+    // Copy the result in the original char array.
+    System.arraycopy(temp, 0, this.content, 0, temp.length);
+    // Move all the positions.
+    Vector refPos = getPositionsInRange(this.positions, where, temp.length - where);
+    Iterator iter = refPos.iterator();
+    while (iter.hasNext())
+      {
+        StickyPosition p = (StickyPosition)iter.next();
+        p.setOffset(p.getOffset() + str.length());
+      }
+    InsertUndo iundo = new InsertUndo(where, insert.length);
+    return iundo;
+  }
+  
+  public UndoableEdit remove(int where, int nitems) throws BadLocationException
+  {
+    checkLocation(where, nitems);
+    char[] temp = new char[(this.content.length - nitems)];
+    this.count = this.count - nitems;
+    RemoveUndo rundo = new RemoveUndo(where, new String(this.content, where, nitems));
+    // Copy array.
+    System.arraycopy(this.content, 0, temp, 0, where);
+    System.arraycopy(this.content, where + nitems, temp, where, this.content.length - where - nitems);
+    this.content = new char[temp.length];
+    // Then copy the result in the original char array.
+    System.arraycopy(temp, 0, this.content, 0, this.content.length);
+    // Move all the positions.
+    Vector refPos = getPositionsInRange(this.positions, where, this.content.length + nitems - where);
+    Iterator iter = refPos.iterator();
+    while (iter.hasNext())
+      {
+        StickyPosition p = (StickyPosition)iter.next();
+        int result = p.getOffset() - nitems;
+        p.setOffset(result);
+        if (result < 0)
+          this.positions.remove(p);
+      }
+    return rundo;
+  }
+  
+  public String getString(int where, int len) throws BadLocationException
+  {
+    checkLocation(where, len);
+    return new String (this.content, where, len);
+  }
+  
+  public void getChars(int where, int len, Segment txt) throws BadLocationException
+  {
+    checkLocation(where, len);
+    if (txt != null)
+      {
+        txt.array = this.content;
+        txt.offset = where;
+        txt.count = len;
+      }
+  }
+
+  private void checkLocation(int where, int len) throws BadLocationException
+  {
+    if (where < 0)
+      throw new BadLocationException("Invalid location", 1);
+    else if (where > this.count)
+      throw new BadLocationException("Invalid location", this.count);
+    else if ((where + len)>this.count)
+      throw new BadLocationException("Invalid range", this.count);
+  }
+  
+}
+
index f185830..148ebd3 100644 (file)
@@ -52,452 +52,452 @@ import javax.swing.event.CaretListener;
 /**
  * StyledEditorKit
  *
- * @author     Andrew Selkirk
+ * @author Andrew Selkirk
  */
 public class StyledEditorKit extends DefaultEditorKit
 {
   private static final long serialVersionUID = 7002391892985555948L;
 
-       /**
-        * UnderlineAction
-        */
+  /**
+   * UnderlineAction
+   */
   public static class UnderlineAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * Constructor UnderlineAction
-                */
+    /**
+     * Constructor UnderlineAction
+     */
     public UnderlineAction()
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * ItalicAction
-        */
+  /**
+   * ItalicAction
+   */
   public static class ItalicAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * Constructor ItalicAction
-                */
+    /**
+     * Constructor ItalicAction
+     */
     public ItalicAction()
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * BoldAction
-        */
+  /**
+   * BoldAction
+   */
   public static class BoldAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * Constructor BoldAction
-                */
+    /**
+     * Constructor BoldAction
+     */
     public BoldAction()
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * AlignmentAction
-        */
+  /**
+   * AlignmentAction
+   */
   public static class AlignmentAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * a
-                */
-               private int a;
-
-               /**
-                * Constructor AlignmentAction
-                * @param nm TODO
-                * @param a TODO
-                */
+    /**
+     * a
+     */
+    private int a;
+
+    /**
+     * Constructor AlignmentAction
+     * @param nm TODO
+     * @param a TODO
+     */
     public AlignmentAction(String nm, int a)
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * ForegroundAction
-        */
+  /**
+   * ForegroundAction
+   */
   public static class ForegroundAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * fg
-                */
-               private Color fg;
-
-               /**
-                * Constructor ForegroundAction
-                * @param nm TODO
-                * @param fg TODO
-                */
+    /**
+     * fg
+     */
+    private Color fg;
+
+    /**
+     * Constructor ForegroundAction
+     * @param nm TODO
+     * @param fg TODO
+     */
     public ForegroundAction(String nm, Color fg)
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * FontSizeAction
-        */
+  /**
+   * FontSizeAction
+   */
   public static class FontSizeAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * size
-                */
-               private int size;
-
-               /**
-                * Constructor FontSizeAction
-                * @param nm TODO
-                * @param size TODO
-                */
+    /**
+     * size
+     */
+    private int size;
+
+    /**
+     * Constructor FontSizeAction
+     * @param nm TODO
+     * @param size TODO
+     */
     public FontSizeAction(String nm, int size)
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * FontFamilyAction
-        */
+  /**
+   * FontFamilyAction
+   */
   public static class FontFamilyAction extends StyledEditorKit.StyledTextAction
   {
-               /**
-                * family
-                */
-               private String family;
-
-               /**
-                * Constructor FontFamilyAction
-                * @param nm TODO
-                * @param family TODO
-                */
+    /**
+     * family
+     */
+    private String family;
+
+    /**
+     * Constructor FontFamilyAction
+     * @param nm TODO
+     * @param family TODO
+     */
     public FontFamilyAction(String nm, String family)
     {
-                       super("TODO");
-                       // TODO
+      super("TODO");
+      // TODO
     }
 
-               /**
-                * actionPerformed
-                * @param event TODO
-                */
+    /**
+     * actionPerformed
+     * @param event TODO
+     */
     public void actionPerformed(ActionEvent event)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * StyledTextAction
-        */
+  /**
+   * StyledTextAction
+   */
   public abstract static class StyledTextAction extends TextAction
   {
-               /**
-                * Constructor StyledTextAction
-                * @param nm TODO
-                */
+    /**
+     * Constructor StyledTextAction
+     * @param nm TODO
+     */
     public StyledTextAction(String nm)
     {
-                       super(nm);
-                       // TODO
+      super(nm);
+      // TODO
     }
 
-               /**
-                * getEditor
-                * @param event TODO
-                * @returns JEditorPane
-                */
+    /**
+     * getEditor
+     * @param event TODO
+     * @returns JEditorPane
+     */
     protected final JEditorPane getEditor(ActionEvent event)
     {
-                       return null; // TODO
+      return null; // TODO
     }
 
-               /**
-                * setCharacterAttributes
-                * @param value0 TODO
-                * @param value1 TODO
-                * @param value2 TODO
-                */
+    /**
+     * setCharacterAttributes
+     * @param value0 TODO
+     * @param value1 TODO
+     * @param value2 TODO
+     */
     protected final void setCharacterAttributes(JEditorPane value0,
                                                 AttributeSet value1,
                                                 boolean value2)
     {
-                       // TODO
+      // TODO
     }
 
-               /**
-                * getStyledDocument
-                * @param value0 TODO
-                * @returns StyledDocument
-                */
+    /**
+     * getStyledDocument
+     * @param value0 TODO
+     * @returns StyledDocument
+     */
     protected final StyledDocument getStyledDocument(JEditorPane value0)
     {
-                       return null; // TODO
+      return null; // TODO
     }
 
-               /**
-                * getStyledEditorKit
-                * @param value0 TODO
-                * @returns StyledEditorKit
-                */
+    /**
+     * getStyledEditorKit
+     * @param value0 TODO
+     * @returns StyledEditorKit
+     */
     protected final StyledEditorKit getStyledEditorKit(JEditorPane value0)
     {
-                       return null; // TODO
+      return null; // TODO
     }
 
-               /**
-                * setParagraphAttributes
-                * @param value0 TODO
-                * @param value1 TODO
-                * @param value2 TODO
-                */
+    /**
+     * setParagraphAttributes
+     * @param value0 TODO
+     * @param value1 TODO
+     * @param value2 TODO
+     */
     protected final void setParagraphAttributes(JEditorPane value0,
                                                 AttributeSet value1,
                                                 boolean value2)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * StyledViewFactory
-        */
+  /**
+   * StyledViewFactory
+   */
   static class StyledViewFactory
     implements ViewFactory
   {
-               /**
-                * Constructor StyledViewFactory
-                */
+    /**
+     * Constructor StyledViewFactory
+     */
     StyledViewFactory()
     {
-                       // TODO
+      // TODO
     }
 
-               /**
-                * create
-                * @param value0 TODO
-                * @returns View
-                */
+    /**
+     * create
+     * @param value0 TODO
+     * @returns View
+     */
     public View create(Element value0)
     {
-                       return null; // TODO
+      return null; // TODO
     }
   }
 
-       /**
-        * AttributeTracker
-        */
+  /**
+   * AttributeTracker
+   */
   class AttributeTracker
     implements CaretListener, PropertyChangeListener, Serializable
   {
-               /**
-                * Constructor AttributeTracker
-                * @param value0 TODO
-                */
+    /**
+     * Constructor AttributeTracker
+     * @param value0 TODO
+     */
     AttributeTracker(StyledEditorKit value0)
     {
-                       // TODO
+      // TODO
     }
 
-               /**
-                * updateInputAttributes
-                * @param value0 TODO
-                * @param value1 TODO
-                * @param value2 TODO
-                */
+    /**
+     * updateInputAttributes
+     * @param value0 TODO
+     * @param value1 TODO
+     * @param value2 TODO
+     */
     void updateInputAttributes(int value0, int value1, JTextComponent value2)
     {
-                       // TODO
+      // TODO
     }
 
-               /**
-                * propertyChange
-                * @param value0 TODO
-                */
+    /**
+     * propertyChange
+     * @param value0 TODO
+     */
     public void propertyChange(PropertyChangeEvent value0)
     {
-                       // TODO
+      // TODO
     }
 
-               /**
-                * caretUpdate
-                * @param value0 TODO
-                */
+    /**
+     * caretUpdate
+     * @param value0 TODO
+     */
     public void caretUpdate(CaretEvent value0)
     {
-                       // TODO
+      // TODO
     }
   }
 
-       /**
-        * currentRun
-        */
-       Element currentRun;
+  /**
+   * currentRun
+   */
+  Element currentRun;
 
-       /**
-        * currentParagraph
-        */
-       Element currentParagraph;
+  /**
+   * currentParagraph
+   */
+  Element currentParagraph;
 
-       /**
-        * inputAttributes
-        */
-       MutableAttributeSet inputAttributes;
+  /**
+   * inputAttributes
+   */
+  MutableAttributeSet inputAttributes;
 
-       /**
-        * Constructor StyledEditorKit
-        */
+  /**
+   * Constructor StyledEditorKit
+   */
   public StyledEditorKit()
   {
-               // TODO
+    // TODO
   }
 
-       /**
-        * clone
-        * @returns Object
-        */
+  /**
+   * clone
+   * @returns Object
+   */
   public Object clone()
   {
-               return null; // TODO
+    return null; // TODO
   }
 
-       /**
-        * getActions
-        * @returns Action[]
-        */
+  /**
+   * getActions
+   * @returns Action[]
+   */
   public Action[] getActions()
   {
-               return null; // TODO
+    return null; // TODO
   }
 
-       /**
-        * getInputAttributes
-        * @returns MutableAttributeSet
-        */
+  /**
+   * getInputAttributes
+   * @returns MutableAttributeSet
+   */
   public MutableAttributeSet getInputAttributes()
   {
-               return null; // TODO
+    return null; // TODO
   }
 
-       /**
-        * getCharacterAttributeRun
-        * @returns Element
-        */
+  /**
+   * getCharacterAttributeRun
+   * @returns Element
+   */
   public Element getCharacterAttributeRun()
   {
-               return null; // TODO
+    return null; // TODO
   }
 
-       /**
-        * createDefaultDocument
-        * @returns Document
-        */
+  /**
+   * createDefaultDocument
+   * @returns Document
+   */
   public Document createDefaultDocument()
   {
-               return null; // TODO
+    return null; // TODO
   }
 
-       /**
-        * install
-        * @param component TODO
-        */
+  /**
+   * install
+   * @param component TODO
+   */
   public void install(JEditorPane component)
   {
-               // TODO
+    // TODO
   }
 
-       /**
-        * deinstall
-        * @param component TODO
-        */
+  /**
+   * deinstall
+   * @param component TODO
+   */
   public void deinstall(JEditorPane component)
   {
-               // TODO
+    // TODO
   }
 
-       /**
-        * getViewFactory
-        * @returns ViewFactory
-        */
+  /**
+   * getViewFactory
+   * @returns ViewFactory
+   */
   public ViewFactory getViewFactory()
   {
-               return null; // TODO
+    return null; // TODO
   }
 
-       /**
-        * createInputAttributes
-        * @param element TODO
-        * @param set TODO
-        */
+  /**
+   * createInputAttributes
+   * @param element TODO
+   * @param set TODO
+   */
   protected void createInputAttributes(Element element, MutableAttributeSet set)
   {
-               // TODO
+    // TODO
   }
 }
index d07bcbf..0191a2d 100644 (file)
@@ -39,56 +39,73 @@ exception statement from your version. */
 package javax.swing.text;
 
 import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.HashSet;
 
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 
 /**
  * TextAction
- * @author     Andrew Selkirk
+ * @author Andrew Selkirk
  */
 public abstract class TextAction extends AbstractAction
 {
-       /**
-        * Constructor TextAction
-        * @param name TODO
-        */
+  /**
+   * Constructor TextAction
+   * @param name TODO
+   */
   public TextAction(String name)
   {
     super(name);
   }
 
-       /**
-        * getTextComponent
-        * @param event TODO
-   * @return JTextComponent
-        */
+  /**
+   * Returns the <code>JTextComponent</code> object associated with the given
+   * <code>ActionEvent</code>. If the source of the event is not a
+   * <code>JTextComponent</code> the currently focused text component is returned.
+   * 
+   * @param event the action event
+   * 
+   * @return the <code>JTextComponent</code>
+   */
   protected final JTextComponent getTextComponent(ActionEvent event)
   {
-    if (event.getSource() != null &&
-        event.getSource() instanceof JTextComponent)
+    if (event.getSource() instanceof JTextComponent)
       return (JTextComponent) event.getSource();
-    else
-      return getFocusedComponent();
+
+    return getFocusedComponent();
   }
 
-       /**
-        * augmentList
-        * @param list1 TODO
-        * @param list2 TODO
-   * @return Action[]
-        */
+  /**
+   * Creates a new array of <code>Action</code> containing both given arrays.
+   * 
+   * @param list1 the first action array
+   * @param list2 the second action array
+   *
+   * @return the augmented array of actions
+   */
   public static final Action[] augmentList(Action[] list1, Action[] list2)
   {
-               return null; // TODO
+    HashSet actionSet = new HashSet();
+
+    for (int i = 0; i < list1.length; ++i)
+      actionSet.add(list1[i]);
+
+    for (int i = 0; i < list2.length; ++i)
+      actionSet.add(list2[i]);
+
+    ArrayList list = new ArrayList(actionSet);
+    return (Action[]) list.toArray(new Action[actionSet.size()]);
   }
 
-       /**
-        * getFocusedComponent
-   * @return JTextComponent
-        */
+  /**
+   * Returns the current focused <code>JTextComponent</code> object.
+   * 
+   * @return the <code>JTextComponent</code>
+   */
   protected final JTextComponent getFocusedComponent()
   {
-               return null; // TODO
+    return null; // TODO
   }
 }
index f9e44a9..46f42b5 100644 (file)
@@ -1,5 +1,5 @@
 /* View.java -- 
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.text;
 
 import java.awt.Container;
@@ -57,91 +58,113 @@ public abstract class View implements SwingConstants
   private Element elt;
   private View parent;
 
-    /** 
+  /**
    * Creates a new <code>View</code> instance.
    *
    * @param elem an <code>Element</code> value
-     */
-    public View(Element elem)
-    {
-       elt = elem;
-    }
+   */
+  public View(Element elem)
+  {
+    elt = elem;
+  }
 
   public abstract void paint(Graphics g, Shape s);
 
-  public void setParent(View a)
-    {
-    parent = a;
-    }
-
+  public void setParent(View parent)
+  {
+    this.parent = parent;
+  }
+    
   public View getParent()
-    {
+  {
     return parent;
-    }
-    
-  public void setSize(int w, int h)
-    {
-    width = w;
-    height = h;
-    }
+  }
     
   public Container getContainer()
-    {
+  {
+    View parent = getParent();
     return parent != null ? parent.getContainer() : null;
-    }     
-    
+  }
+  
   public Document getDocument()
-    {
+  {
     return getElement().getDocument();
-    }
-       
+  }
+    
   public Element getElement()
-    {
+  {
     return elt;
-    }
+  }
 
   public abstract float getPreferredSpan(int axis);
+
+  public int getResizeWeight(int axis)
+  {
+    return 0;
+  }
+
+  public float getMaximumSpan(int axis)
+  {
+    if (getResizeWeight(axis) <= 0)
+      return getPreferredSpan(axis);
+
+    return Integer.MAX_VALUE;
+  }
+
+  public float getMinimumSpan(int axis)
+  {
+    if (getResizeWeight(axis) <= 0)
+      return getPreferredSpan(axis);
+
+    return Integer.MAX_VALUE;
+  }
+  
+  public void setSize(float width, float height)
+  {
+    // The default implementation does nothing.
+  }
   
   public float getAlignment(int axis)
-    {
+  {
     return 0.5f;
-    }
-    
+  }
+
   public AttributeSet getAttributes()
-    {
-    return elt.getAttributes();
-    }
-    
+  {
+    return getElement().getAttributes();
+  }
+  
   public boolean isVisible()
-    {
+  {
     return true;
-    }
+  }
 
   public int getViewCount()
-    {
+  {
     return 0;
-    }
-    
+  }
+  
   public View getView(int index)
-    {
+  {
     return null;
-    }
+  }
 
   public ViewFactory getViewFactory()
-    {
+  {
+    View parent = getParent();
     return parent != null ? parent.getViewFactory() : null;
   }
 
   public void replace(int offset, int length, View[] views)
-           {
+  {
     // Default implementation does nothing.
   }
 
   public void insert(int offset, View view)
-               {
+  {
     View[] array = { view };
     replace(offset, 1, array);
-               }
+  }
 
   public void append(View view)
   {
@@ -152,7 +175,7 @@ public abstract class View implements SwingConstants
   public void removeAll()
   {
     replace(0, getViewCount(), null); 
-           }
+  }
 
   public void remove(int index)
   {
@@ -167,12 +190,12 @@ public abstract class View implements SwingConstants
 
   public int getStartOffset()
   {
-    return elt.getStartOffset();
+    return getElement().getStartOffset();
   }
 
   public int getEndOffset()
   {
-    return elt.getEndOffset();
+    return getElement().getEndOffset();
   }
 
   public Shape getChildAllocation(int index, Shape a)
@@ -205,5 +228,37 @@ public abstract class View implements SwingConstants
 
     return null;
   }
+
+  /**
+   * @since 1.3
+   */
+  public Graphics getGraphics()
+  {
+    return getContainer().getGraphics();
+  }
+
+  public void preferenceChanged(View child, boolean width, boolean height)
+  {
+    if (parent != null)
+      parent.preferenceChanged(this, width, height);
+  }
+
+  public int getBreakWeight(int axis, float pos, float len)
+  {
+    return BadBreakWeight;
+  }
+
+  public View breakView(int axis, int offset, float pos, float len)
+  {
+    return this;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public int getViewIndex(int pos, Position.Bias b)
+  {
+    return -1;
+  }
 }
 
index 52be67b..c9cc4b7 100644 (file)
@@ -46,5 +46,5 @@ public interface ViewFactory
    *
    * @return a new created view
    */
-    View create (Element elem);
+  View create(Element elem);
 }
index b6dd1d0..de34ee0 100644 (file)
@@ -1,5 +1,5 @@
 /* DefaultMutableTreeNode.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,984 +38,917 @@ exception statement from your version. */
 
 package javax.swing.tree;
 
+import gnu.java.util.EmptyEnumeration;
+
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.Random;
 import java.util.Stack;
 import java.util.Vector;
 
 /**
  * DefaultMutableTreeNode
+ *
  * @author Andrew Selkirk
  */
 public class DefaultMutableTreeNode
   implements Cloneable, MutableTreeNode, Serializable
 {
-  static final long serialVersionUID = -4298474751201349152L;
-
-       //-------------------------------------------------------------
-       // Variables --------------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * EMPTY_ENUMERATION
-        */
-       public static final Enumeration EMPTY_ENUMERATION = null; // TODO
-
-       /**
-        * parent
-        */
-       protected MutableTreeNode parent = null;
-
-       /**
-        * children
-        */
-       protected Vector children = new Vector();
-
-       /**
-        * userObject
-        */
-       protected transient Object userObject = "";
-
-       /**
-        * allowsChildren
-        */
-       protected boolean allowsChildren = true;
-
-
-       //-------------------------------------------------------------
-       // Initialization ---------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * Constructor DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode() {
-               // TODO
-       } // DefaultMutableTreeNode()
-
-       /**
-        * Constructor DefaultMutableTreeNode
-        * @param value0 TODO
-        */
-       public DefaultMutableTreeNode(Object userObject) {
-               this.userObject = userObject;
-       } // DefaultMutableTreeNode()
-
-       /**
-        * Constructor DefaultMutableTreeNode
-        * @param value0 TODO
-        * @param value1 TODO
-        */
-       public DefaultMutableTreeNode(Object userObject, boolean allowsChildren) {
-               this.userObject = userObject;
-               this.allowsChildren = allowsChildren;
-       } // DefaultMutableTreeNode()
-
-
-       //-------------------------------------------------------------
-       // Methods ----------------------------------------------------
-       //-------------------------------------------------------------
-
-       /**
-        * clone
-        * @returns Object
-        */
-       public Object clone() {
-               return null; // TODO
-       } // clone()
-
-       /**
-        * toString
-        * @returns String
-        */
-       public String toString() {
-               if (userObject == null) {
-                       return null;
-               } // if
-               return userObject.toString();
-       } // toString()
-
-       /**
-        * add
-        * @param value0 TODO
-        */
-       public void add(MutableTreeNode child) {
-               children.add(child);
-               child.setParent(this);
-       } // add()
-
-       /**
-        * getParent
-        * @returns TreeNode
-        */
-       public TreeNode getParent() {
-               return parent;
-       } // getParent()
-
-       /**
-        * remove
-        * @param value0 TODO
-        */
-       public void remove(int index) {
-               children.remove(index);
-       } // remove()
-
-       /**
-        * remove
-        * @param value0 TODO
-        */
-       public void remove(MutableTreeNode node) {
-               children.remove(node);
-       } // remove()
-
-       /**
-        * writeObject
-        * @param value0 TODO
-        * @exception IOException TODO
-        */
-       private void writeObject(ObjectOutputStream value0) throws IOException {
-               // TODO
-       } // writeObject()
-
-       /**
-        * readObject
-        * @param value0 TODO
-        * @exception IOException TODO
-        * @exception ClassNotFoundException TODO
-        */
-       private void readObject(ObjectInputStream value0) throws IOException, ClassNotFoundException {
-               // TODO
-       } // readObject()
-
-       /**
-        * insert
-        * @param value0 TODO
-        * @param value1 TODO
-        */
-       public void insert(MutableTreeNode node, int index) {
-               children.insertElementAt(node, index);
-       } // insert()
-
-       /**
-        * getPath
-        * @returns TreeNode[]
-        */
-       public TreeNode[] getPath() {
-
-               // Variables
-               TreeNode[]      path;
-               int                     size;
-               int                     index;
-               TreeNode        current;
-
-               // Determine length of Path
-               size = getLevel() + 1;
-
-               // Create Path
-               path = new TreeNode[size];
-               current = this;
-               for (index = size - 1; index >= 0; index--) {
-                       path[index] = current;
-                       current = current.getParent();
-               } // for
-
-               // Return Path
-               return path;
-
-       } // getPath()
-
-       /**
-        * children
-        * @returns Enumeration
-        */
-       public Enumeration children() {
-               return children.elements();
-       } // children()
-
-       /**
-        * setParent
-        * @param value0 TODO
-        */
-       public void setParent(MutableTreeNode node) {
-               parent = node;
-       } // setParent()
-
-       /**
-        * getChildAt
-        * @param value0 TODO
-        * @returns TreeNode
-        */
-       public TreeNode getChildAt(int index) {
-               return (TreeNode) children.elementAt(index);
-       } // getChildAt()
-
-       /**
-        * getChildCount
-        * @returns int
-        */
-       public int getChildCount() {
-               return children.size();
-       } // getChildCount()
-
-       /**
-        * getIndex
-        * @param value0 TODO
-        * @returns int
-        */
-       public int getIndex(TreeNode node) {
-               return children.indexOf(node);
-       } // getIndex()
-
-       /**
-        * setAllowsChildren
-        * @param value0 TODO
-        */
-       public void setAllowsChildren(boolean allowsChildren) {
-               this.allowsChildren = allowsChildren;
-       } // setAllowsChildren()
-
-       /**
-        * getAllowsChildren
-        * @returns boolean
-        */
-       public boolean getAllowsChildren() {
-               return allowsChildren;
-       } // getAllowsChildren()
-
-       /**
-        * setUserObject
-        * @param value0 TODO
-        */
-       public void setUserObject(Object userObject) {
-               this.userObject = userObject;
-       } // setUserObject()
-
-       /**
-        * getUserObject
-        * @returns Object
-        */
-       public Object getUserObject() {
-               return userObject;
-       } // getUserObject()
-
-       /**
-        * removeFromParent
-        */
-       public void removeFromParent() {
-               parent = null;
-               // TODO
-       } // removeFromParent()
-
-       /**
-        * removeAllChildren
-        */
-       public void removeAllChildren() {
-               children.removeAllElements();
-       } // removeAllChildren()
-
-       /**
-        * isNodeAncestor
-        * @param value0 TODO
-        * @returns boolean
-        */
-       public boolean isNodeAncestor(TreeNode node) {
-
-               // Variables
-               TreeNode        current;
-
-               // Sanity Check
-               if (node == null) {
-                       return false;
-               } // if
-
-               // Search For Ancestor
-               current = this;
-               while (current != null && current != node) {
-                       current = current.getParent();
-               } // while
-
-               // Check for Ancestor
-               if (current == node) {
-                       return true;
-               } // if
-
-               // Otherwise, no
-               return false;
-
-       } // isNodeAncestor()
-
-       /**
-        * isNodeDescendant
-        * @param value0 TODO
-        * @returns boolean
-        */
-       public boolean isNodeDescendant(DefaultMutableTreeNode node) {
-
-               // Variables
-               TreeNode        current;
-
-               // Sanity Check
-               if (node == null) {
-                       return false;
-               } // if
-
-               // Search For Descendant
-               current = node;
-               while (current != null && current != this) {
-                       current = current.getParent();
-               } // while
-
-               // Check for Descendant
-               if (current == this) {
-                       return true;
-               } // if
-
-               // Otherwise, no
-               return false;
-
-       } // isNodeDescendant()
-
-       /**
-        * getSharedAncestor
-        * @param value0 TODO
-        * @returns TreeNode
-        */
-       public TreeNode getSharedAncestor(DefaultMutableTreeNode node) {
-
-               // Variables
-               ArrayList       list;
-               TreeNode        current;
-
-               // Get List of Path Elements for this node
-               current = this;
-               list = new ArrayList();
-               while (current != null) {
-                       list.add(current);
-                       current = current.getParent();
-               } // while
-
-               // Check if any path element of node are in list
-               current = node;
-               while (current != null) {
-                       if (list.contains(current) == true) {
-                               return current;
-                       } // if
-                       current = current.getParent();
-               } // while
-
-               // Unable to locate shared ancestor
-               return null;
-
-       } // getSharedAncestor()
-
-       /**
-        * isNodeRelated
-        * @param value0 TODO
-        * @returns boolean
-        */
-       public boolean isNodeRelated(DefaultMutableTreeNode node) {
-
-               // Sanity Check
-               if (node == null) {
-                       return false;
-               } // if
-
-               // Check for the same root
-               if (node.getRoot() == getRoot()) {
-                       return true;
-               } // if
-
-               // Nodes are not related
-               return false;
-
-       } // isNodeRelated()
-
-       /**
-        * getDepth
-        * @returns int
-        */
-       public int getDepth() {
-
-               // Variables
-               TreeNode                node;
-               int                             depth;
-               int                             current;
-               int                             size;
-               Stack                   stack;
-               int                             index;
-
-               // Check for children
-               if (allowsChildren == false || children.size() == 0) {
-                       return 0;
-               } // if
-
-               // Process Depths
-               stack = new Stack();
-               stack.push(new Integer(0));
-               node = getChildAt(0);
-//System.out.println("  * Descend: 0-0");
-               depth = 0;
-               current = 1;
-               while (stack.empty() == false) {
-
-                       // Check if node has children
-                       if (node.getChildCount() != 0) {
-                               node = node.getChildAt(0);
-                               stack.push(new Integer(0));
-                               current++;
-//                             System.out.println("  * Descend: 0-" + current);
-
-                       // Check for next sibling
-                       } else {
-
-                               // Check Depth
-                               if (current > depth) {
-                                       depth = current;
-                               } // if
-
-                               do {
-
-                                       // Traverse to Parent
-                                       node = node.getParent();
-                                       size = node.getChildCount();
-                                       current--;
-                                       index = ((Integer) stack.pop()).intValue();
-//                                     System.out.println("  * Ascend from: " + index + "-" + current);
-                                       index++;
-
-                               } while (index >= size && node != this);
-
-                               // Check for child
-                               if (index < size) {
-                                       node = node.getChildAt(index);
-                                       stack.push(new Integer(index));
-                                       current++;
-//                                     System.out.println("  * Descend: " + index + "-" + current);
-                               } // if
-
-                       } // if
-
-               } // while
-
-               return depth;
-
-       } // getDepth()
-
-       static Random   random = new Random(System.currentTimeMillis());
-
-       public static void growTree(DefaultMutableTreeNode root) {
-
-               // Variables
-               int                                             index;
-               DefaultMutableTreeNode  node;
-               DefaultMutableTreeNode  current;
-
-               current = root;
-               index = 0;
-//             while (current != root) {
-               do {
-
-//                     if (random.nextInt(3) < 2) {
-                       if (random.nextBoolean()) {
-                               node = new DefaultMutableTreeNode(String.valueOf(index));
-                               index++;
-                               current.add(node);
-                               current = node;
-                       } else {
-                               current = (DefaultMutableTreeNode) current.getParent();
-                       } // if
-
-//             } // while
-               } while (current != root && current != null);
-
-               System.out.println("Number of nodes: " + index);
-
-/*
-               // Calc # children
-               size = random.nextInt(4);
-
-               for (index = 0; index < size; index++) {
-
-                       // Create Node
-                       node = new DefaultMutableTreeNode(String.valueOf(index));
-                       growTree(node);
-
-                       // Add Node to root
-                       root.add(node);
-
-               } // for
-*/
-       } // growTree()
-
-       public static void main(String[] argv) {
-/*
-               DefaultMutableTreeNode  node1 = new DefaultMutableTreeNode("node1");
-               DefaultMutableTreeNode  node2 = new DefaultMutableTreeNode("node2");
-               DefaultMutableTreeNode  node3 = new DefaultMutableTreeNode("node3");
-               DefaultMutableTreeNode  node4 = new DefaultMutableTreeNode("node4");
-               DefaultMutableTreeNode  node5 = new DefaultMutableTreeNode("node5");
-               DefaultMutableTreeNode  node6 = new DefaultMutableTreeNode("node6");
-               DefaultMutableTreeNode  node7 = new DefaultMutableTreeNode("node7");
-               DefaultMutableTreeNode  node8 = new DefaultMutableTreeNode("node8");
-
-               node1.add(node2);
-               node1.add(node3);
-               node2.add(node4);
-               node2.add(node5);
-               node3.add(node6);
-               node3.add(node7);
-               node5.add(node8);
-
-               System.out.println("Depth (node1): " + node1.getDepth());
-               System.out.println("Depth (node2): " + node2.getDepth());
-               System.out.println("Depth (node3): " + node3.getDepth());
-*/
-
-               System.out.println("Create tree...");
-               DefaultMutableTreeNode  root = new DefaultMutableTreeNode("root");
-               growTree(root);
-               System.out.println("Find depth...");
-               System.out.println("Depth (root): " + root.getDepth());
-
-       } // main
-
-       /**
-        * getLevel
-        * @returns int
-        */
-       public int getLevel() {
-
-               // Variables
-               TreeNode        current;
-               int                     count;
-
-               // Lookup Parent
-               count = -1;
-               current = this;
-               do {
-                       current = current.getParent();
-                       count++;
-               } while (current != null);
-
-               return count;
-
-       } // getLevel()
-
-       /**
-        * getPathToRoot
-        * @param value0 TODO
-        * @param value1 TODO
-        * @returns TreeNode[]
-        */
-       protected TreeNode[] getPathToRoot(TreeNode value0, int value1) {
-               return null; // TODO
-       } // getPathToRoot()
-
-       /**
-        * getUserObjectPath
-        * @returns Object[]
-        */
-       public Object[] getUserObjectPath() {
-
-               // Variables
-               TreeNode[]      path;
-               Object[]        object;
-               int                     index;
-
-               // Get Path for Tree Nodes
-               path = getPath();
-
-               // Construct Object Path
-               object = new Object[path.length];
-               for (index = 0; index < path.length; index++) {
-                       object[index] = ((DefaultMutableTreeNode) path[index]).getUserObject();
-               } // for
-
-               // Return Object Path
-               return object;
-
-       } // getUserObjectPath()
-
-       /**
-        * getRoot
-        * @returns TreeNode
-        */
-       public TreeNode getRoot() {
-
-               // Variables
-               TreeNode        current;
-               TreeNode        check;
-
-               // Lookup Parent
-               current = this;
-               check = current.getParent();
-               while (check != null) {
-                       current = check;
-                       check = current.getParent();
-               } // while
-
-               return current;
-
-       } // getRoot()
-
-       /**
-        * isRoot
-        * @returns boolean
-        */
-       public boolean isRoot() {
-               return (parent == null);
-       } // isRoot()
-
-       /**
-        * getNextNode
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getNextNode() {
-               return null; // TODO
-       } // getNextNode()
-
-       /**
-        * getPreviousNode
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getPreviousNode() {
-               return null; // TODO
-       } // getPreviousNode()
-
-       /**
-        * preorderEnumeration
-        * @returns Enumeration
-        */
-       public Enumeration preorderEnumeration() {
-               return null; // TODO
-       } // preorderEnumeration()
-
-       /**
-        * postorderEnumeration
-        * @returns Enumeration
-        */
-       public Enumeration postorderEnumeration() {
-               return null; // TODO
-       } // postorderEnumeration()
-
-       /**
-        * breadthFirstEnumeration
-        * @returns Enumeration
-        */
-       public Enumeration breadthFirstEnumeration() {
-               return null; // TODO
-       } // breadthFirstEnumeration()
-
-       /**
-        * depthFirstEnumeration
-        * @returns Enumeration
-        */
-       public Enumeration depthFirstEnumeration() {
-               return null; // TODO
-       } // depthFirstEnumeration()
-
-       /**
-        * pathFromAncestorEnumeration
-        * @param value0 TODO
-        * @returns Enumeration
-        */
-       public Enumeration pathFromAncestorEnumeration(TreeNode value0) {
-               return null; // TODO
-       } // pathFromAncestorEnumeration()
-
-       /**
-        * isNodeChild
-        * @param value0 TODO
-        * @returns boolean
-        */
-       public boolean isNodeChild(TreeNode node) {
-
-               // Variables
-               TreeNode        current;
-
-               // Sanity Check
-               if (node == null) {
-                       return false;
-               } // if
-
-               // Process Path
-               current = node;
-               while (current != null) {
-                       if (current == this) {
-                               return true;
-                       } // if
-                       current = current.getParent();
-               } // while
-
-               // Node not located in path, not child
-               return false;
-
-       } // isNodeChild()
-
-       /**
-        * getFirstChild
-        * @returns TreeNode
-        */
-       public TreeNode getFirstChild() {
-               return (TreeNode) children.firstElement();
-       } // getFirstChild()
-
-       /**
-        * getLastChild
-        * @returns TreeNode
-        */
-       public TreeNode getLastChild() {
-               return (TreeNode) children.lastElement();
-       } // getLastChild()
-
-       /**
-        * getChildAfter
-        * @param value0 TODO
-        * @returns TreeNode
-        */
-       public TreeNode getChildAfter(TreeNode node) {
-
-               // Variables
-               int             index;
-
-               // Check node
-               if (node == null || node.getParent() != this) {
-                       throw new IllegalArgumentException();
-               } // if
-
-               // Get index of child node
-               index = getIndex(node);
-
-               // Check for child after
-               index++;
-               if (index == getChildCount()) {
-                       return null;
-               } // if
-
-               // Retrieve Child After
-               return getChildAt(index);
-
-       } // getChildAfter()
-
-       /**
-        * getChildBefore
-        * @param value0 TODO
-        * @returns TreeNode
-        */
-       public TreeNode getChildBefore(TreeNode node) {
-
-               // Variables
-               int             index;
-
-               // Check node
-               if (node == null || node.getParent() != this) {
-                       throw new IllegalArgumentException();
-               } // if
-
-               // Get index of child node
-               index = getIndex(node);
-
-               // Check for child before
-               index--;
-               if (index < 0) {
-                       return null;
-               } // if
-
-               // Retrieve Child Before
-               return getChildAt(index);
-
-       } // getChildBefore()
-
-       /**
-        * isNodeSibling
-        * @param value0 TODO
-        * @returns boolean
-        */
-       public boolean isNodeSibling(TreeNode node) {
-
-               // Check for null
-               if (node == null) {
-                       return false;
-               } // if
-
-               // Check if nodes share a parent
-               if (node.getParent() == getParent() && getParent() != null) {
-                       return true;
-               } // if
-
-               // Nodes are not siblings
-               return false;
-
-       } // isNodeSibling()
-
-       /**
-        * getSiblingCount
-        * @returns int
-        */
-       public int getSiblingCount() {
-
-               // Variables
-
-               // Check for no parent
-               if (parent == null) {
-                       return 1;
-               } // if
-
-               // Calculate sibling count from parent's child count
-               return parent.getChildCount();
-
-       } // getSiblingCount()
-
-       /**
-        * getNextSibling
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getNextSibling() {
-
-               // Variables
-               int             index;
-               int             size;
-
-               // Check for Parent
-               if (parent == null) {
-                       return null;
-               } // if
-
-               // Get Index of this node
-               index = parent.getIndex(this);
-
-               // Check for Next Sibling
-               size = parent.getChildCount();
-               index++;
-               if (index == size) {
-                       return null;
-               } // if
-
-               return (DefaultMutableTreeNode) parent.getChildAt(index);
-
-       } // getNextSibling()
-
-       /**
-        * getPreviousSibling
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getPreviousSibling() {
-
-               // Variables
-               int             index;
-
-               // Check for Parent
-               if (parent == null) {
-                       return null;
-               } // if
-
-               // Get Index of this node
-               index = parent.getIndex(this);
-
-               // Check for Previous Sibling
-               index--;
-               if (index < 0) {
-                       return null;
-               } // if
-
-               return (DefaultMutableTreeNode) parent.getChildAt(index);
-
-       } // getPreviousSibling()
-
-       /**
-        * isLeaf
-        * @returns boolean
-        */
-       public boolean isLeaf() {
-               return (children.size() == 0); // TODO: check allowsChildren??
-       } // isLeaf()
-
-       /**
-        * getFirstLeaf
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getFirstLeaf() {
-
-               // Variables
-               TreeNode        current;
-
-               current = this;
-               while (current.getChildCount() > 0) {
-                       current = current.getChildAt(0);
-               } // while
-
-               return (DefaultMutableTreeNode) current;
-
-       } // getFirstLeaf()
-
-       /**
-        * getLastLeaf
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getLastLeaf() {
-
-               // Variables
-               TreeNode        current;
-               int                     size;
-
-               current = this;
-               size = current.getChildCount();
-               while (size > 0) {
-                       current = current.getChildAt(size - 1);
-                       size = current.getChildCount();
-               } // while
-
-               return (DefaultMutableTreeNode) current;
-
-       } // getLastLeaf()
-
-       /**
-        * getNextLeaf
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getNextLeaf() {
-               return null; // TODO
-       } // getNextLeaf()
-
-       /**
-        * getPreviousLeaf
-        * @returns DefaultMutableTreeNode
-        */
-       public DefaultMutableTreeNode getPreviousLeaf() {
-               return null; // TODO
-       } // getPreviousLeaf()
-
-       /**
-        * getLeafCount
-        * @returns int
-        */
-       public int getLeafCount() {
-
-               // Variables
-               Enumeration     e;
-               int                     count;
-               TreeNode        current;
-
-               // Get Enumeration of all descendants
-               e = depthFirstEnumeration();
-
-               // Process Nodes
-               count = 0;
-               while (e.hasMoreElements() == true) {
-                       current = (TreeNode) e.nextElement();
-                       if (current.isLeaf() == true) {
-                               count++;
-                       } // if
-               } // if
-
-               return count;
-
-       } // getLeafCount()
-
-
-} // DefaultMutableTreeNode
+  private static final long serialVersionUID = -4298474751201349152L;
+
+  /**
+   * EMPTY_ENUMERATION
+   */
+  public static final Enumeration EMPTY_ENUMERATION =
+    EmptyEnumeration.getInstance();
+
+  /**
+   * parent
+   */
+  protected MutableTreeNode parent;
+
+  /**
+   * children
+   */
+  protected Vector children = new Vector();
+
+  /**
+   * userObject
+   */
+  protected transient Object userObject;
+
+  /**
+   * allowsChildren
+   */
+  protected boolean allowsChildren;
+
+  /**
+   * Creates a <code>DefaultMutableTreeNode</code> object.
+   * This node allows to add child nodes.
+   */
+  public DefaultMutableTreeNode()
+  {
+    this(null, true);
+  }
+
+  /**
+   * Creates a <code>DefaultMutableTreeNode</code> object with the given
+   * user object attached to it. This node allows to add child nodes.
+   *
+   * @param userObject the user object
+   */
+  public DefaultMutableTreeNode(Object userObject)
+  {
+    this(userObject, true);
+  }
+
+  /**
+   * Creates a <code>DefaultMutableTreeNode</code> object with the given
+   * user object attached to it.
+   *
+   * @param userObject the user object
+   * @param allowsChildren <code>true</code> if the code allows to add child
+   * nodes, <code>false</code> otherwise
+   */
+  public DefaultMutableTreeNode(Object userObject, boolean allowsChildren)
+  {
+    this.userObject = userObject;
+    this.allowsChildren = allowsChildren;
+  }
+
+  /**
+   * clone
+   *
+   * @return Object
+   */
+  public Object clone()
+  {
+    try
+      {
+        return super.clone();
+        // TODO: Do we need to do more here ?
+      }
+    catch (CloneNotSupportedException e)
+      {
+        // This never happens.
+        return null;
+      }
+  }
+
+  /**
+   * Returns a string representation of this node
+   *
+   * @return a human-readable String representing this node
+   */
+  public String toString()
+  {
+    if (userObject == null)
+      return null;
+
+    return userObject.toString();
+  }
+
+  /**
+   * Adds a new child node to this node.
+   *
+   * @param child the child node
+   *
+   * @throws IllegalArgumentException if <code>child</code> is null
+   * @throws IllegalStateException if the node does not allow children
+   */
+  public void add(MutableTreeNode child)
+  {
+    if (child == null)
+      throw new IllegalArgumentException();
+
+    if (! allowsChildren)
+      throw new IllegalStateException();
+    
+    children.add(child);
+    child.setParent(this);
+  }
+
+  /**
+   * Returns the parent node of this node.
+   *
+   * @return the parent node
+   */
+  public TreeNode getParent()
+  {
+    return parent;
+  }
+
+  /**
+   * Removes the child with the given index from this node
+   *
+   * @param index the index
+   */
+  public void remove(int index)
+  {
+    children.remove(index);
+  }
+
+  /**
+   * Removes the given child from this node.
+   *
+   * @param node the child node
+   */
+  public void remove(MutableTreeNode node)
+  {
+    children.remove(node);
+  }
+
+  /**
+   * writeObject
+   *
+   * @param stream the output stream
+   *
+   * @exception IOException If an error occurs
+   */
+  private void writeObject(ObjectOutputStream stream)
+    throws IOException
+  {
+    // TODO: Implement me.
+  }
+
+  /**
+   * readObject
+   *
+   * @param stream the input stream
+   *
+   * @exception IOException If an error occurs
+   * @exception ClassNotFoundException TODO
+   */
+  private void readObject(ObjectInputStream stream)
+    throws IOException, ClassNotFoundException
+  {
+    // TODO: Implement me.
+  }
+
+  /**
+   * Inserts given child node at the given index.
+   *
+   * @param node the child node
+   * @param value the index.
+   */
+  public void insert(MutableTreeNode node, int index)
+  {
+    children.insertElementAt(node, index);
+  }
+
+  /**
+   * Returns a path to this node from the root.
+   *
+   * @return an array of tree nodes
+   */
+  public TreeNode[] getPath()
+  {
+    return getPathToRoot(this, 0);
+  }
+
+  /**
+   * Returns an enumeration containing all children of this node.
+   * <code>EMPTY_ENUMERATION</code> is returned if this node has no children.
+   *
+   * @return an enumeration of tree nodes
+   */
+  public Enumeration children()
+  {
+    if (children.size() == 0)
+      return EMPTY_ENUMERATION;
+    
+    return children.elements();
+  }
+
+  /**
+   * Set the parent node for this node.
+   *
+   * @param node the parent node
+   */
+  public void setParent(MutableTreeNode node)
+  {
+    parent = node;
+  }
+
+  /**
+   * Returns the child node at a given index.
+   *
+   * @param index the index
+   *
+   * @return the child node
+   */
+  public TreeNode getChildAt(int index)
+  {
+    return (TreeNode) children.elementAt(index);
+  }
+
+  /**
+   * Returns the number of children of this node.
+   *
+   * @return the number of children
+   */
+  public int getChildCount()
+  {
+    return children.size();
+  }
+
+  /**
+   * Returns the child index for a given node.
+   *
+   * @param node this node
+   *
+   * @return the index
+   */
+  public int getIndex(TreeNode node)
+  {
+    return children.indexOf(node);
+  }
+
+  /**
+   * setAllowsChildren
+   *
+   * @param allowsChildren TODO
+   */
+  public void setAllowsChildren(boolean allowsChildren)
+  {
+    this.allowsChildren = allowsChildren;
+  }
+
+  /**
+   * getAllowsChildren
+   *
+   * @return boolean
+   */
+  public boolean getAllowsChildren()
+  {
+    return allowsChildren;
+  }
+
+  /**
+   * Sets the user object for this node
+   *
+   * @param userObject the user object
+   */
+  public void setUserObject(Object userObject)
+  {
+    this.userObject = userObject;
+  }
+
+  /**
+   * Returns the user object attached to this node. <code>null</code> is
+   * returned when no user object is set.
+   *
+   * @return the user object
+   */
+  public Object getUserObject()
+  {
+    return userObject;
+  }
+
+  /**
+   * Removes this node from its parent.
+   */
+  public void removeFromParent()
+  {
+    // FIXME: IS this implementation really correct ?
+    parent = null;
+  }
+
+  /**
+   * Removes all child nodes from this node.
+   */
+  public void removeAllChildren()
+  {
+    children.removeAllElements();
+  }
+
+  /**
+   * isNodeAncestor
+   *
+   * @param node TODO
+   *
+   * @return boolean
+   */
+  public boolean isNodeAncestor(TreeNode node)
+  {
+    if (node == null)
+      return false;
+
+    TreeNode current = this;
+
+    while (current != null
+           && current != node)
+      current = current.getParent();
+
+    return current == node;
+  }
+
+  /**
+   * isNodeDescendant
+   *
+   * @param node0 TODO
+   *
+   * @return boolean
+   */
+  public boolean isNodeDescendant(DefaultMutableTreeNode node)
+  {
+    if (node == null)
+      return false;
+
+    TreeNode current = node;
+    
+    while (current != null
+           && current != this)
+      current = current.getParent();
+
+    return current == this;
+  }
+
+  /**
+   * getSharedAncestor
+   *
+   * @param node TODO
+   *
+   * @return TreeNode
+   */
+  public TreeNode getSharedAncestor(DefaultMutableTreeNode node)
+  {
+    TreeNode current = this;
+    ArrayList list = new ArrayList();
+
+    while (current != null)
+      {
+        list.add(current);
+        current = current.getParent();
+      }
+
+    current = node;
+
+    while (current != null)
+      {
+        if (list.contains(current))
+          return current;
+
+        current = current.getParent();
+      }
+
+    return null;
+  }
+
+  /**
+   * isNodeRelated
+   *
+   * @param node TODO
+   *
+   * @return boolean
+   */
+  public boolean isNodeRelated(DefaultMutableTreeNode node)
+  {
+    if (node == null)
+      return false;
+
+    return node.getRoot() == getRoot();
+  }
+
+  /**
+   * getDepth
+   *
+   * @return int
+   */
+  public int getDepth()
+  {
+    if ((! allowsChildren)
+        || children.size() == 0)
+      return 0;
+
+    Stack stack = new Stack();
+    stack.push(new Integer(0));
+    TreeNode node = getChildAt(0);
+    int depth = 0;
+    int current = 1;
+    
+    while (! stack.empty())
+      {
+        if (node.getChildCount() != 0)
+          {
+            node = node.getChildAt(0);
+            stack.push(new Integer(0));
+            current++;
+          }
+        else
+          {
+            if (current > depth)
+              depth = current;
+
+            int size;
+            int index;
+            
+            do
+              {
+                node = node.getParent();
+                size = node.getChildCount();
+                index = ((Integer) stack.pop()).intValue() + 1;
+                current--;
+              }
+            while (index >= size
+                   && node != this);
+
+            if (index < size)
+              {
+                node = node.getChildAt(index);
+                stack.push(new Integer(index));
+                current++;
+              }
+          }
+      }
+
+    return depth;
+  }
+
+  /**
+   * getLevel
+   *
+   * @return int
+   */
+  public int getLevel()
+  {
+    int count = -1;
+    TreeNode current = this;
+
+    do
+      {
+        current = current.getParent();
+        count++;
+      }
+    while (current != null);
+
+    return count;
+  }
+
+  /**
+   * getPathToRoot
+   *
+   * @param node TODO
+   * @param depth TODO
+   *
+   * @return TreeNode[]
+   */
+  protected TreeNode[] getPathToRoot(TreeNode node, int depth)
+  {
+    if (node == null)
+      {
+        if (depth == 0)
+          return null;
+        
+        return new TreeNode[depth];
+      }
+
+    TreeNode[] path = getPathToRoot(node.getParent(), depth + 1);
+    path[path.length - depth - 1] = node;
+    return path;
+  }
+
+  /**
+   * getUserObjectPath
+   *
+   * @return Object[]
+   */
+  public Object[] getUserObjectPath()
+  {
+    TreeNode[] path = getPathToRoot(this, 0);
+    Object[] object = new Object[path.length];
+    
+    for (int index = 0; index < path.length; ++index)
+      object[index] = ((DefaultMutableTreeNode) path[index]).getUserObject();
+
+    return object;
+  }
+
+  /**
+   * Returns the root node by iterating the parents of this node.
+   *
+   * @return the root node
+   */
+  public TreeNode getRoot()
+  {
+    TreeNode current = this;
+    TreeNode check = current.getParent();
+    
+    while (check != null)
+      {
+        current = check;
+        check = current.getParent();
+      }
+
+    return current;
+  }
+
+  /**
+   * Tells whether this node is the root node or not.
+   *
+   * @return <code>true</code> if this is the root node,
+   * <code>false</code>otherwise
+   */
+  public boolean isRoot()
+  {
+    return parent == null;
+  }
+
+  /**
+   * getNextNode
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getNextNode()
+  {
+    // Return first child.
+    if (getChildCount() != 0)
+      return (DefaultMutableTreeNode) getChildAt(0);
+
+    // Return next sibling (if needed the sibling of some parent).
+    DefaultMutableTreeNode node = this;
+    DefaultMutableTreeNode sibling;
+    
+    do
+      {
+        sibling = node.getNextSibling();
+        node = (DefaultMutableTreeNode) node.getParent();
+      }
+    while (sibling == null &&
+           node != null);
+    
+    // Return sibling.
+    return sibling;
+  }
+
+  /**
+   * getPreviousNode
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getPreviousNode()
+  {
+    // Return null if no parent.
+    if (parent == null)
+      return null;
+    
+    DefaultMutableTreeNode sibling = getPreviousSibling();
+
+    // Return parent if no sibling.
+    if (sibling == null)
+      return (DefaultMutableTreeNode) parent;
+
+    // Return last leaf of sibling.
+    if (sibling.getChildCount() != 0)
+      return sibling.getLastLeaf();
+
+    // Return sibling.
+    return sibling;
+  }
+
+  /**
+   * preorderEnumeration
+   *
+   * @return Enumeration
+   */
+  public Enumeration preorderEnumeration()
+  {
+    return null; // TODO: Implement me.
+  }
+
+  /**
+   * postorderEnumeration
+   *
+   * @return Enumeration
+   */
+  public Enumeration postorderEnumeration()
+  {
+    return null; // TODO: Implement me.
+  }
+
+  /**
+   * breadthFirstEnumeration
+   *
+   * @return Enumeration
+   */
+  public Enumeration breadthFirstEnumeration()
+  {
+    return null; // TODO: Implement me.
+  }
+
+  /**
+   * depthFirstEnumeration
+   *
+   * @return Enumeration
+   */
+  public Enumeration depthFirstEnumeration()
+  {
+    return postorderEnumeration();
+  }
+
+  /**
+   * pathFromAncestorEnumeration
+   *
+   * @param node TODO
+   *
+   * @return Enumeration
+   */
+  public Enumeration pathFromAncestorEnumeration(TreeNode node)
+  {
+    if (node == null)
+      throw new IllegalArgumentException();
+    
+    TreeNode parent = this;
+    Vector nodes = new Vector();
+    nodes.add(this);
+
+    while (parent != node && parent != null)
+      {
+        parent = parent.getParent();
+        nodes.add(0, parent);
+      }
+
+    if (parent != node)
+      throw new IllegalArgumentException();
+    
+    return nodes.elements();
+  }
+
+  /**
+   * isNodeChild
+   *
+   * @param node TODO
+   *
+   * @return boolean
+   */
+  public boolean isNodeChild(TreeNode node)
+  {
+    if (node == null)
+      return false;
+
+    return node.getParent() == this;
+  }
+
+  /**
+   * getFirstChild
+   *
+   * @return TreeNode
+   */
+  public TreeNode getFirstChild()
+  {
+    return (TreeNode) children.firstElement();
+  }
+
+  /**
+   * getLastChild
+   *
+   * @return TreeNode
+   */
+  public TreeNode getLastChild()
+  {
+    return (TreeNode) children.lastElement();
+  }
+
+  /**
+   * getChildAfter
+   *
+   * @param node TODO
+   *
+   * @return TreeNode
+   */
+  public TreeNode getChildAfter(TreeNode node)
+  {
+    if (node == null
+        || node.getParent() != this)
+      throw new IllegalArgumentException();
+
+    int index = getIndex(node) + 1;
+
+    if (index == getChildCount())
+      return null;
+
+    return getChildAt(index);
+  }
+
+  /**
+   * getChildBefore
+   *
+   * @param node TODO
+   *
+   * @return TreeNode
+   */
+  public TreeNode getChildBefore(TreeNode node)
+  {
+    if (node == null
+        || node.getParent() != this)
+      throw new IllegalArgumentException();
+
+    int index = getIndex(node) - 1;
+
+    if (index < 0)
+      return null;
+
+    return getChildAt(index);
+  }
+
+  /**
+   * isNodeSibling
+   *
+   * @param node TODO
+   *
+   * @return boolean
+   */
+  public boolean isNodeSibling(TreeNode node)
+  {
+    if (node == null)
+      return false;
+
+    return (node.getParent() == getParent()
+            && getParent() != null);
+  }
+
+  /**
+   * getSiblingCount
+   *
+   * @return int
+   */
+  public int getSiblingCount()
+  {
+    if (parent == null)
+      return 1;
+
+    return parent.getChildCount();
+  }
+
+  /**
+   * getNextSibling
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getNextSibling()
+  {
+    if (parent == null)
+      return null;
+
+    int index = parent.getIndex(this) + 1;
+    
+    if (index == parent.getChildCount())
+      return null;
+
+    return (DefaultMutableTreeNode) parent.getChildAt(index);
+  }
+
+  /**
+   * getPreviousSibling
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getPreviousSibling()
+  {
+    if (parent == null)
+      return null;
+
+    int index = parent.getIndex(this) - 1;
+
+    if (index < 0)
+      return null;
+
+    return (DefaultMutableTreeNode) parent.getChildAt(index);
+  }
+
+  /**
+   * isLeaf
+   *
+   * @return boolean
+   */
+  public boolean isLeaf()
+  {
+    return children.size() == 0;
+  }
+
+  /**
+   * getFirstLeaf
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getFirstLeaf()
+  {
+    TreeNode current = this;
+    
+    while (current.getChildCount() > 0)
+      current = current.getChildAt(0);
+
+    return (DefaultMutableTreeNode) current;
+  }
+
+  /**
+   * getLastLeaf
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getLastLeaf()
+  {
+    TreeNode current = this;
+    int size = current.getChildCount();
+    
+    while (size > 0)
+      {
+        current = current.getChildAt(size - 1);
+        size = current.getChildCount();
+      }
+
+    return (DefaultMutableTreeNode) current;
+  }
+
+  /**
+   * getNextLeaf
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getNextLeaf()
+  {
+    if (parent == null)
+      return null;
+
+    return null;
+    //return parent.getChildAfter(this);
+  }
+
+  /**
+   * getPreviousLeaf
+   *
+   * @return DefaultMutableTreeNode
+   */
+  public DefaultMutableTreeNode getPreviousLeaf()
+  {
+    if (parent == null)
+      return null;
+    
+    return null;
+    //return parent.getChildBefore(this);
+  }
+
+  /**
+   * getLeafCount
+   *
+   * @return int
+   */
+  public int getLeafCount()
+  {
+    int count = 0;
+    Enumeration e = depthFirstEnumeration();
+
+    while (e.hasMoreElements())
+      {
+        TreeNode current = (TreeNode) e.nextElement();
+        
+        if (current.isLeaf())
+          count++;
+      }
+
+    return count;
+  }
+}
index ff038d5..1f0c943 100644 (file)
@@ -1,5 +1,5 @@
 /* MutableTreeNode.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,45 +39,66 @@ package javax.swing.tree;
 
 /**
  * MutableTreeNode public interface
  * @author Andrew Selkirk
  */
-public interface MutableTreeNode extends TreeNode {
-
-       /**
-        * insert
-        * @param child MutableTreeNode
-        * @param index Index
-        */
-       void insert(MutableTreeNode child, int index);
-
-       /**
-        * remove
-        * @param index Index
-        */
-       void remove(int index);
-
-       /**
-        * remove
-        * @param node MutableTreeNode
-        */
-       void remove(MutableTreeNode node);
-
-       /**
-        * setUserObject
-        * @param object Object
-        */
-       void setUserObject(Object object);
-
-       /**
-        * removeFromParent
-        */
-       void removeFromParent();
-
-       /**
-        * setParent
-        * @param parent MutableTreeNode
-        */
-       void setParent(MutableTreeNode parent);
-
-
-} // MutableTreeNode
+public interface MutableTreeNode extends TreeNode
+{
+  /**
+   * Inserts a node as child at a given index.
+   *
+   * @param child the note to insert
+   * @param index the index
+   *
+   * @see #remove(int)
+   * @see #remove(MutableTreeNode)
+   * @see #setParent(MutableTreeNode)
+   */
+  void insert(MutableTreeNode child, int index);
+
+  /**
+   * Removes the child node a given index.
+   *
+   * @param index the index
+   *
+   * @see #add(MutableTreeNode,int)
+   * @see #remove(MutableTreeNode)
+   * @see #removeFromParent()
+   */
+  void remove(int index);
+
+  /**
+   * Removes a given child node.
+   *
+   * @param node the node to remove
+   *
+   * @see #add(MutableTreeNode,int)
+   * @see #remove(int)
+   * @see #removeFromParent()
+   */
+  void remove(MutableTreeNode node);
+
+  /**
+   * Sets a user object, the data represented by the node. 
+   *
+   * @param object the data
+   */
+  void setUserObject(Object object);
+
+  /**
+   * Removes this node from its parent.
+   *
+   * @see #remove(int)
+   * @see #remove(MutableTreeNode)
+   */
+  void removeFromParent();
+
+  /**
+   * Sets the parent of the node.
+   *
+   * @param parent the parent
+   *
+   * @see insert(MutableTreeNode,int)
+   */
+  void setParent(MutableTreeNode parent);
+}
index d9de676..4b4357a 100644 (file)
@@ -49,19 +49,17 @@ import javax.swing.JTree;
  */
 public interface TreeCellEditor extends CellEditor
 {
-       /**
-        * getTreeCellEditorComponent
-        * @param tree TODO
-        * @param value TODO
-        * @param isSelected TODO
-        * @param expanded TODO
-        * @param leaf TODO
-        * @param row TODO
-        * @returns TODO
-        */
-       Component getTreeCellEditorComponent(JTree tree,
-                       Object value, boolean isSelected, boolean expanded,
-                       boolean leaf, int row);
-
-
-} // TreeCellEditor
+  /**
+   * getTreeCellEditorComponent
+   * @param tree TODO
+   * @param value TODO
+   * @param isSelected TODO
+   * @param expanded TODO
+   * @param leaf TODO
+   * @param row TODO
+   * @return TODO
+   */
+  Component getTreeCellEditorComponent(JTree tree, Object value,
+                                      boolean isSelected, boolean expanded,
+                                      boolean leaf, int row);
+}
index 792cee4..3370152 100644 (file)
@@ -102,6 +102,21 @@ extern struct state_table *native_text_layout_state_table;
 #define TEXT_METRICS_Y_ADVANCE 5
 #define NUM_TEXT_METRICS 6
 
+#define NUM_GLYPH_METRICS 10
+
+#define GLYPH_LOG_X(i)      (NUM_GLYPH_METRICS * (i)    )
+#define GLYPH_LOG_Y(i)      (NUM_GLYPH_METRICS * (i) + 1)
+#define GLYPH_LOG_WIDTH(i)  (NUM_GLYPH_METRICS * (i) + 2)
+#define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3)
+
+#define GLYPH_INK_X(i)      (NUM_GLYPH_METRICS * (i) + 4)
+#define GLYPH_INK_Y(i)      (NUM_GLYPH_METRICS * (i) + 5)
+#define GLYPH_INK_WIDTH(i)  (NUM_GLYPH_METRICS * (i) + 6)
+#define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7)
+
+#define GLYPH_POS_X(i)      (NUM_GLYPH_METRICS * (i) + 8)
+#define GLYPH_POS_Y(i)      (NUM_GLYPH_METRICS * (i) + 9)
+
 struct peerfont
 {
   PangoFont *font;
@@ -119,16 +134,6 @@ struct peerfont
   void *graphics_resource;
 };
 
-struct glyphvec 
-{
-  /* the GList is list of PangoGlyphItems, each of which is a pair of 1
-     PangoItem and 1 PangoGlyphString. */
-  GList *glyphitems;
-  PangoFontDescription *desc;
-  PangoFont *font;
-  PangoContext *ctx;
-};
-
 struct textlayout
 {
   PangoLayout *pango_layout;
index c94e664..7787eb4 100644 (file)
@@ -49,7 +49,7 @@ exception statement from your version. */
  */
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun
-  (JNIEnv *gdk_env __attribute__((unused)),
+  (JNIEnv *env __attribute__((unused)),
    jobject lcl_obj __attribute__((unused)),
    jlong funcAddr, jlong funcArg)
 {
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
deleted file mode 100644 (file)
index 5248938..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/* gdkfontmetrics.c
-   Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include "gdkfont.h"
-
-#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h"
-#include <gdk/gdkx.h>
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics
-   (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jdoubleArray java_metrics)
-{
-  struct peerfont *pfont = NULL;
-  jdouble *native_metrics = NULL;
-  PangoFontMetrics *pango_metrics;
-
-  gdk_threads_enter();
-
-  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
-  g_assert (pfont != NULL);
-
-  pango_metrics = pango_context_get_metrics (pfont->ctx, pfont->desc,
-                                             gtk_get_default_language ());
-
-  native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
-  g_assert (native_metrics != NULL);
-
-  native_metrics[FONT_METRICS_ASCENT] = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics));
-  native_metrics[FONT_METRICS_MAX_ASCENT] = native_metrics[FONT_METRICS_ASCENT];
-  native_metrics[FONT_METRICS_DESCENT] = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics));
-  if (native_metrics[FONT_METRICS_DESCENT] < 0)
-    native_metrics[FONT_METRICS_DESCENT] = - native_metrics[FONT_METRICS_DESCENT];
-  native_metrics[FONT_METRICS_MAX_DESCENT] = native_metrics[FONT_METRICS_DESCENT];
-  native_metrics[FONT_METRICS_MAX_ADVANCE] = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width (pango_metrics));
-        
-  (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
-
-  pango_font_metrics_unref (pango_metrics);
-
-  gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerTextMetrics
-   (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jstring str, jdoubleArray java_metrics)
-{
-  struct peerfont *pfont = NULL;
-  const char *cstr = NULL;
-  jdouble *native_metrics = NULL;  
-  PangoRectangle log;
-
-  gdk_threads_enter();
-
-  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
-  g_assert (pfont != NULL);
-
-  cstr = (*env)->GetStringUTFChars (env, str, NULL);
-  g_assert(cstr != NULL);
-
-  pango_layout_set_text (pfont->layout, cstr, -1);
-  pango_layout_get_extents (pfont->layout, NULL, &log);
-
-  (*env)->ReleaseStringUTFChars (env, str, cstr);  
-  pango_layout_set_text (pfont->layout, "", -1);
-
-  native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
-  g_assert (native_metrics != NULL);
-
-  native_metrics[TEXT_METRICS_X_BEARING] = PANGO_PIXELS(log.x);
-  native_metrics[TEXT_METRICS_Y_BEARING] = PANGO_PIXELS(log.y);
-  native_metrics[TEXT_METRICS_WIDTH] = PANGO_PIXELS(log.width);
-  native_metrics[TEXT_METRICS_HEIGHT] = PANGO_PIXELS(log.height);
-  native_metrics[TEXT_METRICS_X_ADVANCE] = PANGO_PIXELS(log.x + log.width);
-  native_metrics[TEXT_METRICS_Y_ADVANCE] = PANGO_PIXELS(log.y + log.height);
-        
-  (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
-
-  gdk_threads_leave();
-}
-
index d992653..7a8a2ce 100644 (file)
 
 struct state_table *native_font_state_table;
 
-/*
-rough sketch of the mapping between java and 
-pango text objects:
-  
-  Font              <->    - PangoFont
-                           - PangoFontDescription
-                           - PangoContext
-                           - PangoLayout (for rendering and measuring)
-
-  GlyphVector       <->    - GList of PangoGlyphItem
-                           - PangoFontDescription
-                           - PangoContext
-
-  FontRenderContext <->    stays in plain java
-
-*/
-
 enum java_awt_font_style {
   java_awt_font_PLAIN = 0,
   java_awt_font_BOLD = 1,
@@ -69,11 +52,22 @@ enum java_awt_font_baseline {
   java_awt_font_HANGING_BASELINE = 2
 };
 
+static jmethodID glyphVector_ctor;
+static jclass glyphVector_class;
+static PangoAttrList *attrs = NULL;
+
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState 
   (JNIEnv *env, jclass clazz)
 {
   NSA_FONT_INIT (env, clazz);
+
+  glyphVector_class = (*env)->FindClass 
+    (env, "gnu/java/awt/peer/gtk/GdkGlyphVector");
+
+  glyphVector_ctor = (*env)->GetMethodID 
+    (env, glyphVector_class, "<init>", 
+     "([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V");
 }
 
 JNIEXPORT void JNICALL
@@ -111,6 +105,223 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
   gdk_threads_leave ();
 }
 
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector
+  (JNIEnv *env, jobject self, 
+   jstring chars,
+   jobject font, 
+   jobject fontRenderContext)
+{
+  struct peerfont *pfont = NULL;
+  GList *items = NULL, *i = NULL;
+  gchar *str = NULL;
+  int len, j;
+  double *native_extents;
+  int *native_codes;
+  jintArray java_codes = NULL;
+  jdoubleArray java_extents = NULL;
+
+  gdk_threads_enter ();
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self);
+  g_assert (pfont != NULL);
+
+  len = (*gdk_env())->GetStringUTFLength (env, chars);  
+  str = (gchar *)(*env)->GetStringUTFChars (env, chars, NULL);
+  g_assert (str != NULL);
+
+  if (attrs == NULL)
+    attrs = pango_attr_list_new ();
+
+  if (len > 0 && str[len-1] == '\0')
+    len--;
+  
+  items = pango_itemize (pfont->ctx, str, 0, len, attrs, NULL);
+
+  i = g_list_first (items);
+
+  if (i == NULL)       
+    {
+      java_extents = (*env)->NewDoubleArray (env, 0);
+      java_codes = (*env)->NewIntArray (env, 0);
+    }
+  else
+    { 
+      PangoGlyphString *glyphs;
+      PangoItem *item = (PangoItem *)i->data;
+
+      pango_context_set_font_description (pfont->ctx, pfont->desc);
+      pango_context_set_language (pfont->ctx, gtk_get_default_language());
+      pango_context_load_font (pfont->ctx, pfont->desc);
+
+      glyphs = pango_glyph_string_new ();
+      g_assert (glyphs != NULL);
+
+      pango_shape (str + item->offset, item->length, 
+                  &(item->analysis), glyphs);
+
+      if (glyphs->num_glyphs > 0)
+       {
+         int x = 0;
+         double scale = ((double) PANGO_SCALE);
+
+         java_extents = (*env)->NewDoubleArray (env, glyphs->num_glyphs * NUM_GLYPH_METRICS);
+         java_codes = (*env)->NewIntArray (env, glyphs->num_glyphs);
+         native_extents = (*env)->GetDoubleArrayElements (env, java_extents, NULL);
+         native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
+
+         for (j = 0; j < glyphs->num_glyphs; ++j)
+           {
+             PangoRectangle ink;
+             PangoRectangle logical;
+             PangoGlyphGeometry *geom = &glyphs->glyphs[j].geometry;
+
+             pango_font_get_glyph_extents (pfont->font, 
+                                           glyphs->glyphs[j].glyph,
+                                           &ink, &logical);
+
+             native_codes[j] = glyphs->glyphs[j].glyph;
+
+             native_extents[ GLYPH_LOG_X(j)      ] = (logical.x)      / scale;
+             native_extents[ GLYPH_LOG_Y(j)      ] = (- logical.y)    / scale;
+             native_extents[ GLYPH_LOG_WIDTH(j)  ] = (logical.width)  / scale;
+             native_extents[ GLYPH_LOG_HEIGHT(j) ] = (logical.height) / scale;
+
+             native_extents[ GLYPH_INK_X(j)      ] = (ink.x)       / scale;
+             native_extents[ GLYPH_INK_Y(j)      ] = (- ink.y)     / scale;
+             native_extents[ GLYPH_INK_WIDTH(j)  ] = (ink.width)   / scale;
+             native_extents[ GLYPH_INK_HEIGHT(j) ] = (ink.height)  / scale;
+
+             native_extents[ GLYPH_POS_X(j)      ] = (x + geom->x_offset)  / scale;
+             native_extents[ GLYPH_POS_Y(j)      ] = (  - geom->y_offset)  / scale;
+
+             x += geom->width;
+           }
+         (*env)->ReleaseDoubleArrayElements (env, java_extents, native_extents, 0);
+         (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
+       }
+
+      pango_glyph_string_free (glyphs);
+    }
+
+  (*env)->ReleaseStringUTFChars (env, chars, str);
+  
+  for (i = g_list_first (items); i != NULL; i = g_list_next (i))
+    g_free (i->data);
+  
+  g_list_free (items);
+
+  gdk_threads_leave ();
+
+  return (*env)->NewObject (env, 
+                           glyphVector_class, 
+                           glyphVector_ctor, 
+                           java_extents, java_codes,
+                           font, fontRenderContext);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics
+   (JNIEnv *env, jobject java_font, jdoubleArray java_metrics)
+{
+  struct peerfont *pfont = NULL;
+  jdouble *native_metrics = NULL;
+  PangoFontMetrics *pango_metrics;
+
+  gdk_threads_enter();
+
+  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+  g_assert (pfont != NULL);
+
+  pango_metrics 
+    = pango_context_get_metrics (pfont->ctx, pfont->desc,
+                                gtk_get_default_language ());
+
+  native_metrics 
+    = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+
+  g_assert (native_metrics != NULL);
+
+  native_metrics[FONT_METRICS_ASCENT] 
+    = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics));
+
+  native_metrics[FONT_METRICS_MAX_ASCENT] 
+    = native_metrics[FONT_METRICS_ASCENT];
+
+  native_metrics[FONT_METRICS_DESCENT] 
+    = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics));
+
+  if (native_metrics[FONT_METRICS_DESCENT] < 0)
+    native_metrics[FONT_METRICS_DESCENT] 
+      = - native_metrics[FONT_METRICS_DESCENT];
+
+  native_metrics[FONT_METRICS_MAX_DESCENT] 
+    = native_metrics[FONT_METRICS_DESCENT];
+
+  native_metrics[FONT_METRICS_MAX_ADVANCE] 
+    = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width 
+                   (pango_metrics));
+        
+  (*env)->ReleaseDoubleArrayElements (env, 
+                                     java_metrics, 
+                                     native_metrics, 0);
+
+  pango_font_metrics_unref (pango_metrics);
+
+  gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics
+   (JNIEnv *env, jobject java_font, jstring str, jdoubleArray java_metrics)
+{
+  struct peerfont *pfont = NULL;
+  const char *cstr = NULL;
+  jdouble *native_metrics = NULL;  
+  PangoRectangle log;
+
+  gdk_threads_enter();
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
+  g_assert (pfont != NULL);
+
+  cstr = (*env)->GetStringUTFChars (env, str, NULL);
+  g_assert(cstr != NULL);
+
+  pango_layout_set_text (pfont->layout, cstr, -1);
+  pango_layout_get_extents (pfont->layout, NULL, &log);
+
+  (*env)->ReleaseStringUTFChars (env, str, cstr);  
+  pango_layout_set_text (pfont->layout, "", -1);
+
+  native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+  g_assert (native_metrics != NULL);
+
+  native_metrics[TEXT_METRICS_X_BEARING] 
+    = PANGO_PIXELS( ((double)log.x) );
+
+  native_metrics[TEXT_METRICS_Y_BEARING] 
+    = PANGO_PIXELS( ((double)log.y) );
+
+  native_metrics[TEXT_METRICS_WIDTH] 
+    = PANGO_PIXELS( ((double)log.width) );
+
+  native_metrics[TEXT_METRICS_HEIGHT] 
+    = PANGO_PIXELS( ((double)log.height) );
+
+  native_metrics[TEXT_METRICS_X_ADVANCE] 
+    = PANGO_PIXELS( ((double) (log.x + log.width)) );
+
+  native_metrics[TEXT_METRICS_Y_ADVANCE] 
+    = PANGO_PIXELS( ((double) (log.y + log.height)) );
+        
+  (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
+
+  gdk_threads_leave();
+}
+
+
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
   (JNIEnv *env, jobject self, jstring family_name_str, jint style_int, jint size, jboolean useGraphics2D)
@@ -142,7 +353,6 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
   pango_font_description_set_family (pfont->desc, family_name);
   (*env)->ReleaseStringUTFChars(env, family_name_str, family_name);
 
-  pango_font_description_set_size (pfont->desc, size * dpi_conversion_factor);
 
   if (style & java_awt_font_BOLD)
     pango_font_description_set_weight (pfont->desc, PANGO_WEIGHT_BOLD);
@@ -152,6 +362,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
 
   if (useGraphics2D)
     {
+      pango_font_description_set_size (pfont->desc, size * PANGO_SCALE);
       if (pfont->ctx == NULL)
        {
          ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_for_display ());
@@ -160,6 +371,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
     }
   else
     {
+      /* GDK uses a slightly different DPI setting. */
+      pango_font_description_set_size (pfont->desc, 
+                                      size * dpi_conversion_factor);
       if (pfont->ctx == NULL)
        pfont->ctx = gdk_pango_context_get();
     }
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
deleted file mode 100644 (file)
index df72097..0000000
+++ /dev/null
@@ -1,696 +0,0 @@
-/* gdkglyphvector.c
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-   
-   This file is part of GNU Classpath.
-   
-   GNU Classpath is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-   
-   GNU Classpath is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with GNU Classpath; see the file COPYING.  If not, write to the
-   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.
-   
-   Linking this library statically or dynamically with other modules is
-   making a combined work based on this library.  Thus, the terms and
-   conditions of the GNU General Public License cover the whole
-   combination.
-   
-   As a special exception, the copyright holders of this library give you
-   permission to link this library with independent modules to produce an
-   executable, regardless of the license terms of these independent
-   modules, and to copy and distribute the resulting executable under
-   terms of your choice, provided that you also meet, for each linked
-   independent module, the terms and conditions of the license of that
-   module.  An independent module is a module which is not derived from
-   or based on this library.  If you modify this library, you may extend
-   this exception to your version of the library, but you are not
-   obligated to do so.  If you do not wish to do so, delete this
-   exception statement from your version. */
-
-#include "gdkfont.h"
-#include "gnu_java_awt_peer_gtk_GdkGlyphVector.h"
-
-struct state_table *native_glyphvector_state_table;
-
-typedef struct { 
-  double x;
-  double y;
-  double width;
-  double height;
-} rect_t;
-
-#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
-#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
-#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
-#define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0)
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initStaticState 
-  (JNIEnv *env, jclass clazz)
-{
-  NSA_GV_INIT (env, clazz);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState
-  (JNIEnv *env, jobject self, jobject font, jobject ctx __attribute__ ((unused)))
-{
-  struct glyphvec *vec = NULL;
-  struct peerfont *pfont = NULL;
-
-  gdk_threads_enter ();
-  g_assert (font != NULL);
-  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
-  g_assert (pfont != NULL);
-  g_assert (pfont->ctx != NULL);
-  g_assert (pfont->desc != NULL);
-
-  g_assert (self != NULL);
-  vec = (struct glyphvec *) g_malloc0 (sizeof (struct glyphvec));
-  g_assert (vec != NULL);
-
-  vec->desc = pango_font_describe (pfont->font); 
-  g_assert (vec->desc != NULL);
-
-  vec->font = pfont->font;
-  g_object_ref (vec->font);
-    
-  vec->ctx = pfont->ctx;
-  g_object_ref (vec->ctx);
-
-  NSA_SET_GV_PTR (env, self, vec);
-  gdk_threads_leave ();
-}
-
-static void free_glyphitems (GList *list)
-{
-  GList *i = NULL;
-  PangoGlyphItem *gi = NULL;
-
-  for (i = g_list_first (list); i != NULL; i = g_list_next (i))
-    {
-      g_assert (i->data != NULL);
-      gi = (PangoGlyphItem *)i->data;
-
-      if (gi->glyphs != NULL)
-       pango_glyph_string_free (gi->glyphs);
-
-      if (gi->item != NULL)
-       g_free (gi->item);
-    }      
-  g_list_free (list);
-}
-
-static void seek_glyphstring_idx (GList *list, int idx, 
-                                 int *nidx, 
-                                 PangoGlyphString **gs,
-                                 PangoFont **fnt)
-{
-  GList *i = NULL;
-  PangoGlyphItem *gi = NULL;
-  int begin = 0;
-
-  g_assert (list != NULL);
-  g_assert (gs != NULL);
-  g_assert (nidx != NULL);
-
-  for (i = g_list_first (list); i != NULL; i = g_list_next (i))
-    {
-      g_assert (i->data != NULL);
-      gi = (PangoGlyphItem *)i->data;
-
-      g_assert (gi->glyphs != NULL);
-      
-      if (begin <= idx && idx < begin + gi->glyphs->num_glyphs)
-       {         
-         *gs = gi->glyphs;
-         *nidx = idx - begin;
-         if (fnt && gi->item)
-           *fnt = gi->item->analysis.font;
-         return;
-       }
-      else
-       {
-         begin += gi->glyphs->num_glyphs;
-       }
-    }
-  *gs = NULL;
-  *nidx = -1;
-}
-
-static void seek_glyph_idx (GList *list, int idx, 
-                           PangoGlyphInfo **g,
-                           PangoFont **fnt)
-{
-  PangoGlyphString *gs = NULL;
-  int nidx = -1;
-
-  g_assert (list != NULL);
-  g_assert (g != NULL);
-
-  seek_glyphstring_idx (list, idx, &nidx, &gs, fnt);
-
-  g_assert (gs != NULL);
-  g_assert (nidx != -1);
-  g_assert (nidx < gs->num_glyphs);
-  g_assert (gs->glyphs != NULL);
-
-  *g = gs->glyphs + nidx;
-}
-
-static void union_rects (rect_t *r1, 
-                        const rect_t *r2)
-{
-  rect_t r;
-
-  g_assert (r1 != NULL);
-  g_assert (r2 != NULL);
-
-  /* 
-     x is the left edge of the rect,
-     y is the top edge of the rect
-  */
-
-#ifndef min
-#define min(x,y) ((x) < (y) ? (x) : (y))
-#endif
-
-#ifndef max
-#define max(x,y) ((x) < (y) ? (y) : (x))
-#endif
-
-  r.x = min(r1->x, r2->x);
-
-  r.y = min(r1->y, r2->y);
-
-  r.width = max(r1->x + r1->width,
-               r2->x + r2->width) - r.x;
-
-  r.height = max(r1->y + r1->height,
-                r2->y + r2->height) - r.y;
-
-  *r1 = r;  
-}
-
-static jdoubleArray rect_to_array (JNIEnv *env, const rect_t *r)
-{
-  /* We often return rectangles as arrays : { x, y, w, h } */
-  jdoubleArray ret;
-  double *rp = NULL;
-  g_assert (r != NULL);
-  ret = (*env)->NewDoubleArray (env, 4);
-  rp = (*env)->GetDoubleArrayElements (env, ret, NULL);
-  g_assert (rp != NULL);
-  rp[0] = r->x;
-  /* freetype and pango's view of space is upside down from java2d's */
-  rp[1] = r->y * -1;
-  rp[2] = r->width;
-  rp[3] = r->height;
-  (*env)->ReleaseDoubleArrayElements (env, ret, rp, 0);
-  return ret;
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose
-  (JNIEnv *env, jobject self)
-{
-  struct glyphvec *vec = NULL;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_DEL_GV_PTR (env, self);
-  g_assert (vec != NULL);
-
-  if (vec->glyphitems != NULL)
-    {
-      free_glyphitems (vec->glyphitems);
-      vec->glyphitems = NULL;
-    }
-      
-  if (vec->desc != NULL)
-    pango_font_description_free (vec->desc);
-
-  if (vec->ctx != NULL)
-    g_object_unref (vec->ctx);
-
-  g_free (vec);
-  gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars 
-  (JNIEnv *env, jobject self, jstring chars)
-{
-  struct glyphvec *vec = NULL;
-  gchar *str = NULL;
-  GList *items = NULL, *item = NULL;
-  PangoGlyphItem *gi;
-  PangoAttrList *attrs = NULL; 
-  gint len = 0;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->desc != NULL);
-  g_assert (vec->ctx != NULL);
-  
-  len = (*gdk_env)->GetStringUTFLength (env, chars);
-  str = (gchar *)(*env)->GetStringUTFChars (env, chars, NULL);
-  g_assert (str != NULL);
-
-  /* step 1: set our FontFescription in the context, then "itemize" the
-     text */
-
-  attrs = pango_attr_list_new ();
-  g_assert (attrs != NULL);
-  
-  pango_context_set_font_description (vec->ctx, vec->desc);
-
-  if (vec->glyphitems != NULL)
-    items = pango_itemize (vec->ctx, str, 0, len, attrs, NULL);
-  if (items != NULL)
-    {
-      
-      /*
-       step 2: for each item:
-       - shape the item into a glyphstring
-       - store the (item, glyphstring) pair in the vec->glyphitems list
-      */
-      
-      if (vec->glyphitems != NULL)
-       {
-         free_glyphitems (vec->glyphitems);
-         vec->glyphitems = NULL;
-       }
-      
-      for (item = g_list_first (items);
-          item != NULL;
-          item = g_list_next (item))
-       {
-         g_assert (item->data != NULL);
-         
-         gi = NULL;
-         gi = g_malloc0 (sizeof(PangoGlyphItem));
-         g_assert (gi != NULL);
-         
-         gi->item = (PangoItem *)item->data;
-         gi->glyphs = pango_glyph_string_new ();
-         g_assert (gi->glyphs != NULL);
-         
-         if (gi->glyphs->num_glyphs > 0)
-           {
-             pango_shape (str + gi->item->offset, 
-                          gi->item->length, 
-                          &(gi->item->analysis), 
-                          gi->glyphs);
-             
-             vec->glyphitems = g_list_append (vec->glyphitems, gi);
-           }
-       }
-      
-      /* 
-        ownership of each item has been transferred to glyphitems, 
-        but the list should be freed.
-      */
-      
-      g_list_free (items);
-    }
-
-  pango_attr_list_unref (attrs);
-      
-  (*env)->ReleaseStringUTFChars (env, chars, str);
-  gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes
-  (JNIEnv *env, jobject self, jintArray codes __attribute__ ((unused)))
-{
-  struct glyphvec *vec = NULL;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-
-  /*
-    FIXME: setting glyph codes doesn't seem particularly plausible at the
-    moment. 
-   */
-
-  gdk_threads_leave ();
-
-}
-
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode 
-  (JNIEnv *env, jobject self, jint idx)
-{
-  struct glyphvec *vec = NULL;
-  PangoGlyphInfo *gi = NULL;
-  jint ret = 0;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
-
-  seek_glyph_idx (vec->glyphitems, idx, &gi, NULL);
-  g_assert (gi != NULL);
-  ret = gi->glyph;
-  gdk_threads_leave ();
-
-  return (jint)(ret);  
-}
-
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs 
-  (JNIEnv *env, jobject self)
-{
-  GList *i = NULL;
-  PangoGlyphItem *gi = NULL;
-  struct glyphvec *vec = NULL;
-  jint count = 0;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-
-  for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
-    {
-      g_assert (i->data != NULL);
-      gi = (PangoGlyphItem *)i->data;
-      g_assert (gi->glyphs != NULL);
-      count += gi->glyphs->num_glyphs;
-    }      
-  gdk_threads_leave ();
-
-  return count;
-}
-
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex
-(JNIEnv *env __attribute__ ((unused)), jobject self  __attribute__ ((unused)), jint idx)
-{
-  /* 
-     FIXME: this is not correct, rather it assumes a (broken) 1:1
-     glyph:char model. it can be implemented in terms of bytes (also
-     broken) using pango's current interface, or perhaps in terms of
-     characters if some better byte->character conversion operator is
-     found. for the time being we leave it broken.
-  */
-  return idx;
-}
-
-static void 
-assume_pointsize_and_identity_transform(double pointsize,
-                                       FT_Face face)
-{
-  FT_Matrix mat;
-  mat.xx = DOUBLE_TO_16_16(1);
-  mat.xy = DOUBLE_TO_16_16(0);
-  mat.yx = DOUBLE_TO_16_16(0);
-  mat.yy = DOUBLE_TO_16_16(1);    
-  FT_Set_Transform(face, &mat, NULL);
-  FT_Set_Char_Size( face, 
-                   DOUBLE_TO_26_6 (pointsize),
-                   DOUBLE_TO_26_6 (pointsize),
-                   0, 0);  
-}                                  
-
-JNIEXPORT jdoubleArray JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkExtents 
-  (JNIEnv *env, jobject self)
-{
-  struct glyphvec *vec = NULL;
-  int j;
-  GList *i;
-  PangoGlyphItem *gi = NULL;
-  rect_t rect = {0,0,0,0};
-  rect_t tmp;  
-  jdoubleArray ret;
-  double x = 0, y = 0;
-  double pointsize;
-  FT_Face face;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  if (vec->glyphitems != NULL)
-    {
-      pointsize = pango_font_description_get_size (vec->desc);
-      pointsize /= (double) PANGO_SCALE;
-      
-      for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
-       {
-         g_assert (i->data != NULL);
-         gi = (PangoGlyphItem *)i->data;
-         g_assert (gi->glyphs != NULL);
-         
-         face = pango_ft2_font_get_face (gi->item->analysis.font);
-         assume_pointsize_and_identity_transform (pointsize, face);
-         
-         for (j = 0; j < gi->glyphs->num_glyphs; ++j)
-           {
-             FT_Load_Glyph (face,
-                            gi->glyphs->glyphs[j].glyph,
-                            FT_LOAD_DEFAULT);
-             /* FIXME: this needs to change for vertical layouts */
-             tmp.x = x + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX);
-             tmp.y = y + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY);
-             tmp.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width);
-             tmp.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height);
-             union_rects (&rect, &tmp);
-             x += DOUBLE_FROM_26_6 (face->glyph->advance.x);
-             y += DOUBLE_FROM_26_6 (face->glyph->advance.y);
-           }
-       }      
-    }
-
-  ret = rect_to_array (env, &rect);
-  gdk_threads_leave ();
-  return ret;
-}
-
-
-JNIEXPORT jdoubleArray JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogicalExtents 
-  (JNIEnv *env, jobject self)
-{
-  struct glyphvec *vec = NULL;
-  int j;
-  GList *i;
-  PangoGlyphItem *gi = NULL;
-  rect_t rect = {0,0,0,0};
-  rect_t tmp;  
-  jdoubleArray ret;
-  double x = 0, y = 0;
-  double pointsize;
-  FT_Face face;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
-
-  pointsize = pango_font_description_get_size (vec->desc);
-  pointsize /= (double) PANGO_SCALE;
-
-  for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
-    {
-      g_assert (i->data != NULL);
-      gi = (PangoGlyphItem *)i->data;
-      g_assert (gi->glyphs != NULL);
-
-      face = pango_ft2_font_get_face (gi->item->analysis.font);
-      assume_pointsize_and_identity_transform (pointsize, face);
-      
-      for (j = 0; j < gi->glyphs->num_glyphs; ++j)
-       {
-         FT_Load_Glyph (face, gi->glyphs->glyphs[j].glyph, FT_LOAD_DEFAULT);
-
-         /* FIXME: also, this is probably not the correct set of metrics;
-            the "logical bounds" are some fancy combination of hori
-            advance and height such that it's good for inverting as a
-            highlight. revisit. */
-
-         tmp.x = x;
-         tmp.y = y;
-         tmp.width = DOUBLE_FROM_26_6 (face->glyph->advance.x);
-         tmp.height = DOUBLE_FROM_26_6 (face->glyph->advance.y);
-         union_rects (&rect, &tmp);
-         x += DOUBLE_FROM_26_6 (face->glyph->advance.x);
-         y += DOUBLE_FROM_26_6 (face->glyph->advance.y);
-       }
-    }      
-
-  ret = rect_to_array (env, &rect);
-  gdk_threads_leave ();
-  return ret;
-}
-
-
-JNIEXPORT jdoubleArray JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLogicalExtents 
-  (JNIEnv *env, jobject self, jint idx)
-{
-  struct glyphvec *vec = NULL;
-  rect_t rect = {0,0,0,0};
-  PangoGlyphInfo *gi = NULL;
-  PangoFont *font = NULL;
-  jdoubleArray ret;
-  double pointsize;
-  FT_Face face;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
-  seek_glyph_idx (vec->glyphitems, idx, &gi, &font);
-  g_assert (gi != NULL);
-  g_assert (font != NULL);
-
-  pointsize = pango_font_description_get_size (vec->desc);
-  pointsize /= (double) PANGO_SCALE;
-  face = pango_ft2_font_get_face (font);
-
-  assume_pointsize_and_identity_transform (pointsize, face);  
-
-  FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT);
-
-  /* FIXME: this is probably not the correct set of metrics;
-     the "logical bounds" are some fancy combination of hori
-     advance and height such that it's good for inverting as a
-     highlight. revisit. */
-  
-  rect.x = 0; 
-  rect.y = 0; 
-  rect.width = DOUBLE_FROM_26_6 (face->glyph->advance.x);
-  rect.height = DOUBLE_FROM_26_6 (face->glyph->advance.y);
-
-  ret = rect_to_array (env, &rect);
-  gdk_threads_leave ();
-  return ret;
-}
-
-
-JNIEXPORT jdoubleArray JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphInkExtents 
-  (JNIEnv *env, jobject self, jint idx)
-{
-  struct glyphvec *vec = NULL;
-  rect_t rect = {0,0,0,0};
-  PangoGlyphInfo *gi = NULL;
-  PangoFont *font = NULL;
-  jdoubleArray ret;
-  double pointsize;
-  FT_Face face;
-  
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->glyphitems != NULL);
-  seek_glyph_idx (vec->glyphitems, idx, &gi, &font);
-  g_assert (gi != NULL);
-  g_assert (font != NULL);
-
-  pointsize = pango_font_description_get_size (vec->desc);
-  pointsize /= (double) PANGO_SCALE;
-  face = pango_ft2_font_get_face (font);
-
-  assume_pointsize_and_identity_transform (pointsize, face);  
-  
-  FT_Load_Glyph (face, gi->glyph, FT_LOAD_DEFAULT);
-  /* FIXME: this needs to change for vertical layouts */
-  rect.x = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX);
-  rect.y = DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY);
-  rect.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width);
-  rect.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height);
-
-  ret = rect_to_array (env, &rect);
-  gdk_threads_leave ();
-  return ret;
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal 
-(JNIEnv *env, jobject self, jint idx  __attribute__ ((unused)))
-{
-  struct glyphvec *vec = NULL;
-  PangoDirection dir;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  g_assert (vec != NULL);
-  g_assert (vec->desc != NULL);
-  g_assert (vec->ctx != NULL);
-
-  /* 
-     FIXME: this is an approximation; it's not clear to me whether
-     glyphs themselves are horizontal or vertical so much as the
-     writing system or writing context. pango thinks it's a context
-     issue, so we use that for now.
-   */
-
-  dir = pango_context_get_base_dir (vec->ctx);
-
-  gdk_threads_leave ();
-
-  return 1;
-  /* FIXME: Pango doesn't seem to have decided how it will deal
-     with vertical text. for the time being we inherit this limitation.
-    ((dir == PANGO_DIRECTION_LTR) ||
-     (dir == PANGO_DIRECTION_RTL));    
-  */
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_isEqual 
-  (JNIEnv *env, jobject self, jobject other)
-{
-  struct glyphvec *vec1 = NULL, *vec2 = NULL;
-  jboolean eq = 0;
-
-  gdk_threads_enter ();
-  g_assert (self != NULL);
-  vec1 = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
-  vec2 = (struct glyphvec *)NSA_GET_GV_PTR (env, other);
-  g_assert (vec1 != NULL);
-  g_assert (vec2 != NULL);
-  
-  /* FIXME: is there some more advantageous definition of equality for
-     glyph vectors? */
-  eq = (vec1 == vec2);
-  
-  gdk_threads_leave ();
-  return eq;
-}
-
-
index a91eea1..99b1511 100644 (file)
@@ -133,13 +133,17 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals
   (JNIEnv *env, jobject obj, jobject peer)
 {
   void *ptr;
+  jobject *gref;
+
+  NSA_SET_GLOBAL_REF (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
 
   ptr = NSA_GET_PTR (env, peer);
 
   gdk_threads_enter ();
 
   g_signal_connect_after (G_OBJECT (ptr), "realize",
-                          G_CALLBACK (realize_cb), obj);
+                          G_CALLBACK (realize_cb), *gref);
 
   gdk_threads_leave ();
 }
@@ -438,6 +442,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
   g = (struct graphics *) NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
+
+  if (!g)
+    {
+      gdk_threads_leave ();
+      return;
+    }
   if (GDK_IS_WINDOW (g->drawable))
     {
       w.widget = &widget;
@@ -455,6 +465,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
                          x + g->x_offset, y + g->y_offset, width, height);
       gdk_gc_set_foreground (g->gc, &(saved.foreground));
     }
+
+  gdk_flush ();
   gdk_threads_leave ();
 }
 
@@ -672,7 +684,9 @@ static void realize_cb (GtkWidget *widget __attribute__ ((unused)),
 {
   gdk_threads_leave ();
 
-  (*gdk_env)->CallVoidMethod (gdk_env, peer, initComponentGraphicsID);
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer, initComponentGraphicsID);
+
+  NSA_DEL_GLOBAL_REF (gdk_env(), peer);
 
   gdk_threads_enter ();
 }
index 90b6aa1..e6535b4 100644 (file)
@@ -1,5 +1,5 @@
 /* gnu_java_awt_peer_gtk_GdkGraphics2d.c
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 200 Free Software Foundation, Inc.
 
    This file is part of GNU Classpath.
    
@@ -45,7 +45,8 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk-pixbuf/gdk-pixdata.h>
 
-#include <cairo.h>
+#include <cairo-ft.h>
+#include <cairo-xlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -175,7 +176,6 @@ x_server_has_render_extension (void)
   return (int) XRenderQueryExtension (GDK_DISPLAY (), &ev, &err);
 }
 
-
 static void
 init_graphics2d_as_pixbuf (struct graphics2d *gr)
 {
@@ -196,13 +196,14 @@ init_graphics2d_as_pixbuf (struct graphics2d *gr)
   g_assert (gdk_pixbuf_get_bits_per_sample (gr->drawbuf) == bits_per_sample);
   g_assert (gdk_pixbuf_get_n_channels (gr->drawbuf) == total_channels);
   
-  gr->surface = cairo_surface_create_for_image (gdk_pixbuf_get_pixels (gr->drawbuf), 
+  gr->surface = cairo_surface_create_for_image ((char *) gdk_pixbuf_get_pixels (gr->drawbuf), 
                                                CAIRO_FORMAT_ARGB32, 
                                                gdk_pixbuf_get_width (gr->drawbuf), 
                                                gdk_pixbuf_get_height (gr->drawbuf), 
                                                gdk_pixbuf_get_rowstride (gr->drawbuf));      
   g_assert (gr->surface != NULL);
   g_assert (gr->cr != NULL);
+  gr->mode = MODE_DRAWABLE_NO_RENDER;
   cairo_set_target_surface (gr->cr, gr->surface);
 }
 
@@ -232,60 +233,99 @@ init_graphics2d_as_renderable (struct graphics2d *gr)
                                           DefaultColormap (dpy, DefaultScreen (dpy)));
   g_assert (gr->surface != NULL);
   g_assert (gr->cr != NULL);
+  gr->mode = MODE_DRAWABLE_WITH_RENDER;
   cairo_set_target_surface (gr->cr, gr->surface);
 }
 
 static void
-begin_drawing_operation (struct graphics2d * gr)
+begin_drawing_operation (JNIEnv *env, struct graphics2d * gr)
 {  
   g_assert(cairo_status (gr->cr) == CAIRO_STATUS_SUCCESS);
-  if (gr->drawbuf)
+
+  switch (gr->mode)
     {
+    case MODE_DRAWABLE_WITH_RENDER:
+      break;
 
-      gint drawable_width, drawable_height;
-      gint pixbuf_width, pixbuf_height;
-      gint width, height;
-      
-      gdk_drawable_get_size (gr->drawable, &drawable_width, &drawable_height);
-      pixbuf_width = gdk_pixbuf_get_width (gr->drawbuf);
-      pixbuf_height = gdk_pixbuf_get_height (gr->drawbuf);
-      width = min (drawable_width, pixbuf_width);
-      height = min (drawable_height, pixbuf_height);
-
-      gdk_pixbuf_get_from_drawable (gr->drawbuf, /* destination pixbuf */
-                                   gr->drawable, 
-                                   NULL, /* colormap */
-                                   0, 0, 0, 0,
-                                   width, height); 
-      
-      if (gr->debug) printf ("copied (%d, %d) pixels from GDK drawable to pixbuf\n",
-                            width, height);      
+    case MODE_DRAWABLE_NO_RENDER:
+      {
+       
+       gint drawable_width, drawable_height;
+       gint pixbuf_width, pixbuf_height;
+       gint width, height;
+       
+       gdk_drawable_get_size (gr->drawable, &drawable_width, &drawable_height);
+       pixbuf_width = gdk_pixbuf_get_width (gr->drawbuf);
+       pixbuf_height = gdk_pixbuf_get_height (gr->drawbuf);
+       width = min (drawable_width, pixbuf_width);
+       height = min (drawable_height, pixbuf_height);
+       
+       gdk_pixbuf_get_from_drawable (gr->drawbuf, /* destination pixbuf */
+                                     gr->drawable, 
+                                     NULL, /* colormap */
+                                     0, 0, 0, 0,
+                                     width, height); 
+       
+       if (gr->debug) printf ("copied (%d, %d) pixels from GDK drawable to pixbuf\n",
+                              width, height);      
+      }
+      break;
+
+    case MODE_JAVA_ARRAY:
+      gr->javabuf = (*env)->GetIntArrayElements (env, gr->jarray, &gr->isCopy);
+      gr->surface = cairo_surface_create_for_image ((char *) gr->javabuf, 
+                                                   CAIRO_FORMAT_ARGB32, 
+                                                   gr->width, 
+                                                   gr->height, 
+                                                   gr->width * 4);
+      g_assert(gr->surface != NULL);
+      g_assert(gr->cr != NULL);
+      cairo_set_target_surface (gr->cr, gr->surface);
+      break;
     }
 }
 
 static void
-end_drawing_operation (struct graphics2d * gr)
+end_drawing_operation (JNIEnv *env, struct graphics2d * gr)
 {
   g_assert(cairo_status (gr->cr) == CAIRO_STATUS_SUCCESS);
-  if (gr->drawbuf)
-    { 
-      gint drawable_width, drawable_height;
-      gint pixbuf_width, pixbuf_height;
-      gint width, height;
+
+  switch (gr->mode)
+    {
+    case MODE_DRAWABLE_WITH_RENDER:
+      break;
+
+    case MODE_DRAWABLE_NO_RENDER:
+      {
+
+       gint drawable_width, drawable_height;
+       gint pixbuf_width, pixbuf_height;
+       gint width, height;
+       
+       gdk_drawable_get_size (gr->drawable, &drawable_width, &drawable_height);
+       pixbuf_width = gdk_pixbuf_get_width (gr->drawbuf);
+       pixbuf_height = gdk_pixbuf_get_height (gr->drawbuf);
+       width = min (drawable_width, pixbuf_width);
+       height = min (drawable_height, pixbuf_height);
+       
+       gdk_draw_pixbuf (gr->drawable, NULL, gr->drawbuf,
+                        0, 0, 0, 0, 
+                        width, height, 
+                        GDK_RGB_DITHER_NORMAL, 0, 0);
+       
+       if (gr->debug) printf ("copied (%d, %d) pixels from pixbuf to GDK drawable\n",
+                              width, height);
+      }
+      break;
       
-      gdk_drawable_get_size (gr->drawable, &drawable_width, &drawable_height);
-      pixbuf_width = gdk_pixbuf_get_width (gr->drawbuf);
-      pixbuf_height = gdk_pixbuf_get_height (gr->drawbuf);
-      width = min (drawable_width, pixbuf_width);
-      height = min (drawable_height, pixbuf_height);
-
-      gdk_draw_pixbuf (gr->drawable, NULL, gr->drawbuf,
-                      0, 0, 0, 0, 
-                      width, height, 
-                      GDK_RGB_DITHER_NORMAL, 0, 0);
-
-      if (gr->debug) printf ("copied (%d, %d) pixels from pixbuf to GDK drawable\n",
-                            width, height);
+    case MODE_JAVA_ARRAY:
+      /* 
+       * FIXME: Perhaps this should use the isCopy flag to try to avoid
+       * tearing down the cairo surface.
+       */
+      cairo_surface_destroy (gr->surface);
+      gr->surface = NULL;
+      (*env)->ReleaseIntArrayElements (env, gr->jarray, gr->javabuf, JNI_COMMIT);
     }
 }
 
@@ -317,11 +357,11 @@ check_for_debug (struct graphics2d *gr)
 }
 
 static void
-realize_cb (GtkWidget *widget, jobject peer)
+realize_cb (GtkWidget *widget __attribute__ ((unused)), jobject peer)
 {
   gdk_threads_leave ();
 
-  (*gdk_env)->CallVoidMethod (gdk_env, peer, initComponentGraphics2DID);
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer, initComponentGraphics2DID);
 
   gdk_threads_enter ();
 }
@@ -342,18 +382,29 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState
 
   if (g_old->debug) printf ("copying state from existing graphics2d\n");
 
-  g->drawable = g_old->drawable;
   g->debug = g_old->debug; 
+  g->mode = g_old->mode;
 
-  g_object_ref (g->drawable);
+  if (g_old->mode == MODE_JAVA_ARRAY)
+    {
+      g->width = g_old->width;
+      g->height = g_old->height;
+      g->jarray = (*env)->NewGlobalRef(env, g_old->jarray);
+    }
+  else
+    {
+      g->drawable = g_old->drawable;
+
+      g_object_ref (g->drawable);
   
-  g->cr = cairo_create();
-  g_assert (g->cr != NULL);
+      g->cr = cairo_create();
+      g_assert (g->cr != NULL);
 
-  if (x_server_has_render_extension ())
-    init_graphics2d_as_renderable (g);
-  else
-    init_graphics2d_as_pixbuf (g);
+      if (x_server_has_render_extension ())
+       init_graphics2d_as_renderable (g);
+      else
+       init_graphics2d_as_pixbuf (g);
+    }
 
   cairo_surface_set_filter (g->surface, CAIRO_FILTER_FAST);
 
@@ -363,6 +414,37 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState
 
 
 JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState___3III
+(JNIEnv *env, jobject obj, jintArray jarr, jint width, jint height)
+{
+  struct graphics2d *gr;
+
+  gdk_threads_enter();
+  gr = (struct graphics2d *) malloc (sizeof (struct graphics2d));
+  g_assert (gr != NULL);
+  memset (gr, 0, sizeof(struct graphics2d));
+
+  check_for_debug (gr);  
+
+  if (gr->debug) printf ("constructing java-backed image of size (%d,%d)\n",
+                        width, height);
+  
+  gr->cr = cairo_create();
+  g_assert (gr->cr != NULL);
+
+  gr->width = width;
+  gr->height = height;
+  gr->jarray = (*env)->NewGlobalRef(env, jarr);
+  gr->mode = MODE_JAVA_ARRAY;
+
+  if (gr->debug) printf ("constructed java-backed image of size (%d,%d)\n",
+                        width, height);
+
+  NSA_SET_G2D_PTR (env, obj, gr);
+  gdk_threads_leave();  
+}
+
+JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
   (JNIEnv *env, jobject obj, jint width, jint height)
 {
@@ -414,7 +496,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
 
   if (src->debug) printf ("copying from offscreen drawable\n");
 
-  begin_drawing_operation(dst); 
+  begin_drawing_operation(env, dst); 
 
   /* gdk_flush(); */
 
@@ -439,7 +521,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
 
   gdk_flush();
 
-  end_drawing_operation(dst);
+  end_drawing_operation(env, dst);
 
   if (src->debug) printf ("copied %d x %d pixels from offscreen drawable\n", width, height);
   gdk_threads_leave();
@@ -531,6 +613,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose
   if (gr->pattern_pixels)
     free (gr->pattern_pixels);
 
+  if (gr->mode == MODE_JAVA_ARRAY)
+    (*env)->DeleteGlobalRef(env, gr->jarray);
+
   if (gr->debug) printf ("disposed of graphics2d\n");
 
   free (gr);
@@ -734,7 +819,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
   g_assert (native_matrix != NULL);
   g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
 
-  begin_drawing_operation (gr);
+  begin_drawing_operation (env, gr);
   
  {
    cairo_matrix_t *mat = NULL;
@@ -748,13 +833,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
                            native_matrix[4], native_matrix[5]);
    cairo_surface_set_matrix (surf, mat);
    cairo_surface_set_filter (surf, cairo_surface_get_filter(gr->surface));
-
    cairo_show_surface (gr->cr, surf, w, h);
    cairo_matrix_destroy (mat);
    cairo_surface_destroy (surf);
  }
   
- end_drawing_operation (gr);
+ end_drawing_operation (env, gr);
  
  (*env)->ReleaseIntArrayElements (env, java_pixels, native_pixels, 0);
  (*env)->ReleaseDoubleArrayElements (env, java_matrix, native_matrix, 0);
@@ -762,65 +846,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
   gdk_threads_leave();
 }
 
-JNIEXPORT jintArray JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels 
-   (JNIEnv *env, jobject obj)
-{
-  struct graphics2d *gr = NULL;
-  jintArray java_pixels;
-  jint* native_pixels;
-  GdkPixbuf *buf = NULL;
-  gint width, height;
-  gint bits_per_sample = 8;
-  gboolean has_alpha = TRUE;
-  gint total_channels = 4;
-  jint i;
-
-  gdk_threads_enter();
-  if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return NULL; }
-
-  gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-  g_assert (gr != NULL);
-  
-  if (gr->debug) printf ("getImagePixels\n");
-  
-  gdk_drawable_get_size (gr->drawable, &width, &height);
-    
-  buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, has_alpha, 
-                        bits_per_sample,
-                        width, height);
-  g_assert (buf != NULL);
-  g_assert (gdk_pixbuf_get_bits_per_sample (buf) == bits_per_sample);
-  g_assert (gdk_pixbuf_get_n_channels (buf) == total_channels);
-  
-      
-  /* copy pixels from drawable to pixbuf */
-  
-  gdk_pixbuf_get_from_drawable (buf, gr->drawable,
-                                NULL, 
-                                0, 0, 0, 0,
-                                width, height);
-                                                                                                     
-  native_pixels= gdk_pixbuf_get_pixels (buf);
-
-#ifndef WORDS_BIGENDIAN
-  /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
-  for (i=0; i<width * height; i++)
-    {
-      native_pixels[i] = SWAPU32 ((unsigned)native_pixels[i]);
-    }
-#endif
-
-   java_pixels = (*env) -> NewIntArray (env, width * height);   
-   
-   (*env)->SetIntArrayRegion(env, java_pixels, 
-                            (jsize)0, (jsize) width*height, 
-                            (jint*) native_pixels);
-   
-   gdk_threads_leave();
-   return java_pixels;
-}
-
 /* passthrough methods to cairo */
 
 JNIEXPORT void JNICALL
@@ -917,13 +942,13 @@ install_font_peer(cairo_t *cr,
       if (debug) printf ("install_font_peer made new cairo font for '%s' at %f\n", 
                         face->family_name,
                         (pango_font_description_get_size (pfont->desc) / 
-                         (double)PANGO_SCALE) * (96.0 / 72.0));
+                         (double)PANGO_SCALE));
     
       cairo_set_font (cr, ft); 
       cairo_font_destroy (ft);
       cairo_scale_font (cr, 
                        (pango_font_description_get_size (pfont->desc) / 
-                        (double)PANGO_SCALE) * (96.0 / 72.0));
+                        (double)PANGO_SCALE));
       ft = cairo_current_font (cr);
       pfont->graphics_resource = ft;
     }
@@ -935,24 +960,10 @@ install_font_peer(cairo_t *cr,
     }
 }
 
-static cairo_t *metrics_cairo = NULL;
-static cairo_surface_t *metrics_surface = NULL;
-
-static void
-ensure_metrics_cairo()
-{
-  if (metrics_cairo == NULL)
-    {
-      metrics_cairo = cairo_create ();
-      metrics_surface = cairo_image_surface_create (CAIRO_FORMAT_A8, 1, 1);
-      cairo_set_target_surface (metrics_cairo, metrics_surface);
-    }
-}
-
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkGraphics2D_releasePeerGraphicsResource
-   (JNIEnv *env, jclass clazz, jobject java_font)
+   (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font)
 {
   struct peerfont *pfont = NULL;
 
@@ -969,80 +980,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_releasePeerGraphicsResource
   gdk_threads_leave();
 }
 
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics
-   (JNIEnv *env, jclass clazz, jobject java_font, jstring str, jdoubleArray java_metrics)
-{
-  struct peerfont *pfont = NULL;
-  const char *cstr = NULL;
-  jdouble *native_metrics = NULL;
-  cairo_text_extents_t extents;
-
-  g_assert(java_font != NULL);
-  gdk_threads_enter();
-
-  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
-  g_assert (pfont != NULL);
-
-  ensure_metrics_cairo();
-  install_font_peer (metrics_cairo, pfont, 0);
-
-  cstr = (*env)->GetStringUTFChars (env, str, NULL);
-  g_assert(cstr != NULL);
-  cairo_text_extents (metrics_cairo, cstr, &extents);
-
-  native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
-  g_assert (native_metrics != NULL);
-
-  native_metrics[TEXT_METRICS_X_BEARING] = extents.x_bearing;
-  native_metrics[TEXT_METRICS_Y_BEARING] = extents.y_bearing;
-  native_metrics[TEXT_METRICS_WIDTH] = extents.width;
-  native_metrics[TEXT_METRICS_HEIGHT] = extents.height;
-  native_metrics[TEXT_METRICS_X_ADVANCE] = extents.x_advance;
-  native_metrics[TEXT_METRICS_Y_ADVANCE] = extents.y_advance;
-        
-  (*env)->ReleaseStringUTFChars (env, str, cstr);  
-  (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
-  gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics
-   (JNIEnv *env, jclass clazz, jobject java_font, jdoubleArray java_metrics)
-{
-  struct peerfont *pfont = NULL;
-  jdouble *native_metrics = NULL;
-  cairo_font_extents_t extents;
-
-  g_assert(java_font != NULL);
-
-  gdk_threads_enter();
-
-  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
-  g_assert (pfont != NULL);
-
-  ensure_metrics_cairo();
-  install_font_peer (metrics_cairo, pfont, 0);
-
-  cairo_current_font_extents (metrics_cairo, &extents); 
-
-  native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
-  g_assert (native_metrics != NULL);
-
-  native_metrics[FONT_METRICS_ASCENT] = extents.ascent;
-  native_metrics[FONT_METRICS_MAX_ASCENT] = extents.ascent;
-  native_metrics[FONT_METRICS_DESCENT] = extents.descent;
-  if (native_metrics[FONT_METRICS_DESCENT] < 0)
-    native_metrics[FONT_METRICS_DESCENT] = - native_metrics[FONT_METRICS_DESCENT];
-  native_metrics[FONT_METRICS_MAX_DESCENT] = native_metrics[FONT_METRICS_DESCENT];
-  native_metrics[FONT_METRICS_MAX_ADVANCE] = extents.max_x_advance;
-
-  (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
-  gdk_threads_leave();
-}
-
 static void
-paint_glyph_run(struct graphics2d *gr,
+paint_glyph_run(JNIEnv *env,
+               struct graphics2d *gr,
                cairo_glyph_t **glyphs,
                gint *n_glyphs,
                PangoLayoutRun *run)
@@ -1090,134 +1030,71 @@ paint_glyph_run(struct graphics2d *gr,
        }
 
       if (gr->debug) printf("\n");
-      begin_drawing_operation (gr);
+      begin_drawing_operation (env, gr);
       cairo_show_glyphs (gr->cr, *glyphs, run->glyphs->num_glyphs);
-      end_drawing_operation (gr);      
+      end_drawing_operation (env, gr);      
     }
 }
 
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString
-  (JNIEnv *env, jobject obj, jobject font, jstring str, float x, float y)
-{
-  struct graphics2d *gr = NULL;
-  const char *cstr = NULL;
-  struct peerfont *pfont = NULL;
-
-  /*
-  cairo_glyph_t *glyphs = NULL;
-  gint n_glyphs = 0;
-  PangoLayoutRun *run = NULL;
-  PangoLayoutIter *iter = NULL;
-  */
-
-  g_assert(obj != NULL);
-  g_assert(font != NULL);
-  g_assert(str != NULL);
-
-  gdk_threads_enter ();
-  if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
-
-  gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
-  g_assert(gr != NULL);
-
-  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font);
-  g_assert (pfont != NULL);
-
-  cstr = (*env)->GetStringUTFChars (env, str, NULL);
-  g_assert(cstr != NULL);
-
-  if (gr->debug) printf ("painting string '%s' at (%f,%f)\n", cstr, x, y);
-
-  /* For now we let cairo do the glyph conversion; eventually this
-   * ought to be unified with pango, but it is impossible to get
-   * pango and cairo to agree on metrics at the moment, so we either
-   * have to use "all cairo" metrics (the string-based APIs) or 
-   * "all pango" metrics (the glyph-vector based APIs). 
-   */
-
-  install_font_peer (gr->cr, pfont, gr->debug);
-  cairo_move_to (gr->cr, x, y);
-  cairo_show_text (gr->cr, cstr);
-  
-  /*
-    
-  pango_layout_set_text (gr->pango_layout, cstr, -1);
-
-  iter = pango_layout_get_iter (gr->pango_layout);
-  g_assert(iter != NULL);
-
-  cairo_translate (gr->cr, x, y);
-
-  do 
-    {
-      run = pango_layout_iter_get_run (iter);
-      if (run != NULL)
-       paint_glyph_run (gr, &glyphs, &n_glyphs, run);
-    } 
-  while (pango_layout_iter_next_run (iter));
-  
-  if (glyphs != NULL)
-    g_free (glyphs);
-
-  cairo_translate (gr->cr, -x, -y);
-  
-  pango_layout_iter_free (iter);
-
-  */
-
-  gdk_threads_leave ();
-
-  (*env)->ReleaseStringUTFChars (env, str, cstr);
-}
-
 
 JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkGlyphVector
-   (JNIEnv *env, jobject self, jobject font, jobject java_vec, jfloat x, jfloat y)
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector
+   (JNIEnv *env, jobject self, 
+    jobject font,
+    jfloat x, jfloat y, jint n,
+    jintArray java_codes,
+    jfloatArray java_positions)
 {
   
   struct graphics2d *gr = NULL;
   struct peerfont *pfont = NULL;
-  struct glyphvec *gv = NULL;
-  PangoLayoutRun *run = NULL;
   cairo_glyph_t *glyphs = NULL;
-  gint n_glyphs = 0;
+  int *native_codes;
+  float *native_positions;
+  jint i = 0;
 
   g_assert (self != NULL);
-  g_assert (java_vec != NULL);
+  g_assert (java_codes != NULL);
+  g_assert (java_positions != NULL);
 
   gdk_threads_enter ();
   if (peer_is_disposed(env, self)) { gdk_threads_leave(); return; }
 
   gr = (struct graphics2d *)NSA_GET_G2D_PTR (env, self);
-  gv = (struct glyphvec *)NSA_GET_GV_PTR (env, java_vec);
-  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font);
-
   g_assert (gr != NULL);
-  g_assert (gv != NULL);
+
+  pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
   g_assert (pfont != NULL);
 
-  if (gr->debug) printf ("painting pango glyph vector\n");
+  install_font_peer(gr->cr, pfont, gr->debug);
 
-  install_font_peer (gr->cr, pfont, gr->debug);
-  cairo_translate (gr->cr, x, y);
+  glyphs = malloc( sizeof(cairo_glyph_t) * n);
+  g_assert (glyphs != NULL);
 
-  /* nb. PangoLayoutRun is a typedef for PangoGlyphItem. */
-  run = (PangoLayoutRun *) gv->glyphitems;
-  if (run != NULL)
-    paint_glyph_run (gr, &glyphs, &n_glyphs, run);
+  native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
+  native_positions = (*env)->GetFloatArrayElements (env, java_positions, NULL);
+  
+  for (i = 0; i < n; ++i)
+    {
+      glyphs[i].index = native_codes[i];
+      glyphs[i].x = x + native_positions[ 2*i ];
+      glyphs[i].y = y + native_positions[ 2*i + 1];
+    }
 
-  if (glyphs != NULL)
-    g_free (glyphs);
+  (*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
+  (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
+
+  begin_drawing_operation (env, gr);  
+  cairo_show_glyphs (gr->cr, glyphs, n);
+  end_drawing_operation (env, gr);
 
-  cairo_translate (gr->cr, -x, -y);
   gdk_threads_leave ();  
+  free(glyphs);
 }
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout
-   (JNIEnv *env, jobject self, jobject font, jobject java_layout, jfloat x, jfloat y)
+   (JNIEnv *env, jobject self, jobject java_layout, jfloat x, jfloat y)
 {
   /* 
    * FIXME: Some day we expect either cairo or pango will know how to make
@@ -1225,7 +1102,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout
    */
 
   struct graphics2d *gr = NULL;
-  struct peerfont *pfont = NULL;
   struct textlayout *tl = NULL;
   PangoLayoutIter *i = NULL;
   PangoLayoutRun *run = NULL;
@@ -1237,12 +1113,10 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout
 
   gr = (struct graphics2d *)NSA_GET_G2D_PTR (env, self);
   tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, java_layout);
-  pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font);
 
   g_assert (gr != NULL);
   g_assert (tl != NULL);
   g_assert (tl->pango_layout != NULL);
-  g_assert (pfont != NULL);
 
   if (gr->debug) printf ("painting pango layout\n");
 
@@ -1252,14 +1126,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout
   i = pango_layout_get_iter (tl->pango_layout);
   g_assert (i != NULL);
 
-  install_font_peer (gr->cr, pfont, gr->debug);
   cairo_translate (gr->cr, x, y);
 
   do 
     {
       run = pango_layout_iter_get_run (i);
       if (run != NULL)
-       paint_glyph_run (gr, &glyphs, &n_glyphs, run);
+       paint_glyph_run (env, gr, &glyphs, &n_glyphs, run);
     } 
   while (pango_layout_iter_next_run (i));
   
@@ -1671,9 +1544,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke
   gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
   g_assert (gr != NULL);
   if (gr->debug) printf ("cairo_stroke\n");
-  begin_drawing_operation (gr);
+  begin_drawing_operation (env, gr);
   cairo_stroke (gr->cr);
-  end_drawing_operation (gr);
+  end_drawing_operation (env, gr);
   gdk_threads_leave();
 }
 
@@ -1689,9 +1562,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill
   gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
   g_assert (gr != NULL);
   if (gr->debug) printf ("cairo_fill\n");
-  begin_drawing_operation (gr);
+  begin_drawing_operation (env, gr);
   cairo_fill (gr->cr);
-  end_drawing_operation (gr);
+  end_drawing_operation (env, gr);
   gdk_threads_leave();
 }
 
@@ -1707,10 +1580,10 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
   gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
   if (gr == NULL) { gdk_threads_leave (); return; }
   if (gr->debug) printf ("cairo_clip\n");
-  begin_drawing_operation (gr);
+  begin_drawing_operation (env, gr);
   cairo_init_clip (gr->cr);
   cairo_clip (gr->cr);
-  end_drawing_operation (gr);
+  end_drawing_operation (env, gr);
   gdk_threads_leave();
 }
 
index 3cb3bd2..0727999 100644 (file)
@@ -60,6 +60,8 @@ static JavaVM *vm;
 
 static jmethodID areaPreparedID;
 static jmethodID areaUpdatedID;
+static jmethodID dataOutputWriteID;
+static jmethodID registerFormatID;
 
 static void
 area_prepared (GdkPixbufLoader *loader, 
@@ -193,10 +195,72 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initState
   NSA_SET_PB_PTR (env, obj, loader);
 }
 
+static void
+query_formats (JNIEnv *env, jclass clazz)
+{
+  jobject jformat;
+  GSList *formats, *f;
+  GdkPixbufFormat *format;
+  char **ch, *name;
+
+  jclass formatClass;
+  jmethodID addExtensionID;
+  jmethodID addMimeTypeID;
+
+  formatClass = (*env)->FindClass
+    (env, "gnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec");
+
+  g_assert(formatClass != NULL);
+
+  addExtensionID = (*env)->GetMethodID (env, formatClass, 
+                                       "addExtension", 
+                                       "(Ljava/lang/String;)V");
+
+  addMimeTypeID = (*env)->GetMethodID (env, formatClass, 
+                                      "addMimeType", 
+                                      "(Ljava/lang/String;)V");
+  
+  formats = gdk_pixbuf_get_formats ();
+
+  for (f = formats; f; f = f->next)
+    {
+      format = (GdkPixbufFormat *) f->data;
+      name = gdk_pixbuf_format_get_name(format);
+
+      jformat = (*env)->CallStaticObjectMethod 
+       (env, clazz, registerFormatID,                              
+        (*env)->NewStringUTF(env, name),
+        (jboolean) gdk_pixbuf_format_is_writable(format));
+
+      g_assert(jformat != NULL);
+      
+      ch = gdk_pixbuf_format_get_extensions(format);
+      while (*ch)
+       {
+         (*env)->CallVoidMethod (env, jformat, addExtensionID, 
+                                 (*env)->NewStringUTF(env, *ch)); 
+         ++ch;
+       }
+      
+      ch = gdk_pixbuf_format_get_mime_types(format);
+      while (*ch)
+       {
+         (*env)->CallVoidMethod (env, jformat, addMimeTypeID, 
+                                 (*env)->NewStringUTF(env, *ch)); 
+         ++ch;
+       }
+    }
+  
+  g_slist_free(formats);  
+}
+
+
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState 
   (JNIEnv *env, jclass clazz)
 {
+  jclass dataOutputClass;
+
   (*env)->GetJavaVM(env, &vm);
 
   areaPreparedID = (*env)->GetMethodID (env, clazz, 
@@ -206,6 +270,20 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
   areaUpdatedID = (*env)->GetMethodID (env, clazz,
                                       "areaUpdated",
                                       "(IIII[II)V");
+
+  registerFormatID = (*env)->GetStaticMethodID 
+    (env, clazz, 
+     "registerFormat", 
+     "(Ljava/lang/String;Z)"
+     "Lgnu/java/awt/peer/gtk/GdkPixbufDecoder$ImageFormatSpec;");
+
+  
+  dataOutputClass = (*env)->FindClass(env, "java/io/DataOutput");
+  dataOutputWriteID = (*env)->GetMethodID (env, dataOutputClass,
+                                            "write", "([B)V");
+
+  query_formats (env, clazz);
+  
   NSA_PB_INIT (env, clazz);
 }
 
@@ -226,6 +304,115 @@ Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_finish
   gdk_threads_leave (); 
 }
 
+struct stream_save_request
+{
+  JNIEnv *env;
+  jobject *stream;
+};
+
+static gboolean
+save_to_stream(const gchar *buf,
+              gsize count,
+              GError **error __attribute__((unused)),
+              gpointer data)
+{
+  struct stream_save_request *ssr = (struct stream_save_request *)data;
+
+  jbyteArray jbuf;
+  jbyte *cbuf;
+
+  gdk_threads_leave ();
+  jbuf = (*(ssr->env))->NewByteArray ((ssr->env), count);
+  cbuf = (*(ssr->env))->GetByteArrayElements ((ssr->env), jbuf, NULL);
+  memcpy (cbuf, buf, count);
+  (*(ssr->env))->ReleaseByteArrayElements ((ssr->env), jbuf, cbuf, 0);
+  (*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->stream), 
+                                dataOutputWriteID, jbuf);  
+  gdk_threads_enter ();
+  return TRUE;
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_streamImage
+(JNIEnv *env, jclass clazz __attribute__((unused)), 
+ jintArray jarr, jstring jenctype, jint width, jint height, 
+ jboolean hasAlpha, jobject stream)
+{
+  GdkPixbuf* pixbuf;  
+  jint *ints;
+  guchar a, r, g, b, *pix, *p;
+  GError *err = NULL;
+  const char *enctype;
+  int i;
+
+  struct stream_save_request ssr;
+  ssr.stream = &stream;
+  ssr.env = env;
+
+  ints = (*env)->GetIntArrayElements (env, jarr, NULL);
+  pix = g_malloc(width * height * (hasAlpha ? 4 : 3));
+
+  enctype = (*env)->GetStringUTFChars (env, jenctype, NULL);
+  g_assert(enctype != NULL);
+
+  g_assert (pix != NULL);
+  g_assert (ints != NULL);
+
+  p = pix;
+  for (i = 0; i < width*height; ++i)
+    {
+      /* 
+       * Java encodes pixels as integers in a predictable arithmetic order:
+       * 0xAARRGGBB. Since these are jints, JNI has already byte-swapped
+       * them for us if necessary, so they're in "our" endianness, whatever
+       * that is. It uses 4 bytes per pixel whether or not there's an alpha
+       * channel.
+       */
+
+      a = 0xff & (ints[i] >> 24);
+      r = 0xff & (ints[i] >> 16);
+      g = 0xff & (ints[i] >> 8);
+      b = 0xff & ints[i];
+
+      /* 
+       * GDK-pixbuf has a very different storage model:
+       *
+       *  - A different alpha order (alpha after colors).
+       *  - A different packing model (no alpha -> 3-bytes-per-pixel).
+       *  - A different "RGB" order (host memory order, not endian-neutral).
+       */
+
+      *p++ = r;
+      *p++ = g;
+      *p++ = b;
+      if (hasAlpha)
+       *p++ = a;
+    }
+
+  gdk_threads_enter ();
+  pixbuf =  gdk_pixbuf_new_from_data (pix,
+                                     GDK_COLORSPACE_RGB,
+                                     (gboolean) hasAlpha,
+                                     8, width, height, 
+                                     width * (hasAlpha ? 4 : 3), /* rowstride */
+                                     NULL, NULL);
+  g_assert (pixbuf != NULL);
+
+  g_assert(gdk_pixbuf_save_to_callback (pixbuf,
+                                       &save_to_stream,
+                                       &ssr,
+                                       enctype,
+                                       &err, NULL));
+
+  g_object_unref (pixbuf);
+
+  gdk_threads_leave ();
+  g_free(pix);
+
+  (*env)->ReleaseStringUTFChars (env, jenctype, enctype);  
+  (*env)->ReleaseIntArrayElements (env, jarr, ints, 0);
+}
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpBytes
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c
new file mode 100644 (file)
index 0000000..6b1b4a9
--- /dev/null
@@ -0,0 +1,328 @@
+/* gdkrobotpeer.c
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GdkRobotPeer.h"
+#include <gdk/gdkx.h>
+#include <X11/extensions/XTest.h>
+
+static int
+awt_button_mask_to_num (int buttons)
+{
+  switch (buttons)
+    {
+    case AWT_BUTTON1_MASK:
+      return 1;
+    case AWT_BUTTON2_MASK:
+      return 2;
+    case AWT_BUTTON3_MASK:
+      return 3;
+    }
+
+  return 0;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_initXTest
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int event_basep;
+  int error_basep;
+  int majorp;
+  int minorp;
+  jboolean result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestQueryExtension (xdisplay,
+                               &event_basep,
+                               &error_basep,
+                               &majorp,
+                               &minorp);
+
+  gdk_threads_leave ();
+
+  return result;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mouseMove
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint x, jint y)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestFakeMotionEvent (xdisplay,
+                                -1,
+                                x, y, CurrentTime);
+
+  XFlush (xdisplay);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mousePress
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint buttons)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestFakeButtonEvent (xdisplay,
+                                awt_button_mask_to_num (buttons),
+                                True, CurrentTime);
+
+  XFlush (xdisplay);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mouseRelease
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint buttons)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  result = XTestFakeButtonEvent (xdisplay,
+                                awt_button_mask_to_num (buttons),
+                                False, CurrentTime);
+
+  XFlush (xdisplay);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_mouseWheel
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint wheelAmt)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  int i = 0;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  if (wheelAmt < 0)
+    for (i = 0; i < -wheelAmt; i++)
+      {
+       XTestFakeButtonEvent (xdisplay,
+                             4,
+                             True, CurrentTime);
+       XTestFakeButtonEvent (xdisplay,
+                             4,
+                             False, CurrentTime);
+      }
+  else
+    for (i = 0; i < wheelAmt; i++)
+      {
+       XTestFakeButtonEvent (xdisplay,
+                             5,
+                             True, CurrentTime);
+       XTestFakeButtonEvent (xdisplay,
+                             5,
+                             False, CurrentTime);
+      }
+
+  XFlush (xdisplay);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_keyPress
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint keycode)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  GdkKeymapKey *keymap_keys = NULL;
+  gint n_keys = 0;
+  guint lookup_keyval = 0;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  lookup_keyval = awt_keycode_to_keysym (keycode, AWT_KEY_LOCATION_LEFT);
+
+  if (!gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
+                                          lookup_keyval,
+                                          &keymap_keys,
+                                          &n_keys))
+    {
+      /* No matching keymap entry was found. */
+      g_printerr ("No matching keymap entries were found\n");
+      gdk_threads_leave ();
+      return;
+    }
+
+  /* If n_keys > 1 then there are multiple hardware keycodes that
+     translate to lookup_keyval.  We arbitrarily choose the first
+     hardware keycode from the list returned by
+     gdk_keymap_get_entries_for_keyval. */
+  result = XTestFakeKeyEvent (xdisplay,
+                             keymap_keys[0].keycode,
+                             True, CurrentTime);
+
+  g_free (keymap_keys);
+
+  XFlush (xdisplay);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_keyRelease
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)), jint keycode)
+{
+  GdkDisplay *display;
+  Display *xdisplay;
+  GdkKeymapKey *keymap_keys = NULL;
+  gint n_keys = 0;
+  guint lookup_keyval = 0;
+  int result;
+
+  gdk_threads_enter ();
+
+  display = gdk_display_get_default ();
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+  lookup_keyval = awt_keycode_to_keysym (keycode, AWT_KEY_LOCATION_LEFT);
+
+  if (!gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
+                                          lookup_keyval,
+                                          &keymap_keys,
+                                          &n_keys))
+    {
+      /* No matching keymap entry was found. */
+      g_printerr ("No matching keymap entries were found\n");
+      gdk_threads_leave ();
+      return;
+    }
+
+  /* If n_keys > 1 then there are multiple hardware keycodes that
+     translate to lookup_keyval.  We arbitrarily choose the first
+     hardware keycode from the list returned by
+     gdk_keymap_get_entries_for_keyval. */
+  result = XTestFakeKeyEvent (xdisplay,
+                             keymap_keys[0].keycode,
+                             False, CurrentTime);
+
+  g_free (keymap_keys);
+
+  XFlush (xdisplay);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkRobotPeer_nativeGetRGBPixels
+  (JNIEnv *env, jobject obj __attribute__((unused)), jint x, jint y,
+   jint width, jint height)
+{
+  jint stride_bytes, stride_pixels, n_channels, n_pixels;
+  jintArray jpixels;  
+  jint *java_pixels;
+  guchar *gdk_pixels;
+  GdkPixbuf *pixbuf_no_alpha = NULL;
+  GdkPixbuf *pixbuf = NULL;
+
+#ifndef WORDS_BIGENDIAN
+  int i;
+#endif
+
+  gdk_threads_enter ();
+
+  pixbuf_no_alpha = gdk_pixbuf_get_from_drawable (NULL,
+                                                 gdk_get_default_root_window (),
+                                                 NULL, x, y, 0, 0,
+                                                 width, height);
+
+  pixbuf = gdk_pixbuf_add_alpha(pixbuf_no_alpha, FALSE, 0, 0, 0);
+  g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
+  
+  stride_bytes = gdk_pixbuf_get_rowstride (pixbuf);
+  n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+  stride_pixels =  stride_bytes / n_channels;
+  n_pixels = height * stride_pixels;
+  gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+  jpixels = (*env)->NewIntArray (env, n_pixels);
+  java_pixels = (*env)->GetIntArrayElements (env, jpixels, NULL);
+
+  memcpy (java_pixels,
+         gdk_pixels,
+         (height * stride_bytes));
+
+#ifndef WORDS_BIGENDIAN
+  /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
+  for (i = 0; i < n_pixels; ++i)
+    {
+      java_pixels[i] = SWAPU32 ((unsigned)java_pixels[i]);
+    }
+#endif
+
+  g_object_unref (pixbuf);
+
+  (*env)->ReleaseIntArrayElements (env, jpixels, java_pixels, 0);
+
+  gdk_threads_leave ();
+
+  return jpixels;
+}
index 1cb4334..94e98bf 100644 (file)
@@ -315,10 +315,12 @@ focus_in_cb (GtkWidget *widget __attribute((unused)),
              GdkEventFocus *event __attribute((unused)),
              jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               postFocusEventID,
                               AWT_FOCUS_GAINED,
                               JNI_FALSE);
+  gdk_threads_enter ();
   return FALSE;
 }
 
@@ -327,21 +329,27 @@ focus_out_cb (GtkWidget *widget __attribute((unused)),
               GdkEventFocus *event __attribute((unused)),
               jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               postFocusEventID,
                               AWT_FOCUS_LOST,
                               JNI_FALSE);
+  gdk_threads_enter ();
   return FALSE;
 }
 
 static void
 block_expose_events_cb (GtkWidget *widget, jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               beginNativeRepaintID);
+  gdk_threads_enter ();
 
   gdk_window_process_updates (widget->window, TRUE);
 
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               endNativeRepaintID);
+  gdk_threads_enter ();
 }
index 3b58c05..6c854ef 100644 (file)
@@ -208,7 +208,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel
 static void
 item_toggled (GtkToggleButton *item, jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                              postItemEventID,
                              peer,
                              item->active ?
index 94c9c3d..b4e64e6 100644 (file)
@@ -39,22 +39,24 @@ exception statement from your version. */
 #include "gtkpeer.h"
 #include "gnu_java_awt_peer_gtk_GtkChoicePeer.h"
 
-static void selection_changed (GtkComboBox *combobox, gpointer data);
+static void selection_changed (GtkComboBox *combobox, jobject peer);
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create 
   (JNIEnv *env, jobject obj)
 {
   GtkWidget *combobox;
+  jobject *gref;
 
   NSA_SET_GLOBAL_REF (env, obj);
+  gref = NSA_GET_GLOBAL_REF (env, obj);
 
   gdk_threads_enter ();
   
   combobox = gtk_combo_box_new_text ();
 
   g_signal_connect (combobox, "changed",
-                    G_CALLBACK (selection_changed), obj);
+                    G_CALLBACK (selection_changed), *gref);
 
   gdk_threads_leave ();
 
@@ -175,7 +177,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeGetSelected
   return index;
 }
 
-void selection_changed (GtkComboBox *combobox, jobject peer)
+static void selection_changed (GtkComboBox *combobox, jobject peer)
 {
   jstring label;
   GtkTreeModel *model;
@@ -195,8 +197,8 @@ void selection_changed (GtkComboBox *combobox, jobject peer)
 
       gdk_threads_leave ();
 
-      label = (*gdk_env)->NewStringUTF (gdk_env, selected);
-      (*gdk_env)->CallVoidMethod (gdk_env, peer,
+      label = (*gdk_env())->NewStringUTF (gdk_env(), selected);
+      (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                  choicePostItemEventID,
                                  label,
                                  (jint) AWT_ITEM_SELECTED);
index 986244e..e051857 100644 (file)
@@ -110,15 +110,15 @@ selection_received (GtkWidget *widget __attribute__((unused)),
   if (selection_data->length < 0
       || selection_data->type != GDK_SELECTION_TYPE_STRING)
     {
-      (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
-                                 NULL);
+      (*gdk_env())->CallVoidMethod (gdk_env(), cb_obj, stringSelectionReceivedID,
+                                   NULL);
     }
   else
     {
       char *str = (char *) selection_data->data;
       
-      (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
-                                 (*gdk_env)->NewStringUTF (gdk_env, str));
+      (*gdk_env())->CallVoidMethod (gdk_env(), cb_obj, stringSelectionReceivedID,
+                                   (*gdk_env())->NewStringUTF (gdk_env(), str));
     }
 
   return;
@@ -135,7 +135,7 @@ selection_get (GtkWidget *widget __attribute__((unused)),
   const char *utf;
   jsize utflen;
 
-  jstr = (*gdk_env)->CallObjectMethod (gdk_env, cb_obj, 
+  jstr = (*gdk_env())->CallObjectMethod (gdk_env(), cb_obj, 
                                       stringSelectionHandlerID);
 
   if (!jstr)
@@ -145,13 +145,13 @@ selection_get (GtkWidget *widget __attribute__((unused)),
       return;
     }
 
-  utflen = (*gdk_env)->GetStringUTFLength (gdk_env, jstr);
-  utf = (*gdk_env)->GetStringUTFChars (gdk_env, jstr, NULL);
+  utflen = (*gdk_env())->GetStringUTFLength (gdk_env(), jstr);
+  utf = (*gdk_env())->GetStringUTFChars (gdk_env(), jstr, NULL);
 
   gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8,
                          (const unsigned char*)utf, utflen);
 
-  (*gdk_env)->ReleaseStringUTFChars (gdk_env, jstr, utf);
+  (*gdk_env())->ReleaseStringUTFChars (gdk_env(), jstr, utf);
 }
 
 JNIEXPORT void JNICALL
@@ -177,7 +177,7 @@ gint
 selection_clear (GtkWidget *widget __attribute__((unused)),
                 GdkEventSelection *event __attribute__((unused)))
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, selectionClearID);
+  (*gdk_env())->CallVoidMethod (gdk_env(), cb_obj, selectionClearID);
 
   return TRUE;
 }
index 3aebe77..4cd3f16 100644 (file)
@@ -60,7 +60,7 @@ static gboolean focus_out_cb (GtkWidget *widget,
 #ifdef __GNUC__
 __inline
 #endif
-static guint
+guint
 awt_keycode_to_keysym (jint keyCode, jint keyLocation)
 {
   /* GDK_A through GDK_Z */
@@ -1054,10 +1054,12 @@ focus_in_cb (GtkWidget *widget __attribute((unused)),
              GdkEventFocus *event __attribute((unused)),
              jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               postFocusEventID,
                               AWT_FOCUS_GAINED,
                               JNI_FALSE);
+  gdk_threads_enter ();
   return FALSE;
 }
 
@@ -1066,9 +1068,11 @@ focus_out_cb (GtkWidget *widget __attribute((unused)),
               GdkEventFocus *event __attribute((unused)),
               jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               postFocusEventID,
                               AWT_FOCUS_LOST,
                               JNI_FALSE);
+  gdk_threads_enter ();
   return FALSE;
 }
index 65f64e0..7ad20b8 100644 (file)
@@ -883,7 +883,8 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
   switch (event->type)
     {
     case GDK_BUTTON_PRESS:
-      (*gdk_env)->CallVoidMethod (gdk_env, peer,
+      gdk_threads_leave ();
+      (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                   postMouseEventID,
                                  AWT_MOUSE_PRESSED, 
                                  (jlong)event->button.time,
@@ -894,13 +895,15 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                  click_count, 
                                  (event->button.button == 3) ? JNI_TRUE :
                                                                JNI_FALSE);
+      gdk_threads_enter ();
       hasBeenDragged = FALSE;
       break;
     case GDK_BUTTON_RELEASE:
       {
        int width, height;
 
-       (*gdk_env)->CallVoidMethod (gdk_env, peer,
+       gdk_threads_leave ();
+       (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                    postMouseEventID,
                                    AWT_MOUSE_RELEASED, 
                                    (jlong)event->button.time,
@@ -910,6 +913,7 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                    (jint)event->button.y, 
                                    click_count,
                                    JNI_FALSE);
+       gdk_threads_enter ();
 
        /* Generate an AWT click event only if the release occured in the
           window it was pressed in, and the mouse has not been dragged since
@@ -921,7 +925,8 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
            && event->button.x <= width 
            && event->button.y <= height)
           {
-           (*gdk_env)->CallVoidMethod (gdk_env, peer,
+           gdk_threads_leave ();
+           (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                        postMouseEventID,
                                        AWT_MOUSE_CLICKED, 
                                        (jlong)event->button.time,
@@ -931,6 +936,7 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                        (jint)event->button.y, 
                                        click_count,
                                        JNI_FALSE);
+           gdk_threads_enter ();
           }
       }
       break;
@@ -941,7 +947,8 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                 | GDK_BUTTON4_MASK
                                 | GDK_BUTTON5_MASK))
        {
-         (*gdk_env)->CallVoidMethod (gdk_env, peer,
+         gdk_threads_leave ();
+         (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                      postMouseEventID,
                                      AWT_MOUSE_DRAGGED,
                                      (jlong)event->motion.time,
@@ -950,44 +957,58 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                      (jint)event->motion.y,
                                      0,
                                      JNI_FALSE);
+         gdk_threads_enter ();
          hasBeenDragged = TRUE;
        }
       else
-        (*gdk_env)->CallVoidMethod (gdk_env, peer, postMouseEventID,
-                                   AWT_MOUSE_MOVED,
-                                   (jlong)event->motion.time,
-                                   state_to_awt_mods (event->motion.state),
-                                   (jint)event->motion.x,
-                                   (jint)event->motion.y,
-                                   0,
-                                   JNI_FALSE);
+       {
+         gdk_threads_leave ();
+         (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID,
+                                       AWT_MOUSE_MOVED,
+                                       (jlong)event->motion.time,
+                                       state_to_awt_mods (event->motion.state),
+                                       (jint)event->motion.x,
+                                       (jint)event->motion.y,
+                                       0,
+                                       JNI_FALSE);
+         gdk_threads_enter ();
+       }
+
       break;
     case GDK_ENTER_NOTIFY:
       /* We are not interested in enter events that are due to
          grab/ungrab and not to actually crossing boundaries */
       if (event->crossing.mode == GDK_CROSSING_NORMAL)
-        (*gdk_env)->CallVoidMethod (gdk_env, peer, postMouseEventID,
-                                   AWT_MOUSE_ENTERED, 
-                                   (jlong)event->crossing.time,
-                                   state_to_awt_mods_with_button_states (event->crossing.state), 
-                                   (jint)event->crossing.x,
-                                   (jint)event->crossing.y, 
-                                   0,
-                                   JNI_FALSE);
+       {
+         gdk_threads_leave ();   
+         (*gdk_env())->CallVoidMethod (gdk_env(), peer, postMouseEventID,
+                                       AWT_MOUSE_ENTERED, 
+                                       (jlong)event->crossing.time,
+                                       state_to_awt_mods_with_button_states (event->crossing.state), 
+                                       (jint)event->crossing.x,
+                                       (jint)event->crossing.y, 
+                                       0,
+                                       JNI_FALSE);
+         gdk_threads_enter ();
+       }
       break;
     case GDK_LEAVE_NOTIFY:
       /* We are not interested in leave events that are due to
          grab/ungrab and not to actually crossing boundaries */
       if (event->crossing.mode == GDK_CROSSING_NORMAL)
-       (*gdk_env)->CallVoidMethod (gdk_env, peer,
-                                   postMouseEventID,
-                                   AWT_MOUSE_EXITED, 
-                                   (jlong)event->crossing.time,
-                                   state_to_awt_mods_with_button_states (event->crossing.state),
-                                   (jint)event->crossing.x,
-                                   (jint)event->crossing.y, 
-                                   0,
-                                   JNI_FALSE);
+       {
+         gdk_threads_leave ();   
+         (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+                                       postMouseEventID,
+                                       AWT_MOUSE_EXITED, 
+                                       (jlong)event->crossing.time,
+                                       state_to_awt_mods_with_button_states (event->crossing.state),
+                                       (jint)event->crossing.x,
+                                       (jint)event->crossing.y, 
+                                       0,
+                                       JNI_FALSE);
+         gdk_threads_enter ();   
+       }
       break;
     case GDK_CONFIGURE:
       {
@@ -1001,7 +1022,7 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
               returns. */
            gdk_threads_leave ();
 
-           (*gdk_env)->CallVoidMethod (gdk_env, peer,
+           (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                        postConfigureEventID,
                                        (jint) event->configure.x,
                                        (jint) event->configure.y,
@@ -1012,20 +1033,24 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
       }
       break;
     case GDK_EXPOSE:
-      (*gdk_env)->CallVoidMethod (gdk_env, peer,
+      gdk_threads_leave ();
+      (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                   postExposeEventID,
                                   (jint)event->expose.area.x,
                                   (jint)event->expose.area.y,
                                   (jint)event->expose.area.width,
                                   (jint)event->expose.area.height);
+      gdk_threads_enter ();
       break;
 
     case GDK_FOCUS_CHANGE:
-      (*gdk_env)->CallVoidMethod (gdk_env, peer,
+      gdk_threads_leave ();
+      (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                  postFocusEventID,
                                  (jint) (event->focus_change.in) ?
                                  AWT_FOCUS_GAINED : AWT_FOCUS_LOST,
                                  JNI_FALSE);
+      gdk_threads_enter ();
       break;
     case GDK_KEY_PRESS:
         if (GTK_IS_WINDOW (widget))
@@ -1033,7 +1058,8 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
             /*            GdkEventKey *keyevent = (GdkEventKey *) event; */
             /*            g_printerr ("key press event: sent: %d  time: %d  state: %d  keyval: %d  length: %d  string: %s  hardware_keycode: %d  group: %d\n", keyevent->send_event, keyevent->time, keyevent->state, keyevent->keyval, keyevent->length, keyevent->string, keyevent->hardware_keycode, keyevent->group); */
 
-            (*gdk_env)->CallVoidMethod (gdk_env, peer,
+           gdk_threads_leave ();
+            (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                         postKeyEventID,
                                         (jint) AWT_KEY_PRESSED,
                                         (jlong) event->key.time,
@@ -1041,6 +1067,7 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                         keysym_to_awt_keycode (event),
                                         keyevent_to_awt_keychar (event),
                                         keysym_to_awt_keylocation (event));
+           gdk_threads_enter ();
             /* FIXME: generation of key typed events needs to be moved
                to GtkComponentPeer.postKeyEvent.  If the key in a key
                press event is not an "action" key
@@ -1054,7 +1081,8 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
     case GDK_KEY_RELEASE:
       if (GTK_IS_WINDOW (widget))
         {
-            (*gdk_env)->CallVoidMethod (gdk_env, peer,
+           gdk_threads_leave ();
+            (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                         postKeyEventID,
                                         (jint) AWT_KEY_RELEASED,
                                         (jlong) event->key.time,
@@ -1062,6 +1090,7 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
                                         keysym_to_awt_keycode (event),
                                         keyevent_to_awt_keychar (event),
                                         keysym_to_awt_keylocation (event));
+           gdk_threads_enter ();
             return TRUE;
         }
       else
@@ -1135,13 +1164,13 @@ void connect_awt_hook_cb (GtkWidget *widget __attribute__((unused)),
 {
   void *ptr;
 
-  ptr = NSA_GET_PTR (gdk_env, peer);
+  ptr = NSA_GET_PTR (gdk_env(), peer);
 
-  connect_awt_hook (gdk_env, peer, 1, GTK_WIDGET (ptr)->window);
+  connect_awt_hook (gdk_env(), peer, 1, GTK_WIDGET (ptr)->window);
 
   gdk_threads_leave ();
 
-  (*gdk_env)->CallVoidMethod (gdk_env, peer, setCursorID);
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer, setCursorID);
 
   gdk_threads_enter ();
 }
index 3a2e41f..7919161 100644 (file)
@@ -41,8 +41,8 @@ exception statement from your version. */
 #include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h"
 
 static void handle_response (GtkDialog *dialog,
-                           gint responseId,
-                           jobject peer_obj);
+                             gint responseId,
+                             jobject peer_obj);
 
 /*
  * Make a new file selection dialog
@@ -62,15 +62,17 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
 
   gdk_threads_enter ();
   
-  widget = gtk_file_chooser_dialog_new("",
-                                       GTK_WINDOW(parentp),
-                                       GTK_FILE_CHOOSER_ACTION_OPEN,
-                                       GTK_STOCK_OK, GTK_RESPONSE_OK,
-                                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                       NULL);
-
-  /* GtkFileChooser doesn't show hidden files by default. */
-  g_object_set(GTK_FILE_CHOOSER(widget), "show_hidden", TRUE);
+  /* FIXME: we should be using the default gnome-vfs backend but it is
+     not currently thread-safe.  See:
+     http://bugzilla.gnome.org/show_bug.cgi?id=166852 */
+  widget = gtk_file_chooser_dialog_new_with_backend
+    ("Open File",
+     GTK_WINDOW(parentp),
+     GTK_FILE_CHOOSER_ACTION_OPEN,
+     "gtk+",
+     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+     GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+     NULL);
 
   /* GtkFileSelect is not modal by default */
   gtk_window_set_modal (GTK_WINDOW (widget), TRUE);
@@ -97,7 +99,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals
   g_signal_connect (G_OBJECT (GTK_DIALOG (ptr)),
                     "response", 
                    GTK_SIGNAL_FUNC (handle_response), *gref);
-                   
+
   gdk_threads_leave ();
 
   /* Connect the superclass signals.  */
@@ -112,7 +114,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeGetDirectory
   const char *str;
 
   ptr = NSA_GET_PTR (env, obj);
-    
+
   gdk_threads_enter ();
 
   str = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(ptr));
@@ -135,14 +137,14 @@ static gboolean filenameFilterCallback (const GtkFileFilterInfo *filter_info,
   jstring *filename;
   gboolean accepted;
 
-  cx = (*gdk_env)->GetObjectClass (gdk_env, (jobject) obj);
-  id = (*gdk_env)->GetMethodID (gdk_env, cx, "filenameFilterCallback",
+  cx = (*gdk_env())->GetObjectClass (gdk_env(), (jobject) obj);
+  id = (*gdk_env())->GetMethodID (gdk_env(), cx, "filenameFilterCallback",
                                              "(Ljava/lang/String;)Z");
 
-  filename = (*gdk_env)->NewStringUTF(gdk_env, filter_info->filename);
-  
+  filename = (*gdk_env())->NewStringUTF(gdk_env(), filter_info->filename);
+
   gdk_threads_leave();
-  accepted = (*gdk_env)->CallBooleanMethod(gdk_env, obj, id, filename);
+  accepted = (*gdk_env())->CallBooleanMethod(gdk_env(), obj, id, filename);
   gdk_threads_enter();
 
   return accepted;
@@ -166,8 +168,8 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter
   gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(ptr), filter);
 
   gdk_threads_leave ();
-    }
-    
+}
+
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetDirectory
     (JNIEnv *env, jobject obj, jstring directory)
@@ -196,7 +198,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile
   ptr = NSA_GET_PTR (env, obj);
     
   str = (*env)->GetStringUTFChars (env, filename, 0);
-
+     
   gdk_threads_enter ();
   gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (ptr), str);
   gdk_threads_leave ();
@@ -207,7 +209,7 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile
 static void
 handle_response (GtkDialog *dialog __attribute__((unused)),
                  gint responseId,
-                       jobject peer_obj)
+                 jobject peer_obj)
 {
   static int isDisposeIDSet = 0;
   static int isIDSet = 0;
@@ -221,51 +223,51 @@ handle_response (GtkDialog *dialog __attribute__((unused)),
   /* We only need this for the case when the user closed the window,
      or clicked ok or cancel. */
   if (responseId != GTK_RESPONSE_DELETE_EVENT
-      && responseId != GTK_RESPONSE_OK
+      && responseId != GTK_RESPONSE_ACCEPT
       && responseId != GTK_RESPONSE_CANCEL)
     return;
-  
-  ptr = NSA_GET_PTR (gdk_env, peer_obj);
-  
+
+  ptr = NSA_GET_PTR (gdk_env(), peer_obj);
+
   if (responseId == GTK_RESPONSE_DELETE_EVENT)
   {
     if (!isDisposeIDSet)
-    {
-      jclass cx = (*gdk_env)->GetObjectClass (gdk_env, peer_obj);
-        disposeID = (*gdk_env)->GetMethodID (gdk_env, cx, "gtkDisposeFileDialog", "()V");
+      {
+        jclass cx = (*gdk_env())->GetObjectClass (gdk_env(), peer_obj);
+        disposeID = (*gdk_env())->GetMethodID (gdk_env(), cx, "gtkDisposeFileDialog", "()V");
         isDisposeIDSet = 1;
-    }
-    
-  gdk_threads_leave ();
+      }
   
+    gdk_threads_leave ();
+
     /* We can dispose of the dialog now (and unblock show) */
-    (*gdk_env)->CallVoidMethod (gdk_env, peer_obj, disposeID);
+    (*gdk_env())->CallVoidMethod (gdk_env(), peer_obj, disposeID);
 
-  gdk_threads_enter ();
+    gdk_threads_enter ();
     return;
-}
+  }
 
-  if (responseId == GTK_RESPONSE_OK) {
+  if (responseId == GTK_RESPONSE_ACCEPT) {
     fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
-    str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName);
+    str_fileName = (*gdk_env())->NewStringUTF (gdk_env(), fileName);
   }
-  
+
   if (!isIDSet)
     {
-      jclass cx = (*gdk_env)->GetObjectClass (gdk_env, peer_obj);
-      hideID = (*gdk_env)->GetMethodID (gdk_env, cx, "gtkHideFileDialog", "()V");
-      gtkSetFilenameID = (*gdk_env)->GetMethodID (gdk_env, cx,
+      jclass cx = (*gdk_env())->GetObjectClass (gdk_env(), peer_obj);
+      hideID = (*gdk_env())->GetMethodID (gdk_env(), cx, "gtkHideFileDialog", "()V");
+      gtkSetFilenameID = (*gdk_env())->GetMethodID (gdk_env(), cx,
                                    "gtkSetFilename", "(Ljava/lang/String;)V");
       isIDSet = 1;
     }
     
   gdk_threads_leave ();
-
+  
   /* Set the Java object field 'file' with this value. */
-  (*gdk_env)->CallVoidMethod (gdk_env, peer_obj, gtkSetFilenameID, str_fileName);
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer_obj, gtkSetFilenameID, str_fileName);
 
   /* We can hide the dialog now (and unblock show) */
-  (*gdk_env)->CallVoidMethod (gdk_env, peer_obj, hideID);
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer_obj, hideID);
 
   gdk_threads_enter ();
 }
index 5c48832..52da40c 100644 (file)
@@ -177,3 +177,47 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder
 
   gdk_threads_leave ();
 }
+
+static void
+free_pixbuf_data (guchar *pixels, gpointer data __attribute__((unused)))
+{
+  free(pixels);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromData
+  (JNIEnv *env, jobject obj, jintArray pixelArray, jint width, jint height)
+{
+  void *ptr;
+  GdkPixbuf *pixbuf;
+  jint *pixels;
+  int pixels_length, i;
+  guchar *data;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  pixels = (*env)->GetIntArrayElements (env, pixelArray, 0);
+  pixels_length = (*env)->GetArrayLength (env, pixelArray);
+
+  data = malloc (sizeof (guchar) * pixels_length);
+  for (i = 0; i < pixels_length; i++)
+    data[i] = (guchar) pixels[i];
+
+  gdk_threads_enter ();
+
+  pixbuf = gdk_pixbuf_new_from_data (data,
+                                     GDK_COLORSPACE_RGB,
+                                     TRUE,
+                                     8,
+                                     width,
+                                     height,
+                                     width*4,
+                                     free_pixbuf_data,
+                                     NULL);
+
+  gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements(env, pixelArray, pixels, 0);
+}
index 8eebce9..49ccffc 100644 (file)
@@ -45,9 +45,7 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
 {
   void *ptr;
 
-  /* Remove entries from state tables */
-  NSA_DEL_GLOBAL_REF (env, obj);
-  ptr = NSA_DEL_PTR (env, obj);
+  ptr = NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
 
@@ -56,6 +54,17 @@ Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
   gtk_widget_destroy (GTK_WIDGET (ptr));
 
   gdk_threads_leave ();
+
+  /* Remove entries from state tables */
+  NSA_DEL_GLOBAL_REF (env, obj);
+  NSA_DEL_PTR (env, obj);
+
+  /* 
+   * Wake up the main thread, to make sure it re-checks the window
+   * destruction condition. 
+   */
+
+  g_main_context_wakeup (NULL);
 }
 
 JNIEXPORT void JNICALL
index 575f3c9..468be06 100644 (file)
@@ -1,5 +1,5 @@
-/* gtklistpeer.c -- Native implementation of GtkListPeer
-   Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
+/* GtkListPeer.c -- implements GtkListPeer's native methods
+   Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GNU Classpath.
 
@@ -498,12 +498,12 @@ item_highlighted (GtkTreeSelection *selection __attribute__((unused)),
       row = indices ? indices[0] : -1;
 
       if (!path_currently_selected)
-        (*gdk_env)->CallVoidMethod (gdk_env, peer,
+        (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                     postListItemEventID,
                                     row,
                                     (jint) AWT_ITEM_SELECTED);
       else
-        (*gdk_env)->CallVoidMethod (gdk_env, peer,
+        (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                     postListItemEventID,
                                     row,
                                     (jint) AWT_ITEM_DESELECTED);
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
deleted file mode 100644 (file)
index 8a2a810..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-/* gtkmainthread.c -- Native implementation of GtkMainThread
-   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkMainThread.h"
-#include "gthread-jni.h"
-
-#ifdef JVM_SUN
-  struct state_table *native_state_table;
-  struct state_table *native_global_ref_table;
-#endif
-
-jmethodID setBoundsCallbackID;
-
-jmethodID postActionEventID;
-jmethodID postMenuActionEventID;
-jmethodID postMouseEventID;
-jmethodID postConfigureEventID;
-jmethodID postExposeEventID;
-jmethodID postKeyEventID;
-jmethodID postFocusEventID;
-jmethodID postAdjustmentEventID;
-jmethodID postItemEventID;
-jmethodID choicePostItemEventID;
-jmethodID postListItemEventID;
-jmethodID postTextEventID;
-jmethodID postWindowEventID;
-
-jmethodID beginNativeRepaintID;
-jmethodID endNativeRepaintID;
-
-jmethodID initComponentGraphicsID;
-jmethodID initComponentGraphics2DID;
-jmethodID setCursorID;
-
-JNIEnv *gdk_env;
-
-GtkWindowGroup *global_gtk_window_group;
-
-static void init_glib_threads(JNIEnv *, jint);
-
-double dpi_conversion_factor;
-
-static void init_dpi_conversion_factor (void);
-static void dpi_changed_cb (GtkSettings  *settings,
-                            GParamSpec   *pspec);
-
-/*
- * Call gtk_init.  It is very important that this happen before any other
- * gtk calls.
- *
- * The portableNativeSync argument may have the values:
- *   1 if the Java property gnu.classpath.awt.gtk.portable.native.sync
- *     is set to "true".  
- *   0 if it is set to "false"
- *  -1 if unset.
- */
-
-JNIEXPORT void JNICALL 
-Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz,
-                                                  jint portableNativeSync)
-{
-  int argc = 1;
-  char **argv;
-  char *homedir, *rcpath = NULL;
-  jclass gtkcomponentpeer, gtkchoicepeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer,
-    gtkmenuitempeer, gtktextcomponentpeer, window, gdkgraphics, gdkgraphics2d;
-
-  NSA_INIT (env, clazz);
-  gdk_env = env;
-
-  /* GTK requires a program's argc and argv variables, and requires that they
-     be valid.   Set it up. */
-  argv = (char **) g_malloc (sizeof (char *) * 2);
-  argv[0] = (char *) g_malloc(1);
-#if 1
-  strcpy(argv[0], "");
-#else  /* The following is a more efficient alternative, but less intuitively
-       * expresses what we are trying to do.   This code is only run once, so
-       * I'm going for intuitive. */
-  argv[0][0] = '\0';
-#endif
-  argv[1] = NULL;
-
-  init_glib_threads(env, portableNativeSync);
-
-  /* From GDK 2.0 onwards we have to explicitly call gdk_threads_init */
-  gdk_threads_init();
-
-  gtk_init (&argc, &argv);
-
-  gdk_rgb_init ();
-  gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
-  gtk_widget_set_default_visual (gdk_rgb_get_visual ());
-
-  /* Make sure queued calls don't get sent to GTK/GDK while 
-     we're shutting down. */
-  atexit (gdk_threads_enter);
-
-  gdk_event_handler_set ((GdkEventFunc)awt_event_handler, NULL, NULL);
-
-  if ((homedir = getenv ("HOME")))
-    {
-      rcpath = (char *) g_malloc (strlen (homedir) + strlen (RC_FILE) + 2);
-      sprintf (rcpath, "%s/%s", homedir, RC_FILE);
-    }
-  
-  gtk_rc_parse ((rcpath) ? rcpath : RC_FILE);
-
-  g_free (rcpath);
-  g_free (argv[0]);
-  g_free (argv);
-
-  /* setup cached IDs for posting GTK events to Java */
-
-  window = (*env)->FindClass (env, "java/awt/Window");
-
-  gtkcomponentpeer = (*env)->FindClass (env,
-                                    "gnu/java/awt/peer/gtk/GtkComponentPeer");
-  gtkchoicepeer = (*env)->FindClass (env,
-                                    "gnu/java/awt/peer/gtk/GtkChoicePeer");
-  gtkwindowpeer = (*env)->FindClass (env,
-                                    "gnu/java/awt/peer/gtk/GtkWindowPeer");
-  gtkscrollbarpeer = (*env)->FindClass (env, 
-                                    "gnu/java/awt/peer/gtk/GtkScrollbarPeer");
-  gtklistpeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkListPeer");
-  gtkmenuitempeer = (*env)->FindClass (env,
-                                     "gnu/java/awt/peer/gtk/GtkMenuItemPeer");
-  gtktextcomponentpeer = (*env)->FindClass (env,
-                                     "gnu/java/awt/peer/gtk/GtkTextComponentPeer");
-  gdkgraphics = (*env)->FindClass (env,
-                                   "gnu/java/awt/peer/gtk/GdkGraphics");
-  gdkgraphics2d = (*env)->FindClass (env,
-                                     "gnu/java/awt/peer/gtk/GdkGraphics2D");
-  setBoundsCallbackID = (*env)->GetMethodID (env, window,
-                                            "setBoundsCallback",
-                                            "(IIII)V");
-
-  postMenuActionEventID = (*env)->GetMethodID (env, gtkmenuitempeer,
-                                              "postMenuActionEvent",
-                                              "()V");
-  postMouseEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 
-                                          "postMouseEvent", "(IJIIIIZ)V");
-  setCursorID = (*env)->GetMethodID (env, gtkcomponentpeer,
-                                     "setCursor", "()V");
-  beginNativeRepaintID = (*env)->GetMethodID (env, gtkcomponentpeer, 
-                                              "beginNativeRepaint", "()V");
-
-  endNativeRepaintID = (*env)->GetMethodID (env, gtkcomponentpeer, 
-                                            "endNativeRepaint", "()V");
-
-  postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer, 
-                                             "postConfigureEvent", "(IIII)V");
-  postWindowEventID = (*env)->GetMethodID (env, gtkwindowpeer,
-                                          "postWindowEvent",
-                                          "(ILjava/awt/Window;I)V");
-  postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 
-                                         "postExposeEvent", "(IIII)V");
-  postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
-                                       "postKeyEvent", "(IJIICI)V");
-  postFocusEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
-                                         "postFocusEvent", "(IZ)V");
-  postAdjustmentEventID = (*env)->GetMethodID (env, gtkscrollbarpeer,
-                                              "postAdjustmentEvent", 
-                                              "(II)V");
-  postItemEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
-                                        "postItemEvent", 
-                                        "(Ljava/lang/Object;I)V");
-  choicePostItemEventID = (*env)->GetMethodID (env, gtkchoicepeer,
-                                        "choicePostItemEvent", 
-                                        "(Ljava/lang/String;I)V");
-  postListItemEventID = (*env)->GetMethodID (env, gtklistpeer,
-                                            "postItemEvent",
-                                            "(II)V");
-  postTextEventID = (*env)->GetMethodID (env, gtktextcomponentpeer,
-                                            "postTextEvent",
-                                            "()V");
-  initComponentGraphicsID = (*env)->GetMethodID (env, gdkgraphics,
-                                                 "initComponentGraphics",
-                                                 "()V");
-  initComponentGraphics2DID = (*env)->GetMethodID (env, gdkgraphics2d,
-                                                   "initComponentGraphics2D",
-                                                   "()V");
-  global_gtk_window_group = gtk_window_group_new ();
-
-  init_dpi_conversion_factor ();
-}
-
-
-/** Initialize GLIB's threads properly, based on the value of the
-    gnu.classpath.awt.gtk.portable.native.sync Java system property.  If
-    that's unset, use the PORTABLE_NATIVE_SYNC config.h macro.  (TODO: 
-    In some release following 0.10, that config.h macro will go away.)
-    */ 
-static void 
-init_glib_threads(JNIEnv *env, jint portableNativeSync)
-{
-  if (portableNativeSync < 0)
-    {
-#ifdef PORTABLE_NATIVE_SYNC /* Default value, if not set by the Java system
-                               property */ 
-      portableNativeSync = 1;
-#else
-      portableNativeSync = 0;
-#endif
-    }
-  
-  (*env)->GetJavaVM( env, &the_vm );
-  if (portableNativeSync)
-    g_thread_init ( &portable_native_sync_jni_functions );
-  else
-    g_thread_init ( NULL );
-
-  /* Debugging progress message; uncomment if needed: */
-  /*   printf("called gthread init\n"); */
-}
-
-
-
-/*
- * Run gtk_main and block.
- */ 
-JNIEXPORT void JNICALL 
-Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkMain
-  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
-{
-  gdk_threads_enter ();
-  gtk_main ();
-  gdk_threads_leave ();
-}
-
-/* This is a big hack, needed until this pango bug is resolved:
-   http://bugzilla.gnome.org/show_bug.cgi?id=119081.
-   See: http://mail.gnome.org/archives/gtk-i18n-list/2003-August/msg00001.html
-   for details. */
-static void
-init_dpi_conversion_factor ()
-{
-  GtkSettings *settings = gtk_settings_get_default ();
-  GObjectClass *klass;
-
-  klass = G_OBJECT_CLASS (GTK_SETTINGS_GET_CLASS (settings));
-  if (g_object_class_find_property (klass, "gtk-xft-dpi"))
-    {
-      int int_dpi;
-      g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL);
-      /* If int_dpi == -1 gtk-xft-dpi returns the default value. So we
-        have to do approximate calculation here.  */
-      if (int_dpi < 0)
-       dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
-      else
-       dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
-
-      g_signal_connect (settings, "notify::gtk-xft-dpi",
-                       G_CALLBACK (dpi_changed_cb), NULL);
-    }
-  else
-    /* Approximate. */
-    dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
-}
-
-static void
-dpi_changed_cb (GtkSettings  *settings,
-               GParamSpec *pspec __attribute__((unused)))
-{
-  int int_dpi;
-  g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL);
-  if (int_dpi < 0)
-    dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
-  else
-    dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
-}
index 4d68fce..1fe18f9 100644 (file)
@@ -165,6 +165,6 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
 static void
 item_activate (GtkMenuItem *item __attribute__((unused)), jobject peer_obj)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer_obj,
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer_obj,
                              postMenuActionEventID);
 }
index 4f83446..790c901 100644 (file)
@@ -160,6 +160,6 @@ post_change_event (GtkRange *range, jobject peer)
 {
   GtkAdjustment *adj;
   adj = gtk_range_get_adjustment (range);
-  (*gdk_env)->CallVoidMethod (gdk_env, peer, postAdjustmentEventID,
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer, postAdjustmentEventID,
                               AWT_ADJUSTMENT_TRACK, (jint) adj->value);
 }
index 771f2b8..6eb06e0 100644 (file)
@@ -492,5 +492,7 @@ static void
 textcomponent_changed_cb (GtkEditable *editable __attribute__((unused)),
                          jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer, postTextEventID);
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer, postTextEventID);
+  gdk_threads_enter ();
 }
index 6234b29..81857c4 100644 (file)
@@ -38,9 +38,364 @@ exception statement from your version. */
 
 #include "gtkpeer.h"
 #include "gnu_java_awt_peer_gtk_GtkToolkit.h"
+#include "gthread-jni.h"
+
+#include <sys/time.h>
+
+#ifdef JVM_SUN
+  struct state_table *native_state_table;
+  struct state_table *native_global_ref_table;
+#endif
+
+jmethodID setBoundsCallbackID;
+
+jmethodID postActionEventID;
+jmethodID postMenuActionEventID;
+jmethodID postMouseEventID;
+jmethodID postConfigureEventID;
+jmethodID postExposeEventID;
+jmethodID postKeyEventID;
+jmethodID postFocusEventID;
+jmethodID postAdjustmentEventID;
+jmethodID postItemEventID;
+jmethodID choicePostItemEventID;
+jmethodID postListItemEventID;
+jmethodID postTextEventID;
+jmethodID postWindowEventID;
+
+jmethodID beginNativeRepaintID;
+jmethodID endNativeRepaintID;
+
+jmethodID initComponentGraphicsID;
+jmethodID initComponentGraphics2DID;
+jmethodID setCursorID;
+
+JavaVM *java_vm;
+
+union env_union
+{
+  void *void_env;
+  JNIEnv *jni_env;
+};
+
+JNIEnv *
+gdk_env()
+{
+  union env_union tmp;
+  g_assert((*java_vm)->GetEnv(java_vm, &tmp.void_env, JNI_VERSION_1_2) == JNI_OK);
+  return tmp.jni_env;
+}
+
+
+GtkWindowGroup *global_gtk_window_group;
+
+static void init_glib_threads(JNIEnv *, jint);
+
+double dpi_conversion_factor;
+
+static void init_dpi_conversion_factor (void);
+static void dpi_changed_cb (GtkSettings  *settings,
+                            GParamSpec   *pspec);
+
+/*
+ * Call gtk_init.  It is very important that this happen before any other
+ * gtk calls.
+ *
+ * The portableNativeSync argument may have the values:
+ *   1 if the Java property gnu.classpath.awt.gtk.portable.native.sync
+ *     is set to "true".  
+ *   0 if it is set to "false"
+ *  -1 if unset.
+ */
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env, 
+                                              jclass clazz __attribute__((unused)),
+                                              jint portableNativeSync)
+{
+  int argc = 1;
+  char **argv;
+  char *homedir, *rcpath = NULL;
+
+  jclass gtkgenericpeer, gtkcomponentpeer, gtkchoicepeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer,
+    gtkmenuitempeer, gtktextcomponentpeer, window, gdkgraphics, gdkgraphics2d;
+
+  gtkgenericpeer = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GtkGenericPeer");
+
+  NSA_INIT (env, gtkgenericpeer);
+
+  g_assert((*env)->GetJavaVM(env, &java_vm) == 0);
+
+  /* GTK requires a program's argc and argv variables, and requires that they
+     be valid.   Set it up. */
+  argv = (char **) g_malloc (sizeof (char *) * 2);
+  argv[0] = (char *) g_malloc(1);
+#if 1
+  strcpy(argv[0], "");
+#else  /* The following is a more efficient alternative, but less intuitively
+       * expresses what we are trying to do.   This code is only run once, so
+       * I'm going for intuitive. */
+  argv[0][0] = '\0';
+#endif
+  argv[1] = NULL;
+
+  init_glib_threads(env, portableNativeSync);
+
+  /* From GDK 2.0 onwards we have to explicitly call gdk_threads_init */
+  gdk_threads_init();
+
+  gtk_init (&argc, &argv);
+
+  gdk_rgb_init ();
+  gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
+  gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+
+  /* Make sure queued calls don't get sent to GTK/GDK while 
+     we're shutting down. */
+  atexit (gdk_threads_enter);
+
+  gdk_event_handler_set ((GdkEventFunc)awt_event_handler, NULL, NULL);
+
+  if ((homedir = getenv ("HOME")))
+    {
+      rcpath = (char *) g_malloc (strlen (homedir) + strlen (RC_FILE) + 2);
+      sprintf (rcpath, "%s/%s", homedir, RC_FILE);
+    }
+  
+  gtk_rc_parse ((rcpath) ? rcpath : RC_FILE);
+
+  g_free (rcpath);
+  g_free (argv[0]);
+  g_free (argv);
+
+  /* setup cached IDs for posting GTK events to Java */
+
+  window = (*env)->FindClass (env, "java/awt/Window");
+
+  gtkcomponentpeer = (*env)->FindClass (env,
+                                    "gnu/java/awt/peer/gtk/GtkComponentPeer");
+  gtkchoicepeer = (*env)->FindClass (env,
+                                    "gnu/java/awt/peer/gtk/GtkChoicePeer");
+  gtkwindowpeer = (*env)->FindClass (env,
+                                    "gnu/java/awt/peer/gtk/GtkWindowPeer");
+  gtkscrollbarpeer = (*env)->FindClass (env, 
+                                    "gnu/java/awt/peer/gtk/GtkScrollbarPeer");
+  gtklistpeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkListPeer");
+  gtkmenuitempeer = (*env)->FindClass (env,
+                                     "gnu/java/awt/peer/gtk/GtkMenuItemPeer");
+  gtktextcomponentpeer = (*env)->FindClass (env,
+                                     "gnu/java/awt/peer/gtk/GtkTextComponentPeer");
+  gdkgraphics = (*env)->FindClass (env,
+                                   "gnu/java/awt/peer/gtk/GdkGraphics");
+  gdkgraphics2d = (*env)->FindClass (env,
+                                     "gnu/java/awt/peer/gtk/GdkGraphics2D");
+  setBoundsCallbackID = (*env)->GetMethodID (env, window,
+                                            "setBoundsCallback",
+                                            "(IIII)V");
+
+  postMenuActionEventID = (*env)->GetMethodID (env, gtkmenuitempeer,
+                                              "postMenuActionEvent",
+                                              "()V");
+  postMouseEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 
+                                          "postMouseEvent", "(IJIIIIZ)V");
+  setCursorID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                     "setCursor", "()V");
+  beginNativeRepaintID = (*env)->GetMethodID (env, gtkcomponentpeer, 
+                                              "beginNativeRepaint", "()V");
+
+  endNativeRepaintID = (*env)->GetMethodID (env, gtkcomponentpeer, 
+                                            "endNativeRepaint", "()V");
+
+  postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer, 
+                                             "postConfigureEvent", "(IIII)V");
+  postWindowEventID = (*env)->GetMethodID (env, gtkwindowpeer,
+                                          "postWindowEvent",
+                                          "(ILjava/awt/Window;I)V");
+  postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 
+                                         "postExposeEvent", "(IIII)V");
+  postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                       "postKeyEvent", "(IJIICI)V");
+  postFocusEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                         "postFocusEvent", "(IZ)V");
+  postAdjustmentEventID = (*env)->GetMethodID (env, gtkscrollbarpeer,
+                                              "postAdjustmentEvent", 
+                                              "(II)V");
+  postItemEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                        "postItemEvent", 
+                                        "(Ljava/lang/Object;I)V");
+  choicePostItemEventID = (*env)->GetMethodID (env, gtkchoicepeer,
+                                        "choicePostItemEvent", 
+                                        "(Ljava/lang/String;I)V");
+  postListItemEventID = (*env)->GetMethodID (env, gtklistpeer,
+                                            "postItemEvent",
+                                            "(II)V");
+  postTextEventID = (*env)->GetMethodID (env, gtktextcomponentpeer,
+                                            "postTextEvent",
+                                            "()V");
+  initComponentGraphicsID = (*env)->GetMethodID (env, gdkgraphics,
+                                                 "initComponentGraphics",
+                                                 "()V");
+  initComponentGraphics2DID = (*env)->GetMethodID (env, gdkgraphics2d,
+                                                   "initComponentGraphics2D",
+                                                   "()V");
+  global_gtk_window_group = gtk_window_group_new ();
+
+  init_dpi_conversion_factor ();
+}
+
+
+/** Initialize GLIB's threads properly, based on the value of the
+    gnu.classpath.awt.gtk.portable.native.sync Java system property.  If
+    that's unset, use the PORTABLE_NATIVE_SYNC config.h macro.  (TODO: 
+    In some release following 0.10, that config.h macro will go away.)
+    */ 
+static void 
+init_glib_threads(JNIEnv *env, jint portableNativeSync)
+{
+  if (portableNativeSync < 0)
+    {
+#ifdef PORTABLE_NATIVE_SYNC /* Default value, if not set by the Java system
+                               property */ 
+      portableNativeSync = 1;
+#else
+      portableNativeSync = 0;
+#endif
+    }
+  
+  (*env)->GetJavaVM( env, &the_vm );
+  if (portableNativeSync)
+    g_thread_init ( &portable_native_sync_jni_functions );
+  else
+    g_thread_init ( NULL );
+
+  /* Debugging progress message; uncomment if needed: */
+  /*   printf("called gthread init\n"); */
+}
+
+
+/* This is a big hack, needed until this pango bug is resolved:
+   http://bugzilla.gnome.org/show_bug.cgi?id=119081.
+   See: http://mail.gnome.org/archives/gtk-i18n-list/2003-August/msg00001.html
+   for details. */
+static void
+init_dpi_conversion_factor ()
+{
+  GtkSettings *settings = gtk_settings_get_default ();
+  GObjectClass *klass;
+
+  klass = G_OBJECT_CLASS (GTK_SETTINGS_GET_CLASS (settings));
+  if (g_object_class_find_property (klass, "gtk-xft-dpi"))
+    {
+      int int_dpi;
+      g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL);
+      /* If int_dpi == -1 gtk-xft-dpi returns the default value. So we
+        have to do approximate calculation here.  */
+      if (int_dpi < 0)
+       dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
+      else
+       dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
+
+      g_signal_connect (settings, "notify::gtk-xft-dpi",
+                       G_CALLBACK (dpi_changed_cb), NULL);
+    }
+  else
+    /* Approximate. */
+    dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
+}
+
+static void
+dpi_changed_cb (GtkSettings  *settings,
+               GParamSpec *pspec __attribute__((unused)))
+{
+  int int_dpi;
+  g_object_get (settings, "gtk-xft-dpi", &int_dpi, NULL);
+  if (int_dpi < 0)
+    dpi_conversion_factor = PANGO_SCALE * 72.0 / 96.;
+  else
+    dpi_conversion_factor = PANGO_SCALE * 72.0 / (int_dpi / PANGO_SCALE);
+}
+
+static int
+within_human_latency_tolerance(struct timeval *init)
+{
+  struct timeval curr;
+  unsigned long milliseconds_elapsed;
+
+  gettimeofday(&curr, NULL);
+  
+  milliseconds_elapsed = (((curr.tv_sec * 1000) + (curr.tv_usec / 1000))
+                         - ((init->tv_sec * 1000) + (init->tv_usec / 1000)));
+  
+  return milliseconds_elapsed < 100;
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_iterateNativeQueue
+(JNIEnv *env, 
+ jobject self __attribute__((unused)),
+ jobject lockedQueue,
+ jboolean block)
+{
+  /* We're holding an EventQueue lock, and we're about to acquire the GDK
+   * lock before dropping the EventQueue lock. This can deadlock if someone
+   * holds the GDK lock and wants to acquire the EventQueue lock; however
+   * all callbacks from GTK happen with the GDK lock released, so this
+   * would only happen in an odd case such as some JNI helper code
+   * acquiring the GDK lock and calling back into
+   * EventQueue.getNextEvent().
+   */
+
+  struct timeval init;
+  gettimeofday(&init, NULL);
+
+  gdk_threads_enter ();
+  (*env)->MonitorExit (env, lockedQueue);
+
+  if (block)
+    {
+      
+      /* If we're blocking-when-empty, we want a do .. while loop. */
+      do 
+       gtk_main_iteration ();
+      while (within_human_latency_tolerance (&init) 
+            && gtk_events_pending ());
+    }
+  else
+    {
+      /* If we're not blocking-when-empty, we want a while loop. */
+      while (within_human_latency_tolerance (&init) 
+            && gtk_events_pending ())
+       gtk_main_iteration ();      
+    }
+  
+  (*env)->MonitorEnter (env, lockedQueue);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_wakeNativeQueue
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  g_main_context_wakeup (NULL);
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_nativeQueueEmpty
+  (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+  jboolean empty = FALSE;
+  gdk_threads_enter ();
+  empty = ! gtk_events_pending();
+  gdk_threads_leave ();
+  return empty;
+}
+
 
 static jint gdk_color_to_java_color (GdkColor color);
 
+
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkToolkit_beep
   (JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
index a8e745e..2ca7f83 100644 (file)
@@ -65,8 +65,8 @@ static void window_active_state_change_cb (GtkWidget *widget,
                                            GParamSpec *pspec,
                                            jobject peer);
 static void window_focus_state_change_cb (GtkWidget *widget,
-                                                    GParamSpec *pspec,
-                                                    jobject peer);
+                                          GParamSpec *pspec,
+                                          jobject peer);
 static gboolean window_focus_in_cb (GtkWidget * widget,
                                     GdkEventFocus *event,
                                     jobject peer);
@@ -320,7 +320,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBoundsCallback
 {
   /* Circumvent package-private access to call Window's
      setBoundsCallback method. */
-  (*gdk_env)->CallVoidMethod (gdk_env, window, setBoundsCallbackID,
+  (*gdk_env())->CallVoidMethod (gdk_env(), window, setBoundsCallbackID,
                              x, y, width, height);
 }
 
@@ -483,9 +483,9 @@ property_notify_predicate (Display *xdisplay __attribute__((unused)),
   if (event->xany.type == PropertyNotify
       && event->xany.window == *window
       && event->xproperty.atom == extents_atom)
-        return True;
+    return True;
   else
-  return False;
+    return False;
 }
 
 static void
@@ -493,10 +493,12 @@ window_delete_cb (GtkWidget *widget __attribute__((unused)),
                  GdkEvent *event __attribute__((unused)),
                  jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                              postWindowEventID,
                              (jint) AWT_WINDOW_CLOSING,
                              (jobject) NULL, (jint) 0);
+  gdk_threads_enter ();
 }
 
 static void
@@ -504,20 +506,24 @@ window_destroy_cb (GtkWidget *widget __attribute__((unused)),
                   GdkEvent *event __attribute__((unused)),
                   jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                              postWindowEventID,
                              (jint) AWT_WINDOW_CLOSED,
                              (jobject) NULL, (jint) 0);
+  gdk_threads_enter ();
 }
 
 static void
 window_show_cb (GtkWidget *widget __attribute__((unused)),
                jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                              postWindowEventID,
                              (jint) AWT_WINDOW_OPENED,
                              (jobject) NULL, (jint) 0);
+  gdk_threads_enter ();
 }
 
 static void
@@ -528,47 +534,53 @@ window_active_state_change_cb (GtkWidget *widget __attribute__((unused)),
   /* FIXME: not sure if this is needed or not. */
   /* Remove the unused attributes if you fix the below.  */
 #if 0
-      if (GTK_WINDOW (widget)->is_active)
-        (*gdk_env)->CallVoidMethod (gdk_env, peer,
-                                    postWindowEventID,
-                                    (jint) AWT_WINDOW_GAINED_FOCUS,
-                                    (jobject) NULL, (jint) 0);
-      else
-        (*gdk_env)->CallVoidMethod (gdk_env, peer,
-                                    postWindowEventID,
-                                    (jint) AWT_WINDOW_DEACTIVATED,
-                                    (jobject) NULL, (jint) 0);
+  gdk_threads_leave ();
+  if (GTK_WINDOW (widget)->is_active)
+    (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+                                postWindowEventID,
+                                (jint) AWT_WINDOW_GAINED_FOCUS,
+                                (jobject) NULL, (jint) 0);
+  else
+    (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+                                postWindowEventID,
+                                (jint) AWT_WINDOW_DEACTIVATED,
+                                (jobject) NULL, (jint) 0);
+  gdk_threads_enter ();
 #endif
-    }
+}
 
 static void
 window_focus_state_change_cb (GtkWidget *widget,
                              GParamSpec *pspec __attribute__((unused)),
                              jobject peer)
 {
+  gdk_threads_leave ();
   if (GTK_WINDOW (widget)->has_toplevel_focus)
-    (*gdk_env)->CallVoidMethod (gdk_env, peer,
+    (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                 postWindowEventID,
                                 (jint) AWT_WINDOW_ACTIVATED,
                                 (jobject) NULL, (jint) 0);
   else
-    (*gdk_env)->CallVoidMethod (gdk_env, peer,
+    (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                 postWindowEventID,
                                 (jint) AWT_WINDOW_DEACTIVATED,
-                                    (jobject) NULL, (jint) 0);
-    }
+                                (jobject) NULL, (jint) 0);
+  gdk_threads_enter ();
+}
 
 static gboolean
 window_focus_in_cb (GtkWidget * widget  __attribute__((unused)),
                    GdkEventFocus *event  __attribute__((unused)),
                    jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               postWindowEventID,
                               (jint) AWT_WINDOW_GAINED_FOCUS,
                               (jobject) NULL, (jint) 0);
   /* FIXME: somewhere after this is handled, the child window is
      getting an expose event. */
+  gdk_threads_enter ();
   return FALSE;
 }
 
@@ -577,12 +589,14 @@ window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
                     GdkEventFocus *event __attribute__((unused)),
                     jobject peer)
 {
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                               postWindowEventID,
                               (jint) AWT_WINDOW_LOST_FOCUS,
                               (jobject) NULL, (jint) 0);
   /* FIXME: somewhere after this is handled, the child window is
      getting an expose event. */
+  gdk_threads_enter ();
   return FALSE;
 }
 
@@ -600,18 +614,22 @@ window_window_state_cb (GtkWidget *widget,
       if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
        {
          /* We've been iconified. */
-         (*gdk_env)->CallVoidMethod (gdk_env, peer,
+         gdk_threads_leave ();
+         (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                      postWindowEventID,
                                      (jint) AWT_WINDOW_ICONIFIED,
                                      (jobject) NULL, (jint) 0);
+         gdk_threads_enter ();
        }
       else
        {
          /* We've been deiconified. */
-         (*gdk_env)->CallVoidMethod (gdk_env, peer,
+         gdk_threads_leave ();
+         (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                                      postWindowEventID,
                                      (jint) AWT_WINDOW_DEICONIFIED,
                                      (jobject) NULL, (jint) 0);
+         gdk_threads_enter ();
        }
     }
 
@@ -624,10 +642,12 @@ window_window_state_cb (GtkWidget *widget,
 
   new_state |= window_get_new_state (widget);
 
-  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+  gdk_threads_leave ();
+  (*gdk_env())->CallVoidMethod (gdk_env(), peer,
                              postWindowEventID,
                              (jint) AWT_WINDOW_STATE_CHANGED,
                              (jobject) NULL, new_state);
+  gdk_threads_enter ();
   return TRUE;
 }
 
@@ -685,9 +705,9 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
 
   if (!id_set)
     {
-      jclass gtkwindowpeer = (*gdk_env)->FindClass (gdk_env,
+      jclass gtkwindowpeer = (*gdk_env())->FindClass (gdk_env(),
                                 "gnu/java/awt/peer/gtk/GtkWindowPeer");
-      postInsetsChangedEventID = (*gdk_env)->GetMethodID (gdk_env,
+      postInsetsChangedEventID = (*gdk_env())->GetMethodID (gdk_env(),
                                                      gtkwindowpeer,
                                                      "postInsetsChangedEvent",
                                                      "(IIII)V");
@@ -705,12 +725,17 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
                            NULL,
                            NULL,
                            gu_ex.gu_extents))
-    (*gdk_env)->CallVoidMethod (gdk_env, peer,
-                               postInsetsChangedEventID,
-                               (jint) extents[2],  /* top */
-                               (jint) extents[0],  /* left */
-                               (jint) extents[3],  /* bottom */
-                               (jint) extents[1]); /* right */
+    {
+      gdk_threads_leave ();
+      (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+                                   postInsetsChangedEventID,
+                                   (jint) extents[2],  /* top */
+                                   (jint) extents[0],  /* left */
+                                   (jint) extents[3],  /* bottom */
+                                   (jint) extents[1]); /* right */
+      gdk_threads_enter ();
+    }
+  
 
   return FALSE;
 }
index b4021f5..85834ca 100644 (file)
@@ -74,6 +74,19 @@ struct graphics2d
   cairo_surface_t *pattern_surface;
   cairo_pattern_t *pattern;
   gboolean debug;
+  enum 
+    { 
+      MODE_DRAWABLE_WITH_RENDER,
+      MODE_DRAWABLE_NO_RENDER,
+      MODE_JAVA_ARRAY
+    } 
+  mode;
+
+  /* Support for MODE_JAVA_ARRAY */
+  jintArray jarray;
+  jint width, height;
+  jint *javabuf;
+  jboolean isCopy;
 };
 
 #endif /* __GTKCAIROPEER_H */
index e982551..9b04bb1 100644 (file)
@@ -147,6 +147,10 @@ struct graphics
 #define AWT_BUTTON2_DOWN_MASK (1 << 11)
 #define AWT_BUTTON3_DOWN_MASK (1 << 12)
 
+#define AWT_BUTTON1_MASK (1 << 4)
+#define AWT_BUTTON2_MASK (1 << 3)
+#define AWT_BUTTON3_MASK (1 << 2)
+
 #define MULTI_CLICK_TIME   250
 /* as opposed to a MULTI_PASS_TIME :) */
 
@@ -460,7 +464,8 @@ extern jmethodID setCursorID;
 extern jmethodID syncAttrsID;
 extern jclass gdkColor;
 extern jmethodID gdkColorID;
-extern JNIEnv *gdk_env;
+
+JNIEnv *gdk_env(void);
 
 extern double dpi_conversion_factor;
 
@@ -480,6 +485,8 @@ void set_parent (GtkWidget *widget, GtkContainer *parent);
 
 jint keyevent_state_to_awt_mods (GdkEvent *event);
 
+guint awt_keycode_to_keysym (jint keyCode, jint keyLocation);
+
 struct item_event_hook_info
 {
   jobject peer_obj;