aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@gcc.gnu.org>2004-11-30 23:59:12 +0000
committerGraydon Hoare <graydon@gcc.gnu.org>2004-11-30 23:59:12 +0000
commitea28b8f60fb4113053238a22a4d2c508f39710bb (patch)
tree35ad0bbb429ac9e5e658fea57b904ce331b0a4dd /libjava
parentc21accc5d9378aa5b20c868364d8025faa5b1ea5 (diff)
downloadgcc-ea28b8f60fb4113053238a22a4d2c508f39710bb.zip
gcc-ea28b8f60fb4113053238a22a4d2c508f39710bb.tar.gz
gcc-ea28b8f60fb4113053238a22a4d2c508f39710bb.tar.bz2
revert: [multiple changes]
2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GdkGraphics.java (drawImage variants): Update image observer. * gnu/java/awt/peer/gtk/GtkComponentPeer.java (createImage): Start image production. * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Protect against negative menu bar widths. (setBounds): Likewise. (postConfigureEvent): Likewise. * gnu/java/awt/peer/gtk/GtkImage.java (imageComplete): Don't remove consumer unless only a single frame has completed. * gnu/java/awt/peer/gtk/GtkImagePainter.java (GtkImagePainter): Add observer parameter. (setPixels): Update image observer. (imageComplete): Likewise. * java/applet/Applet.java (width): New field. (height): Likewise. (setStub): Set size if width or height field has been set. (resize): If stub is null save width and height values. * java/awt/Component.java (reshape): Protect against null parent. * java/awt/image/MemoryImageSource.java (MemoryImageSource(int,int,ColorModel,byte[],int,int)): Document. (MemoryImageSource(int,int,ColorModel,int[],int,int)): Likewise. (MemoryImageSource(int,int,ColorModel,byte[],int,int,Hashtable)): Reference pixel array directly, rather than creating a local copy. (MemoryImageSource(int,int,ColorModel,int[],int,int,Hashtable)): Likewise. (newPixels(int,int,int,int)): Fix for loop and array copy bounds. (newPixels(int,int,int,int,boolean)): Likewise. (startProduction): If animated call imageComplete with SINGLEFRAME. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Uncomment gdk_flush lines. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c (drawPixels): Return if g is null or g->drawable is not a gdk drawable. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/DefaultSingleSelectionModel.java, javax/swing/JPasswordField.java, javax/swing/tree/AbstractLayoutCache.java: Reformatted and javadocs cleaned up. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/Component.java: Fixed argument names to match javadocs. (setFont): Rewritten set property first and then fire event. (setLocale): Likewise. * javax/swing/text/JTextComponent.java (setEditable): Likewise. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Button.java (AccessibleAWTButton.getAccessibleActionDescription): Explain the source of 'click'. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Checkbox.java: Remove stub comments. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Button.java (AccessibleAWTButton.getAccessibleActionDescription): Return 'click'. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/CardLayout.java: Made some constants static. (serialVersionUID): Made private. (addLayoutComponent): Simplified code. * java/awt/event/InputEvent.java (getModifiersEx): Added missing @param tag. * java/awt/image/RGBImageFilter.java (filterRGBPixels): Reformatted, removed wrong @param tag. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/text/FieldView.java, javax/swing/text/JTextComponent.java: Removed debug code. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/BorderFactory.java (BorderFactory): Added private constructor. * javax/swing/SwingUtilities.java (SwingUtilities): Likewise. (computeStringWidth): New method. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/color/ICC_Profile.java (icSigNamedColorTag): Removed. * java/awt/datatransfer/DataFlavor.java (isMimeTypeEqual): Made final. * java/awt/image/AffineTransformOp.java: Reworked javadocs. (TYPE_BICUBIC): Added @since tag. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Checkbox.java (AccessibleAWTCheckBox): Remove todo comments. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Checkbox.java (itemStateChanged): Implement function. (getAccessibleContext): Add AccessibleAWTCheckBox to item listeners. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/Polygon.java (contains): Reimplemented. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/print/PrinterJob.java: Reformatted. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/image/AffineTransformOp.java, java/awt/image/ColorConvertOp.java, java/awt/image/LookupOp.java, java/awt/image/RescaleOp.java: Added final keywords where they belong. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/CardLayout.java, java/awt/Component.java, java/awt/Font.java, java/awt/image/SinglePixelPackedSampleModel.java: Fixed javadocs and argument names all over. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/image/DataBufferShort.java: Fixed file header. * java/awt/image/DataBufferUShort.java: Likewise. (DataBufferUShort): Throw NullPointerException if dataArray is null. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/geom/Arc2D.java (setAngleStart): Corrected (wrong sign on atan2 y parameter). (setAngles): Likewise. (containsAngle): Return false on zero extent, don't include final angle. (contains): Treat OPEN-type arcs like CHORD ones, not as PIE ones. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/geom/AffineTransform.java, (inverseTransform): Fixed bug and simplified code. (createTransformedShape): Return null on null parameter. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/color/ICC_ColorSpace.java, java/awt/color/ICC_Profile.java, java/awt/color/ICC_ProfileGray.java, java/awt/color/ICC_ProfileRGB.java: Re-indent copyright header to be standardish. * java/awt/datatransfer/StringSelection.java: Reformatted. * java/awt/geom/Area.java (EPSILON): Made static. (RS_EPSILON): Likewise. (PE_EPSILON): Likewide. 2004-11-30 Sven de Marothy <sven@physto.se> * javax/swing/SwingUtilities.java: (computeDifference): Implemented (computeIntersection): Likewise (computeUnion): Likewise (isRectangleContainingRectangle): Likewise 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/BasicStroke.java, java/awt/Button.java, java/awt/Canvas.java, java/awt/CheckboxMenuItem.java, java/awt/Container.java, java/awt/EventQueue.java, java/awt/FileDialog.java, java/awt/FlowLayout.java, java/awt/FontMetrics.java, java/awt/Graphics.java, java/awt/GridLayout.java, java/awt/KeyboardFocusManager.java, java/awt/Label.java, java/awt/LayoutManager2.java, java/awt/List.java, java/awt/MenuBar.java, java/awt/Scrollbar.java, java/awt/Toolkit.java, java/awt/Window.java, java/awt/datatransfer/DataFlavor.java, java/awt/datatransfer/FlavorTable.java, java/awt/event/ActionListener.java, java/awt/event/HierarchyBoundsAdapter.java, java/awt/geom/Arc2D.java, java/awt/geom/Rectangle2D.java, java/awt/geom/RectangularShape.java, java/awt/im/spi/InputMethod.java, java/awt/image/ByteLookupTable.java, java/awt/image/ColorModel.java, java/awt/image/DirectColorModel.java, java/awt/image/ShortLookupTable.java, java/awt/print/Book.java: Fixed javadocs and method argument names all over. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GdkFontPeer.java (buildString): Optimise String building. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/TextArea.java (AccessibleAWTTextArea, getAccessibleContext): Implement. * java/awt/TextField.java (AccessibleAWTTextField, getAccessibleContext): Implement. 2004-11-30 Tom Tromey <tromey@redhat.com> * Makefile.in: Rebuilt. * Makefile.am (jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.lo): Fixed typo. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Menu.java (AccessibleAWTMenu, getAccessibleContext): Implement. * java/awt/PopupMenu.java (AccessibleAWTMenu, getAccessibleContext): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/print/PrinterJob.java (lookupPrintServices, getPrintService, setPrintService): Implement. (lookupStreamPrintServices): Add commented out implementation. (printer): New field. 2004-11-30 Mark Wielaard <mark@klomp.org> * javax/swing/ToolTipManager.java (mouseMoved): Set currentComponent when not yet set. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/geom/GeneralPath.java (evaluateCrossings): Fixed epsilon value, should always be nonzero. 2004-11-30 Paul Jenner <psj.home@ntlworld.com> * java/awt/image/Raster.java (createPackedRaster): Implemented. 2004-11-30 Graydon Hoare <graydon@redhat.com> * javax/swing/plaf/basic/BasicTextUI.java: Listen to focus events, indicate focus via caret. * javax/swing/text/GapContent.java (getString): Return substring. * javax/swing/text/PlainDocument.java (reindex): New method. (createDefaultRoot): Call it. (insertUpdate): Likewise. (removeUpdate): Likewise. * javax/swing/text/Utilities.java (drawTabbedText): Always advance on tab and newline, even if no painting happens. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am: List peer JNI header: Java source file dependencies explicitly. Likewise for JNI .lo: JNI header dependencies. * Makefile.in: Regenerate. 2004-11-30 Graydon Hoare <graydon@redhat.com> * Makefile.am: Add entry for BasicTextPaneUI.java * Makefile.in: Regenerate. * gnu/java/awt/peer/gtk/GdkGraphics2D.java (GdkGraphics2D): Set clip after transform. (drawImage): Protect against null image. * gnu/java/awt/peer/gtk/GtkFramePeer.java (setIconImage): Protect against non-GtkImage args. * gnu/java/awt/peer/gtk/GtkToolkit.java (checkImage): Protect against non-GtkImage args. * java/awt/print/PrinterJob.java: (print): Add variant taking PrintRequestAttributeSet. (printDialog): Likewise. * javax/swing/JComponent.java: (transferHandler): New field. (getComponentGraphics): Build new Graphics for each sub-paint. (getTransferHandler): New method. (setTransferHandler): New method. * javax/swing/JDesktopPane.java (setDragMode): Force LIVE_DRAG_MODE. * javax/swing/JMenuItem.java (menuSelectionChanged): Protect against null parent. * javax/swing/JTable.java (setDefaultRenderer): New method. * javax/swing/JTree.java: Get basic ctors and UI working. * javax/swing/JViewport.java (JViewport): Set scroll mode. * javax/swing/RepaintManager.java (addDirtyRegion): Skip empty regions. * javax/swing/ScrollPaneLayout.java (minimumLayoutSize): Do not bound scrollpane minimum by central view minimum. * javax/swing/ToolTipManager.java (showTip): Guard against null component. * javax/swing/TransferHandler.java: Stub out. * javax/swing/plaf/basic/BasicLookAndFeel.java: Add entry for TextPaneUI, change Tree icons to pngs. * javax/swing/plaf/basic/BasicMenuItemUI.java: (installDefaults): Set text position and alignment. (paintMenuItem): Layout icon with normal compound function. * javax/swing/plaf/basic/BasicTableHeaderUI.java: (getMaximumSize): Delete. (getMinimumSize): Delete. (getPreferredSize): Use column model's total width. * javax/swing/plaf/basic/BasicTextPaneUI.java: New file. * javax/swing/plaf/basic/BasicTextUI.java (modelChanged): Make resilient against nulls. * javax/swing/plaf/basic/BasicTreeUI.java: Add some simplistic config / painting functions. * javax/swing/plaf/basic/BasicViewportUI.java (paintSimple): Add new non-backingstore paint mode. (paintBackingStore): Split out backing store code. (paint): Switch on painting mode. * javax/swing/text/SimpleAttributeSet.java (SimpleAttributeSet): Resist nulls. * javax/swing/tree/DefaultTreeCellRenderer.java: Implement. * javax/swing/tree/DefaultTreeModel.java: Partially implement. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (setFont): Set pango context's description and language. 2004-11-30 Mark Wielaard <mark@klomp.org> * java/awt/image/LookupOp.java: Comments and indentation fixes. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Checkbox.java (AccessibleAWTCheckBox): Implement. (getAccessibleContext): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/TextComponent.java (AccessibleAWTTextComponent): Implement. (getIndexAtPoint, getCharacterBounds): New methods. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Button.java (AccessibleAWTButton): Implement. 2004-11-30 Mark Wielaard <mark@klomp.org> * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (filenameFilterCallback): Made static. 2004-11-30 Michael Koch <konqueror@gmx.de> * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (cairoShowGlyphs) Removed. 2004-11-30 Sven de Marothy <sven@physto.se> * gnu/java/awt/color/RgbProfileConverter.java (RgbProfileConverter): Don't invert matrix when reverse CLUT is available. * gnu/java/awt/color/LinearRGBConverter.java: Documentation update. * java/awt/color/ICC_ColorSpace.java: Likewise. * java/awt/color/ICC_Profile.java: Likewise. * java/awt/color/ICC_ProfileGray.java: Likewise. * java/awt/color/ICC_ProfileRGB.java: Likewise. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/MenuItem.java (AccessibleAWTMenuItem): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/Choice.java (AccessibleAWTChoice): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/BandedSampleModel.java (scanlineStride): Remove field hiding ComponentSampleModel.scanlineStride. 2004-11-30 Noa Resare <noa@resare.com> * java/awt/geom/GeneralPath.java (currentSegment): Fix typo in transform.transform() invocation. 2004-11-30 Sven de Marothy <sven@physto.se> * gnu/java/awt/peer/gtk/GtkComponentPeer.java (createImage): Created bitmap should be filled with bg color 2004-11-30 Noa Resare <noa@resare.com> * java/awt/Choice.java (add): Implement correct selection behavior when peer == null. (insert): Likewise. (remove): Likewise. 2004-11-30 Mark Wielaard <mark@klomp.org> * gnu/java/awt/peer/gtk/GtkChoicePeer.java (GtkChoicePeer): Call select() when Choice has a selected item. 2004-11-30 Michael Koch <address@bogus.example.com> * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.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_GdkGraphics2D.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_GdkTextLayout.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c, 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_GtkMenuBarPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c: Fixed method names to start at begin of line. This is desired by GNU coding style guide. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GtkComponentPeer.java (gtkWidgetSetVisible): Unused. Removed. (connectJObject): Likewise. * gnu/java/awt/peer/gtk/GtkScrollPanePeer.java (gtkScrolledWindowSetScrollPosition): Commented out. 2004-11-30 Mark Wielaard <mark@klomp.org> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c (Java_gnu_java_awt_peer_gtk_GdkTextLayout_setText): Installed and renamed from Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setText. 2004-11-30 Mark Wielaard <mark@klomp.org> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setText): Removed. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c (init_dpi_conversion_factor): Correct prototype. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/image/ConvolveOp.java: Added missing copyright notice. 2004-11-30 Robert Schuster <theBohemian@gmx.net> Fixes bug #10908 * gnu/java/beans/IntrospectionIncubator.java: (addMethod): static methods are discarded now, too. 2004-11-30 Mark Wielaard <mark@klomp.org> * Makefile.am (awt_java_source_files): Add new gnu/java/awt/color java source files. * Makefile.in: Regenerated. 2004-11-30 Sven de Marothy <sven@physto.se> * gnu/java/awt/color/CieXyzConverter.java, gnu/java/awt/color/GrayScaleConverter.java, gnu/java/awt/color/SrgbConverter.java, gnu/java/awt/color/ClutProfileConverter.java, gnu/java/awt/color/LinearRGBConverter.java, gnu/java/awt/color/TagEntry.java, gnu/java/awt/color/ColorLookUpTable.java, gnu/java/awt/color/ProfileHeader.java, gnu/java/awt/color/ToneReproductionCurve.java, gnu/java/awt/color/ColorSpaceConverter.java, gnu/java/awt/color/PyccConverter.java, gnu/java/awt/color/GrayProfileConverter.java, gnu/java/awt/color/RgbProfileConverter.java: New files. * java/awt/color/ICC_ColorSpace.java, java/awt/color/ICC_Profile.java, java/awt/color/ICC_ProfileGray.java, java/awt/color/ICC_ProfileRGB.java: Implemented (sans PhotoYCC color space). 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/AffineTransformOp.java (filter): Implement bilinear interpolation for Rasters. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/IndexColorModel.java (IndexColorModel): Actually use the provided colormap. Throw documented exceptions. Document exceptions. 2004-11-30 Paul Jenner <psj.home@ntlworld.com> * java/awt/image/IndexColorModel.java (IndexColorModel): Fix constructor. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/AffineTransformOp.java: Add TYPE_BICUBIC. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/AffineTransformOp.java (filter): Implement Raster filtering. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ComponentSampleModel.java (getDataElements, setDataElements): Implement SHORT, FLOAT, and INT transfer types. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * java/awt/Font.java (name): New field. (size): Likewise. (style): Likewise. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/Raster.java (createBandedRaster): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ConvolveOp.java: New class. * Makefile.am: Add ConvolveOp. * Makefile.in: Regenerate. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/RescaleOp.java (BandCombineOp, ColorConvertOp, LookupOp, RescaleOp): Fix loop bounds. 2004-11-30 jlquinn <jlquinn@optonline.net> * Makefile.am: Fix typo in BandCombineOp. * Makefile.in: Regenerate. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/BandCombineOp.java: New class. * Makefile.am: Add BandCombineOp. * Makefile.in: Regenerate. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/LookupOp.java: New class. * Makefile.am: Add LookupOp. * Makefile.in: Regenerate. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/SampleModel.java (createSubsetSampleModel): Add javadocs. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ColorModel.java (cloneColorModel): Fix line wrap. Use Boolean.valueOf. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GdkGraphics2D.java (releasePeerGraphicsResource): Fixed typo in method name. * gnu/java/awt/peer/gtk/GdkFontPeer.java (finalize): Fixed typo in releasePeerGraphicsResource. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/font/TextAttribute.java (RUN_DIRECTION_LTR): Initialie with static value instead of calculating it. (RUN_DIRECTION_RTL): Likewise. (STRIKETHROUGH_ON): Likewise. (SWAP_COLORS_ON): Likewise. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ColorConvertOp.java: New class. * java/awt/image/ColorModel.java (cloneColorModel): New method. * Makefile.am: Add ColorConvertOp. * Makefile.in: Regenerate. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * java/awt/DefaultKeyboardFocusManager.java (dispatchEvent): Track Window focus owner on FOCUS_GAINED events. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c (nativeSetIconImage): Rename to nativeSetIconImageFromDecoder. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c (Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun): Fix pointer warning. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter): Fix pointer warning. * jni/gtk-peer/gtkpeer.h: Introduce widget_union to fix type punned warnings. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect): Use widget_union to fix type punned pointer warning. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (pre_event_handler): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (window_get_new_state): Introduce unions to fix warnings as above. (window_property_changed_cb): Likewise. (window_active_state_change_cb): Mark unused variables unused. (window_focus_state_change_cb): Likewise. (window_focus_in_cb): Likewise. (window_focus_out_cb): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont): Convert PangoFontMap correctly with PANGO_FT2FONT_MAP macro. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JMenuBar.java (updateUI): Simplified. * javax/swing/tree/DefaultTreeSelectionModel.java: Reorganized import statements. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/font/TextAttribute.java, javax/swing/JComponent.java, javax/swing/JInternalFrame.java, javax/swing/table/TableColumn.java, javax/swing/text/StyleConstants.java: Replaced "new Boolean(boolean)" with "Boolean.valueOf(boolean)". 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/tree/DefaultTreeCellEditor.java, javax/swing/tree/DefaultTreeModel.java, javax/swing/tree/DefaultTreeSelectionModel.java: Jalopied. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/tree/DefaultTreeCellEditor.java (EditorContainer.EditorContainer): Fixed arguments. (EditorContainer.EditorContainer): New method. (DefaultTextField.DefaultTextField): Fixed arguments, implemented. (DefaultTextField.getBorder): Implemented. (listenerList): New field. (addCellEditorListener): Implemented. (removeCellEditorListener): Implemented. (getCellEditorListeners): New method. * javax/swing/tree/DefaultTreeModel.java (addTreeModelListener): Fixed javadoc. (removeTreeModelListener): Likewise. (getTreeModelListeners): New method. (fireTreeNodesChanged): Implemented. (fireTreeNodesInserted): Likewise. (fireTreeNodesRemoved): Likewise. (fireTreeStructureChanged): Likewise. (getListeners): Fixed javadoc. * javax/swing/tree/DefaultTreeSelectionModel.java (addTreeSelectionListener): Implemented. (removeTreeSelectionListener): Likewise. (fireValueChanged): Likewise. (getListeners): Likewise. (addPropertyChangeListener): Likewise. (removePropertyChangeListener): Likewise. (getTreeSelectionListeners): New method. (getPropertyChangeListeners): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/plaf/basic/BasicScrollBarUI.java (maximumThumbSize): Removed static keyword. (minimumThumbSize): Likewise. * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java (CloseAction): Made public. (IconifyAction): Likewise. (MaximizeAction): Likewise. (MoveAction): Likewise. (RestoreAction): Likewise. (SizeAction): Likewise. (SystemMenuBar): Likewise. * javax/swing/plaf/basic/BasicSliderUI.java (TrackListener): Likewise. * javax/swing/plaf/basic/BasicSplitPaneUI.java (KeyboardDownRightHandler): Likewise. (KeyboardEndHandler): Likewise. (KeyboardHomeHandler): Likewise. (KeyboardResizeToggleHandler): Likewise. (KeyboardUpLeftHandler): Likewise. (PropertyHandler): Likewise. * javax/swing/plaf/basic/BasicTabbedPaneUI.java (PropertyChangeHandler): Likewise. (TabSelectionHandler): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/text/JTextComponent.java (getKeymap): Made public. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JEditorPane.java (getStream): Throws IOException. (read): Likewise. * javax/swing/JRootPane.java (createContentPane): Fixed return type. * javax/swing/JSpinner.java (commitEdit): Throws ParseException. * javax/swing/plaf/metal/MetalLookAndFeel.java (serialVersionUID): New field. * javax/swing/table/TableColumn.java (resizedPostingDisableCount): Added @deprecated tag. (disableResizedPosting): Likewise. (enableResizedPosting): Likewise. * javax/swing/text/Document.java (TitleProperty): Fixed value. * javax/swing/tree/TreeCellEditor.java (TreeCellEditor): Extends CellEditor. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JWindow.java javax/swing/SpinnerModel.java javax/swing/Timer.java javax/swing/event/MenuKeyEvent.java javax/swing/plaf/basic/BasicButtonUI.java javax/swing/plaf/basic/BasicIconFactory.java javax/swing/plaf/basic/BasicTabbedPaneUI.java javax/swing/text/AttributeSet.java javax/swing/text/Highlighter.java javax/swing/text/StyleConstants.java javax/swing/tree/TreeCellEditor.java: Removed redundant and reordered modifiers. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/plaf/basic/BasicToolTipUI.java: Reformatted copyright header. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/AbstractAction.java, javax/swing/AbstractButton.java, javax/swing/AbstractCellEditor.java, javax/swing/AbstractListModel.java, javax/swing/AbstractSpinnerModel.java, javax/swing/ActionMap.java, javax/swing/BorderFactory.java, javax/swing/Box.java, javax/swing/ButtonModel.java, javax/swing/CellEditor.java, javax/swing/CellRendererPane.java, javax/swing/DefaultBoundedRangeModel.java, javax/swing/DefaultButtonModel.java, javax/swing/DefaultCellEditor.java, javax/swing/DefaultDesktopManager.java, javax/swing/DefaultListCellRenderer.java, javax/swing/DefaultListSelectionModel.java, javax/swing/DefaultSingleSelectionModel.java, javax/swing/GrayFilter.java, javax/swing/InputMap.java, javax/swing/JApplet.java, javax/swing/JCheckBoxMenuItem.java, javax/swing/JColorChooser.java, javax/swing/JComboBox.java, javax/swing/JComponent.java, javax/swing/JDesktopPane.java, javax/swing/JDialog.java, javax/swing/JEditorPane.java, javax/swing/JFileChooser.java, javax/swing/JFormattedTextField.java, javax/swing/JFrame.java, javax/swing/JInternalFrame.java, javax/swing/JLabel.java, javax/swing/JLayeredPane.java, javax/swing/JList.java, javax/swing/JMenu.java, javax/swing/JMenuBar.java, javax/swing/JMenuItem.java, javax/swing/JOptionPane.java, javax/swing/JPanel.java, javax/swing/JPasswordField.java, javax/swing/JPopupMenu.java, javax/swing/JRadioButtonMenuItem.java, javax/swing/JRootPane.java, javax/swing/JSpinner.java, javax/swing/JSplitPane.java, javax/swing/JTabbedPane.java, javax/swing/JTable.java, javax/swing/JTextArea.java, javax/swing/JTextPane.java, javax/swing/JToggleButton.java, javax/swing/JToolBar.java, javax/swing/JToolTip.java, javax/swing/JTree.java, javax/swing/JViewport.java, javax/swing/ListModel.java, javax/swing/LookAndFeel.java, javax/swing/MenuSelectionManager.java, javax/swing/ProgressMonitorInputStream.java, javax/swing/RepaintManager.java, javax/swing/RootPaneContainer.java, javax/swing/ScrollPaneLayout.java, javax/swing/SpringLayout.java, javax/swing/SwingUtilities.java, javax/swing/Timer.java, javax/swing/ToolTipManager.java, javax/swing/UIDefaults.java, javax/swing/UIManager.java, javax/swing/border/MatteBorder.java, javax/swing/colorchooser/AbstractColorChooserPanel.java, javax/swing/colorchooser/ColorSelectionModel.java, javax/swing/colorchooser/DefaultColorSelectionModel.java, javax/swing/colorchooser/DefaultHSBChooserPanel.java, javax/swing/colorchooser/DefaultPreviewPanel.java, javax/swing/colorchooser/DefaultRGBChooserPanel.java, javax/swing/colorchooser/DefaultSwatchChooserPanel.java, javax/swing/event/AncestorEvent.java, javax/swing/event/HyperlinkEvent.java, javax/swing/event/InternalFrameEvent.java, javax/swing/event/MenuDragMouseEvent.java, javax/swing/event/TableColumnModelEvent.java, javax/swing/event/TableModelEvent.java, javax/swing/event/TreeExpansionEvent.java, javax/swing/event/TreeModelEvent.java, javax/swing/event/TreeSelectionEvent.java, javax/swing/event/TreeWillExpandListener.java, javax/swing/event/UndoableEditEvent.java, javax/swing/filechooser/FileView.java, javax/swing/plaf/BorderUIResource.java, javax/swing/plaf/ComponentUI.java, javax/swing/plaf/FileChooserUI.java, javax/swing/plaf/IconUIResource.java, javax/swing/plaf/ListUI.java, javax/swing/plaf/PopupMenuUI.java, javax/swing/plaf/SplitPaneUI.java, javax/swing/plaf/TabbedPaneUI.java, javax/swing/plaf/TextUI.java, javax/swing/plaf/TreeUI.java, javax/swing/plaf/basic/BasicArrowButton.java, javax/swing/plaf/basic/BasicBorders.java, javax/swing/plaf/basic/BasicButtonUI.java, javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java, javax/swing/plaf/basic/BasicColorChooserUI.java, javax/swing/plaf/basic/BasicComboBoxEditor.java, javax/swing/plaf/basic/BasicComboBoxRenderer.java, javax/swing/plaf/basic/BasicComboBoxUI.java, javax/swing/plaf/basic/BasicComboPopup.java, javax/swing/plaf/basic/BasicDesktopIconUI.java, javax/swing/plaf/basic/BasicDesktopPaneUI.java, javax/swing/plaf/basic/BasicIconFactory.java, javax/swing/plaf/basic/BasicInternalFrameTitlePane.java, javax/swing/plaf/basic/BasicInternalFrameUI.java, javax/swing/plaf/basic/BasicListUI.java, javax/swing/plaf/basic/BasicLookAndFeel.java, javax/swing/plaf/basic/BasicMenuBarUI.java, javax/swing/plaf/basic/BasicMenuItemUI.java, javax/swing/plaf/basic/BasicMenuUI.java, javax/swing/plaf/basic/BasicOptionPaneUI.java, javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java, javax/swing/plaf/basic/BasicPopupMenuUI.java, javax/swing/plaf/basic/BasicProgressBarUI.java, javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java, javax/swing/plaf/basic/BasicRootPaneUI.java, javax/swing/plaf/basic/BasicScrollBarUI.java, javax/swing/plaf/basic/BasicSeparatorUI.java, javax/swing/plaf/basic/BasicSliderUI.java, javax/swing/plaf/basic/BasicSpinnerUI.java, javax/swing/plaf/basic/BasicSplitPaneDivider.java, javax/swing/plaf/basic/BasicSplitPaneUI.java, javax/swing/plaf/basic/BasicTabbedPaneUI.java, javax/swing/plaf/basic/BasicTableHeaderUI.java, javax/swing/plaf/basic/BasicTableUI.java, javax/swing/plaf/basic/BasicTextAreaUI.java, javax/swing/plaf/basic/BasicTextFieldUI.java, javax/swing/plaf/basic/BasicTextUI.java, javax/swing/plaf/basic/BasicToolBarSeparatorUI.java, javax/swing/plaf/basic/BasicToolBarUI.java, javax/swing/plaf/basic/BasicToolTipUI.java, javax/swing/plaf/basic/BasicTreeUI.java, javax/swing/plaf/basic/BasicViewportUI.java, javax/swing/plaf/basic/ComboPopup.java, javax/swing/table/AbstractTableModel.java, javax/swing/table/DefaultTableCellRenderer.java, javax/swing/table/DefaultTableColumnModel.java, javax/swing/table/DefaultTableModel.java, javax/swing/table/JTableHeader.java, javax/swing/table/TableCellEditor.java, javax/swing/table/TableCellRenderer.java, javax/swing/table/TableColumn.java, javax/swing/table/TableColumnModel.java, javax/swing/text/AbstractDocument.java, javax/swing/text/Caret.java, javax/swing/text/DefaultCaret.java, javax/swing/text/DefaultEditorKit.java, javax/swing/text/DefaultHighlighter.java, javax/swing/text/EditorKit.java, javax/swing/text/JTextComponent.java, javax/swing/text/LayeredHighlighter.java, javax/swing/text/PasswordView.java, javax/swing/text/SimpleAttributeSet.java, javax/swing/text/StyleConstants.java, javax/swing/text/StyleContext.java, javax/swing/text/StyledEditorKit.java, javax/swing/text/TextAction.java, javax/swing/text/View.java, javax/swing/tree/AbstractLayoutCache.java, javax/swing/tree/DefaultTreeCellRenderer.java, javax/swing/tree/DefaultTreeModel.java, javax/swing/tree/DefaultTreeSelectionModel.java, javax/swing/tree/FixedHeightLayoutCache.java, javax/swing/tree/TreeCellRenderer.java, javax/swing/tree/TreeSelectionModel.java, javax/swing/tree/VariableHeightLayoutCache.java, javax/swing/undo/AbstractUndoableEdit.java, javax/swing/undo/UndoableEditSupport.java: Imports cleaned up. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/Container.java, java/awt/Font.java, java/awt/font/TextLayout.java: Imports cleaned up. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/AbstractButton.java (getLabel): Added @deprecated tag. (setLabel): Likewise. * javax/swing/FocusManager.java (disableSwingFocusManager): Likewise. (isFocusManagerEnabled): Likewise. * javax/swing/JComponent.java (isManagingFocus): Added version to @deprecated tag. (getNextFocusableComponent): Moved @deprecated tag to bottom of javadoc. (getConditionForKeyStroke): Likewise. (getActionForKeyStroke): Likewise. * javax/swing/JDesktopPane.java (LIVE_DRAG_MODE): Added @specnote tag. (OUTLINE_DRAG_MODE): Likewise. * javax/swing/JInternalFrame.java (MENU_BAR_PROPERTY): Fixed value. (getMenuBar): Added @deprecated tag. (setMenuBar): Likewise. * javax/swing/JViewport.java (isBackingStoreEnabled): Likewise. (setBackingStoreEnabled): Likewise. * javax/swing/plaf/basic/BasicDesktopPaneUI.java (closeKey): Likewise. (maximizeKey): Likewise. (minimizeKey): Likewise. (navigateKey): Likewise. (navigateKey2): Likewise. * javax/swing/plaf/basic/BasicInternalFrameUI.java (openMenuKey): Likewise. * javax/swing/plaf/basic/BasicSplitPaneUI.java (keyboardDownRightListener): Likewise. (keyboardEndListener): Likewise. (keyboardHomeListener): Likewise. (keyboardResizeToggleListener): Likewise. (keyboardUpLeftListener): Likewise. (dividerResizeToggleKey): Likewise. (downKey): Likewise. (endKey): Likewise. (homeKey): Likewise. (leftKey): Likewise. (rightKey): Likewise. (upKey): Likewise. (createKeyboardUpLeftListener): Likewise. (createKeyboardDownRightListener): Likewise. (createKeyboardHomeListener): Likewise. (createKeyboardEndListener): Likewise. (createKeyboardResizeToggleListener): Likewise. (getDividerBorderSize): Likewise. * javax/swing/plaf/basic/BasicTabbedPaneUI.java (downKey): Likewise. (leftKey): Likewise. (rightKey): Likewise. (upKey): Likewise. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c (Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create): Use the GTK_TEXT_VIEW macro. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (connect_awt_hook_cb): Mark unused variable unused. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c (selection_get): Do the cast right. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c (Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create): According to the gtk API gtk_combo_box_new_text actually returns a GtkWidget. Remove unused var menu. (selection_changed): Remove unused value. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c (Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds): Fix pointer warning with using an intermediate variable. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_updated): Fix unused var warning for BE archs. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals): Remove unused var. (realize_cb): Mark unused variable unused. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c (seek_glyphstring_idx): Fix a C90 warning. * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c (Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun): Mark unused arguments unused. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState), (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes), (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex), (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c (Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics), (Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerTextMetrics): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter): Likewise. (filenameFilterCallback): Remove unused var. (handle_response): Declare str_fileName and remove last else statement. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c: New File. (nativeGetNumFontsFamilies) New function. (nativeGetFontFamilies) Likewise. * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java (getAvailableFontFamilyNames): Implement. * Makefile.am (gtk_c_source_files): Add GdkGraphicsEnvironment.c. * Makefile.in: Regenerate. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/ClasspathFontPeer.java (setStandardAttributes(String,Map)): If size attribute doesn't exist, default to size 12. Clamp size value to a minimum of 1. 2004-11-30 Jeroen Frijters <jeroen@frijters.net> * javax/swing/JDialog.java (decorated): Likewise. * javax/swing/JFrame.java (defaultLookAndFeelDecorated): Likewise. 2004-11-30 Jeroen Frijters <jeroen@frijters.net> * javax/swing/plaf/basic/BasicToolBarUI.java (offset, regular): Made final. * javax/swing/plaf/basic/BasicScrollBarUI.java (DECREASE_HIGHLIGHT, INCREASE_HIGHLIGHT, NO_HIGHLIGHT, POSITIVE_SCROLL, NEGATIVE_SCROLL): Made final. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/BitwiseXORComposite.java, gnu/java/awt/ClasspathToolkit.java, gnu/java/awt/image/XBMDecoder.java, gnu/java/awt/peer/GLightweightPeer.java, gnu/java/awt/peer/gtk/GdkGlyphVector.java: Reorganized import statements. 2004-11-30 Jeroen Frijters <jeroen@frijters.net> * java/awt/Button.java (next_button_number): Removed useless initializer. * java/awt/Frame.java (next_frame_number): Likewise. * java/awt/Panel.java (next_panel_number): Likewise, * java/awt/Scrollbar.java (next_scrollbar_number): Likewise. * java/awt/TextArea.java (next_text_number): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/image/ByteLookupTable.java (ByteLookupTable) :Fixed HTML entities in javadocs. (lookupPixel): Fix case when dst is null. * java/awt/image/ShortLookupTable.java (ShortLookupTable) :Fixed HTML entities in javadocs. (lookupPixel): Fix case when dst is null. * java/awt/image/DataBufferByte.java, java/awt/image/DataBufferDouble.java, java/awt/image/DataBufferFloat.java, java/awt/image/DataBufferInt.java, java/awt/image/DataBufferShort.java, java/awt/image/DataBufferUShort.java: Fix initialization of bankData in constructors. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkButtonPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c (setNativeBounds): Set GtkEventBox, GtkButton and GtkLabel size requests. * gnu/java/awt/peer/gtk/GtkComponentPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (setNativeBounds): Make package private. Set size request even if GTK parent is NULL. * gnu/java/awt/peer/gtk/GtkLabelPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (setNativeBounds): Set GtkEventBox and GtkLabel size requests. 2004-11-30 Mark Wielaard <mark@klomp.org> Workaround for bug #17952. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (request_frame_extents): Check window->window != NULL. 2004-11-30 Mark Wielaard <mark@klomp.org> * jni/gtk-peer/gdkfont.h: Include gtkpeer.h not gtkcairopeer.h. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c: Use native_text_layout_state_table here. * jni/gtk-peer/gdkfont.h: Mark native_text_layout_state_table extern. 2004-11-30 Mark Wielaard <mark@klomp.org> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c (setChars): Only call pango_itemize() when vec->glyphitems != NULL. Only call pango_shape() when gi->glyphs->num_glyphs > 0. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GtkToolkit.java: Merged import statements. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GdkGraphics2D.java (isBufferedImageGraphics): Simplified. 2004-11-30 Paul Jenner <psj.home@ntlworld.com> * javax/swing/JTree.java (isRootVisible): Fixed typo in method name. * javax/swing/JScrollBar.java (setValues): Likewise. * javax/swing/JScrollPane.java (createScrollListener): Call JScrollBar.setValues. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkContainerPeer.java (endValidate): Don't call setParentAndBounds on GtkWindowPeers. * java/awt/Component.java (static): Don't set default keyboard focus manager. * java/awt/KeyboardFocusManager.java (getCurrentKeyboardFocusManager): If current keyboard focus manager is null set a default. * gnu/java/awt/peer/gtk/GtkButtonPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c (gtkWidgetSetBackground): New method. (block_expose_events_cb): New function. (connectSignals): Block the AWT's expose event processing on button press and release. (gtkSetLabel): Set text on proper widget. (gtkWidgetModifyFont): Modify font on proper widget. (gtkWidgetSetBackground): Set normal, active and prelight colours. (gtkWidgetSetForeground): Set forground colour of proper widget. (gtkActivate): Activate the correct widget. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (clearRect): Only clear rectangle if the backing component is not an event box. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c (beginNativeRepaintID): New variable. (endNativeRepaintID): Likewise. (gtkInit): Initialize new fields with method IDs. * jni/gtk-peer/gtkpeer.h (beginNativeRepaintID): Declare extern. (endNativeRepaintID): Likewise. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * javax/swing/JList.java (init): Revert accidental commit. * gnu/java/awt/peer/gtk/GdkGraphics.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (GdkGraphics): Call initComponentGraphics or connectSignals depending on component's realization status. (realize_cb): New function. (initComponentGraphics): New method. (connectSignals): New method. (clipRect): Return immediately if component is not realized. (setClip): Likewise. (translate): Likewise. (drawImage variants): Return false immediately if component is not realized. * gnu/java/awt/peer/gtk/GdkGraphics2D.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (connectSignals): New method. (GdkGraphics2D): Call initComponentGraphics2D or connectSignals depending on component's realization status. Move other initialization calls to ... (initComponentGraphics2D): New method. (realize_cb): New function. (cairoSetMatrix): Return immediately if gr is NULL. (cairoNewPath): Likewise. (cairoRectangle): Likewise. (cairoClip): Likewise. * gnu/java/awt/peer/gtk/GtkComponentPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (gtkWidgetRepaintArea): Remove method. (isRealized): New method. (GtkComponentPeer): Move setParent, connectJObject and setCursor calls to setParentAndBounds. Call setParentAndBounds. (setParentAndBounds): New method. (setComponentBounds): Return immediately if bounds are all zero. (repaint): Remove call to gtkWidgetRepaintArea. Return immediately if requested paint region is 0x0. (setCursor): New method. (gtkWidgetSetParent): Only set widget's parent if its parent is currently NULL. (setNativeBounds): Only set widget's bounds if it has a parent. (connectSignals): Don't call gtk_widget_realize. Connect "realize" signal to connect_awt_hook_cb handler. * gnu/java/awt/peer/gtk/GtkContainerPeer.java (isValidating): New field. (beginValidate): Set isValidating true. (endValidate): Set parents and bounds for children first, then for this. Set isValidating false. * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (connectJObject): Remove method. (connectSignals): Don't call gtk_widget_realize. * gnu/java/awt/peer/gtk/GtkListPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c (connectJObject): Remove method. (connectSignals): Don't call gtk_widget_realize. * gnu/java/awt/peer/gtk/GtkPanelPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (connectJObject): Remove method. * gnu/java/awt/peer/gtk/GtkScrollbarPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c (connectJObject): Remove method. * gnu/java/awt/peer/gtk/GtkWindowPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create): Don't call gtk_widget_realize. (connectJObject): Remove method. (connectSignals): Don't call gtk_widget_realize. Connect "realize" signal to connect_awt_hook_cb handler. (nativeSetBounds): Don't attempt to move GDK window if it is NULL. * java/awt/Container.java (addImpl): Don't call comp.addNotify if peer is not null. (validateTree): Create peers for all children before calling doLayout. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c (connectSignals): Don't call gtk_widget_realize. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (connect_awt_hook_cb): New function. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c (initComponentGraphicsID): New variable. (initComponentGraphics2DID): Likewise. (setCursorID): Likewise. (gtkInit): Initialize new fields with method IDs. * jni/gtk-peer/gtkpeer.h (initComponentGraphicsID): Declare extern. (initComponentGraphics2DID): Declare extern. (setCursorID): Likewise. (connect_awt_hook_cb): Declare function. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GdkClasspathFontPeer.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/GtkButtonPeer.java, gnu/java/awt/peer/gtk/GtkClipboard.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/GtkListPeer.java, gnu/java/awt/peer/gtk/GtkMenuItemPeer.java, gnu/java/awt/peer/gtk/GtkToolkit.java, gnu/java/awt/peer/gtk/GtkWindowPeer.java: Import statements reworked. Some little reformattings. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/image/AffineTransformOp.java (TYPE_BILINEAR): Initialize with 2. * java/awt/print/Printable.java: Jalopied. (PAGE_EXISTS): Initialize with 0; (NO_SUCH_PAGE): Initialized with 1. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * Makefile.am: Add BufferedImageFilter.java. * Makefile.in: Regenerate. 2004-11-30 Graydon Hoare <graydon@redhat.com> * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (install_font_peer): Minor bug fixes to track cairo font semantics. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/BufferedImageFilter.java: Implement. 2004-11-30 Graydon Hoare <graydon@redhat.com> * Makefile.am (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c) (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c) (gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java) (gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java): Remove. (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c) (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c) (gnu/java/awt/peer/gtk/GdkTextLayout.java) (gnu/java/awt/peer/gtk/GdkFontPeer.java) (gnu/java/awt/peer/ClasspathTextLayoutPeer.java): Add * Makefile.in: Regenerate. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Add stub. * gnu/java/awt/ClasspathToolkit.java (getClasspathTextLayoutPeer) Add. * gnu/java/awt/peer/ClasspathFontPeer.java (copyStyleToAttrs) (copySizeToAttrs): Make public. * gnu/java/awt/peer/ClasspathTextLayoutPeer.java: New file. * gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java: Remove. * gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java: Remove. * gnu/java/awt/peer/gtk/GdkFontMetrics.java: Rewrite. * gnu/java/awt/peer/gtk/GdkFontPeer.java: New file. * gnu/java/awt/peer/gtk/GdkGlyphVector.java: Adjust type names. * gnu/java/awt/peer/gtk/GdkGraphics.java (getFontPeer): New function. (drawString): Pass font peer to native side. * gnu/java/awt/peer/gtk/GdkGraphics2D.java (cairoSetFont) (cairoShowGlyphs) (PainterThread): Remove. (GdkGraphics2D): Set hints during construction. (shifted) (walkPath) (draw) (setRenderingHint) (setRenderingHints): Reimplement normalization logic. (getDefaultHints) (updateBufferedImage) (isBufferedImageGraphics) (updateImagePixels) (drawImage): Make final. (drawImage): Always paint synchronously. (drawString) (drawGlyphVector): Rewrite. (releasePeerGraphicResource) (getPeerTextMetrics) (getPeerFontMetrics) (drawGdkGlyphVector) (drawGdkTextLayout) (cairoDrawGdkGlyphVector) (cairoDrawGdkTextLayout) (cairoDrawString) (getFontPeer): New functions. * gnu/java/awt/peer/gtk/GdkTextLayout.java: New file. * gnu/java/awt/peer/gtk/GtkComponentPeer.java (getFontMetrics): Get metrics via toolkit, to hit cache. * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java: Use getFontMetrics. * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java: Likewise. * gnu/java/awt/peer/gtk/GtkToolkit.java (LRUCache): New class. (fontCache) (metricsCache) (imageCache): New members. (getFontMetrics) (getImage) (getClasspathFontPeer): Use caches. (getFontPeer): Route through getClasspathFontPeer. * java/awt/Font.java (attrsToMap): Remove, adjust ctors. * java/awt/font/TextLayout.java: Implement in terms of peer. * javax/swing/plaf/basic/BasicSliderUI.java (paintThumb): Use polyline rather than polygon. * javax/swing/plaf/basic/BasicGraphicsUtils.java: Update comment but, alas, still do not switch to using TextLayouts. * javax/swing/text/Utilities.java (drawTabbedText): Draw text run-at-a-time, not char-at-a-time. * jni/gtk-peer/gdkfont.h: Publicize some of the font interface, add layout table. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c: * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c: Remove files. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Rewrite to incorporate brains of old GdkClasspathFontPeerMetrics. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c: Rewrite to incorporate brains of old GdkClasspathFontPeer. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c: New file. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString): Rewrite to use persistent layout in peer font. Comment out extraneous gdk_flush calls. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (metrics_cairo) (metrics_surface): New static variables. (paint_glyph_run) (install_font_peer): New helper functions. (releasePeerGraphicResource) (getPeerTextMetrics) (getPeerFontMetrics) (cairoDrawGdkTextLayout) (cairoDrawGdkGlyphVector): New native methods. (cairoDrawString): Rewrite, leaving layout-based version commented out for the time being. * jni/gtk-peer/gtkpeer.h (graphics): Add fields for pango stuff. 2004-11-30 David Gilbert <david.gilbert@object-refinery.com> * java/awt/geom/AffineTransform.java: Fixed javadocs overall. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ComponentColorModel.java: Remove FIXME comment since it's correct. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/IndexColorModel.java: Fix use of immutable BigIntegers. 2004-11-30 Tom Tromey <tromey@redhat.com> * javax/swing/plaf/basic/BasicOptionPaneUI.java (MessageIcon): Renamed from 'messageIcon'. (errorIcon, infoIcon, warningIcon, questionIcon): Updated. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/RescaleOp.java: Fix formatting. 2004-11-30 Olga Rodimina <rodimina@redhat.com> * javax/swing/plaf/basic/BasicComboPopup.java (SCROLL_DOWN): made final. (SCROLL_UP): made final. 2004-11-30 Olga Rodimina <rodimina@redhat.com> * javax/swing/plaf/basic/BasicComboPopup.java: Added javadocs for undocumented fields. (show): scroll down to the selected item and highlight selected item. (startAutoScrolling): Implemented. (stopAutoScrolling): Implemented. (autoScrollUp): Implemented. (autoScrollDown): Implemented. (InvocationMouseHandler.mouseReleased): Implemented. (InvocationMouseMotionHandler.mouseDragged): Implemented. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/RescaleOp.java: Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/IndexColorModel.java (getRGBs, convertToIntDiscrete): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/IndexColorModel.java: Add class docs. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/IndexColorModel.java (isValid, getValidPixels): Implement. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/MenuBar.java, java/awt/peer/MenuBarPeer.java: Revert accidentally commited changes. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/AWTKeyStroke.java, java/awt/Canvas.java, java/awt/CardLayout.java, java/awt/CheckboxMenuItem.java, java/awt/Component.java, java/awt/Container.java, java/awt/DefaultKeyboardFocusManager.java, java/awt/EventDispatchThread.java, java/awt/FileDialog.java, java/awt/FlowLayout.java, java/awt/Font.java, java/awt/Frame.java, java/awt/Graphics2D.java, java/awt/GraphicsEnvironment.java, java/awt/GridBagConstraints.java, java/awt/GridBagLayout.java, java/awt/GridLayout.java, java/awt/Image.java, java/awt/KeyboardFocusManager.java, java/awt/Label.java, java/awt/List.java, java/awt/MediaTracker.java, java/awt/Menu.java, java/awt/MenuBar.java, java/awt/MenuComponent.java, java/awt/Panel.java, java/awt/PopupMenu.java, java/awt/ScrollPane.java, java/awt/Scrollbar.java, java/awt/SystemColor.java, java/awt/TextArea.java, java/awt/TextField.java, java/awt/Toolkit.java, java/awt/Window.java, java/awt/color/ICC_Profile.java, java/awt/datatransfer/DataFlavor.java, java/awt/datatransfer/StringSelection.java, java/awt/datatransfer/SystemFlavorMap.java, java/awt/dnd/Autoscroll.java, java/awt/dnd/DropTarget.java, java/awt/dnd/DropTargetContext.java, java/awt/dnd/DropTargetDragEvent.java, java/awt/dnd/peer/DropTargetContextPeer.java, java/awt/event/AdjustmentEvent.java, java/awt/event/InputEvent.java, java/awt/event/InvocationEvent.java, java/awt/event/KeyEvent.java, java/awt/event/MouseEvent.java, java/awt/font/TextLayout.java, java/awt/geom/GeneralPath.java, java/awt/geom/Point2D.java, java/awt/im/InputContext.java, java/awt/im/spi/InputMethodContext.java, java/awt/image/AffineTransformOp.java, java/awt/image/BufferedImage.java, java/awt/image/ColorModel.java, java/awt/image/ComponentColorModel.java, java/awt/image/CropImageFilter.java, java/awt/image/DirectColorModel.java, java/awt/image/MemoryImageSource.java, java/awt/image/PackedColorModel.java, java/awt/image/PixelGrabber.java, java/awt/image/RasterOp.java, java/awt/peer/MenuBarPeer.java: Some fixes for checkstyle. Import statement and modifier order redordering. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JTable.java (setModel): Reimplemented. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JTextArea.java (append): Re-implemented. (insert): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JSpinner.java (serialVersionUID): New static field. * javax/swing/JToggleButton.java (JToggleButton): Fixed email addresses. * javax/swing/SpinnerNumberModel.java (serialVersionUID): Added javadoc. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JTextArea.java: Don't use JTextComponent.doc directly. GCJ from java-gui-branch has a bug here which is fixed in HEAD ... 2004-11-30 Andrew John Hughes <address@hidden> * javax/swing/JTextArea.java: Added additional documentation. 2004-11-30 Andrew John Hughes <address@hidden> * javax/swing/JRadioButton.java: Implemented additional constructors and accessibility classes. Added documentation and fixed a typo in AbstractButton. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/IndexColorModel.java (IndexColorModel): Implement missing constructor. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ComponentColorModel.java (ComponentColorModel): Implement missing 1.4 constructor. 2004-11-30 Andrew John Hughes <address@hidden> * javax/swing/JToggleButton.java: Implemented additional constructors and accessibility classes. Added documentation and fixed a typo in AbstractButton. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ColorModel.java (getDataElement, getDataElements): Document since 1.4. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/BandedSampleModel.java: Implement. * Makefile.am: Add java/awt/image/BandedSampleModel.java. * Makefile.in: Regenerated. 2004-11-30 Michael Koch <konqueror@gmx.de> * java/awt/Window.java: Fixed whitespace difference with GNU classpath. 2004-11-30 Mark Wielaard <mark@klomp.org> * Makefile.am: Add javax/swing/SpinnerListModel.java. * Makefile.in: Regenerated. 2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * javax/swing/SpinnerListModel.java, javax/swing/SpinnerModel.java Implemented SpinnerListModel. Added documentation to SpinnerModel. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c (init_dpi_conversion_factor): Apply the patch from main correctly. 2004-06-26 Andreas Tobler <a.tobler@schweiz.ch> 2004-11-30 Tom Tromey <tromey@redhat.com> Bug 9948. * javax/swing/JDesktopPane.java (LIVE_DRAG_MODE): Now final. (OUTLINE_DRAG_MODE): LIVE_DRAG_MODE. * javax/swing/plaf/basic/BasicSplitPaneUI.java (NON_CONTINUOUS_DIVIDER): Now final. Initialize. 2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/awt/Canvas.java (AccessibleAWTCanvas): added serialization UID * java/awt/Label.java (AccessibleAWTLabel): added serialization UID * javax/swing/JRootPane.java (AccessibleJRootPane): added comment to existing UID * javax/swing/JSpinner.java (DefaultEditor): added serialization UID (NumberEditor): added serialization UID * javax/swing/text/html/HTML.java (UnknownTag): added serialization UID 2004-11-30 Jeroen Frijters <jeroen@frijters.net> * javax/swing/JInternalFrame.java (CONTENT_PANE_PROPERTY,FRAME_ICON_PROPERTY,GLASS_PANE_PROPERTY, IS_CLOSED_PROPERTY,IS_ICON_PROPERTY,IS_MAXIMUM_PROPERTY, IS_SELECTED_PROPERTY,LAYERED_PANE_PROPERTY,MENU_BAR_PROPERTY, ROOT_PANE_PROPERTY,TITLE_PROPERTY): Made final as per API spec. * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java (CLOSE_CMD,ICONIFY_CMD,MAXIMIZE_CMD,MOVE_CMD,RESTORE_CMD,SIZE_CMD): Made final as per API spec. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * jni/gtk-peer/gtkpeer.h: Remove duplicated copyright string. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/geom/Arc2D.java: Reformatted. (setArc): Correct documentation to say 'upper left corner'. (setArcByTangent,contains,intersects): Implemented. (containsAngle): Corrected to handle negative extents. (ArcIterator): Set to private. (ArcIterator): Corrected for CHORD-type arcs, negative extents. (intersects): Fix: Now checks the arc segment. (contains): Cleaned up. * java/awt/geom/CubicCurve2a.javaD: Fix insideness-test. Reindent. (contains): Implemented. (intersects): Implemented. * java/awt/geom/QuadCurve2D.java: Fix insideness-test. Reindent. * java/awt/geom/GeneralPath: Fix insideness-test. Reindent and document. Fully (re)implemented using separate xpoints and ypoints float[] coords. 2004-11-30 Andreas Tobler <a.tobler@schweiz.ch> * configure.ac: Introduce AC_C_BIGENDIAN_CROSS for WORDS_BIGENDIAN. * configure: Regenerate. * include/config.h.in: Likewise. * jni/gtk-peer/gtkpeer.h (SWAPU32): Introduce macro to swap pixels. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c: Moved SWAPU32 macro to gtkpeer.h. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels): Convert pixels from 0xBBGGRRAA to 0xAARRGGBB only on Little Endian architectures. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_updated): Likewise. 2004-11-30 David Gilbert <david.gilbert@object-refinery.com> * java/awt/SystemColor.java: Fix @link doc entries. 2004-11-30 David Gilbert <david.gilbert@object-refinery.com> * java/awt/RenderingHints.java: Documented. (RenderingHints): Accept null init Map. (putAll): Preprocess map to generate appropriate exceptions. (remove): Cast object to Key and remove from hintMap. 2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/awt/MenuComponent.java, java/awt/MenuBar.java: Implementation of accessibility classes and methods for these two components. 2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/awt/KeyboardFocusManager.java: Added missing documentation. 2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/awt/Label.java, java/awt/Canvas.java: Added accessibility classes to AWT Label and Canvas, as well as additional documentation for Canvas. 2004-11-30 David Gilbert <address@bogus.example.com> * java/awt/image/DataBuffer.java: Update API documentation. * java/awt/image/DataBufferByte.java: Likewise. * java/awt/image/DataBufferDouble.java: Likewise. * java/awt/image/DataBufferFloat.java: Likewise. * java/awt/image/DataBufferInt.java: Likewise. * java/awt/image/DataBufferShort.java: Likewise. * java/awt/image/DataBufferUShort.java: Likewise. 2004-11-30 Dalibor Topic <robilad@kaffe.org> * java/awt/Component.java (postEvent): Only delegate to parent if a parent exists. Reported by: Stephane Meslin-Weber <steph@tangency.co.uk> 2004-11-30 Sven de Marothy <sven@physto.se> *java/awt/AWTEventMulticaster.java, java/awt/Adjustable.java, java/awt/Point.java, java/awt/Polygon.java, java/awt/Rectangle.java, java/awt/Shape.java, java/awt/geom/Area.java, java/awt/geom/Ellipse2D.java, java/awt/geom/PathIterator.java, java/awt/geom/Point2D.java, java/awt/geom/Rectangle2D.java, java/lang/Comparable.java, java/util/Arrays.java: Fixed documentation errors 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ComponentSampleModel.java: Add documentation. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ComponentSampleModel.java (constructor): Initialize numBanks when figuring out the max bank index. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/Raster.java (createPackedRaster): Implement MultiPixelPackedSampleModel codepath. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/MultiPixelPackedSampleModel.java: Implement. * Makefile.am: Add MultiPixelPackedSampleModel.java. * Makefile.in: Regenerate. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/Raster.java (getNumBands): Implement. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/Raster.java (createPackedRaster(int,int,int,int,int,Point)): Implement for bands>1. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/SinglePixelPackedSampleModel.java (SinglePixelPackedSampleModel): Throw exception for unsupported datatype. 2004-11-30 Jerry Quinn <jlquinn@optonline.net> * java/awt/image/ColorModel.java (getDataElement): Implemented. Update javadoc. (getDataElements): Add missing version. Remove bogus version. Update javadoc. 2004-11-30 Olga Rodimina <rodimina@redhat.com> * javax/swing/plaf/basic/BasicComboBoxUI.java: (paintCurrentValue): Pass correct parameters to getListCellRendererComponent(). (ListDataHandler.intervalRemoved): Implemented. (PropertyChangeHandler.propertyChange): Handle changes in MODEL_CHANGED_PROPERTY of the JComboBox * javax/swing/plaf/basic/BasicComboPopup.java: (BasicComboPopup): Moved code that configures popup to configurePopup() and call it instead. (firePopupMenuWillBecomeVisible): Implemented. (firePopupMenuWillBecomeInvisible): Likewise. (firePopupMenuCanceled): Likewise. (configureList): Set list's visibleRowCount same as comboBox's visibleRowCount. (configurePopup): Implemented. (getPopupHeightForRowCount): Get item's from JComboBox's model and not from model of the JList. (ListMouseMotionHandler.mouseMoved): Implemented. (PropertyChangeHandler.propertyChange): Handles change in the JComboBox's model. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JComponent.java (isMaximumSizeSet): New method. (isMinimumSizeSet): Likewise. (isPreferredSizeSet): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JSpinner.java: Some Re-formatting. (spinner): New field. (DefaultEditor): New method. (getSpinner): Likewise. (NumberEdito): Likewise. (getModel): Likewise 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/InputVerifier.java: Re-formatted. * javax/swing/JComponent.java (inputVerifier): New property field. (getInputVerifier): New method. (setInputVerifier): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JComponent.java (JComponent): Added javadoc comment. (setBorder): Fire property change eventr. (setEnabled): Likewise. (setMaximumSize): Likewise. (setMinimumSize): Likewise. (setPreferredSize): Likewise. (setOpaque): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JTextField.java (action): New field. (actionCommand): Likewise. (actionPropertyChangeListener): Likewise. (setHorizontalAlignment): Abort soon if new value == old value. Fire event before repainting. (postActionEvent): New method. (getAction): Likewise. (setAction): Likewise. (getActionCommand): Likewise. (setActionCommand): Likewise. (createActionPropertyChangeListener): Likewise. (configurePropertiesFromAction): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/DebugGraphics.java: Re-formatted. Fixed some javadocs. * javax/swing/JApplet.java (rootPaneCheckingEnabled): Renamed from checking. * javax/swing/JCheckBox.java (BORDER_PAINTED_FLAT_CHANGED_PROPERTY): New statif field. * javax/swing/JFrame.java: Re-formatted a bit and reordered some methods. (rootPaneCheckingEnabled): Renamed from checking. (getPreferredSize): Simplified. * javax/swing/JTextArea.java (getColumnWidth): New method. (getLineCount): Likewise. (getLineStartOffset): Likewise. (getLineEndOffset): Likewise. (getLineOfOffset): Likewise. (getRowHeight): Likewise. (insert): Likewise. (replaceRange): Likewise. * javax/swing/JTextField.java (scrollOffset): new field. (getScrollOffset): New method. (setScrollOffset): Likewise. (getColumnWidth): Likewise. * javax/swing/JTree.java (ANCHOR_SELECTION_PATH_PROPERTY): New static field. (CELL_EDITOR_PROPERTY): Likewise. (CELL_RENDERER_PROPERTY): Likewise. (EDITABLE_PROPERTY): Likewise. (EXPANDS_SELECTED_PATHS_PROPERTY): Likewise. (INVOKES_STOP_CELL_EDITING_PROPERTY): Likewise. (LARGE_MODEL_PROPERTY): Likewise. (LEAD_SELECTION_PATH_PROPERTY): Likewise. (ROOT_VISIBLE_PROPERTY): Likewise. (ROW_HEIGHT_PROPERTY): Likewise. (SCROLLS_ON_EXPAND_PROPERTY): Likewise. (SELECTION_MODEL_PROPERTY): Likewise. (SHOWS_ROOT_HANDLES_PROPERTY): Likewise. (TOGGLE_CLICK_COUNT_PROPERTY): Likewise. (TREE_MODEL_PROPERTY): Likewise. (VISIBLE_ROW_COUNT_PROPERTY): Likewise. (cellEditor): New field. (invokesStopCellEditing): Likewise. (largeModel): Likewise. (rowHeight): Likewise. (scrollsOnExpand): Likewise. (selectionModel): Likewise. (toggleClickCount): Likewise. (visibleRowCount): Likewise. (setShowsRootHandles): Fixed typo in method name. (getCellEditor): New method. (setCellEditor): Likewise. (getSelectionModel): Likewise. (setSelectionModel): Likewise. (getVisibleRowCount): Likewise. (setVisibleRowCount): Likewise. (isLargeModel): Likewise. (setLargeModel): Likewise. (getRowHeight): Likewise. (setRowHeight): Likewise. (getInvokesStopCellEditing): Likewise. (setInvokesStopCellEditing): Likewise. (getToggleClickCount): Likewise. (setToggleClickCount): Likewise. (getScrollsOnExpand): Likewise. (setScrollsOnExpand): Likewise. * javax/swing/table/DefaultTableColumnModel.java (addColumnModelListener): Fixed javadoc. (removeColumnModelListener): Implemented. Fixed javadoc. (getColumnModelListeners): New method. * javax/swing/table/JTableHeader.java (columnModel): Made protected. (draggedColumn): Likewise. (draggedDistance): Likewise. (reorderingAllowed): Likewise. (resizingAllowed): Likewise. (resizingColumn): Likewise. (table): Likewise. (updateTableInRealTime): Likewise. (createDefaultColumnModel): Renamed from createDefaultTableColumnModel. (setDefaultRenderer): New method. * javax/swing/table/TableColumn.java (getPropertyChangeListeners): New method. * javax/swing/text/DefaultHighlighter.java (drawsLayeredHighlights): New field. (getDrawsLayeredHighlights): New method. (setDrawsLayeredHighlights): Likewise. * javax/swing/text/DocumentFilter.java (FilterBypass): New inner class. (insertString): New method. (remove): Likewise. (replace): Likewise. * javax/swing/text/JTextComponent.java (dragEnabled): New field. (getSelectedText): New method. (getDragEnabled): Likewise. (setDragEnabled): Likewise. (replaceSelection): Reimplemented. * javax/swing/text/NavigationFilter.java (FilterBypass): New inner class. (NavigationFilter): New method. (moveDot): Likewise. (setDot): Likewise. * javax/swing/text/SimpleAttributeSet.java (EMPTY): Made public final. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/SpinnerNumberModel.java (getMinimum): New method. (setMinimum): Likewise. (getMaximum): Likewise. (setMaximum): Likewise. (getStepSize): Likewise. (setStepSize): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JMenu.java (getMenuListeners): New method. (fireMenuSelected): Simplified. * javax/swing/JRootPane.java (NONE): New static field. (FRAME): Likewise. (PLAIN_DIALOG): Likewise. (INFORMATION_DIALOG): Likewise. (ERROR_DIALOG): Likewise. (COLOR_CHOOSER_DIALOG): Likewise. (FILE_CHOOSER_DIALOG): Likewise. (QUESTION_DIALOG): Likewise. (WARNING_DIALOG): Likewise. (defaultButton): New field. (getDefaultButton): New method. (setDefaultButton): Likewise. * javax/swing/JScrollPane.java (getUI): New method. (setUI): Likewise. * javax/swing/JTable.java (getUI): Javadoc added. (setUI): New method. * javax/swing/JViewport.java (getUI): New method. (setUI): Likewise. * javax/swing/UIDefaults.java (removePropertyChangeListener): Made public. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JApplet.java, javax/swing/JFrame.java: Re-indented. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/AbstractButton.java: Little re-formatting. (changeEvent): Made protected. (fireStateChanged): Removed argument. (setHorizontalAlignment): Abort method when old value is equal too new value. (setHorizontalTextPosition): Likewise. (setVerticalAlignment): Likewise. (setVerticalTextPosition): Likewise. (setBorderPainted): Likewise. (setIcon): Likewise. (setText): Likewise. (setIconTextGap): Likewise. (setMargin): Likewise. (setPressedIcon): Likewise. (setFocusPainted): Likewise. (setDisabledSelectedIcon): Likewise. (setRolloverIcon): Likewise. (setRolloverSelectedIcon): Likewise. (setSelectedIcon): Likewise. (setContentAreaFilled): Likewise. 2004-11-30 Kim Ho <kho@redhat.com> * javax/swing/plaf/basic/BasicArrowButton.java: Jalopy. Reimplement. * javax/swing/plaf/basic/BasicScrollBarUI.java: Jalopy. (arrowIcon, upIcon, downIcon, leftIcon, rightIcon): Removed. (createIncreaseButton): Use BasicArrowButton. (createDecreaseButton): Ditto. * javax/swing/plaf/basic/BasicSplitPaneDivider.java: (createRightOneTouchButton): Remove button border. (createLeftOneTouchButton): Ditto. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JSpinner.java (setModel): New method. * javax/swing/SpringLayout.java (Constraints): May not be final. 2004-11-30 Michael Koch <konqueror@gmx.de> * gnu/java/awt/peer/gtk/GtkClipboard.java, java/awt/datatransfer/Clipboard.java, java/awt/datatransfer/ClipboardOwner.java: Reformated to make it use our coding standard. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/SpinnerNumberModel.java (SpinnerNumberModel): Implements java.io.Serializable. (serialVersionUID): New field. (SpinnerNumberModel): Added missing @throws tags to javadocs. * javax/swing/UIManager.java (get): New method. (getBoolean): Likewise. (getBorder): Likewise. (getColor): Likewise. (getDimension): Likewise. (getFont): Likewise. (getIcon): Likewise. (getInsets): Likewise. (getInt): Likewise. (getString): Likewise. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JPasswordField.java: Reformated. Implemented construtors. * javax/swing/plaf/basic/BasicPasswordFieldUI.java (create): New method. * javax/swing/text/PlainView.java (selectedColor): Made package-private to allow access from sub-classes in same package too. (unselectedColor): Likewise. (font): Likewise. (drawSelectedText): Make protected. (drawUnselectedText): Likewise. * javax/swing/text/PasswordView.java: New file. * Makefile.am: Added javax/swing/text/PasswordView.java. * Makefile.in: Regenerated. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Set menu bar's width. * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (nativeSetHelpMenu): Add FIXME comment. (addHelpMenu): Elide call to nativeSetHelpMenu. * java/awt/Menu.java (isTearOff): Rename to tearOff. (menuSerializedDataVersion): Initialize to 1. (separatorLabel): Mark transient. (insert(MenuItem,int)): Implement. * java/awt/MenuBar.java (setHelpMenu): Call getPeer to retrieve peer. (countMenus): Count help menu. * java/awt/MenuComponent.java (nameExplicitlySet, newEventsOnly, accessibleContext): Add fields. * java/awt/MenuItem.java: Remove event mask FIXME. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c (gtkWidgetModifyFont): Only set font if label is non-NULL. (setLabel): Don't treat "-" specially. 2004-11-30 Kim Ho <kho@redhat.com> * javax/swing/colorchooser/DefaultHSBChooserPanel.java: (stateChanged): Only update the image and the track if the values are not being adjusted. (updateChooser): Grab the new mouse point from the spinner values. Update the image and track only if the values are not being adjusted. (getHSBValues): New method. * javax/swing/colorchooser/DefaultRGBChooserPanel.java: (SliderHandler::stateChanged): Changed internalChange to updateChange. Set sliderChange. (SpinnerHandler::stateChanged): Ditto. Set spinnerChange. (spinnerChange): New variable. (sliderChange): Ditto. (updateChange): Renamed from internalChange. (updateChooser): Do not update sliders if the sliders were the original source of the change. Ditto for spinners. * javax/swing/plaf/basic/BasicTabbedPaneUI.java: (mousePress): Don't scroll the JViewport if there will be extra space at the end of the run. Change layout() to revalidate(). (calculateSize): Use the component's width/height unless it is smaller than the max tab width/height. (calculateTabRects): Subtract the tab run overlay. (rotateTabRuns): Don't rotate if there's only one run. (layoutContainer): Reuse the viewport point. (createLayoutManager): Set the viewport to use no layout. (paintTabArea): Don't paint the tabs that are not visible to the JViewport. (paintContentBorderTopEdge): Check for scroll tab layout before looking for gap. (paintContentBorderLeftEdge): Ditto. (paintContentBorderBottomEdge): Ditto. (paintContentBorderRightEdge): Ditto. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkButtonPeer.java (gtkWidgetSetFont): Rename ... (gtkWidgetModifyFont): New method. * gnu/java/awt/peer/gtk/GtkFramePeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c (setMenuBarWidth): New method. (setBounds): Set the menu bar width. (postConfigureEvent): Set the menu bar width if the window's width has changed. * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (GtkMenuBarPeer): Don't call create. (setFont): New method. * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java (create): New method. (setFont): Likewise. (GtkMenuComponentPeer): Call create and setFont. * gnu/java/awt/peer/gtk/GtkMenuItemPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c (connectSignals): Make package private. (gtkWidgetModifyFont): New method. (create): Likewise. (GtkMenuItemPeer): Don't call create. (setFont): New method. * java/awt/CheckboxMenuItem.java (addNotify): Fix peer == null condition. * java/awt/Container.java (validateTree): Fix comment typos. * java/awt/MenuComponent.java (getFont): Return parent's font if our font is null. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c (create): Remove call to deprecated gtk_check_menu_item_set_show_toggle function. 2004-11-30 Hans Boehm <Hans.Boehm@hp.com> * java/lang/natObject.cc (LOCK_LOG, LOG): Add debug tracing. (Almost everywhere): add LOG calls, fix, add comments. (_Jv_MonitorEnter): Replace masking of LOCKED bit with assertion. Add explicit check for LOCKED bit in slow case (PR 16662). (_Jv_MonitorExit): Add casts in debug-only code. Always release LOCKED bit before throwing exception. (_Jv_ObjectCheckMonitor): Lock may be held if lightweight lock isn't. Handle easy cases without lock acquisition. (Object::wait): Use NotifyAll for lock inflation. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkFramePeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c (gtkFixedMove): Remove method. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/geom/Area.java: Implemented. 2004-11-30 Mark Wielaard <mark@klomp.org> * java/awt/geom/Arc2D.java (ArcIterator): Make package private. 2004-11-30 Sven de Marothy <sven@physto.se> * java/awt/geom/Arc2D.java Reformatted. (setArc): Correct documentation to say 'upper left corner'. (setArcByTangent,contains,intersects): Implemented. (containsAngle): Corrected to handle negative extents. (ArcIterator): Set to private. (ArcIterator): Corrected for CHORD-type arcs, negative extents. * java/awt/geom/Ellipse2D.java Documented. (contains,intersects): Implemented. * java/awt/geom/Line2D.java (linesIntersect): Correct handling of special cases. 2004-11-30 Mark Wielaard <mark@klomp.org> * gnu/java/awt/peer/gtk/GdkGraphics.java (setColor): Use Color.BLACK if c == null, don't create new Color object each time. * gnu/java/awt/peer/gtk/GdkGraphics2D.java (comp): New private field. (setColor): Use Color.BLACK when argument null. (setComposite): Set this.comp field. (getComposite): Return this.comp, or AlphaComposite.SrcOver when null. (DrawState.comp): New private field. (DrawState.save): Save Composite. (DrawState.restore): Restore comp field. * java/awt/FontMetrics.java (gRC): New static final private field. (getLineMetrics(String, Graphics)): New method. (getLineMetrics(String, int, int, Graphics)): Likewise. (getLineMetrics(char[], int, int, Graphics)): Likewise. (getLineMetrics(CharacterIterator, int, int, Graphics)): Likewise. * javax/swing/JMenu.java (JMenu(String, boolean)): Ignore tearoff argument. PR SWING/17294. * javax/swing/plaf/basic/BasicGraphicsUtils.java (): Always use the fall-back code since none of the TextArea methods are really implemented now. PR SWING/17296. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c (GdkGlyphVector_setChars): Replace assert() with if block when pango_itemize() returns null. PR AWT/17295. (GdkGlyphVector_allInkExtents): Likewise when vec->glyphitems is null. 2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (gtk_c_source_files): Add gnu_java_awt_peer_gtk_GtkFramePeer.c. * Makefile.in: Regenerate. * gnu/java/awt/peer/gtk/GdkGraphics.java (getClipBounds): Remove comment. * gnu/java/awt/peer/gtk/GtkButtonPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c (create): Pack GtkButton in GtkEventBox. (connectJObject): Remove. (focus_in_cb): New function. (focus_out_cb): Likewise. (connectSignals): Connect focus-in-event and focus-out-event signals. (gtkSetFont): Rename to ... (gtkWidgetModifyFont): New method. (gtkWidgetRequestFocus): New method. * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c (gtkSetFont): Rename to ... (gtkWidgetModifyFont): New method. * gnu/java/awt/peer/gtk/GtkComponentPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (isInRepaint): New field. (gtkSetFont): Remove method. (addExposeFilter): Likewise. (removeExposeFilter): Likewise. (gtkWidgetQueueDrawArea): Rename to ... (gtkWidgetRepaintArea): New method. (beginNativeRepaint): New method. (endNativeRepaint): New method. (setComponentBounds): Move implementation here from GtkComponentPeer. (paint): Remove implementation. (repaint): Wrap call to gtkWidgetRepaintArea with calls to beginNativeRepaint and endNativeRepaint. (setBounds): Use menu bar height in bounds calculation. (postExposeEvent): Only post paint event if we're not doing a native repaint. (gtkWidgetSetParent): Replace gtk_layout_put with gtk_fixed_put. (setNativeBounds): Replace gtk_layout_move with gtk_fixed_move. (find_gtk_layout): Remove function. (filter_expose_event_handler): Likewise. * gnu/java/awt/peer/gtk/GtkDialogPeer.java (postExposeEvent): Likewise. * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java (setComponentBounds): Call GtkComponentPeer's setComponentBounds. * gnu/java/awt/peer/gtk/GtkFramePeer.java (getMenuBarHeight): New method. (moveLayout): Rename to ... (gtkFixedMove): New method. (gtkLayoutSetVisible): Rename to ... (gtkFixedSetVisible): New method. (setMenuBar): Rearrange, to make the three separate cases clearer. (postExposeEvent): Only post paint event if we're not doing a native repaint. * gnu/java/awt/peer/gtk/GtkGenericPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c (gtkWidgetModifyFont): New method. * gnu/java/awt/peer/gtk/GtkImagePainter.java (GtkImagePainter(GtkImage,GdkGraphics,int,int,int,int,Color)): Call run directly, rather than spawning a new thread. (GtkImagePainter(GtkImage,GdkGraphics,int,int,int,int,int,int,int,int,Color)): Likewise. * gnu/java/awt/peer/gtk/GtkLabelPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (gtkSetFont): Rename to ... (gtkWidgetModifyFont): New method. (create): Rename ebox to eventbox. * gnu/java/awt/peer/gtk/GtkListPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c (gtkSetFont): Rename to ... (gtkWidgetModifyFont): New method. * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java (GtkMenuComponentPeer): Set the default font. * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c (gtkSetFont): Rename to ... (gtkWidgetModifyFont): New method. * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c: Likewise. * java/awt/Component.java (locale): Initialize to default locale. * java/awt/Container.java (invalidateTree): Make package-private. (paint): Paint self first. (setMenuBar): Call invalidateTree. * java/awt/Panel.java (dispatchEventImpl): Remove method. * java/awt/Window.java (show): Call no-parameter variant of requestFocusInWindow. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (initState): Remove special case for window widget. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c (grab_current_drawable): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c (create): Replace GtkLayout with GtkFixed. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (pre_event_handler): Remove special cases for GDK_EXPOSE events. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c: New file. Move all GtkFramePeer native method implementations here from gnu_java_awt_peer_gtk_GtkWindowPeer.c. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (create): Replace GtkLayout with GtkFixed. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (find_layout): Remove function. (create): Replace GtkLayout with GtkFixed. (connectSignals): Remove find_layout call. (toBack): Replace XFlush with gdk_flush. (toFront): Replace XFlush with gdk_flush. Move GtkFramePeer native method implementations to gnu_java_awt_peer_gtk_GtkFramePeer.c. * jni/gtk-peer/gtkpeer.h: Remove declaration of find_gtk_layout. 2004-11-30 Michael Koch <konqueror@gmx.de> * javax/swing/JTextArea.java (lineWrap): Renamed from "wrapping". (wrapStyleWord): NEw field. (getLineWrap): Re-edited javadoc comment. (setLineWrap): Likewise. (getWrapStyleWord): New method. (setWrapStyleWord): Likewise. From-SVN: r91544
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog2495
-rw-r--r--libjava/Makefile.am125
-rw-r--r--libjava/Makefile.in521
-rw-r--r--libjava/gnu/awt/xlib/XToolkit.java8
-rw-r--r--libjava/gnu/java/awt/BitwiseXORComposite.java3
-rw-r--r--libjava/gnu/java/awt/ClasspathToolkit.java15
-rw-r--r--libjava/gnu/java/awt/color/CieXyzConverter.java74
-rw-r--r--libjava/gnu/java/awt/color/ClutProfileConverter.java154
-rw-r--r--libjava/gnu/java/awt/color/ColorLookUpTable.java430
-rw-r--r--libjava/gnu/java/awt/color/ColorSpaceConverter.java70
-rw-r--r--libjava/gnu/java/awt/color/GrayProfileConverter.java138
-rw-r--r--libjava/gnu/java/awt/color/GrayScaleConverter.java111
-rw-r--r--libjava/gnu/java/awt/color/LinearRGBConverter.java152
-rw-r--r--libjava/gnu/java/awt/color/ProfileHeader.java399
-rw-r--r--libjava/gnu/java/awt/color/PyccConverter.java73
-rw-r--r--libjava/gnu/java/awt/color/RgbProfileConverter.java245
-rw-r--r--libjava/gnu/java/awt/color/SrgbConverter.java153
-rw-r--r--libjava/gnu/java/awt/color/TagEntry.java (renamed from libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java)104
-rw-r--r--libjava/gnu/java/awt/color/ToneReproductionCurve.java178
-rw-r--r--libjava/gnu/java/awt/image/XBMDecoder.java16
-rw-r--r--libjava/gnu/java/awt/peer/ClasspathFontPeer.java12
-rw-r--r--libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java111
-rw-r--r--libjava/gnu/java/awt/peer/GLightweightPeer.java1
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java85
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java (renamed from libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java)172
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java100
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkGraphics.java101
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java566
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java32
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java83
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java435
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java14
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java2
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java4
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkClipboard.java93
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java109
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java43
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java13
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java4
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java21
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java98
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java2
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkImage.java9
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java31
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java3
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkListPeer.java5
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java18
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java15
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java30
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java1
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java2
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java1
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java20
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java20
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkToolkit.java136
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java3
-rw-r--r--libjava/gnu/java/beans/IntrospectionIncubator.java3
-rw-r--r--libjava/include/config.h.in12
-rw-r--r--libjava/java/applet/Applet.java17
-rw-r--r--libjava/java/awt/AWTEventMulticaster.java76
-rw-r--r--libjava/java/awt/AWTKeyStroke.java4
-rw-r--r--libjava/java/awt/Adjustable.java4
-rw-r--r--libjava/java/awt/BasicStroke.java4
-rw-r--r--libjava/java/awt/Button.java128
-rw-r--r--libjava/java/awt/Canvas.java141
-rw-r--r--libjava/java/awt/CardLayout.java128
-rw-r--r--libjava/java/awt/Checkbox.java107
-rw-r--r--libjava/java/awt/CheckboxMenuItem.java14
-rw-r--r--libjava/java/awt/Choice.java69
-rw-r--r--libjava/java/awt/Component.java207
-rw-r--r--libjava/java/awt/Container.java79
-rw-r--r--libjava/java/awt/DefaultKeyboardFocusManager.java41
-rw-r--r--libjava/java/awt/EventDispatchThread.java15
-rw-r--r--libjava/java/awt/EventQueue.java2
-rw-r--r--libjava/java/awt/FileDialog.java5
-rw-r--r--libjava/java/awt/FlowLayout.java13
-rw-r--r--libjava/java/awt/Font.java82
-rw-r--r--libjava/java/awt/FontMetrics.java111
-rw-r--r--libjava/java/awt/Frame.java6
-rw-r--r--libjava/java/awt/Graphics.java14
-rw-r--r--libjava/java/awt/Graphics2D.java7
-rw-r--r--libjava/java/awt/GraphicsEnvironment.java7
-rw-r--r--libjava/java/awt/GridBagConstraints.java11
-rw-r--r--libjava/java/awt/GridBagLayout.java4
-rw-r--r--libjava/java/awt/GridLayout.java7
-rw-r--r--libjava/java/awt/Image.java3
-rw-r--r--libjava/java/awt/KeyboardFocusManager.java561
-rw-r--r--libjava/java/awt/Label.java70
-rw-r--r--libjava/java/awt/LayoutManager2.java4
-rw-r--r--libjava/java/awt/List.java7
-rw-r--r--libjava/java/awt/MediaTracker.java4
-rw-r--r--libjava/java/awt/Menu.java77
-rw-r--r--libjava/java/awt/MenuBar.java78
-rw-r--r--libjava/java/awt/MenuComponent.java1053
-rw-r--r--libjava/java/awt/MenuItem.java113
-rw-r--r--libjava/java/awt/Panel.java39
-rw-r--r--libjava/java/awt/Point.java2
-rw-r--r--libjava/java/awt/Polygon.java514
-rw-r--r--libjava/java/awt/PopupMenu.java24
-rw-r--r--libjava/java/awt/Rectangle.java2
-rw-r--r--libjava/java/awt/RenderingHints.java439
-rw-r--r--libjava/java/awt/ScrollPane.java3
-rw-r--r--libjava/java/awt/Scrollbar.java10
-rw-r--r--libjava/java/awt/Shape.java26
-rw-r--r--libjava/java/awt/SystemColor.java58
-rw-r--r--libjava/java/awt/TextArea.java91
-rw-r--r--libjava/java/awt/TextComponent.java248
-rw-r--r--libjava/java/awt/TextField.java25
-rw-r--r--libjava/java/awt/Toolkit.java10
-rw-r--r--libjava/java/awt/Window.java15
-rw-r--r--libjava/java/awt/color/ICC_ColorSpace.java167
-rw-r--r--libjava/java/awt/color/ICC_Profile.java1173
-rw-r--r--libjava/java/awt/color/ICC_ProfileGray.java76
-rw-r--r--libjava/java/awt/color/ICC_ProfileRGB.java163
-rw-r--r--libjava/java/awt/datatransfer/Clipboard.java162
-rw-r--r--libjava/java/awt/datatransfer/ClipboardOwner.java3
-rw-r--r--libjava/java/awt/datatransfer/DataFlavor.java11
-rw-r--r--libjava/java/awt/datatransfer/FlavorTable.java4
-rw-r--r--libjava/java/awt/datatransfer/StringSelection.java33
-rw-r--r--libjava/java/awt/datatransfer/SystemFlavorMap.java4
-rw-r--r--libjava/java/awt/dnd/Autoscroll.java5
-rw-r--r--libjava/java/awt/dnd/DropTarget.java5
-rw-r--r--libjava/java/awt/dnd/DropTargetContext.java7
-rw-r--r--libjava/java/awt/dnd/DropTargetDragEvent.java5
-rw-r--r--libjava/java/awt/dnd/peer/DropTargetContextPeer.java5
-rw-r--r--libjava/java/awt/event/ActionListener.java6
-rw-r--r--libjava/java/awt/event/AdjustmentEvent.java4
-rw-r--r--libjava/java/awt/event/HierarchyBoundsAdapter.java6
-rw-r--r--libjava/java/awt/event/InputEvent.java6
-rw-r--r--libjava/java/awt/event/InvocationEvent.java4
-rw-r--r--libjava/java/awt/event/KeyEvent.java5
-rw-r--r--libjava/java/awt/event/MouseEvent.java5
-rw-r--r--libjava/java/awt/font/TextAttribute.java12
-rw-r--r--libjava/java/awt/font/TextLayout.java259
-rw-r--r--libjava/java/awt/geom/AffineTransform.java73
-rw-r--r--libjava/java/awt/geom/Arc2D.java415
-rw-r--r--libjava/java/awt/geom/Area.java3212
-rw-r--r--libjava/java/awt/geom/CubicCurve2D.java11
-rw-r--r--libjava/java/awt/geom/Ellipse2D.java225
-rw-r--r--libjava/java/awt/geom/GeneralPath.java105
-rw-r--r--libjava/java/awt/geom/Line2D.java117
-rw-r--r--libjava/java/awt/geom/PathIterator.java4
-rw-r--r--libjava/java/awt/geom/Point2D.java11
-rw-r--r--libjava/java/awt/geom/QuadCurve2D.java11
-rw-r--r--libjava/java/awt/geom/Rectangle2D.java32
-rw-r--r--libjava/java/awt/geom/RectangularShape.java2
-rw-r--r--libjava/java/awt/im/InputContext.java8
-rw-r--r--libjava/java/awt/im/spi/InputMethod.java2
-rw-r--r--libjava/java/awt/im/spi/InputMethodContext.java7
-rw-r--r--libjava/java/awt/image/AffineTransformOp.java159
-rw-r--r--libjava/java/awt/image/BandCombineOp.java168
-rw-r--r--libjava/java/awt/image/BandedSampleModel.java537
-rw-r--r--libjava/java/awt/image/BufferedImage.java26
-rw-r--r--libjava/java/awt/image/BufferedImageFilter.java110
-rw-r--r--libjava/java/awt/image/ByteLookupTable.java18
-rw-r--r--libjava/java/awt/image/ColorConvertOp.java319
-rw-r--r--libjava/java/awt/image/ColorModel.java120
-rw-r--r--libjava/java/awt/image/ComponentColorModel.java38
-rw-r--r--libjava/java/awt/image/ComponentSampleModel.java85
-rw-r--r--libjava/java/awt/image/ConvolveOp.java341
-rw-r--r--libjava/java/awt/image/CropImageFilter.java5
-rw-r--r--libjava/java/awt/image/DataBuffer.java231
-rw-r--r--libjava/java/awt/image/DataBufferByte.java115
-rw-r--r--libjava/java/awt/image/DataBufferDouble.java115
-rw-r--r--libjava/java/awt/image/DataBufferFloat.java115
-rw-r--r--libjava/java/awt/image/DataBufferInt.java118
-rw-r--r--libjava/java/awt/image/DataBufferShort.java118
-rw-r--r--libjava/java/awt/image/DataBufferUShort.java118
-rw-r--r--libjava/java/awt/image/DirectColorModel.java20
-rw-r--r--libjava/java/awt/image/IndexColorModel.java239
-rw-r--r--libjava/java/awt/image/LookupOp.java252
-rw-r--r--libjava/java/awt/image/MemoryImageSource.java60
-rw-r--r--libjava/java/awt/image/MultiPixelPackedSampleModel.java387
-rw-r--r--libjava/java/awt/image/PackedColorModel.java6
-rw-r--r--libjava/java/awt/image/PixelGrabber.java70
-rw-r--r--libjava/java/awt/image/RGBImageFilter.java25
-rw-r--r--libjava/java/awt/image/Raster.java86
-rw-r--r--libjava/java/awt/image/RasterOp.java5
-rw-r--r--libjava/java/awt/image/RescaleOp.java218
-rw-r--r--libjava/java/awt/image/SampleModel.java11
-rw-r--r--libjava/java/awt/image/ShortLookupTable.java12
-rw-r--r--libjava/java/awt/image/SinglePixelPackedSampleModel.java12
-rw-r--r--libjava/java/awt/print/Book.java14
-rw-r--r--libjava/java/awt/print/Printable.java84
-rw-r--r--libjava/java/awt/print/PrinterJob.java451
-rw-r--r--libjava/javax/swing/AbstractAction.java1
-rw-r--r--libjava/javax/swing/AbstractButton.java255
-rw-r--r--libjava/javax/swing/AbstractCellEditor.java1
-rw-r--r--libjava/javax/swing/AbstractListModel.java5
-rw-r--r--libjava/javax/swing/AbstractSpinnerModel.java2
-rw-r--r--libjava/javax/swing/ActionMap.java1
-rw-r--r--libjava/javax/swing/BorderFactory.java10
-rw-r--r--libjava/javax/swing/Box.java9
-rw-r--r--libjava/javax/swing/ButtonModel.java2
-rw-r--r--libjava/javax/swing/CellEditor.java2
-rw-r--r--libjava/javax/swing/CellRendererPane.java2
-rw-r--r--libjava/javax/swing/DebugGraphics.java1402
-rw-r--r--libjava/javax/swing/DefaultBoundedRangeModel.java3
-rw-r--r--libjava/javax/swing/DefaultButtonModel.java3
-rw-r--r--libjava/javax/swing/DefaultCellEditor.java2
-rw-r--r--libjava/javax/swing/DefaultDesktopManager.java6
-rw-r--r--libjava/javax/swing/DefaultListCellRenderer.java3
-rw-r--r--libjava/javax/swing/DefaultListSelectionModel.java5
-rw-r--r--libjava/javax/swing/DefaultSingleSelectionModel.java24
-rw-r--r--libjava/javax/swing/FocusManager.java6
-rw-r--r--libjava/javax/swing/GrayFilter.java4
-rw-r--r--libjava/javax/swing/InputMap.java1
-rw-r--r--libjava/javax/swing/InputVerifier.java72
-rw-r--r--libjava/javax/swing/JApplet.java313
-rw-r--r--libjava/javax/swing/JCheckBox.java3
-rw-r--r--libjava/javax/swing/JCheckBoxMenuItem.java3
-rw-r--r--libjava/javax/swing/JColorChooser.java5
-rw-r--r--libjava/javax/swing/JComboBox.java5
-rw-r--r--libjava/javax/swing/JComponent.java148
-rw-r--r--libjava/javax/swing/JDesktopPane.java18
-rw-r--r--libjava/javax/swing/JDialog.java9
-rw-r--r--libjava/javax/swing/JEditorPane.java15
-rw-r--r--libjava/javax/swing/JFileChooser.java3
-rw-r--r--libjava/javax/swing/JFormattedTextField.java1
-rw-r--r--libjava/javax/swing/JFrame.java341
-rw-r--r--libjava/javax/swing/JInternalFrame.java34
-rw-r--r--libjava/javax/swing/JLabel.java6
-rw-r--r--libjava/javax/swing/JLayeredPane.java2
-rw-r--r--libjava/javax/swing/JList.java5
-rw-r--r--libjava/javax/swing/JMenu.java28
-rw-r--r--libjava/javax/swing/JMenuBar.java24
-rw-r--r--libjava/javax/swing/JMenuItem.java12
-rw-r--r--libjava/javax/swing/JOptionPane.java6
-rw-r--r--libjava/javax/swing/JPanel.java3
-rw-r--r--libjava/javax/swing/JPasswordField.java334
-rw-r--r--libjava/javax/swing/JPopupMenu.java9
-rw-r--r--libjava/javax/swing/JRadioButton.java191
-rw-r--r--libjava/javax/swing/JRadioButtonMenuItem.java5
-rw-r--r--libjava/javax/swing/JRootPane.java35
-rw-r--r--libjava/javax/swing/JScrollBar.java2
-rw-r--r--libjava/javax/swing/JScrollPane.java24
-rw-r--r--libjava/javax/swing/JSpinner.java89
-rw-r--r--libjava/javax/swing/JSplitPane.java3
-rw-r--r--libjava/javax/swing/JTabbedPane.java3
-rw-r--r--libjava/javax/swing/JTable.java53
-rw-r--r--libjava/javax/swing/JTextArea.java256
-rw-r--r--libjava/javax/swing/JTextField.java148
-rw-r--r--libjava/javax/swing/JTextPane.java2
-rw-r--r--libjava/javax/swing/JToggleButton.java177
-rw-r--r--libjava/javax/swing/JToolBar.java6
-rw-r--r--libjava/javax/swing/JToolTip.java3
-rw-r--r--libjava/javax/swing/JTree.java214
-rw-r--r--libjava/javax/swing/JViewport.java53
-rw-r--r--libjava/javax/swing/JWindow.java8
-rw-r--r--libjava/javax/swing/ListModel.java1
-rw-r--r--libjava/javax/swing/LookAndFeel.java3
-rw-r--r--libjava/javax/swing/MenuSelectionManager.java5
-rw-r--r--libjava/javax/swing/ProgressMonitorInputStream.java3
-rw-r--r--libjava/javax/swing/RepaintManager.java9
-rw-r--r--libjava/javax/swing/RootPaneContainer.java3
-rw-r--r--libjava/javax/swing/ScrollPaneLayout.java4
-rw-r--r--libjava/javax/swing/SpinnerListModel.java296
-rw-r--r--libjava/javax/swing/SpinnerModel.java69
-rw-r--r--libjava/javax/swing/SpinnerNumberModel.java57
-rw-r--r--libjava/javax/swing/SpringLayout.java5
-rw-r--r--libjava/javax/swing/SwingUtilities.java174
-rw-r--r--libjava/javax/swing/Timer.java3
-rw-r--r--libjava/javax/swing/ToolTipManager.java19
-rw-r--r--libjava/javax/swing/TransferHandler.java60
-rw-r--r--libjava/javax/swing/UIDefaults.java5
-rw-r--r--libjava/javax/swing/UIManager.java110
-rw-r--r--libjava/javax/swing/border/MatteBorder.java4
-rw-r--r--libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java5
-rw-r--r--libjava/javax/swing/colorchooser/ColorSelectionModel.java3
-rw-r--r--libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java5
-rw-r--r--libjava/javax/swing/colorchooser/DefaultHSBChooserPanel.java48
-rw-r--r--libjava/javax/swing/colorchooser/DefaultPreviewPanel.java3
-rw-r--r--libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java66
-rw-r--r--libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java3
-rw-r--r--libjava/javax/swing/event/AncestorEvent.java3
-rw-r--r--libjava/javax/swing/event/HyperlinkEvent.java3
-rw-r--r--libjava/javax/swing/event/InternalFrameEvent.java3
-rw-r--r--libjava/javax/swing/event/MenuDragMouseEvent.java7
-rw-r--r--libjava/javax/swing/event/MenuKeyEvent.java5
-rw-r--r--libjava/javax/swing/event/TableColumnModelEvent.java5
-rw-r--r--libjava/javax/swing/event/TableModelEvent.java3
-rw-r--r--libjava/javax/swing/event/TreeExpansionEvent.java5
-rw-r--r--libjava/javax/swing/event/TreeModelEvent.java5
-rw-r--r--libjava/javax/swing/event/TreeSelectionEvent.java2
-rw-r--r--libjava/javax/swing/event/TreeWillExpandListener.java3
-rw-r--r--libjava/javax/swing/event/UndoableEditEvent.java2
-rw-r--r--libjava/javax/swing/filechooser/FileView.java3
-rw-r--r--libjava/javax/swing/plaf/BorderUIResource.java20
-rw-r--r--libjava/javax/swing/plaf/ComponentUI.java6
-rw-r--r--libjava/javax/swing/plaf/FileChooserUI.java4
-rw-r--r--libjava/javax/swing/plaf/IconUIResource.java6
-rw-r--r--libjava/javax/swing/plaf/ListUI.java6
-rw-r--r--libjava/javax/swing/plaf/PopupMenuUI.java5
-rw-r--r--libjava/javax/swing/plaf/SplitPaneUI.java6
-rw-r--r--libjava/javax/swing/plaf/TabbedPaneUI.java6
-rw-r--r--libjava/javax/swing/plaf/TextUI.java6
-rw-r--r--libjava/javax/swing/plaf/TreeUI.java6
-rw-r--r--libjava/javax/swing/plaf/basic/BasicArrowButton.java351
-rw-r--r--libjava/javax/swing/plaf/basic/BasicBorders.java8
-rw-r--r--libjava/javax/swing/plaf/basic/BasicButtonUI.java5
-rw-r--r--libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java5
-rw-r--r--libjava/javax/swing/plaf/basic/BasicColorChooserUI.java10
-rw-r--r--libjava/javax/swing/plaf/basic/BasicComboBoxEditor.java3
-rw-r--r--libjava/javax/swing/plaf/basic/BasicComboBoxRenderer.java4
-rw-r--r--libjava/javax/swing/plaf/basic/BasicComboBoxUI.java31
-rw-r--r--libjava/javax/swing/plaf/basic/BasicComboPopup.java280
-rw-r--r--libjava/javax/swing/plaf/basic/BasicDesktopIconUI.java4
-rw-r--r--libjava/javax/swing/plaf/basic/BasicDesktopPaneUI.java27
-rw-r--r--libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java6
-rw-r--r--libjava/javax/swing/plaf/basic/BasicIconFactory.java10
-rw-r--r--libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java33
-rw-r--r--libjava/javax/swing/plaf/basic/BasicInternalFrameUI.java16
-rw-r--r--libjava/javax/swing/plaf/basic/BasicListUI.java5
-rw-r--r--libjava/javax/swing/plaf/basic/BasicLookAndFeel.java13
-rw-r--r--libjava/javax/swing/plaf/basic/BasicMenuBarUI.java24
-rw-r--r--libjava/javax/swing/plaf/basic/BasicMenuItemUI.java31
-rw-r--r--libjava/javax/swing/plaf/basic/BasicMenuUI.java14
-rw-r--r--libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java19
-rw-r--r--libjava/javax/swing/plaf/basic/BasicPasswordFieldUI.java6
-rw-r--r--libjava/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java10
-rw-r--r--libjava/javax/swing/plaf/basic/BasicPopupMenuUI.java35
-rw-r--r--libjava/javax/swing/plaf/basic/BasicProgressBarUI.java5
-rw-r--r--libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java5
-rw-r--r--libjava/javax/swing/plaf/basic/BasicRootPaneUI.java4
-rw-r--r--libjava/javax/swing/plaf/basic/BasicScrollBarUI.java416
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSeparatorUI.java16
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSliderUI.java11
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSpinnerUI.java5
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSplitPaneDivider.java121
-rw-r--r--libjava/javax/swing/plaf/basic/BasicSplitPaneUI.java75
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java144
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTableHeaderUI.java85
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTableUI.java14
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTextAreaUI.java1
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTextFieldUI.java2
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTextPaneUI.java69
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTextUI.java33
-rw-r--r--libjava/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java11
-rw-r--r--libjava/javax/swing/plaf/basic/BasicToolBarUI.java14
-rw-r--r--libjava/javax/swing/plaf/basic/BasicToolTipUI.java69
-rw-r--r--libjava/javax/swing/plaf/basic/BasicTreeUI.java171
-rw-r--r--libjava/javax/swing/plaf/basic/BasicViewportUI.java66
-rw-r--r--libjava/javax/swing/plaf/basic/ComboPopup.java6
-rw-r--r--libjava/javax/swing/plaf/metal/MetalLookAndFeel.java4
-rw-r--r--libjava/javax/swing/table/AbstractTableModel.java4
-rw-r--r--libjava/javax/swing/table/DefaultTableCellRenderer.java4
-rw-r--r--libjava/javax/swing/table/DefaultTableColumnModel.java36
-rw-r--r--libjava/javax/swing/table/DefaultTableModel.java3
-rw-r--r--libjava/javax/swing/table/JTableHeader.java78
-rw-r--r--libjava/javax/swing/table/TableCellEditor.java7
-rw-r--r--libjava/javax/swing/table/TableCellRenderer.java5
-rw-r--r--libjava/javax/swing/table/TableColumn.java184
-rw-r--r--libjava/javax/swing/table/TableColumnModel.java5
-rw-r--r--libjava/javax/swing/text/AbstractDocument.java3
-rw-r--r--libjava/javax/swing/text/AttributeSet.java4
-rw-r--r--libjava/javax/swing/text/Caret.java2
-rw-r--r--libjava/javax/swing/text/DefaultCaret.java1
-rw-r--r--libjava/javax/swing/text/DefaultEditorKit.java5
-rw-r--r--libjava/javax/swing/text/DefaultHighlighter.java15
-rw-r--r--libjava/javax/swing/text/Document.java2
-rw-r--r--libjava/javax/swing/text/DocumentFilter.java42
-rw-r--r--libjava/javax/swing/text/EditorKit.java5
-rw-r--r--libjava/javax/swing/text/FieldView.java2
-rw-r--r--libjava/javax/swing/text/GapContent.java2
-rw-r--r--libjava/javax/swing/text/Highlighter.java3
-rw-r--r--libjava/javax/swing/text/JTextComponent.java62
-rw-r--r--libjava/javax/swing/text/LayeredHighlighter.java4
-rw-r--r--libjava/javax/swing/text/NavigationFilter.java30
-rw-r--r--libjava/javax/swing/text/PasswordView.java138
-rw-r--r--libjava/javax/swing/text/PlainDocument.java53
-rw-r--r--libjava/javax/swing/text/PlainView.java10
-rw-r--r--libjava/javax/swing/text/SimpleAttributeSet.java9
-rw-r--r--libjava/javax/swing/text/StyleConstants.java88
-rw-r--r--libjava/javax/swing/text/StyleContext.java8
-rw-r--r--libjava/javax/swing/text/StyledEditorKit.java3
-rw-r--r--libjava/javax/swing/text/TextAction.java3
-rw-r--r--libjava/javax/swing/text/Utilities.java32
-rw-r--r--libjava/javax/swing/text/View.java2
-rw-r--r--libjava/javax/swing/text/html/HTML.java5
-rw-r--r--libjava/javax/swing/tree/AbstractLayoutCache.java303
-rw-r--r--libjava/javax/swing/tree/DefaultTreeCellEditor.java888
-rw-r--r--libjava/javax/swing/tree/DefaultTreeCellRenderer.java160
-rw-r--r--libjava/javax/swing/tree/DefaultTreeModel.java720
-rw-r--r--libjava/javax/swing/tree/DefaultTreeSelectionModel.java865
-rw-r--r--libjava/javax/swing/tree/FixedHeightLayoutCache.java3
-rw-r--r--libjava/javax/swing/tree/TreeCellEditor.java8
-rw-r--r--libjava/javax/swing/tree/TreeCellRenderer.java5
-rw-r--r--libjava/javax/swing/tree/TreeSelectionModel.java3
-rw-r--r--libjava/javax/swing/tree/VariableHeightLayoutCache.java3
-rw-r--r--libjava/javax/swing/undo/AbstractUndoableEdit.java6
-rw-r--r--libjava/javax/swing/undo/UndoableEditSupport.java2
-rw-r--r--libjava/jni/gtk-peer/gdkfont.h46
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c16
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c102
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c136
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (renamed from libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c)69
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c191
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c163
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c563
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c99
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c19
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c183
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c199
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c3
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c6
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c2
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c2
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c4
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c4
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c321
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c12
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c50
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c37
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c179
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c34
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c17
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c48
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c20
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c39
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c13
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c66
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c16
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c22
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c3
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c17
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c4
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c2
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c375
-rw-r--r--libjava/jni/gtk-peer/gtkpeer.h19
429 files changed, 29765 insertions, 8787 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 0b4d6f6..bc85372 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,2469 @@
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (drawImage variants):
+ Update image observer.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (createImage):
+ Start image production.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Protect
+ against negative menu bar widths.
+ (setBounds): Likewise.
+ (postConfigureEvent): Likewise.
+ * gnu/java/awt/peer/gtk/GtkImage.java (imageComplete): Don't
+ remove consumer unless only a single frame has completed.
+ * gnu/java/awt/peer/gtk/GtkImagePainter.java (GtkImagePainter):
+ Add observer parameter.
+ (setPixels): Update image observer.
+ (imageComplete): Likewise.
+ * java/applet/Applet.java (width): New field.
+ (height): Likewise.
+ (setStub): Set size if width or height field has been set.
+ (resize): If stub is null save width and height values.
+ * java/awt/Component.java (reshape): Protect against null
+ parent.
+ * java/awt/image/MemoryImageSource.java
+ (MemoryImageSource(int,int,ColorModel,byte[],int,int)):
+ Document.
+ (MemoryImageSource(int,int,ColorModel,int[],int,int)):
+ Likewise.
+ (MemoryImageSource(int,int,ColorModel,byte[],int,int,Hashtable)):
+ Reference pixel array directly, rather than creating a local
+ copy.
+ (MemoryImageSource(int,int,ColorModel,int[],int,int,Hashtable)):
+ Likewise.
+ (newPixels(int,int,int,int)): Fix for loop and array copy
+ bounds.
+ (newPixels(int,int,int,int,boolean)): Likewise.
+ (startProduction): If animated call imageComplete with
+ SINGLEFRAME.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Uncomment
+ gdk_flush lines.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
+ (drawPixels): Return if g is null or g->drawable is not a gdk
+ drawable.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/DefaultSingleSelectionModel.java,
+ javax/swing/JPasswordField.java,
+ javax/swing/tree/AbstractLayoutCache.java:
+ Reformatted and javadocs cleaned up.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Component.java:
+ Fixed argument names to match javadocs.
+ (setFont): Rewritten set property first and then fire event.
+ (setLocale): Likewise.
+ * javax/swing/text/JTextComponent.java
+ (setEditable): Likewise.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Button.java
+ (AccessibleAWTButton.getAccessibleActionDescription): Explain the
+ source of 'click'.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Checkbox.java: Remove stub comments.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Button.java
+ (AccessibleAWTButton.getAccessibleActionDescription): Return
+ 'click'.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/CardLayout.java:
+ Made some constants static.
+ (serialVersionUID): Made private.
+ (addLayoutComponent): Simplified code.
+ * java/awt/event/InputEvent.java
+ (getModifiersEx): Added missing @param tag.
+ * java/awt/image/RGBImageFilter.java
+ (filterRGBPixels): Reformatted, removed wrong @param tag.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/FieldView.java,
+ javax/swing/text/JTextComponent.java:
+ Removed debug code.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/BorderFactory.java
+ (BorderFactory): Added private constructor.
+ * javax/swing/SwingUtilities.java
+ (SwingUtilities): Likewise.
+ (computeStringWidth): New method.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/color/ICC_Profile.java
+ (icSigNamedColorTag): Removed.
+ * java/awt/datatransfer/DataFlavor.java
+ (isMimeTypeEqual): Made final.
+ * java/awt/image/AffineTransformOp.java:
+ Reworked javadocs.
+ (TYPE_BICUBIC): Added @since tag.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Checkbox.java (AccessibleAWTCheckBox): Remove todo
+ comments.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Checkbox.java (itemStateChanged): Implement function.
+ (getAccessibleContext): Add AccessibleAWTCheckBox to item listeners.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/Polygon.java (contains): Reimplemented.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/print/PrinterJob.java: Reformatted.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/AffineTransformOp.java,
+ java/awt/image/ColorConvertOp.java,
+ java/awt/image/LookupOp.java,
+ java/awt/image/RescaleOp.java:
+ Added final keywords where they belong.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/CardLayout.java,
+ java/awt/Component.java,
+ java/awt/Font.java,
+ java/awt/image/SinglePixelPackedSampleModel.java:
+ Fixed javadocs and argument names all over.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/DataBufferShort.java: Fixed file header.
+ * java/awt/image/DataBufferUShort.java: Likewise.
+ (DataBufferUShort): Throw NullPointerException if dataArray is null.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/Arc2D.java
+ (setAngleStart): Corrected (wrong sign on atan2 y parameter).
+ (setAngles): Likewise.
+ (containsAngle): Return false on zero extent, don't include
+ final angle.
+ (contains): Treat OPEN-type arcs like CHORD ones, not as PIE
+ ones.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/AffineTransform.java,
+ (inverseTransform): Fixed bug and simplified code.
+ (createTransformedShape): Return null on null parameter.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/color/ICC_ColorSpace.java,
+ java/awt/color/ICC_Profile.java,
+ java/awt/color/ICC_ProfileGray.java,
+ java/awt/color/ICC_ProfileRGB.java:
+ Re-indent copyright header to be standardish.
+ * java/awt/datatransfer/StringSelection.java:
+ Reformatted.
+ * java/awt/geom/Area.java
+ (EPSILON): Made static.
+ (RS_EPSILON): Likewise.
+ (PE_EPSILON): Likewide.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/SwingUtilities.java:
+ (computeDifference): Implemented
+ (computeIntersection): Likewise
+ (computeUnion): Likewise
+ (isRectangleContainingRectangle): Likewise
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/BasicStroke.java,
+ java/awt/Button.java,
+ java/awt/Canvas.java,
+ java/awt/CheckboxMenuItem.java,
+ java/awt/Container.java,
+ java/awt/EventQueue.java,
+ java/awt/FileDialog.java,
+ java/awt/FlowLayout.java,
+ java/awt/FontMetrics.java,
+ java/awt/Graphics.java,
+ java/awt/GridLayout.java,
+ java/awt/KeyboardFocusManager.java,
+ java/awt/Label.java,
+ java/awt/LayoutManager2.java,
+ java/awt/List.java,
+ java/awt/MenuBar.java,
+ java/awt/Scrollbar.java,
+ java/awt/Toolkit.java,
+ java/awt/Window.java,
+ java/awt/datatransfer/DataFlavor.java,
+ java/awt/datatransfer/FlavorTable.java,
+ java/awt/event/ActionListener.java,
+ java/awt/event/HierarchyBoundsAdapter.java,
+ java/awt/geom/Arc2D.java,
+ java/awt/geom/Rectangle2D.java,
+ java/awt/geom/RectangularShape.java,
+ java/awt/im/spi/InputMethod.java,
+ java/awt/image/ByteLookupTable.java,
+ java/awt/image/ColorModel.java,
+ java/awt/image/DirectColorModel.java,
+ java/awt/image/ShortLookupTable.java,
+ java/awt/print/Book.java:
+ Fixed javadocs and method argument names all over.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GdkFontPeer.java
+ (buildString): Optimise String building.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/TextArea.java (AccessibleAWTTextArea,
+ getAccessibleContext): Implement.
+ * java/awt/TextField.java (AccessibleAWTTextField,
+ getAccessibleContext): Implement.
+
+2004-11-30 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.lo):
+ Fixed typo.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Menu.java (AccessibleAWTMenu, getAccessibleContext):
+ Implement.
+ * java/awt/PopupMenu.java (AccessibleAWTMenu, getAccessibleContext):
+ Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/print/PrinterJob.java (lookupPrintServices,
+ getPrintService, setPrintService): Implement.
+ (lookupStreamPrintServices): Add commented out implementation.
+ (printer): New field.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/ToolTipManager.java (mouseMoved): Set currentComponent
+ when not yet set.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/GeneralPath.java (evaluateCrossings):
+ Fixed epsilon value, should always be nonzero.
+
+2004-11-30 Paul Jenner <psj.home@ntlworld.com>
+
+ * java/awt/image/Raster.java
+ (createPackedRaster): Implemented.
+
+2004-11-30 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ Listen to focus events, indicate focus via caret.
+ * javax/swing/text/GapContent.java (getString): Return substring.
+ * javax/swing/text/PlainDocument.java (reindex): New method.
+ (createDefaultRoot): Call it.
+ (insertUpdate): Likewise.
+ (removeUpdate): Likewise.
+ * javax/swing/text/Utilities.java (drawTabbedText): Always advance
+ on tab and newline, even if no painting happens.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * Makefile.am: List peer JNI header: Java source file
+ dependencies explicitly. Likewise for JNI .lo: JNI header
+ dependencies.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Graydon Hoare <graydon@redhat.com>
+
+ * Makefile.am: Add entry for BasicTextPaneUI.java
+ * Makefile.in: Regenerate.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (GdkGraphics2D): Set clip after transform.
+ (drawImage): Protect against null image.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java
+ (setIconImage): Protect against non-GtkImage args.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java
+ (checkImage): Protect against non-GtkImage args.
+ * java/awt/print/PrinterJob.java:
+ (print): Add variant taking PrintRequestAttributeSet.
+ (printDialog): Likewise.
+ * javax/swing/JComponent.java:
+ (transferHandler): New field.
+ (getComponentGraphics): Build new Graphics for each sub-paint.
+ (getTransferHandler): New method.
+ (setTransferHandler): New method.
+ * javax/swing/JDesktopPane.java
+ (setDragMode): Force LIVE_DRAG_MODE.
+ * javax/swing/JMenuItem.java
+ (menuSelectionChanged): Protect against null parent.
+ * javax/swing/JTable.java (setDefaultRenderer): New method.
+ * javax/swing/JTree.java: Get basic ctors and UI working.
+ * javax/swing/JViewport.java (JViewport): Set scroll mode.
+ * javax/swing/RepaintManager.java
+ (addDirtyRegion): Skip empty regions.
+ * javax/swing/ScrollPaneLayout.java (minimumLayoutSize): Do not
+ bound scrollpane minimum by central view minimum.
+ * javax/swing/ToolTipManager.java
+ (showTip): Guard against null component.
+ * javax/swing/TransferHandler.java: Stub out.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ Add entry for TextPaneUI, change Tree icons to pngs.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ (installDefaults): Set text position and alignment.
+ (paintMenuItem): Layout icon with normal compound function.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java:
+ (getMaximumSize): Delete.
+ (getMinimumSize): Delete.
+ (getPreferredSize): Use column model's total width.
+ * javax/swing/plaf/basic/BasicTextPaneUI.java: New file.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (modelChanged): Make resilient against nulls.
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Add some simplistic config / painting functions.
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (paintSimple): Add new non-backingstore paint mode.
+ (paintBackingStore): Split out backing store code.
+ (paint): Switch on painting mode.
+ * javax/swing/text/SimpleAttributeSet.java
+ (SimpleAttributeSet): Resist nulls.
+ * javax/swing/tree/DefaultTreeCellRenderer.java: Implement.
+ * javax/swing/tree/DefaultTreeModel.java: Partially implement.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (setFont):
+ Set pango context's description and language.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/image/LookupOp.java: Comments and indentation fixes.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Checkbox.java (AccessibleAWTCheckBox): Implement.
+ (getAccessibleContext): Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/TextComponent.java (AccessibleAWTTextComponent):
+ Implement.
+ (getIndexAtPoint, getCharacterBounds): New methods.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Button.java (AccessibleAWTButton): Implement.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+ (filenameFilterCallback): Made static.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (cairoShowGlyphs) Removed.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/color/RgbProfileConverter.java (RgbProfileConverter):
+ Don't invert matrix when reverse CLUT is available.
+ * gnu/java/awt/color/LinearRGBConverter.java: Documentation update.
+ * java/awt/color/ICC_ColorSpace.java: Likewise.
+ * java/awt/color/ICC_Profile.java: Likewise.
+ * java/awt/color/ICC_ProfileGray.java: Likewise.
+ * java/awt/color/ICC_ProfileRGB.java: Likewise.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/MenuItem.java (AccessibleAWTMenuItem): Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/Choice.java (AccessibleAWTChoice): Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/BandedSampleModel.java (scanlineStride): Remove
+ field hiding ComponentSampleModel.scanlineStride.
+
+2004-11-30 Noa Resare <noa@resare.com>
+
+ * java/awt/geom/GeneralPath.java (currentSegment):
+ Fix typo in transform.transform() invocation.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (createImage): Created bitmap should be filled with bg color
+
+2004-11-30 Noa Resare <noa@resare.com>
+
+ * java/awt/Choice.java (add):
+ Implement correct selection behavior when peer == null.
+ (insert): Likewise.
+ (remove): Likewise.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GtkChoicePeer.java (GtkChoicePeer):
+ Call select() when Choice has a selected item.
+
+2004-11-30 Michael Koch <address@bogus.example.com>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.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_GdkGraphics2D.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_GdkTextLayout.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
+ 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_GtkMenuBarPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c:
+ Fixed method names to start at begin of line. This is desired by GNU
+ coding style guide.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (gtkWidgetSetVisible): Unused. Removed.
+ (connectJObject): Likewise.
+ * gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
+ (gtkScrolledWindowSetScrollPosition): Commented out.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+ (Java_gnu_java_awt_peer_gtk_GdkTextLayout_setText): Installed and
+ renamed from Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setText.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+ (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setText): Removed.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+ (init_dpi_conversion_factor): Correct prototype.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/image/ConvolveOp.java: Added missing
+ copyright notice.
+
+2004-11-30 Robert Schuster <theBohemian@gmx.net>
+
+ Fixes bug #10908
+ * gnu/java/beans/IntrospectionIncubator.java:
+ (addMethod): static methods are discarded now, too.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (awt_java_source_files): Add new gnu/java/awt/color
+ java source files.
+ * Makefile.in: Regenerated.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/color/CieXyzConverter.java,
+ gnu/java/awt/color/GrayScaleConverter.java,
+ gnu/java/awt/color/SrgbConverter.java,
+ gnu/java/awt/color/ClutProfileConverter.java,
+ gnu/java/awt/color/LinearRGBConverter.java,
+ gnu/java/awt/color/TagEntry.java,
+ gnu/java/awt/color/ColorLookUpTable.java,
+ gnu/java/awt/color/ProfileHeader.java,
+ gnu/java/awt/color/ToneReproductionCurve.java,
+ gnu/java/awt/color/ColorSpaceConverter.java,
+ gnu/java/awt/color/PyccConverter.java,
+ gnu/java/awt/color/GrayProfileConverter.java,
+ gnu/java/awt/color/RgbProfileConverter.java:
+ New files.
+ * java/awt/color/ICC_ColorSpace.java,
+ java/awt/color/ICC_Profile.java,
+ java/awt/color/ICC_ProfileGray.java,
+ java/awt/color/ICC_ProfileRGB.java:
+ Implemented (sans PhotoYCC color space).
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/AffineTransformOp.java (filter): Implement
+ bilinear interpolation for Rasters.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java (IndexColorModel): Actually
+ use the provided colormap. Throw documented exceptions. Document
+ exceptions.
+
+2004-11-30 Paul Jenner <psj.home@ntlworld.com>
+
+ * java/awt/image/IndexColorModel.java (IndexColorModel): Fix
+ constructor.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/AffineTransformOp.java: Add TYPE_BICUBIC.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/AffineTransformOp.java (filter): Implement Raster
+ filtering.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ComponentSampleModel.java (getDataElements,
+ setDataElements): Implement SHORT, FLOAT, and INT transfer types.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Font.java (name): New field.
+ (size): Likewise.
+ (style): Likewise.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/Raster.java (createBandedRaster): Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ConvolveOp.java: New class.
+ * Makefile.am: Add ConvolveOp.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/RescaleOp.java (BandCombineOp, ColorConvertOp,
+ LookupOp, RescaleOp): Fix loop bounds.
+
+2004-11-30 jlquinn <jlquinn@optonline.net>
+
+ * Makefile.am: Fix typo in BandCombineOp.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/BandCombineOp.java: New class.
+ * Makefile.am: Add BandCombineOp.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/LookupOp.java: New class.
+ * Makefile.am: Add LookupOp.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/SampleModel.java (createSubsetSampleModel): Add
+ javadocs.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ColorModel.java (cloneColorModel): Fix line
+ wrap. Use Boolean.valueOf.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (releasePeerGraphicsResource): Fixed typo in method name.
+ * gnu/java/awt/peer/gtk/GdkFontPeer.java
+ (finalize): Fixed typo in releasePeerGraphicsResource.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/font/TextAttribute.java
+ (RUN_DIRECTION_LTR): Initialie with static value instead of
+ calculating it.
+ (RUN_DIRECTION_RTL): Likewise.
+ (STRIKETHROUGH_ON): Likewise.
+ (SWAP_COLORS_ON): Likewise.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ColorConvertOp.java: New class.
+ * java/awt/image/ColorModel.java (cloneColorModel): New method.
+ * Makefile.am: Add ColorConvertOp.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/DefaultKeyboardFocusManager.java (dispatchEvent):
+ Track Window focus owner on FOCUS_GAINED events.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+ (nativeSetIconImage): Rename to nativeSetIconImageFromDecoder.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
+ (Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun):
+ Fix pointer warning.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter):
+ Fix pointer warning.
+
+ * jni/gtk-peer/gtkpeer.h: Introduce widget_union to fix type punned
+ warnings.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect): Use widget_union
+ to fix type punned pointer warning.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (pre_event_handler):
+ Likewise.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (window_get_new_state): Introduce unions to fix warnings as above.
+ (window_property_changed_cb): Likewise.
+ (window_active_state_change_cb): Mark unused variables unused.
+ (window_focus_state_change_cb): Likewise.
+ (window_focus_in_cb): Likewise.
+ (window_focus_out_cb): Likewise.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont): Convert
+ PangoFontMap correctly with PANGO_FT2FONT_MAP macro.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JMenuBar.java
+ (updateUI): Simplified.
+ * javax/swing/tree/DefaultTreeSelectionModel.java:
+ Reorganized import statements.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/font/TextAttribute.java,
+ javax/swing/JComponent.java,
+ javax/swing/JInternalFrame.java,
+ javax/swing/table/TableColumn.java,
+ javax/swing/text/StyleConstants.java:
+ Replaced "new Boolean(boolean)" with "Boolean.valueOf(boolean)".
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/tree/DefaultTreeCellEditor.java,
+ javax/swing/tree/DefaultTreeModel.java,
+ javax/swing/tree/DefaultTreeSelectionModel.java:
+ Jalopied.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (EditorContainer.EditorContainer): Fixed arguments.
+ (EditorContainer.EditorContainer): New method.
+ (DefaultTextField.DefaultTextField): Fixed arguments, implemented.
+ (DefaultTextField.getBorder): Implemented.
+ (listenerList): New field.
+ (addCellEditorListener): Implemented.
+ (removeCellEditorListener): Implemented.
+ (getCellEditorListeners): New method.
+ * javax/swing/tree/DefaultTreeModel.java
+ (addTreeModelListener): Fixed javadoc.
+ (removeTreeModelListener): Likewise.
+ (getTreeModelListeners): New method.
+ (fireTreeNodesChanged): Implemented.
+ (fireTreeNodesInserted): Likewise.
+ (fireTreeNodesRemoved): Likewise.
+ (fireTreeStructureChanged): Likewise.
+ (getListeners): Fixed javadoc.
+ * javax/swing/tree/DefaultTreeSelectionModel.java
+ (addTreeSelectionListener): Implemented.
+ (removeTreeSelectionListener): Likewise.
+ (fireValueChanged): Likewise.
+ (getListeners): Likewise.
+ (addPropertyChangeListener): Likewise.
+ (removePropertyChangeListener): Likewise.
+ (getTreeSelectionListeners): New method.
+ (getPropertyChangeListeners): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (maximumThumbSize): Removed static keyword.
+ (minimumThumbSize): Likewise.
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (CloseAction): Made public.
+ (IconifyAction): Likewise.
+ (MaximizeAction): Likewise.
+ (MoveAction): Likewise.
+ (RestoreAction): Likewise.
+ (SizeAction): Likewise.
+ (SystemMenuBar): Likewise.
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (TrackListener): Likewise.
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (KeyboardDownRightHandler): Likewise.
+ (KeyboardEndHandler): Likewise.
+ (KeyboardHomeHandler): Likewise.
+ (KeyboardResizeToggleHandler): Likewise.
+ (KeyboardUpLeftHandler): Likewise.
+ (PropertyHandler): Likewise.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (PropertyChangeHandler): Likewise.
+ (TabSelectionHandler): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/JTextComponent.java
+ (getKeymap): Made public.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JEditorPane.java
+ (getStream): Throws IOException.
+ (read): Likewise.
+ * javax/swing/JRootPane.java
+ (createContentPane): Fixed return type.
+ * javax/swing/JSpinner.java
+ (commitEdit): Throws ParseException.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (serialVersionUID): New field.
+ * javax/swing/table/TableColumn.java
+ (resizedPostingDisableCount): Added @deprecated tag.
+ (disableResizedPosting): Likewise.
+ (enableResizedPosting): Likewise.
+ * javax/swing/text/Document.java
+ (TitleProperty): Fixed value.
+ * javax/swing/tree/TreeCellEditor.java
+ (TreeCellEditor): Extends CellEditor.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JWindow.java
+ javax/swing/SpinnerModel.java
+ javax/swing/Timer.java
+ javax/swing/event/MenuKeyEvent.java
+ javax/swing/plaf/basic/BasicButtonUI.java
+ javax/swing/plaf/basic/BasicIconFactory.java
+ javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ javax/swing/text/AttributeSet.java
+ javax/swing/text/Highlighter.java
+ javax/swing/text/StyleConstants.java
+ javax/swing/tree/TreeCellEditor.java:
+ Removed redundant and reordered modifiers.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicToolTipUI.java:
+ Reformatted copyright header.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractAction.java,
+ javax/swing/AbstractButton.java,
+ javax/swing/AbstractCellEditor.java,
+ javax/swing/AbstractListModel.java,
+ javax/swing/AbstractSpinnerModel.java,
+ javax/swing/ActionMap.java,
+ javax/swing/BorderFactory.java,
+ javax/swing/Box.java,
+ javax/swing/ButtonModel.java,
+ javax/swing/CellEditor.java,
+ javax/swing/CellRendererPane.java,
+ javax/swing/DefaultBoundedRangeModel.java,
+ javax/swing/DefaultButtonModel.java,
+ javax/swing/DefaultCellEditor.java,
+ javax/swing/DefaultDesktopManager.java,
+ javax/swing/DefaultListCellRenderer.java,
+ javax/swing/DefaultListSelectionModel.java,
+ javax/swing/DefaultSingleSelectionModel.java,
+ javax/swing/GrayFilter.java,
+ javax/swing/InputMap.java,
+ javax/swing/JApplet.java,
+ javax/swing/JCheckBoxMenuItem.java,
+ javax/swing/JColorChooser.java,
+ javax/swing/JComboBox.java,
+ javax/swing/JComponent.java,
+ javax/swing/JDesktopPane.java,
+ javax/swing/JDialog.java,
+ javax/swing/JEditorPane.java,
+ javax/swing/JFileChooser.java,
+ javax/swing/JFormattedTextField.java,
+ javax/swing/JFrame.java,
+ javax/swing/JInternalFrame.java,
+ javax/swing/JLabel.java,
+ javax/swing/JLayeredPane.java,
+ javax/swing/JList.java,
+ javax/swing/JMenu.java,
+ javax/swing/JMenuBar.java,
+ javax/swing/JMenuItem.java,
+ javax/swing/JOptionPane.java,
+ javax/swing/JPanel.java,
+ javax/swing/JPasswordField.java,
+ javax/swing/JPopupMenu.java,
+ javax/swing/JRadioButtonMenuItem.java,
+ javax/swing/JRootPane.java,
+ javax/swing/JSpinner.java,
+ javax/swing/JSplitPane.java,
+ javax/swing/JTabbedPane.java,
+ javax/swing/JTable.java,
+ javax/swing/JTextArea.java,
+ javax/swing/JTextPane.java,
+ javax/swing/JToggleButton.java,
+ javax/swing/JToolBar.java,
+ javax/swing/JToolTip.java,
+ javax/swing/JTree.java,
+ javax/swing/JViewport.java,
+ javax/swing/ListModel.java,
+ javax/swing/LookAndFeel.java,
+ javax/swing/MenuSelectionManager.java,
+ javax/swing/ProgressMonitorInputStream.java,
+ javax/swing/RepaintManager.java,
+ javax/swing/RootPaneContainer.java,
+ javax/swing/ScrollPaneLayout.java,
+ javax/swing/SpringLayout.java,
+ javax/swing/SwingUtilities.java,
+ javax/swing/Timer.java,
+ javax/swing/ToolTipManager.java,
+ javax/swing/UIDefaults.java,
+ javax/swing/UIManager.java,
+ javax/swing/border/MatteBorder.java,
+ javax/swing/colorchooser/AbstractColorChooserPanel.java,
+ javax/swing/colorchooser/ColorSelectionModel.java,
+ javax/swing/colorchooser/DefaultColorSelectionModel.java,
+ javax/swing/colorchooser/DefaultHSBChooserPanel.java,
+ javax/swing/colorchooser/DefaultPreviewPanel.java,
+ javax/swing/colorchooser/DefaultRGBChooserPanel.java,
+ javax/swing/colorchooser/DefaultSwatchChooserPanel.java,
+ javax/swing/event/AncestorEvent.java,
+ javax/swing/event/HyperlinkEvent.java,
+ javax/swing/event/InternalFrameEvent.java,
+ javax/swing/event/MenuDragMouseEvent.java,
+ javax/swing/event/TableColumnModelEvent.java,
+ javax/swing/event/TableModelEvent.java,
+ javax/swing/event/TreeExpansionEvent.java,
+ javax/swing/event/TreeModelEvent.java,
+ javax/swing/event/TreeSelectionEvent.java,
+ javax/swing/event/TreeWillExpandListener.java,
+ javax/swing/event/UndoableEditEvent.java,
+ javax/swing/filechooser/FileView.java,
+ javax/swing/plaf/BorderUIResource.java,
+ javax/swing/plaf/ComponentUI.java,
+ javax/swing/plaf/FileChooserUI.java,
+ javax/swing/plaf/IconUIResource.java,
+ javax/swing/plaf/ListUI.java,
+ javax/swing/plaf/PopupMenuUI.java,
+ javax/swing/plaf/SplitPaneUI.java,
+ javax/swing/plaf/TabbedPaneUI.java,
+ javax/swing/plaf/TextUI.java,
+ javax/swing/plaf/TreeUI.java,
+ javax/swing/plaf/basic/BasicArrowButton.java,
+ javax/swing/plaf/basic/BasicBorders.java,
+ javax/swing/plaf/basic/BasicButtonUI.java,
+ javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java,
+ javax/swing/plaf/basic/BasicColorChooserUI.java,
+ javax/swing/plaf/basic/BasicComboBoxEditor.java,
+ javax/swing/plaf/basic/BasicComboBoxRenderer.java,
+ javax/swing/plaf/basic/BasicComboBoxUI.java,
+ javax/swing/plaf/basic/BasicComboPopup.java,
+ javax/swing/plaf/basic/BasicDesktopIconUI.java,
+ javax/swing/plaf/basic/BasicDesktopPaneUI.java,
+ javax/swing/plaf/basic/BasicIconFactory.java,
+ javax/swing/plaf/basic/BasicInternalFrameTitlePane.java,
+ javax/swing/plaf/basic/BasicInternalFrameUI.java,
+ javax/swing/plaf/basic/BasicListUI.java,
+ javax/swing/plaf/basic/BasicLookAndFeel.java,
+ javax/swing/plaf/basic/BasicMenuBarUI.java,
+ javax/swing/plaf/basic/BasicMenuItemUI.java,
+ javax/swing/plaf/basic/BasicMenuUI.java,
+ javax/swing/plaf/basic/BasicOptionPaneUI.java,
+ javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java,
+ javax/swing/plaf/basic/BasicPopupMenuUI.java,
+ javax/swing/plaf/basic/BasicProgressBarUI.java,
+ javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java,
+ javax/swing/plaf/basic/BasicRootPaneUI.java,
+ javax/swing/plaf/basic/BasicScrollBarUI.java,
+ javax/swing/plaf/basic/BasicSeparatorUI.java,
+ javax/swing/plaf/basic/BasicSliderUI.java,
+ javax/swing/plaf/basic/BasicSpinnerUI.java,
+ javax/swing/plaf/basic/BasicSplitPaneDivider.java,
+ javax/swing/plaf/basic/BasicSplitPaneUI.java,
+ javax/swing/plaf/basic/BasicTabbedPaneUI.java,
+ javax/swing/plaf/basic/BasicTableHeaderUI.java,
+ javax/swing/plaf/basic/BasicTableUI.java,
+ javax/swing/plaf/basic/BasicTextAreaUI.java,
+ javax/swing/plaf/basic/BasicTextFieldUI.java,
+ javax/swing/plaf/basic/BasicTextUI.java,
+ javax/swing/plaf/basic/BasicToolBarSeparatorUI.java,
+ javax/swing/plaf/basic/BasicToolBarUI.java,
+ javax/swing/plaf/basic/BasicToolTipUI.java,
+ javax/swing/plaf/basic/BasicTreeUI.java,
+ javax/swing/plaf/basic/BasicViewportUI.java,
+ javax/swing/plaf/basic/ComboPopup.java,
+ javax/swing/table/AbstractTableModel.java,
+ javax/swing/table/DefaultTableCellRenderer.java,
+ javax/swing/table/DefaultTableColumnModel.java,
+ javax/swing/table/DefaultTableModel.java,
+ javax/swing/table/JTableHeader.java,
+ javax/swing/table/TableCellEditor.java,
+ javax/swing/table/TableCellRenderer.java,
+ javax/swing/table/TableColumn.java,
+ javax/swing/table/TableColumnModel.java,
+ javax/swing/text/AbstractDocument.java,
+ javax/swing/text/Caret.java,
+ javax/swing/text/DefaultCaret.java,
+ javax/swing/text/DefaultEditorKit.java,
+ javax/swing/text/DefaultHighlighter.java,
+ javax/swing/text/EditorKit.java,
+ javax/swing/text/JTextComponent.java,
+ javax/swing/text/LayeredHighlighter.java,
+ javax/swing/text/PasswordView.java,
+ javax/swing/text/SimpleAttributeSet.java,
+ javax/swing/text/StyleConstants.java,
+ javax/swing/text/StyleContext.java,
+ javax/swing/text/StyledEditorKit.java,
+ javax/swing/text/TextAction.java,
+ javax/swing/text/View.java,
+ javax/swing/tree/AbstractLayoutCache.java,
+ javax/swing/tree/DefaultTreeCellRenderer.java,
+ javax/swing/tree/DefaultTreeModel.java,
+ javax/swing/tree/DefaultTreeSelectionModel.java,
+ javax/swing/tree/FixedHeightLayoutCache.java,
+ javax/swing/tree/TreeCellRenderer.java,
+ javax/swing/tree/TreeSelectionModel.java,
+ javax/swing/tree/VariableHeightLayoutCache.java,
+ javax/swing/undo/AbstractUndoableEdit.java,
+ javax/swing/undo/UndoableEditSupport.java:
+ Imports cleaned up.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Container.java,
+ java/awt/Font.java,
+ java/awt/font/TextLayout.java:
+ Imports cleaned up.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractButton.java
+ (getLabel): Added @deprecated tag.
+ (setLabel): Likewise.
+ * javax/swing/FocusManager.java
+ (disableSwingFocusManager): Likewise.
+ (isFocusManagerEnabled): Likewise.
+ * javax/swing/JComponent.java
+ (isManagingFocus): Added version to @deprecated tag.
+ (getNextFocusableComponent): Moved @deprecated tag to bottom of
+ javadoc.
+ (getConditionForKeyStroke): Likewise.
+ (getActionForKeyStroke): Likewise.
+ * javax/swing/JDesktopPane.java
+ (LIVE_DRAG_MODE): Added @specnote tag.
+ (OUTLINE_DRAG_MODE): Likewise.
+ * javax/swing/JInternalFrame.java
+ (MENU_BAR_PROPERTY): Fixed value.
+ (getMenuBar): Added @deprecated tag.
+ (setMenuBar): Likewise.
+ * javax/swing/JViewport.java
+ (isBackingStoreEnabled): Likewise.
+ (setBackingStoreEnabled): Likewise.
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (closeKey): Likewise.
+ (maximizeKey): Likewise.
+ (minimizeKey): Likewise.
+ (navigateKey): Likewise.
+ (navigateKey2): Likewise.
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (openMenuKey): Likewise.
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (keyboardDownRightListener): Likewise.
+ (keyboardEndListener): Likewise.
+ (keyboardHomeListener): Likewise.
+ (keyboardResizeToggleListener): Likewise.
+ (keyboardUpLeftListener): Likewise.
+ (dividerResizeToggleKey): Likewise.
+ (downKey): Likewise.
+ (endKey): Likewise.
+ (homeKey): Likewise.
+ (leftKey): Likewise.
+ (rightKey): Likewise.
+ (upKey): Likewise.
+ (createKeyboardUpLeftListener): Likewise.
+ (createKeyboardDownRightListener): Likewise.
+ (createKeyboardHomeListener): Likewise.
+ (createKeyboardEndListener): Likewise.
+ (createKeyboardResizeToggleListener): Likewise.
+ (getDividerBorderSize): Likewise.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (downKey): Likewise.
+ (leftKey): Likewise.
+ (rightKey): Likewise.
+ (upKey): Likewise.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create): Use the
+ GTK_TEXT_VIEW macro.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+ (connect_awt_hook_cb): Mark unused variable unused.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c (selection_get):
+ Do the cast right.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create): According to
+ the gtk API gtk_combo_box_new_text actually returns a GtkWidget.
+ Remove unused var menu.
+ (selection_changed): Remove unused value.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds): Fix pointer
+ warning with using an intermediate variable.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+ (area_updated): Fix unused var warning for BE archs.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals): Remove unused
+ var.
+ (realize_cb): Mark unused variable unused.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+ (seek_glyphstring_idx): Fix a C90 warning.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
+ (Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun):
+ Mark unused arguments unused.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+ (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState),
+ (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes),
+ (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex),
+ (Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal):
+ Likewise.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
+ (Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics),
+ (Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerTextMetrics):
+ Likewise.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter):
+ Likewise.
+ (filenameFilterCallback): Remove unused var.
+ (handle_response): Declare str_fileName and remove last else statement.
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c:
+ New File.
+ (nativeGetNumFontsFamilies) New function.
+ (nativeGetFontFamilies) Likewise.
+ * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+ (getAvailableFontFamilyNames): Implement.
+ * Makefile.am (gtk_c_source_files): Add GdkGraphicsEnvironment.c.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/ClasspathFontPeer.java
+ (setStandardAttributes(String,Map)): If size attribute doesn't
+ exist, default to size 12. Clamp size value to a minimum of 1.
+
+2004-11-30 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/swing/JDialog.java
+ (decorated): Likewise.
+ * javax/swing/JFrame.java
+ (defaultLookAndFeelDecorated): Likewise.
+
+2004-11-30 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (offset, regular): Made final.
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (DECREASE_HIGHLIGHT, INCREASE_HIGHLIGHT, NO_HIGHLIGHT,
+ POSITIVE_SCROLL, NEGATIVE_SCROLL): Made final.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/BitwiseXORComposite.java,
+ gnu/java/awt/ClasspathToolkit.java,
+ gnu/java/awt/image/XBMDecoder.java,
+ gnu/java/awt/peer/GLightweightPeer.java,
+ gnu/java/awt/peer/gtk/GdkGlyphVector.java:
+ Reorganized import statements.
+
+2004-11-30 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/awt/Button.java
+ (next_button_number): Removed useless initializer.
+ * java/awt/Frame.java
+ (next_frame_number): Likewise.
+ * java/awt/Panel.java
+ (next_panel_number): Likewise,
+ * java/awt/Scrollbar.java
+ (next_scrollbar_number): Likewise.
+ * java/awt/TextArea.java
+ (next_text_number): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/ByteLookupTable.java
+ (ByteLookupTable) :Fixed HTML entities in javadocs.
+ (lookupPixel): Fix case when dst is null.
+ * java/awt/image/ShortLookupTable.java
+ (ShortLookupTable) :Fixed HTML entities in javadocs.
+ (lookupPixel): Fix case when dst is null.
+ * java/awt/image/DataBufferByte.java,
+ java/awt/image/DataBufferDouble.java,
+ java/awt/image/DataBufferFloat.java,
+ java/awt/image/DataBufferInt.java,
+ java/awt/image/DataBufferShort.java,
+ java/awt/image/DataBufferUShort.java:
+ Fix initialization of bankData in constructors.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (setNativeBounds): Set GtkEventBox, GtkButton and GtkLabel size
+ requests.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (setNativeBounds): Make package private. Set size request even
+ if GTK parent is NULL.
+ * gnu/java/awt/peer/gtk/GtkLabelPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+ (setNativeBounds): Set GtkEventBox and GtkLabel size requests.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ Workaround for bug #17952.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (request_frame_extents): Check window->window != NULL.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * jni/gtk-peer/gdkfont.h: Include gtkpeer.h not gtkcairopeer.h.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c: Use
+ native_text_layout_state_table here.
+
+ * jni/gtk-peer/gdkfont.h: Mark native_text_layout_state_table extern.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+ (setChars): Only call pango_itemize() when vec->glyphitems != NULL.
+ Only call pango_shape() when gi->glyphs->num_glyphs > 0.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GtkToolkit.java:
+ Merged import statements.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (isBufferedImageGraphics): Simplified.
+
+2004-11-30 Paul Jenner <psj.home@ntlworld.com>
+
+ * javax/swing/JTree.java
+ (isRootVisible): Fixed typo in method name.
+ * javax/swing/JScrollBar.java
+ (setValues): Likewise.
+ * javax/swing/JScrollPane.java
+ (createScrollListener): Call JScrollBar.setValues.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkContainerPeer.java (endValidate):
+ Don't call setParentAndBounds on GtkWindowPeers.
+
+ * java/awt/Component.java (static): Don't set default keyboard
+ focus manager.
+ * java/awt/KeyboardFocusManager.java
+ (getCurrentKeyboardFocusManager): If current keyboard focus
+ manager is null set a default.
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (gtkWidgetSetBackground): New method.
+ (block_expose_events_cb): New function.
+ (connectSignals): Block the AWT's expose event processing on
+ button press and release.
+ (gtkSetLabel): Set text on proper widget.
+ (gtkWidgetModifyFont): Modify font on proper widget.
+ (gtkWidgetSetBackground): Set normal, active and prelight
+ colours.
+ (gtkWidgetSetForeground): Set forground colour of proper widget.
+ (gtkActivate): Activate the correct widget.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (clearRect):
+ Only clear rectangle if the backing component is not an event
+ box.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+ (beginNativeRepaintID): New variable.
+ (endNativeRepaintID): Likewise.
+ (gtkInit): Initialize new fields with method IDs.
+ * jni/gtk-peer/gtkpeer.h (beginNativeRepaintID): Declare extern.
+ (endNativeRepaintID): Likewise.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/swing/JList.java (init): Revert accidental commit.
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (GdkGraphics):
+ Call initComponentGraphics or connectSignals depending on
+ component's realization status.
+ (realize_cb): New function.
+ (initComponentGraphics): New method.
+ (connectSignals): New method.
+ (clipRect): Return immediately if component is not realized.
+ (setClip): Likewise.
+ (translate): Likewise.
+ (drawImage variants): Return false immediately if component is
+ not realized.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (connectSignals): New method.
+ (GdkGraphics2D): Call initComponentGraphics2D or connectSignals
+ depending on component's realization status. Move other
+ initialization calls to ...
+ (initComponentGraphics2D): New method.
+ (realize_cb): New function.
+ (cairoSetMatrix): Return immediately if gr is NULL.
+ (cairoNewPath): Likewise.
+ (cairoRectangle): Likewise.
+ (cairoClip): Likewise.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (gtkWidgetRepaintArea): Remove method.
+ (isRealized): New method.
+ (GtkComponentPeer): Move setParent, connectJObject and setCursor
+ calls to setParentAndBounds. Call setParentAndBounds.
+ (setParentAndBounds): New method.
+ (setComponentBounds): Return immediately if bounds are all zero.
+ (repaint): Remove call to gtkWidgetRepaintArea. Return
+ immediately if requested paint region is 0x0.
+ (setCursor): New method.
+ (gtkWidgetSetParent): Only set widget's parent if its parent is
+ currently NULL.
+ (setNativeBounds): Only set widget's bounds if it has a parent.
+ (connectSignals): Don't call gtk_widget_realize. Connect
+ "realize" signal to connect_awt_hook_cb handler.
+ * gnu/java/awt/peer/gtk/GtkContainerPeer.java (isValidating):
+ New field.
+ (beginValidate): Set isValidating true.
+ (endValidate): Set parents and bounds for children first, then
+ for this. Set isValidating false.
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+ (connectJObject): Remove method.
+ (connectSignals): Don't call gtk_widget_realize.
+ * gnu/java/awt/peer/gtk/GtkListPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+ (connectJObject): Remove method.
+ (connectSignals): Don't call gtk_widget_realize.
+ * gnu/java/awt/peer/gtk/GtkPanelPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
+ (connectJObject): Remove method.
+ * gnu/java/awt/peer/gtk/GtkScrollbarPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+ (connectJObject): Remove method.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (create): Don't call gtk_widget_realize.
+ (connectJObject): Remove method.
+ (connectSignals): Don't call gtk_widget_realize. Connect
+ "realize" signal to connect_awt_hook_cb handler.
+ (nativeSetBounds): Don't attempt to move GDK window if it is
+ NULL.
+ * java/awt/Container.java (addImpl): Don't call comp.addNotify
+ if peer is not null.
+ (validateTree): Create peers for all children before calling
+ doLayout.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (connectSignals): Don't call gtk_widget_realize.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+ (connect_awt_hook_cb): New function.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+ (initComponentGraphicsID): New variable.
+ (initComponentGraphics2DID): Likewise.
+ (setCursorID): Likewise.
+ (gtkInit): Initialize new fields with method IDs.
+ * jni/gtk-peer/gtkpeer.h (initComponentGraphicsID): Declare
+ extern.
+ (initComponentGraphics2DID): Declare extern.
+ (setCursorID): Likewise.
+ (connect_awt_hook_cb): Declare function.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GdkClasspathFontPeer.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/GtkButtonPeer.java,
+ gnu/java/awt/peer/gtk/GtkClipboard.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/GtkListPeer.java,
+ gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
+ gnu/java/awt/peer/gtk/GtkToolkit.java,
+ gnu/java/awt/peer/gtk/GtkWindowPeer.java:
+ Import statements reworked. Some little reformattings.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/image/AffineTransformOp.java
+ (TYPE_BILINEAR): Initialize with 2.
+ * java/awt/print/Printable.java: Jalopied.
+ (PAGE_EXISTS): Initialize with 0;
+ (NO_SUCH_PAGE): Initialized with 1.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * Makefile.am: Add BufferedImageFilter.java.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Graydon Hoare <graydon@redhat.com>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (install_font_peer): Minor bug fixes to track cairo font semantics.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/BufferedImageFilter.java: Implement.
+
+2004-11-30 Graydon Hoare <graydon@redhat.com>
+
+ * Makefile.am
+ (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c)
+ (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c)
+ (gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java)
+ (gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java): Remove.
+ (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c)
+ (jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c)
+ (gnu/java/awt/peer/gtk/GdkTextLayout.java)
+ (gnu/java/awt/peer/gtk/GdkFontPeer.java)
+ (gnu/java/awt/peer/ClasspathTextLayoutPeer.java): Add
+ * Makefile.in: Regenerate.
+ * gnu/awt/xlib/XToolkit.java
+ (getClasspathTextLayoutPeer): Add stub.
+ * gnu/java/awt/ClasspathToolkit.java
+ (getClasspathTextLayoutPeer) Add.
+ * gnu/java/awt/peer/ClasspathFontPeer.java
+ (copyStyleToAttrs)
+ (copySizeToAttrs): Make public.
+ * gnu/java/awt/peer/ClasspathTextLayoutPeer.java: New file.
+ * gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java: Remove.
+ * gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java: Remove.
+ * gnu/java/awt/peer/gtk/GdkFontMetrics.java: Rewrite.
+ * gnu/java/awt/peer/gtk/GdkFontPeer.java: New file.
+ * gnu/java/awt/peer/gtk/GdkGlyphVector.java: Adjust type names.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (getFontPeer): New function.
+ (drawString): Pass font peer to native side.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (cairoSetFont)
+ (cairoShowGlyphs)
+ (PainterThread): Remove.
+ (GdkGraphics2D): Set hints during construction.
+ (shifted)
+ (walkPath)
+ (draw)
+ (setRenderingHint)
+ (setRenderingHints): Reimplement normalization logic.
+ (getDefaultHints)
+ (updateBufferedImage)
+ (isBufferedImageGraphics)
+ (updateImagePixels)
+ (drawImage): Make final.
+ (drawImage): Always paint synchronously.
+ (drawString)
+ (drawGlyphVector): Rewrite.
+ (releasePeerGraphicResource)
+ (getPeerTextMetrics)
+ (getPeerFontMetrics)
+ (drawGdkGlyphVector)
+ (drawGdkTextLayout)
+ (cairoDrawGdkGlyphVector)
+ (cairoDrawGdkTextLayout)
+ (cairoDrawString)
+ (getFontPeer): New functions.
+ * gnu/java/awt/peer/gtk/GdkTextLayout.java: New file.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (getFontMetrics): Get metrics via toolkit, to hit cache.
+ * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java: Use getFontMetrics.
+ * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java: Likewise.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java (LRUCache): New class.
+ (fontCache)
+ (metricsCache)
+ (imageCache): New members.
+ (getFontMetrics)
+ (getImage)
+ (getClasspathFontPeer): Use caches.
+ (getFontPeer): Route through getClasspathFontPeer.
+ * java/awt/Font.java (attrsToMap): Remove, adjust ctors.
+ * java/awt/font/TextLayout.java: Implement in terms of peer.
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (paintThumb): Use polyline rather than polygon.
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java:
+ Update comment but, alas, still do not switch to using TextLayouts.
+ * javax/swing/text/Utilities.java (drawTabbedText):
+ Draw text run-at-a-time, not char-at-a-time.
+ * jni/gtk-peer/gdkfont.h: Publicize some of the font interface, add
+ layout table.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c:
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c:
+ Remove files.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Rewrite to
+ incorporate brains of old GdkClasspathFontPeerMetrics.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c: Rewrite to
+ incorporate brains of old GdkClasspathFontPeer.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c: New file.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (drawString): Rewrite to use persistent layout in peer font.
+ Comment out extraneous gdk_flush calls.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (metrics_cairo)
+ (metrics_surface): New static variables.
+ (paint_glyph_run)
+ (install_font_peer): New helper functions.
+ (releasePeerGraphicResource)
+ (getPeerTextMetrics)
+ (getPeerFontMetrics)
+ (cairoDrawGdkTextLayout)
+ (cairoDrawGdkGlyphVector): New native methods.
+ (cairoDrawString): Rewrite, leaving layout-based version
+ commented out for the time being.
+ * jni/gtk-peer/gtkpeer.h (graphics): Add fields for pango stuff.
+
+2004-11-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/geom/AffineTransform.java:
+ Fixed javadocs overall.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ComponentColorModel.java: Remove FIXME comment since
+ it's correct.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java: Fix use of immutable
+ BigIntegers.
+
+2004-11-30 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java (MessageIcon):
+ Renamed from 'messageIcon'.
+ (errorIcon, infoIcon, warningIcon, questionIcon): Updated.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/RescaleOp.java: Fix formatting.
+
+2004-11-30 Olga Rodimina <rodimina@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (SCROLL_DOWN): made final.
+ (SCROLL_UP): made final.
+
+2004-11-30 Olga Rodimina <rodimina@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboPopup.java:
+ Added javadocs for undocumented fields.
+ (show): scroll down to the selected item and
+ highlight selected item.
+ (startAutoScrolling): Implemented.
+ (stopAutoScrolling): Implemented.
+ (autoScrollUp): Implemented.
+ (autoScrollDown): Implemented.
+ (InvocationMouseHandler.mouseReleased): Implemented.
+ (InvocationMouseMotionHandler.mouseDragged): Implemented.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/RescaleOp.java: Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java (getRGBs,
+ convertToIntDiscrete): Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java: Add class docs.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java (isValid, getValidPixels):
+ Implement.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/MenuBar.java,
+ java/awt/peer/MenuBarPeer.java:
+ Revert accidentally commited changes.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/AWTKeyStroke.java,
+ java/awt/Canvas.java,
+ java/awt/CardLayout.java,
+ java/awt/CheckboxMenuItem.java,
+ java/awt/Component.java,
+ java/awt/Container.java,
+ java/awt/DefaultKeyboardFocusManager.java,
+ java/awt/EventDispatchThread.java,
+ java/awt/FileDialog.java,
+ java/awt/FlowLayout.java,
+ java/awt/Font.java,
+ java/awt/Frame.java,
+ java/awt/Graphics2D.java,
+ java/awt/GraphicsEnvironment.java,
+ java/awt/GridBagConstraints.java,
+ java/awt/GridBagLayout.java,
+ java/awt/GridLayout.java,
+ java/awt/Image.java,
+ java/awt/KeyboardFocusManager.java,
+ java/awt/Label.java,
+ java/awt/List.java,
+ java/awt/MediaTracker.java,
+ java/awt/Menu.java,
+ java/awt/MenuBar.java,
+ java/awt/MenuComponent.java,
+ java/awt/Panel.java,
+ java/awt/PopupMenu.java,
+ java/awt/ScrollPane.java,
+ java/awt/Scrollbar.java,
+ java/awt/SystemColor.java,
+ java/awt/TextArea.java,
+ java/awt/TextField.java,
+ java/awt/Toolkit.java,
+ java/awt/Window.java,
+ java/awt/color/ICC_Profile.java,
+ java/awt/datatransfer/DataFlavor.java,
+ java/awt/datatransfer/StringSelection.java,
+ java/awt/datatransfer/SystemFlavorMap.java,
+ java/awt/dnd/Autoscroll.java,
+ java/awt/dnd/DropTarget.java,
+ java/awt/dnd/DropTargetContext.java,
+ java/awt/dnd/DropTargetDragEvent.java,
+ java/awt/dnd/peer/DropTargetContextPeer.java,
+ java/awt/event/AdjustmentEvent.java,
+ java/awt/event/InputEvent.java,
+ java/awt/event/InvocationEvent.java,
+ java/awt/event/KeyEvent.java,
+ java/awt/event/MouseEvent.java,
+ java/awt/font/TextLayout.java,
+ java/awt/geom/GeneralPath.java,
+ java/awt/geom/Point2D.java,
+ java/awt/im/InputContext.java,
+ java/awt/im/spi/InputMethodContext.java,
+ java/awt/image/AffineTransformOp.java,
+ java/awt/image/BufferedImage.java,
+ java/awt/image/ColorModel.java,
+ java/awt/image/ComponentColorModel.java,
+ java/awt/image/CropImageFilter.java,
+ java/awt/image/DirectColorModel.java,
+ java/awt/image/MemoryImageSource.java,
+ java/awt/image/PackedColorModel.java,
+ java/awt/image/PixelGrabber.java,
+ java/awt/image/RasterOp.java,
+ java/awt/peer/MenuBarPeer.java:
+ Some fixes for checkstyle. Import statement and modifier order
+ redordering.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTable.java
+ (setModel): Reimplemented.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextArea.java
+ (append): Re-implemented.
+ (insert): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JSpinner.java
+ (serialVersionUID): New static field.
+ * javax/swing/JToggleButton.java
+ (JToggleButton): Fixed email addresses.
+ * javax/swing/SpinnerNumberModel.java
+ (serialVersionUID): Added javadoc.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextArea.java:
+ Don't use JTextComponent.doc directly. GCJ from java-gui-branch has a
+ bug here which is fixed in HEAD ...
+
+2004-11-30 Andrew John Hughes <address@hidden>
+
+ * javax/swing/JTextArea.java: Added additional
+ documentation.
+
+2004-11-30 Andrew John Hughes <address@hidden>
+
+ * javax/swing/JRadioButton.java:
+ Implemented additional constructors and accessibility
+ classes. Added documentation and fixed a typo in
+ AbstractButton.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java (IndexColorModel): Implement
+ missing constructor.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ComponentColorModel.java (ComponentColorModel):
+ Implement missing 1.4 constructor.
+
+2004-11-30 Andrew John Hughes <address@hidden>
+
+ * javax/swing/JToggleButton.java:
+ Implemented additional constructors and accessibility
+ classes. Added documentation and fixed a typo in
+ AbstractButton.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ColorModel.java (getDataElement,
+ getDataElements): Document since 1.4.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/BandedSampleModel.java: Implement.
+ * Makefile.am: Add java/awt/image/BandedSampleModel.java.
+ * Makefile.in: Regenerated.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Window.java: Fixed whitespace difference with GNU
+ classpath.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am: Add javax/swing/SpinnerListModel.java.
+ * Makefile.in: Regenerated.
+
+2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * javax/swing/SpinnerListModel.java, javax/swing/SpinnerModel.java
+ Implemented SpinnerListModel. Added documentation to
+ SpinnerModel.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+ (init_dpi_conversion_factor): Apply the patch from main correctly.
+ 2004-06-26 Andreas Tobler <a.tobler@schweiz.ch>
+
+2004-11-30 Tom Tromey <tromey@redhat.com>
+
+ Bug 9948.
+ * javax/swing/JDesktopPane.java (LIVE_DRAG_MODE): Now final.
+ (OUTLINE_DRAG_MODE): LIVE_DRAG_MODE.
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (NON_CONTINUOUS_DIVIDER): Now final. Initialize.
+
+2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/Canvas.java
+ (AccessibleAWTCanvas): added serialization UID
+ * java/awt/Label.java
+ (AccessibleAWTLabel): added serialization UID
+ * javax/swing/JRootPane.java
+ (AccessibleJRootPane): added comment to existing UID
+ * javax/swing/JSpinner.java
+ (DefaultEditor): added serialization UID
+ (NumberEditor): added serialization UID
+ * javax/swing/text/html/HTML.java
+ (UnknownTag): added serialization UID
+
+2004-11-30 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/swing/JInternalFrame.java
+ (CONTENT_PANE_PROPERTY,FRAME_ICON_PROPERTY,GLASS_PANE_PROPERTY,
+ IS_CLOSED_PROPERTY,IS_ICON_PROPERTY,IS_MAXIMUM_PROPERTY,
+ IS_SELECTED_PROPERTY,LAYERED_PANE_PROPERTY,MENU_BAR_PROPERTY,
+ ROOT_PANE_PROPERTY,TITLE_PROPERTY): Made final as per API spec.
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (CLOSE_CMD,ICONIFY_CMD,MAXIMIZE_CMD,MOVE_CMD,RESTORE_CMD,SIZE_CMD):
+ Made final as per API spec.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * jni/gtk-peer/gtkpeer.h: Remove duplicated copyright string.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/Arc2D.java: Reformatted.
+ (setArc): Correct documentation to say 'upper left corner'.
+ (setArcByTangent,contains,intersects): Implemented.
+ (containsAngle): Corrected to handle negative extents.
+ (ArcIterator): Set to private.
+ (ArcIterator): Corrected for CHORD-type arcs, negative extents.
+ (intersects): Fix: Now checks the arc segment.
+ (contains): Cleaned up.
+ * java/awt/geom/CubicCurve2a.javaD: Fix insideness-test. Reindent.
+ (contains): Implemented.
+ (intersects): Implemented.
+ * java/awt/geom/QuadCurve2D.java: Fix insideness-test. Reindent.
+ * java/awt/geom/GeneralPath: Fix insideness-test. Reindent and
+ document. Fully (re)implemented using separate xpoints and ypoints
+ float[] coords.
+
+2004-11-30 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * configure.ac: Introduce AC_C_BIGENDIAN_CROSS for WORDS_BIGENDIAN.
+ * configure: Regenerate.
+ * include/config.h.in: Likewise.
+ * jni/gtk-peer/gtkpeer.h (SWAPU32): Introduce macro to swap pixels.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c: Moved SWAPU32
+ macro to gtkpeer.h.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels): Convert
+ pixels from 0xBBGGRRAA to 0xAARRGGBB only on Little Endian
+ architectures.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_updated):
+ Likewise.
+
+2004-11-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/SystemColor.java: Fix @link doc entries.
+
+2004-11-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/RenderingHints.java: Documented.
+ (RenderingHints): Accept null init Map.
+ (putAll): Preprocess map to generate appropriate exceptions.
+ (remove): Cast object to Key and remove from hintMap.
+
+2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/MenuComponent.java, java/awt/MenuBar.java:
+ Implementation of accessibility classes and methods
+ for these two components.
+
+2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/KeyboardFocusManager.java:
+ Added missing documentation.
+
+2004-11-30 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/Label.java, java/awt/Canvas.java:
+ Added accessibility classes to AWT Label and Canvas,
+ as well as additional documentation for Canvas.
+
+2004-11-30 David Gilbert <address@bogus.example.com>
+
+ * java/awt/image/DataBuffer.java: Update API documentation.
+ * java/awt/image/DataBufferByte.java: Likewise.
+ * java/awt/image/DataBufferDouble.java: Likewise.
+ * java/awt/image/DataBufferFloat.java: Likewise.
+ * java/awt/image/DataBufferInt.java: Likewise.
+ * java/awt/image/DataBufferShort.java: Likewise.
+ * java/awt/image/DataBufferUShort.java: Likewise.
+
+2004-11-30 Dalibor Topic <robilad@kaffe.org>
+
+ * java/awt/Component.java (postEvent):
+ Only delegate to parent if a parent exists.
+ Reported by: Stephane Meslin-Weber <steph@tangency.co.uk>
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ *java/awt/AWTEventMulticaster.java,
+ java/awt/Adjustable.java,
+ java/awt/Point.java,
+ java/awt/Polygon.java,
+ java/awt/Rectangle.java,
+ java/awt/Shape.java,
+ java/awt/geom/Area.java,
+ java/awt/geom/Ellipse2D.java,
+ java/awt/geom/PathIterator.java,
+ java/awt/geom/Point2D.java,
+ java/awt/geom/Rectangle2D.java,
+ java/lang/Comparable.java,
+ java/util/Arrays.java:
+ Fixed documentation errors
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ComponentSampleModel.java: Add documentation.
+
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ComponentSampleModel.java (constructor):
+ Initialize numBanks when figuring out the max bank index.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/Raster.java (createPackedRaster): Implement
+ MultiPixelPackedSampleModel codepath.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/MultiPixelPackedSampleModel.java: Implement.
+ * Makefile.am: Add MultiPixelPackedSampleModel.java.
+ * Makefile.in: Regenerate.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/Raster.java (getNumBands): Implement.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/Raster.java
+ (createPackedRaster(int,int,int,int,int,Point)): Implement for
+ bands>1.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/SinglePixelPackedSampleModel.java
+ (SinglePixelPackedSampleModel): Throw exception for unsupported
+ datatype.
+
+2004-11-30 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ColorModel.java (getDataElement): Implemented.
+ Update javadoc.
+ (getDataElements): Add missing version. Remove bogus version.
+ Update javadoc.
+
+2004-11-30 Olga Rodimina <rodimina@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java:
+ (paintCurrentValue): Pass correct parameters to
+ getListCellRendererComponent().
+ (ListDataHandler.intervalRemoved): Implemented.
+ (PropertyChangeHandler.propertyChange): Handle changes in
+ MODEL_CHANGED_PROPERTY of the JComboBox
+ * javax/swing/plaf/basic/BasicComboPopup.java:
+ (BasicComboPopup): Moved code that configures popup to
+ configurePopup() and call it instead.
+ (firePopupMenuWillBecomeVisible): Implemented.
+ (firePopupMenuWillBecomeInvisible): Likewise.
+ (firePopupMenuCanceled): Likewise.
+ (configureList): Set list's visibleRowCount same as
+ comboBox's visibleRowCount.
+ (configurePopup): Implemented.
+ (getPopupHeightForRowCount): Get item's from JComboBox's model and
+ not from model of the JList.
+ (ListMouseMotionHandler.mouseMoved): Implemented.
+ (PropertyChangeHandler.propertyChange): Handles change in the
+ JComboBox's model.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java
+ (isMaximumSizeSet): New method.
+ (isMinimumSizeSet): Likewise.
+ (isPreferredSizeSet): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JSpinner.java:
+ Some Re-formatting.
+ (spinner): New field.
+ (DefaultEditor): New method.
+ (getSpinner): Likewise.
+ (NumberEdito): Likewise.
+ (getModel): Likewise
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/InputVerifier.java:
+ Re-formatted.
+ * javax/swing/JComponent.java
+ (inputVerifier): New property field.
+ (getInputVerifier): New method.
+ (setInputVerifier): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java
+ (JComponent): Added javadoc comment.
+ (setBorder): Fire property change eventr.
+ (setEnabled): Likewise.
+ (setMaximumSize): Likewise.
+ (setMinimumSize): Likewise.
+ (setPreferredSize): Likewise.
+ (setOpaque): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextField.java
+ (action): New field.
+ (actionCommand): Likewise.
+ (actionPropertyChangeListener): Likewise.
+ (setHorizontalAlignment): Abort soon if new value == old value. Fire
+ event before repainting.
+ (postActionEvent): New method.
+ (getAction): Likewise.
+ (setAction): Likewise.
+ (getActionCommand): Likewise.
+ (setActionCommand): Likewise.
+ (createActionPropertyChangeListener): Likewise.
+ (configurePropertiesFromAction): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/DebugGraphics.java:
+ Re-formatted. Fixed some javadocs.
+ * javax/swing/JApplet.java
+ (rootPaneCheckingEnabled): Renamed from checking.
+ * javax/swing/JCheckBox.java
+ (BORDER_PAINTED_FLAT_CHANGED_PROPERTY): New statif field.
+ * javax/swing/JFrame.java:
+ Re-formatted a bit and reordered some methods.
+ (rootPaneCheckingEnabled): Renamed from checking.
+ (getPreferredSize): Simplified.
+ * javax/swing/JTextArea.java
+ (getColumnWidth): New method.
+ (getLineCount): Likewise.
+ (getLineStartOffset): Likewise.
+ (getLineEndOffset): Likewise.
+ (getLineOfOffset): Likewise.
+ (getRowHeight): Likewise.
+ (insert): Likewise.
+ (replaceRange): Likewise.
+ * javax/swing/JTextField.java
+ (scrollOffset): new field.
+ (getScrollOffset): New method.
+ (setScrollOffset): Likewise.
+ (getColumnWidth): Likewise.
+ * javax/swing/JTree.java
+ (ANCHOR_SELECTION_PATH_PROPERTY): New static field.
+ (CELL_EDITOR_PROPERTY): Likewise.
+ (CELL_RENDERER_PROPERTY): Likewise.
+ (EDITABLE_PROPERTY): Likewise.
+ (EXPANDS_SELECTED_PATHS_PROPERTY): Likewise.
+ (INVOKES_STOP_CELL_EDITING_PROPERTY): Likewise.
+ (LARGE_MODEL_PROPERTY): Likewise.
+ (LEAD_SELECTION_PATH_PROPERTY): Likewise.
+ (ROOT_VISIBLE_PROPERTY): Likewise.
+ (ROW_HEIGHT_PROPERTY): Likewise.
+ (SCROLLS_ON_EXPAND_PROPERTY): Likewise.
+ (SELECTION_MODEL_PROPERTY): Likewise.
+ (SHOWS_ROOT_HANDLES_PROPERTY): Likewise.
+ (TOGGLE_CLICK_COUNT_PROPERTY): Likewise.
+ (TREE_MODEL_PROPERTY): Likewise.
+ (VISIBLE_ROW_COUNT_PROPERTY): Likewise.
+ (cellEditor): New field.
+ (invokesStopCellEditing): Likewise.
+ (largeModel): Likewise.
+ (rowHeight): Likewise.
+ (scrollsOnExpand): Likewise.
+ (selectionModel): Likewise.
+ (toggleClickCount): Likewise.
+ (visibleRowCount): Likewise.
+ (setShowsRootHandles): Fixed typo in method name.
+ (getCellEditor): New method.
+ (setCellEditor): Likewise.
+ (getSelectionModel): Likewise.
+ (setSelectionModel): Likewise.
+ (getVisibleRowCount): Likewise.
+ (setVisibleRowCount): Likewise.
+ (isLargeModel): Likewise.
+ (setLargeModel): Likewise.
+ (getRowHeight): Likewise.
+ (setRowHeight): Likewise.
+ (getInvokesStopCellEditing): Likewise.
+ (setInvokesStopCellEditing): Likewise.
+ (getToggleClickCount): Likewise.
+ (setToggleClickCount): Likewise.
+ (getScrollsOnExpand): Likewise.
+ (setScrollsOnExpand): Likewise.
+ * javax/swing/table/DefaultTableColumnModel.java
+ (addColumnModelListener): Fixed javadoc.
+ (removeColumnModelListener): Implemented. Fixed javadoc.
+ (getColumnModelListeners): New method.
+ * javax/swing/table/JTableHeader.java
+ (columnModel): Made protected.
+ (draggedColumn): Likewise.
+ (draggedDistance): Likewise.
+ (reorderingAllowed): Likewise.
+ (resizingAllowed): Likewise.
+ (resizingColumn): Likewise.
+ (table): Likewise.
+ (updateTableInRealTime): Likewise.
+ (createDefaultColumnModel): Renamed from
+ createDefaultTableColumnModel.
+ (setDefaultRenderer): New method.
+ * javax/swing/table/TableColumn.java
+ (getPropertyChangeListeners): New method.
+ * javax/swing/text/DefaultHighlighter.java
+ (drawsLayeredHighlights): New field.
+ (getDrawsLayeredHighlights): New method.
+ (setDrawsLayeredHighlights): Likewise.
+ * javax/swing/text/DocumentFilter.java
+ (FilterBypass): New inner class.
+ (insertString): New method.
+ (remove): Likewise.
+ (replace): Likewise.
+ * javax/swing/text/JTextComponent.java
+ (dragEnabled): New field.
+ (getSelectedText): New method.
+ (getDragEnabled): Likewise.
+ (setDragEnabled): Likewise.
+ (replaceSelection): Reimplemented.
+ * javax/swing/text/NavigationFilter.java
+ (FilterBypass): New inner class.
+ (NavigationFilter): New method.
+ (moveDot): Likewise.
+ (setDot): Likewise.
+ * javax/swing/text/SimpleAttributeSet.java
+ (EMPTY): Made public final.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/SpinnerNumberModel.java
+ (getMinimum): New method.
+ (setMinimum): Likewise.
+ (getMaximum): Likewise.
+ (setMaximum): Likewise.
+ (getStepSize): Likewise.
+ (setStepSize): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JMenu.java
+ (getMenuListeners): New method.
+ (fireMenuSelected): Simplified.
+ * javax/swing/JRootPane.java
+ (NONE): New static field.
+ (FRAME): Likewise.
+ (PLAIN_DIALOG): Likewise.
+ (INFORMATION_DIALOG): Likewise.
+ (ERROR_DIALOG): Likewise.
+ (COLOR_CHOOSER_DIALOG): Likewise.
+ (FILE_CHOOSER_DIALOG): Likewise.
+ (QUESTION_DIALOG): Likewise.
+ (WARNING_DIALOG): Likewise.
+ (defaultButton): New field.
+ (getDefaultButton): New method.
+ (setDefaultButton): Likewise.
+ * javax/swing/JScrollPane.java
+ (getUI): New method.
+ (setUI): Likewise.
+ * javax/swing/JTable.java
+ (getUI): Javadoc added.
+ (setUI): New method.
+ * javax/swing/JViewport.java
+ (getUI): New method.
+ (setUI): Likewise.
+ * javax/swing/UIDefaults.java
+ (removePropertyChangeListener): Made public.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JApplet.java, javax/swing/JFrame.java:
+ Re-indented.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractButton.java:
+ Little re-formatting.
+ (changeEvent): Made protected.
+ (fireStateChanged): Removed argument.
+ (setHorizontalAlignment): Abort method when old value is equal too new
+ value.
+ (setHorizontalTextPosition): Likewise.
+ (setVerticalAlignment): Likewise.
+ (setVerticalTextPosition): Likewise.
+ (setBorderPainted): Likewise.
+ (setIcon): Likewise.
+ (setText): Likewise.
+ (setIconTextGap): Likewise.
+ (setMargin): Likewise.
+ (setPressedIcon): Likewise.
+ (setFocusPainted): Likewise.
+ (setDisabledSelectedIcon): Likewise.
+ (setRolloverIcon): Likewise.
+ (setRolloverSelectedIcon): Likewise.
+ (setSelectedIcon): Likewise.
+ (setContentAreaFilled): Likewise.
+
+2004-11-30 Kim Ho <kho@redhat.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java:
+ Jalopy. Reimplement.
+ * javax/swing/plaf/basic/BasicScrollBarUI.java:
+ Jalopy.
+ (arrowIcon, upIcon, downIcon, leftIcon,
+ rightIcon): Removed.
+ (createIncreaseButton): Use BasicArrowButton.
+ (createDecreaseButton): Ditto.
+ * javax/swing/plaf/basic/BasicSplitPaneDivider.java:
+ (createRightOneTouchButton): Remove button border.
+ (createLeftOneTouchButton): Ditto.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JSpinner.java
+ (setModel): New method.
+ * javax/swing/SpringLayout.java
+ (Constraints): May not be final.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GtkClipboard.java,
+ java/awt/datatransfer/Clipboard.java,
+ java/awt/datatransfer/ClipboardOwner.java:
+ Reformated to make it use our coding standard.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/SpinnerNumberModel.java
+ (SpinnerNumberModel): Implements java.io.Serializable.
+ (serialVersionUID): New field.
+ (SpinnerNumberModel): Added missing @throws tags to javadocs.
+ * javax/swing/UIManager.java
+ (get): New method.
+ (getBoolean): Likewise.
+ (getBorder): Likewise.
+ (getColor): Likewise.
+ (getDimension): Likewise.
+ (getFont): Likewise.
+ (getIcon): Likewise.
+ (getInsets): Likewise.
+ (getInt): Likewise.
+ (getString): Likewise.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JPasswordField.java:
+ Reformated. Implemented construtors.
+ * javax/swing/plaf/basic/BasicPasswordFieldUI.java
+ (create): New method.
+ * javax/swing/text/PlainView.java
+ (selectedColor): Made package-private to allow access from sub-classes
+ in same package too.
+ (unselectedColor): Likewise.
+ (font): Likewise.
+ (drawSelectedText): Make protected.
+ (drawUnselectedText): Likewise.
+ * javax/swing/text/PasswordView.java: New file.
+ * Makefile.am: Added javax/swing/text/PasswordView.java.
+ * Makefile.in: Regenerated.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Set menu
+ bar's width.
+ * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (nativeSetHelpMenu):
+ Add FIXME comment.
+ (addHelpMenu): Elide call to nativeSetHelpMenu.
+ * java/awt/Menu.java (isTearOff): Rename to tearOff.
+ (menuSerializedDataVersion): Initialize to 1.
+ (separatorLabel): Mark transient.
+ (insert(MenuItem,int)): Implement.
+ * java/awt/MenuBar.java (setHelpMenu): Call getPeer to retrieve
+ peer.
+ (countMenus): Count help menu.
+ * java/awt/MenuComponent.java (nameExplicitlySet, newEventsOnly,
+ accessibleContext): Add fields.
+ * java/awt/MenuItem.java: Remove event mask FIXME.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+ (gtkWidgetModifyFont): Only set font if label is non-NULL.
+ (setLabel): Don't treat "-" specially.
+
+2004-11-30 Kim Ho <kho@redhat.com>
+
+ * javax/swing/colorchooser/DefaultHSBChooserPanel.java:
+ (stateChanged): Only update the image and the track if
+ the values are not being adjusted.
+ (updateChooser): Grab the new mouse point from the
+ spinner values. Update the image and track only if
+ the values are not being adjusted.
+ (getHSBValues): New method.
+ * javax/swing/colorchooser/DefaultRGBChooserPanel.java:
+ (SliderHandler::stateChanged): Changed internalChange
+ to updateChange. Set sliderChange.
+ (SpinnerHandler::stateChanged): Ditto. Set spinnerChange.
+ (spinnerChange): New variable.
+ (sliderChange): Ditto.
+ (updateChange): Renamed from internalChange.
+ (updateChooser): Do not update sliders if the sliders
+ were the original source of the change. Ditto for spinners.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java:
+ (mousePress): Don't scroll the JViewport if there will
+ be extra space at the end of the run. Change layout() to
+ revalidate().
+ (calculateSize): Use the component's width/height unless
+ it is smaller than the max tab width/height.
+ (calculateTabRects): Subtract the tab run overlay.
+ (rotateTabRuns): Don't rotate if there's only one run.
+ (layoutContainer): Reuse the viewport point.
+ (createLayoutManager): Set the viewport to use no layout.
+ (paintTabArea): Don't paint the tabs that are not visible
+ to the JViewport.
+ (paintContentBorderTopEdge): Check for scroll tab layout before
+ looking for gap.
+ (paintContentBorderLeftEdge): Ditto.
+ (paintContentBorderBottomEdge): Ditto.
+ (paintContentBorderRightEdge): Ditto.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java (gtkWidgetSetFont):
+ Rename ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+ (setMenuBarWidth): New method.
+ (setBounds): Set the menu bar width.
+ (postConfigureEvent): Set the menu bar width if the window's
+ width has changed.
+ * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (GtkMenuBarPeer):
+ Don't call create.
+ (setFont): New method.
+ * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java (create): New
+ method.
+ (setFont): Likewise.
+ (GtkMenuComponentPeer): Call create and setFont.
+ * gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+ (connectSignals): Make package private.
+ (gtkWidgetModifyFont): New method.
+ (create): Likewise.
+ (GtkMenuItemPeer): Don't call create.
+ (setFont): New method.
+ * java/awt/CheckboxMenuItem.java (addNotify): Fix peer == null
+ condition.
+ * java/awt/Container.java (validateTree): Fix comment typos.
+ * java/awt/MenuComponent.java (getFont): Return parent's font if
+ our font is null.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
+ (create): Remove call to deprecated
+ gtk_check_menu_item_set_show_toggle function.
+
+2004-11-30 Hans Boehm <Hans.Boehm@hp.com>
+
+ * java/lang/natObject.cc (LOCK_LOG, LOG): Add debug tracing.
+ (Almost everywhere): add LOG calls, fix, add comments.
+ (_Jv_MonitorEnter): Replace masking of LOCKED bit with assertion.
+ Add explicit check for LOCKED bit in slow case (PR 16662).
+ (_Jv_MonitorExit): Add casts in debug-only code.
+ Always release LOCKED bit before throwing exception.
+ (_Jv_ObjectCheckMonitor): Lock may be held if lightweight lock
+ isn't. Handle easy cases without lock acquisition.
+ (Object::wait): Use NotifyAll for lock inflation.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+ (gtkFixedMove): Remove method.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/Area.java: Implemented.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/geom/Arc2D.java (ArcIterator): Make package private.
+
+2004-11-30 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/Arc2D.java
+ Reformatted.
+ (setArc): Correct documentation to say 'upper left corner'.
+ (setArcByTangent,contains,intersects): Implemented.
+ (containsAngle): Corrected to handle negative extents.
+ (ArcIterator): Set to private.
+ (ArcIterator): Corrected for CHORD-type arcs, negative extents.
+ * java/awt/geom/Ellipse2D.java
+ Documented.
+ (contains,intersects): Implemented.
+ * java/awt/geom/Line2D.java
+ (linesIntersect): Correct handling of special cases.
+
+2004-11-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (setColor): Use
+ Color.BLACK if c == null, don't create new Color object each time.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (comp): New private
+ field.
+ (setColor): Use Color.BLACK when argument null.
+ (setComposite): Set this.comp field.
+ (getComposite): Return this.comp, or AlphaComposite.SrcOver when null.
+ (DrawState.comp): New private field.
+ (DrawState.save): Save Composite.
+ (DrawState.restore): Restore comp field.
+ * java/awt/FontMetrics.java (gRC): New static final private field.
+ (getLineMetrics(String, Graphics)): New method.
+ (getLineMetrics(String, int, int, Graphics)): Likewise.
+ (getLineMetrics(char[], int, int, Graphics)): Likewise.
+ (getLineMetrics(CharacterIterator, int, int, Graphics)): Likewise.
+ * javax/swing/JMenu.java (JMenu(String, boolean)): Ignore tearoff
+ argument. PR SWING/17294.
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java (): Always use
+ the fall-back code since none of the TextArea methods are really
+ implemented now. PR SWING/17296.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+ (GdkGlyphVector_setChars): Replace assert() with if block when
+ pango_itemize() returns null. PR AWT/17295.
+ (GdkGlyphVector_allInkExtents): Likewise when vec->glyphitems is null.
+
+2004-11-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * Makefile.am (gtk_c_source_files): Add
+ gnu_java_awt_peer_gtk_GtkFramePeer.c.
+ * Makefile.in: Regenerate.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (getClipBounds): Remove
+ comment.
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (create): Pack GtkButton in GtkEventBox.
+ (connectJObject): Remove.
+ (focus_in_cb): New function.
+ (focus_out_cb): Likewise.
+ (connectSignals): Connect focus-in-event and focus-out-event
+ signals.
+ (gtkSetFont): Rename to ...
+ (gtkWidgetModifyFont): New method.
+ (gtkWidgetRequestFocus): New method.
+ * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+ (gtkSetFont): Rename to ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (isInRepaint): New field.
+ (gtkSetFont): Remove method.
+ (addExposeFilter): Likewise.
+ (removeExposeFilter): Likewise.
+ (gtkWidgetQueueDrawArea): Rename to ...
+ (gtkWidgetRepaintArea): New method.
+ (beginNativeRepaint): New method.
+ (endNativeRepaint): New method.
+ (setComponentBounds): Move implementation here from
+ GtkComponentPeer.
+ (paint): Remove implementation.
+ (repaint): Wrap call to gtkWidgetRepaintArea with calls to
+ beginNativeRepaint and endNativeRepaint.
+ (setBounds): Use menu bar height in bounds calculation.
+ (postExposeEvent): Only post paint event if we're not doing a
+ native repaint.
+ (gtkWidgetSetParent): Replace gtk_layout_put with gtk_fixed_put.
+ (setNativeBounds): Replace gtk_layout_move with gtk_fixed_move.
+ (find_gtk_layout): Remove function.
+ (filter_expose_event_handler): Likewise.
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java (postExposeEvent):
+ Likewise.
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+ (setComponentBounds): Call GtkComponentPeer's
+ setComponentBounds.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (getMenuBarHeight):
+ New method.
+ (moveLayout): Rename to ...
+ (gtkFixedMove): New method.
+ (gtkLayoutSetVisible): Rename to ...
+ (gtkFixedSetVisible): New method.
+ (setMenuBar): Rearrange, to make the three separate cases
+ clearer.
+ (postExposeEvent): Only post paint event if we're not doing a
+ native repaint.
+ * gnu/java/awt/peer/gtk/GtkGenericPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkImagePainter.java
+ (GtkImagePainter(GtkImage,GdkGraphics,int,int,int,int,Color)):
+ Call run directly, rather than spawning a new thread.
+ (GtkImagePainter(GtkImage,GdkGraphics,int,int,int,int,int,int,int,int,Color)):
+ Likewise.
+ * gnu/java/awt/peer/gtk/GtkLabelPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (gtkSetFont):
+ Rename to ...
+ (gtkWidgetModifyFont): New method.
+ (create): Rename ebox to eventbox.
+ * gnu/java/awt/peer/gtk/GtkListPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c (gtkSetFont):
+ Rename to ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+ (GtkMenuComponentPeer): Set the default font.
+ * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+ (gtkSetFont): Rename to ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c: Likewise.
+ * java/awt/Component.java (locale): Initialize to default
+ locale.
+ * java/awt/Container.java (invalidateTree): Make
+ package-private.
+ (paint): Paint self first.
+ (setMenuBar): Call invalidateTree.
+ * java/awt/Panel.java (dispatchEventImpl): Remove method.
+ * java/awt/Window.java (show): Call no-parameter variant of
+ requestFocusInWindow.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (initState):
+ Remove special case for window widget.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (grab_current_drawable): Likewise.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
+ (create): Replace GtkLayout with GtkFixed.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+ (pre_event_handler): Remove special cases for GDK_EXPOSE events.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c: New file.
+ Move all GtkFramePeer native method implementations here from
+ gnu_java_awt_peer_gtk_GtkWindowPeer.c.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (create):
+ Replace GtkLayout with GtkFixed.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (find_layout): Remove function.
+ (create): Replace GtkLayout with GtkFixed.
+ (connectSignals): Remove find_layout call.
+ (toBack): Replace XFlush with gdk_flush.
+ (toFront): Replace XFlush with gdk_flush.
+ Move GtkFramePeer native method implementations to
+ gnu_java_awt_peer_gtk_GtkFramePeer.c.
+ * jni/gtk-peer/gtkpeer.h: Remove declaration of find_gtk_layout.
+
+2004-11-30 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextArea.java
+ (lineWrap): Renamed from "wrapping".
+ (wrapStyleWord): NEw field.
+ (getLineWrap): Re-edited javadoc comment.
+ (setLineWrap): Likewise.
+ (getWrapStyleWord): New method.
+ (setWrapStyleWord): Likewise.
+
2004-11-29 Kelley Cook <kcook@gcc.gnu.org>
* configure: Regenerate for libtool change.
@@ -2601,6 +5067,29 @@
java/applet/AudioClip.java:
Jalopied and checkstyle clean.
+ * javax/swing/JCheckBox.java: Reformated.
+ (JCheckBox): Fixed all constructors.
+ (isBorderPaintedFlat): New method.
+ (setBorderPaintedFlat): New method.
+ * javax/swing/JEditorPane.java
+ (createEditorKitForContentType): Made public.
+ (scrollToReference): Likewise.
+ * javax/swing/JTextArea.java
+ (setLineWrap): Fire property change.
+ * javax/swing/JToggleButton.java
+ (JToggleButton): New constructor.
+ (JToggleButton): Simplified.
+ * javax/swing/text/AttributeSet.java
+ (FontAttribute): Renamed from FontCharacterAttribute.
+ * javax/swing/text/JTextComponent.java
+ (KeyBinBinding): Added javadoc.
+ (JTextComponent): Likewise.
+ (getAccessibleContext): Fixed javadoc.
+ * javax/swing/text/View.java
+ (View): Added javadoc.
+ * javax/swing/text/TabableView.java: New file.
+ * Makefile.am: Added javax/swing/text/TabableView.java.
+ * Makefile.in: Regenerated.
2004-09-23 Mark Wielaard <mark@klomp.org>
* java/util/Collections.java
@@ -12750,7 +15239,7 @@
Reset the queue after transferring its contents.
(push): Start a new dispatch thread if none is running.
-2004-01-16  Olga Rodimina <rodimina@redhat.com>
+2004-01-16 Olga Rodimina <rodimina@redhat.com>
* gnu/java/awt/peer/gtk/GdkGraphics2D.java:
(doPolygon): set fill rule of polygon to
@@ -12855,14 +15344,14 @@
* gnu/java/awt/peer/gtk/TestAWT.java (DialogWindow): Add WindowAdapter
to handle Window "Closing" events.
-2004-01-13  David Jee  <djee@redhat.com>
+2004-01-13 David Jee <djee@redhat.com>
* gnu/java/awt/peer/gtk/GtkContainerPeer.java
(setBackground): New method. Children with no explicitly-set
background will be repainted with the parent container's new
background color.
-2004-01-13  David Jee  <djee@redhat.com>
+2004-01-13 David Jee <djee@redhat.com>
* Makefile.am: Add BitwiseXORComposite.java.
* Makefile.in: Regenerated.
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 507d0d7..253e190 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -235,9 +235,6 @@ libgcj_la_LINK = $(LIBLINK)
# Gtk/Cairo JNI sources.
if GTK_CAIRO
gtk_cairo_c_source_files = \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c \
-jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
else
gtk_cairo_c_source_files =
@@ -246,8 +243,12 @@ endif
## Gtk JNI sources.
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_GtkButtonPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
@@ -260,6 +261,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.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_GtkFramePeer.c \
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 \
@@ -287,9 +289,9 @@ jni/classpath/primlib.c
## Java sources for Gtk peers.
gtk_awt_peer_sources = \
-gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java \
-gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java \
+gnu/java/awt/peer/gtk/GdkTextLayout.java \
gnu/java/awt/peer/gtk/GdkFontMetrics.java \
+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 \
@@ -307,7 +309,6 @@ gnu/java/awt/peer/gtk/GtkContainerPeer.java \
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.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/GtkGenericPeer.java \
gnu/java/awt/peer/gtk/GtkImage.java \
@@ -335,11 +336,96 @@ gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java
gtk_jni_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
-$(gtk_jni_headers): $(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
+jniinclude/gnu_java_awt_peer_gtk_GdkPixbufDecoder.h: gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+jniinclude/gnu_java_awt_peer_gtk_GtkButtonPeer.h: gnu/java/awt/peer/gtk/GtkButtonPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCanvasPeer.h: gnu/java/awt/peer/gtk/GtkCanvasPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h: gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.h: gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkChoicePeer.h: gnu/java/awt/peer/gtk/GtkChoicePeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkClipboard.h: gnu/java/awt/peer/gtk/GtkClipboard.java
+jniinclude/gnu_java_awt_peer_gtk_GtkComponentPeer.h: gnu/java/awt/peer/gtk/GtkComponentPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkContainerPeer.h: gnu/java/awt/peer/gtk/GtkContainerPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkDialogPeer.h: gnu/java/awt/peer/gtk/GtkDialogPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.h: gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h: gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkFontPeer.h: gnu/java/awt/peer/gtk/GtkFontPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkFramePeer.h: gnu/java/awt/peer/gtk/GtkFramePeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkGenericPeer.h: gnu/java/awt/peer/gtk/GtkGenericPeer.java
+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
+jniinclude/gnu_java_awt_peer_gtk_GtkMenuPeer.h: gnu/java/awt/peer/gtk/GtkMenuPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkOffScreenImage.h: gnu/java/awt/peer/gtk/GtkOffScreenImage.java
+jniinclude/gnu_java_awt_peer_gtk_GtkPanelPeer.h: gnu/java/awt/peer/gtk/GtkPanelPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h: gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkScrollPanePeer.h: gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkScrollbarPeer.h: gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h: gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkTextComponentPeer.h: gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h: gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkToolkit.h: gnu/java/awt/peer/gtk/GtkToolkit.java
+jniinclude/gnu_java_awt_peer_gtk_GtkWindowPeer.h: gnu/java/awt/peer/gtk/GtkWindowPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GThreadMutex.h: gnu/java/awt/peer/gtk/GThreadMutex.java
+jniinclude/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h: gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java
+jniinclude/gnu_java_awt_peer_gtk_GdkTextLayout.h: gnu/java/awt/peer/gtk/GdkTextLayout.java
+jniinclude/gnu_java_awt_peer_gtk_GdkFontPeer.h: gnu/java/awt/peer/gtk/GdkFontPeer.java
+
+$(gtk_jni_headers): %.h:
@input=`echo $@ | sed -e 's,jniinclude/,,' -e 's,_,.,g' -e 's,.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
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkPixbufDecoder.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkTextLayout.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkButtonPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCanvasPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkChoicePeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkClipboard.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkFramePeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkGenericPeer.h
+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
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkPanelPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkScrollbarPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkScrollPanePeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkTextComponentPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkToolkit.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkWindowPeer.h
+
+
## For the peer library, DEPENDENCIES need to come before OBJECTS so
## that JNI headers are built before JNI C files.
$(lib_gnu_java_awt_peer_gtk_la_OBJECTS): $(lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES)
@@ -1046,11 +1132,25 @@ gnu/java/awt/ClasspathToolkit.java \
gnu/java/awt/EmbeddedWindow.java \
gnu/java/awt/EmbeddedWindowSupport.java \
gnu/java/awt/EventModifier.java \
+gnu/java/awt/color/CieXyzConverter.java \
+gnu/java/awt/color/ClutProfileConverter.java \
+gnu/java/awt/color/ColorLookUpTable.java \
+gnu/java/awt/color/ColorSpaceConverter.java \
+gnu/java/awt/color/GrayProfileConverter.java \
+gnu/java/awt/color/GrayScaleConverter.java \
+gnu/java/awt/color/LinearRGBConverter.java \
+gnu/java/awt/color/ProfileHeader.java \
+gnu/java/awt/color/PyccConverter.java \
+gnu/java/awt/color/RgbProfileConverter.java \
+gnu/java/awt/color/SrgbConverter.java \
+gnu/java/awt/color/TagEntry.java \
+gnu/java/awt/color/ToneReproductionCurve.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/awt/peer/EmbeddedWindowPeer.java \
gnu/java/awt/peer/GLightweightPeer.java \
gnu/java/awt/peer/ClasspathFontPeer.java \
+gnu/java/awt/peer/ClasspathTextLayoutPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \
@@ -1230,12 +1330,17 @@ java/awt/geom/CubicCurve2D.java \
java/awt/geom/FlatteningPathIterator.java \
java/awt/geom/GeneralPath.java \
java/awt/geom/QuadCurve2D.java \
+java/awt/image/BandCombineOp.java \
+java/awt/image/BandedSampleModel.java \
java/awt/image/AffineTransformOp.java \
java/awt/image/BufferedImage.java \
+java/awt/image/BufferedImageFilter.java \
java/awt/image/ByteLookupTable.java \
+java/awt/image/ColorConvertOp.java \
java/awt/image/ColorModel.java \
java/awt/image/ComponentColorModel.java \
java/awt/image/ComponentSampleModel.java \
+java/awt/image/ConvolveOp.java \
java/awt/image/DataBuffer.java \
java/awt/image/DataBufferByte.java \
java/awt/image/DataBufferDouble.java \
@@ -1249,11 +1354,14 @@ java/awt/image/ImageObserver.java \
java/awt/image/ImageProducer.java \
java/awt/image/IndexColorModel.java \
java/awt/image/Kernel.java \
+java/awt/image/LookupOp.java \
java/awt/image/LookupTable.java \
+java/awt/image/MultiPixelPackedSampleModel.java \
java/awt/image/PackedColorModel.java \
java/awt/image/PixelInterleavedSampleModel.java \
java/awt/image/Raster.java \
java/awt/image/RasterOp.java \
+java/awt/image/RescaleOp.java \
java/awt/image/SampleModel.java \
java/awt/image/ShortLookupTable.java \
java/awt/image/SinglePixelPackedSampleModel.java \
@@ -1491,6 +1599,7 @@ javax/swing/plaf/basic/BasicTableUI.java \
javax/swing/plaf/basic/BasicTableHeaderUI.java \
javax/swing/plaf/basic/BasicTextAreaUI.java \
javax/swing/plaf/basic/BasicTextFieldUI.java \
+javax/swing/plaf/basic/BasicTextPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarSeparatorUI.java \
@@ -1614,6 +1723,7 @@ javax/swing/ListModel.java \
javax/swing/ListSelectionModel.java \
javax/swing/LookAndFeel.java \
javax/swing/Scrollable.java \
+javax/swing/SpinnerListModel.java \
javax/swing/SpinnerModel.java \
javax/swing/SpinnerNumberModel.java \
javax/swing/Spring.java \
@@ -1690,6 +1800,7 @@ javax/swing/text/Keymap.java \
javax/swing/text/LayeredHighlighter.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
+javax/swing/text/PasswordView.java \
javax/swing/text/PlainDocument.java \
javax/swing/text/PlainView.java \
javax/swing/text/Position.java \
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index 5e245da..11bdead 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -138,9 +138,9 @@ lib_gnu_awt_xlib_la_OBJECTS = $(am_lib_gnu_awt_xlib_la_OBJECTS)
@XLIB_AWT_TRUE@am_lib_gnu_awt_xlib_la_rpath = -rpath $(toolexeclibdir)
am__DEPENDENCIES_1 =
am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST = \
- gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java \
- gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java \
+ gnu/java/awt/peer/gtk/GdkTextLayout.java \
gnu/java/awt/peer/gtk/GdkFontMetrics.java \
+ 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 \
@@ -158,7 +158,6 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST = \
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.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/GtkGenericPeer.java \
gnu/java/awt/peer/gtk/GtkImage.java \
@@ -182,12 +181,13 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST = \
gnu/java/awt/peer/gtk/GtkWindowPeer.java \
gnu/java/awt/peer/gtk/GThreadMutex.java \
gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java \
- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c \
- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c \
- jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c \
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_GtkButtonPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
@@ -200,6 +200,7 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST = \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.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_GtkFramePeer.c \
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 \
@@ -225,9 +226,9 @@ am__lib_gnu_java_awt_peer_gtk_la_SOURCES_DIST = \
jni/gtk-peer/gtkpeer.h jni/classpath/jcl.h \
jni/classpath/jnilink.h jni/classpath/native_state.h \
jni/classpath/primlib.h
-am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.lo \
- gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.lo \
+am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.lo \
+ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.lo \
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 \
@@ -245,7 +246,6 @@ am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathF
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkDialogPeer.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkEmbeddedWindowPeer.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFileDialogPeer.lo \
- gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkGenericPeer.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkImage.lo \
@@ -269,13 +269,14 @@ am__objects_3 = gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathF
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkWindowPeer.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GThreadMutex.lo \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GThreadNativeMethodRunner.lo
-@GTK_CAIRO_TRUE@am__objects_4 = jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.lo \
-@GTK_CAIRO_TRUE@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.lo \
-@GTK_CAIRO_TRUE@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo \
-@GTK_CAIRO_TRUE@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo
+@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_GtkButtonPeer.lo \
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkCanvasPeer.lo \
@@ -288,6 +289,7 @@ am__objects_5 = $(am__objects_4) \
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo \
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkEvents.lo \
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo \
+ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.lo \
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.lo \
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 \
@@ -1287,11 +1289,25 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc link.cc \
gnu/java/awt/EmbeddedWindow.java \
gnu/java/awt/EmbeddedWindowSupport.java \
gnu/java/awt/EventModifier.java \
+ gnu/java/awt/color/CieXyzConverter.java \
+ gnu/java/awt/color/ClutProfileConverter.java \
+ gnu/java/awt/color/ColorLookUpTable.java \
+ gnu/java/awt/color/ColorSpaceConverter.java \
+ gnu/java/awt/color/GrayProfileConverter.java \
+ gnu/java/awt/color/GrayScaleConverter.java \
+ gnu/java/awt/color/LinearRGBConverter.java \
+ gnu/java/awt/color/ProfileHeader.java \
+ gnu/java/awt/color/PyccConverter.java \
+ gnu/java/awt/color/RgbProfileConverter.java \
+ gnu/java/awt/color/SrgbConverter.java \
+ gnu/java/awt/color/TagEntry.java \
+ gnu/java/awt/color/ToneReproductionCurve.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/awt/peer/EmbeddedWindowPeer.java \
gnu/java/awt/peer/GLightweightPeer.java \
gnu/java/awt/peer/ClasspathFontPeer.java \
+ gnu/java/awt/peer/ClasspathTextLayoutPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \
@@ -1426,13 +1442,17 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc link.cc \
java/awt/geom/CubicCurve2D.java \
java/awt/geom/FlatteningPathIterator.java \
java/awt/geom/GeneralPath.java java/awt/geom/QuadCurve2D.java \
+ java/awt/image/BandCombineOp.java \
+ java/awt/image/BandedSampleModel.java \
java/awt/image/AffineTransformOp.java \
java/awt/image/BufferedImage.java \
+ java/awt/image/BufferedImageFilter.java \
java/awt/image/ByteLookupTable.java \
+ java/awt/image/ColorConvertOp.java \
java/awt/image/ColorModel.java \
java/awt/image/ComponentColorModel.java \
java/awt/image/ComponentSampleModel.java \
- java/awt/image/DataBuffer.java \
+ java/awt/image/ConvolveOp.java java/awt/image/DataBuffer.java \
java/awt/image/DataBufferByte.java \
java/awt/image/DataBufferDouble.java \
java/awt/image/DataBufferFloat.java \
@@ -1444,11 +1464,12 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc link.cc \
java/awt/image/ImageObserver.java \
java/awt/image/ImageProducer.java \
java/awt/image/IndexColorModel.java java/awt/image/Kernel.java \
- java/awt/image/LookupTable.java \
+ java/awt/image/LookupOp.java java/awt/image/LookupTable.java \
+ java/awt/image/MultiPixelPackedSampleModel.java \
java/awt/image/PackedColorModel.java \
java/awt/image/PixelInterleavedSampleModel.java \
java/awt/image/Raster.java java/awt/image/RasterOp.java \
- java/awt/image/SampleModel.java \
+ java/awt/image/RescaleOp.java java/awt/image/SampleModel.java \
java/awt/image/ShortLookupTable.java \
java/awt/image/SinglePixelPackedSampleModel.java \
java/awt/image/WritableRaster.java \
@@ -1652,6 +1673,7 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc link.cc \
javax/swing/plaf/basic/BasicTableHeaderUI.java \
javax/swing/plaf/basic/BasicTextAreaUI.java \
javax/swing/plaf/basic/BasicTextFieldUI.java \
+ javax/swing/plaf/basic/BasicTextPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarSeparatorUI.java \
@@ -1751,6 +1773,7 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc link.cc \
javax/swing/ListCellRenderer.java javax/swing/ListModel.java \
javax/swing/ListSelectionModel.java \
javax/swing/LookAndFeel.java javax/swing/Scrollable.java \
+ javax/swing/SpinnerListModel.java \
javax/swing/SpinnerModel.java \
javax/swing/SpinnerNumberModel.java javax/swing/Spring.java \
javax/swing/SpringLayout.java javax/swing/SwingConstants.java \
@@ -1822,6 +1845,7 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc link.cc \
javax/swing/text/LayeredHighlighter.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
+ javax/swing/text/PasswordView.java \
javax/swing/text/PlainDocument.java \
javax/swing/text/PlainView.java javax/swing/text/Position.java \
javax/swing/text/Segment.java \
@@ -2618,11 +2642,25 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
gnu/java/awt/EmbeddedWindow.lo \
gnu/java/awt/EmbeddedWindowSupport.lo \
gnu/java/awt/EventModifier.lo \
+ gnu/java/awt/color/CieXyzConverter.lo \
+ gnu/java/awt/color/ClutProfileConverter.lo \
+ gnu/java/awt/color/ColorLookUpTable.lo \
+ gnu/java/awt/color/ColorSpaceConverter.lo \
+ gnu/java/awt/color/GrayProfileConverter.lo \
+ gnu/java/awt/color/GrayScaleConverter.lo \
+ gnu/java/awt/color/LinearRGBConverter.lo \
+ gnu/java/awt/color/ProfileHeader.lo \
+ gnu/java/awt/color/PyccConverter.lo \
+ gnu/java/awt/color/RgbProfileConverter.lo \
+ gnu/java/awt/color/SrgbConverter.lo \
+ gnu/java/awt/color/TagEntry.lo \
+ gnu/java/awt/color/ToneReproductionCurve.lo \
gnu/java/awt/image/ImageDecoder.lo \
gnu/java/awt/image/XBMDecoder.lo \
gnu/java/awt/peer/EmbeddedWindowPeer.lo \
gnu/java/awt/peer/GLightweightPeer.lo \
gnu/java/awt/peer/ClasspathFontPeer.lo \
+ gnu/java/awt/peer/ClasspathTextLayoutPeer.lo \
gnu/java/beans/editors/ColorEditor.lo \
gnu/java/beans/editors/FontEditor.lo \
gnu/java/beans/editors/NativeBooleanEditor.lo \
@@ -2742,12 +2780,17 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
java/awt/geom/CubicCurve2D.lo \
java/awt/geom/FlatteningPathIterator.lo \
java/awt/geom/GeneralPath.lo java/awt/geom/QuadCurve2D.lo \
+ java/awt/image/BandCombineOp.lo \
+ java/awt/image/BandedSampleModel.lo \
java/awt/image/AffineTransformOp.lo \
java/awt/image/BufferedImage.lo \
- java/awt/image/ByteLookupTable.lo java/awt/image/ColorModel.lo \
+ java/awt/image/BufferedImageFilter.lo \
+ java/awt/image/ByteLookupTable.lo \
+ java/awt/image/ColorConvertOp.lo java/awt/image/ColorModel.lo \
java/awt/image/ComponentColorModel.lo \
java/awt/image/ComponentSampleModel.lo \
- java/awt/image/DataBuffer.lo java/awt/image/DataBufferByte.lo \
+ java/awt/image/ConvolveOp.lo java/awt/image/DataBuffer.lo \
+ java/awt/image/DataBufferByte.lo \
java/awt/image/DataBufferDouble.lo \
java/awt/image/DataBufferFloat.lo \
java/awt/image/DataBufferInt.lo \
@@ -2758,11 +2801,12 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
java/awt/image/ImageObserver.lo \
java/awt/image/ImageProducer.lo \
java/awt/image/IndexColorModel.lo java/awt/image/Kernel.lo \
- java/awt/image/LookupTable.lo \
+ java/awt/image/LookupOp.lo java/awt/image/LookupTable.lo \
+ java/awt/image/MultiPixelPackedSampleModel.lo \
java/awt/image/PackedColorModel.lo \
java/awt/image/PixelInterleavedSampleModel.lo \
java/awt/image/Raster.lo java/awt/image/RasterOp.lo \
- java/awt/image/SampleModel.lo \
+ java/awt/image/RescaleOp.lo java/awt/image/SampleModel.lo \
java/awt/image/ShortLookupTable.lo \
java/awt/image/SinglePixelPackedSampleModel.lo \
java/awt/image/WritableRaster.lo \
@@ -2955,6 +2999,7 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
javax/swing/plaf/basic/BasicTableHeaderUI.lo \
javax/swing/plaf/basic/BasicTextAreaUI.lo \
javax/swing/plaf/basic/BasicTextFieldUI.lo \
+ javax/swing/plaf/basic/BasicTextPaneUI.lo \
javax/swing/plaf/basic/BasicTextUI.lo \
javax/swing/plaf/basic/BasicToggleButtonUI.lo \
javax/swing/plaf/basic/BasicToolBarSeparatorUI.lo \
@@ -3043,12 +3088,13 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
javax/swing/JWindow.lo javax/swing/KeyStroke.lo \
javax/swing/ListCellRenderer.lo javax/swing/ListModel.lo \
javax/swing/ListSelectionModel.lo javax/swing/LookAndFeel.lo \
- javax/swing/Scrollable.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/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 \
@@ -3109,6 +3155,7 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \
javax/swing/text/LayeredHighlighter.lo \
javax/swing/text/MutableAttributeSet.lo \
javax/swing/text/NavigationFilter.lo \
+ javax/swing/text/PasswordView.lo \
javax/swing/text/PlainDocument.lo \
javax/swing/text/PlainView.lo javax/swing/text/Position.lo \
javax/swing/text/Segment.lo \
@@ -4581,15 +4628,16 @@ libgcj_la_LINK = $(LIBLINK)
# Gtk/Cairo JNI sources.
@GTK_CAIRO_TRUE@gtk_cairo_c_source_files = \
-@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c \
-@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c \
-@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c \
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
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_GtkButtonPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
@@ -4602,6 +4650,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.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_GtkFramePeer.c \
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 \
@@ -4628,9 +4677,9 @@ jni/classpath/native_state.c \
jni/classpath/primlib.c
gtk_awt_peer_sources = \
-gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java \
-gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java \
+gnu/java/awt/peer/gtk/GdkTextLayout.java \
gnu/java/awt/peer/gtk/GdkFontMetrics.java \
+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 \
@@ -4648,7 +4697,6 @@ gnu/java/awt/peer/gtk/GtkContainerPeer.java \
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.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/GtkGenericPeer.java \
gnu/java/awt/peer/gtk/GtkImage.java \
@@ -4923,11 +4971,25 @@ gnu/java/awt/ClasspathToolkit.java \
gnu/java/awt/EmbeddedWindow.java \
gnu/java/awt/EmbeddedWindowSupport.java \
gnu/java/awt/EventModifier.java \
+gnu/java/awt/color/CieXyzConverter.java \
+gnu/java/awt/color/ClutProfileConverter.java \
+gnu/java/awt/color/ColorLookUpTable.java \
+gnu/java/awt/color/ColorSpaceConverter.java \
+gnu/java/awt/color/GrayProfileConverter.java \
+gnu/java/awt/color/GrayScaleConverter.java \
+gnu/java/awt/color/LinearRGBConverter.java \
+gnu/java/awt/color/ProfileHeader.java \
+gnu/java/awt/color/PyccConverter.java \
+gnu/java/awt/color/RgbProfileConverter.java \
+gnu/java/awt/color/SrgbConverter.java \
+gnu/java/awt/color/TagEntry.java \
+gnu/java/awt/color/ToneReproductionCurve.java \
gnu/java/awt/image/ImageDecoder.java \
gnu/java/awt/image/XBMDecoder.java \
gnu/java/awt/peer/EmbeddedWindowPeer.java \
gnu/java/awt/peer/GLightweightPeer.java \
gnu/java/awt/peer/ClasspathFontPeer.java \
+gnu/java/awt/peer/ClasspathTextLayoutPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \
@@ -5107,12 +5169,17 @@ java/awt/geom/CubicCurve2D.java \
java/awt/geom/FlatteningPathIterator.java \
java/awt/geom/GeneralPath.java \
java/awt/geom/QuadCurve2D.java \
+java/awt/image/BandCombineOp.java \
+java/awt/image/BandedSampleModel.java \
java/awt/image/AffineTransformOp.java \
java/awt/image/BufferedImage.java \
+java/awt/image/BufferedImageFilter.java \
java/awt/image/ByteLookupTable.java \
+java/awt/image/ColorConvertOp.java \
java/awt/image/ColorModel.java \
java/awt/image/ComponentColorModel.java \
java/awt/image/ComponentSampleModel.java \
+java/awt/image/ConvolveOp.java \
java/awt/image/DataBuffer.java \
java/awt/image/DataBufferByte.java \
java/awt/image/DataBufferDouble.java \
@@ -5126,11 +5193,14 @@ java/awt/image/ImageObserver.java \
java/awt/image/ImageProducer.java \
java/awt/image/IndexColorModel.java \
java/awt/image/Kernel.java \
+java/awt/image/LookupOp.java \
java/awt/image/LookupTable.java \
+java/awt/image/MultiPixelPackedSampleModel.java \
java/awt/image/PackedColorModel.java \
java/awt/image/PixelInterleavedSampleModel.java \
java/awt/image/Raster.java \
java/awt/image/RasterOp.java \
+java/awt/image/RescaleOp.java \
java/awt/image/SampleModel.java \
java/awt/image/ShortLookupTable.java \
java/awt/image/SinglePixelPackedSampleModel.java \
@@ -5368,6 +5438,7 @@ javax/swing/plaf/basic/BasicTableUI.java \
javax/swing/plaf/basic/BasicTableHeaderUI.java \
javax/swing/plaf/basic/BasicTextAreaUI.java \
javax/swing/plaf/basic/BasicTextFieldUI.java \
+javax/swing/plaf/basic/BasicTextPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarSeparatorUI.java \
@@ -5491,6 +5562,7 @@ javax/swing/ListModel.java \
javax/swing/ListSelectionModel.java \
javax/swing/LookAndFeel.java \
javax/swing/Scrollable.java \
+javax/swing/SpinnerListModel.java \
javax/swing/SpinnerModel.java \
javax/swing/SpinnerNumberModel.java \
javax/swing/Spring.java \
@@ -5567,6 +5639,7 @@ javax/swing/text/Keymap.java \
javax/swing/text/LayeredHighlighter.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
+javax/swing/text/PasswordView.java \
javax/swing/text/PlainDocument.java \
javax/swing/text/PlainView.java \
javax/swing/text/Position.java \
@@ -7535,13 +7608,13 @@ gnu/java/awt/peer/gtk/$(am__dirstamp):
gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp):
@$(mkdir_p) gnu/java/awt/peer/gtk/$(DEPDIR)
@: > gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
-gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.lo: \
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.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-GdkClasspathFontPeerMetrics.lo: \
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.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-GdkFontMetrics.lo: \
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.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-GdkGlyphVector.lo: \
@@ -7595,9 +7668,6 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkEmbeddedWindowPeer.lo: \
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFileDialogPeer.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-GtkFontPeer.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-GtkFramePeer.lo: \
gnu/java/awt/peer/gtk/$(am__dirstamp) \
gnu/java/awt/peer/gtk/$(DEPDIR)/$(am__dirstamp)
@@ -7673,24 +7743,27 @@ jni/gtk-peer/$(am__dirstamp):
jni/gtk-peer/$(DEPDIR)/$(am__dirstamp):
@$(mkdir_p) jni/gtk-peer/$(DEPDIR)
@: > jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.lo: \
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.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_GdkClasspathFontPeerMetrics.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_GdkGlyphVector.lo: \
+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_GdkGraphics2D.lo: \
+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_GdkFontMetrics.lo: \
+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)
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.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_GdkPixbufDecoder.lo: \
jni/gtk-peer/$(am__dirstamp) \
jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
@@ -7727,6 +7800,9 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkEvents.lo: \
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFileDialogPeer.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_GtkFramePeer.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_GtkGenericPeer.lo: \
jni/gtk-peer/$(am__dirstamp) \
jni/gtk-peer/$(DEPDIR)/$(am__dirstamp)
@@ -11101,6 +11177,50 @@ gnu/java/awt/EmbeddedWindowSupport.lo: gnu/java/awt/$(am__dirstamp) \
gnu/java/awt/$(DEPDIR)/$(am__dirstamp)
gnu/java/awt/EventModifier.lo: gnu/java/awt/$(am__dirstamp) \
gnu/java/awt/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/$(am__dirstamp):
+ @$(mkdir_p) gnu/java/awt/color
+ @: > gnu/java/awt/color/$(am__dirstamp)
+gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp):
+ @$(mkdir_p) gnu/java/awt/color/$(DEPDIR)
+ @: > gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/CieXyzConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/ClutProfileConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/ColorLookUpTable.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/ColorSpaceConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/GrayProfileConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/GrayScaleConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/LinearRGBConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/ProfileHeader.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/PyccConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/RgbProfileConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/SrgbConverter.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/TagEntry.lo: gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/color/ToneReproductionCurve.lo: \
+ gnu/java/awt/color/$(am__dirstamp) \
+ gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
gnu/java/awt/image/$(am__dirstamp):
@$(mkdir_p) gnu/java/awt/image
@: > gnu/java/awt/image/$(am__dirstamp)
@@ -11127,6 +11247,9 @@ gnu/java/awt/peer/GLightweightPeer.lo: \
gnu/java/awt/peer/ClasspathFontPeer.lo: \
gnu/java/awt/peer/$(am__dirstamp) \
gnu/java/awt/peer/$(DEPDIR)/$(am__dirstamp)
+gnu/java/awt/peer/ClasspathTextLayoutPeer.lo: \
+ gnu/java/awt/peer/$(am__dirstamp) \
+ gnu/java/awt/peer/$(DEPDIR)/$(am__dirstamp)
gnu/java/beans/editors/$(am__dirstamp):
@$(mkdir_p) gnu/java/beans/editors
@: > gnu/java/beans/editors/$(am__dirstamp)
@@ -11581,12 +11704,20 @@ java/awt/image/$(am__dirstamp):
java/awt/image/$(DEPDIR)/$(am__dirstamp):
@$(mkdir_p) java/awt/image/$(DEPDIR)
@: > java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/BandCombineOp.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/BandedSampleModel.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/AffineTransformOp.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/BufferedImage.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/BufferedImageFilter.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/ByteLookupTable.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/ColorConvertOp.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/ColorModel.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/ComponentColorModel.lo: java/awt/image/$(am__dirstamp) \
@@ -11594,6 +11725,8 @@ java/awt/image/ComponentColorModel.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/ComponentSampleModel.lo: \
java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/ConvolveOp.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/DataBuffer.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/DataBufferByte.lo: java/awt/image/$(am__dirstamp) \
@@ -11620,8 +11753,13 @@ java/awt/image/IndexColorModel.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/Kernel.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/LookupOp.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/LookupTable.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/MultiPixelPackedSampleModel.lo: \
+ java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/PackedColorModel.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/PixelInterleavedSampleModel.lo: \
@@ -11631,6 +11769,8 @@ java/awt/image/Raster.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/RasterOp.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
+java/awt/image/RescaleOp.lo: java/awt/image/$(am__dirstamp) \
+ java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/SampleModel.lo: java/awt/image/$(am__dirstamp) \
java/awt/image/$(DEPDIR)/$(am__dirstamp)
java/awt/image/ShortLookupTable.lo: java/awt/image/$(am__dirstamp) \
@@ -12263,6 +12403,9 @@ javax/swing/plaf/basic/BasicTextAreaUI.lo: \
javax/swing/plaf/basic/BasicTextFieldUI.lo: \
javax/swing/plaf/basic/$(am__dirstamp) \
javax/swing/plaf/basic/$(DEPDIR)/$(am__dirstamp)
+javax/swing/plaf/basic/BasicTextPaneUI.lo: \
+ javax/swing/plaf/basic/$(am__dirstamp) \
+ javax/swing/plaf/basic/$(DEPDIR)/$(am__dirstamp)
javax/swing/plaf/basic/BasicTextUI.lo: \
javax/swing/plaf/basic/$(am__dirstamp) \
javax/swing/plaf/basic/$(DEPDIR)/$(am__dirstamp)
@@ -12575,6 +12718,8 @@ 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/SpinnerListModel.lo: javax/swing/$(am__dirstamp) \
+ javax/swing/$(DEPDIR)/$(am__dirstamp)
javax/swing/SpinnerModel.lo: javax/swing/$(am__dirstamp) \
javax/swing/$(DEPDIR)/$(am__dirstamp)
javax/swing/SpinnerNumberModel.lo: javax/swing/$(am__dirstamp) \
@@ -12781,6 +12926,8 @@ javax/swing/text/MutableAttributeSet.lo: \
javax/swing/text/NavigationFilter.lo: \
javax/swing/text/$(am__dirstamp) \
javax/swing/text/$(DEPDIR)/$(am__dirstamp)
+javax/swing/text/PasswordView.lo: javax/swing/text/$(am__dirstamp) \
+ javax/swing/text/$(DEPDIR)/$(am__dirstamp)
javax/swing/text/PlainDocument.lo: javax/swing/text/$(am__dirstamp) \
javax/swing/text/$(DEPDIR)/$(am__dirstamp)
javax/swing/text/PlainView.lo: javax/swing/text/$(am__dirstamp) \
@@ -14724,12 +14871,40 @@ mostlyclean-compile:
-rm -f gnu/java/awt/EmbeddedWindowSupport.lo
-rm -f gnu/java/awt/EventModifier.$(OBJEXT)
-rm -f gnu/java/awt/EventModifier.lo
+ -rm -f gnu/java/awt/color/CieXyzConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/CieXyzConverter.lo
+ -rm -f gnu/java/awt/color/ClutProfileConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/ClutProfileConverter.lo
+ -rm -f gnu/java/awt/color/ColorLookUpTable.$(OBJEXT)
+ -rm -f gnu/java/awt/color/ColorLookUpTable.lo
+ -rm -f gnu/java/awt/color/ColorSpaceConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/ColorSpaceConverter.lo
+ -rm -f gnu/java/awt/color/GrayProfileConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/GrayProfileConverter.lo
+ -rm -f gnu/java/awt/color/GrayScaleConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/GrayScaleConverter.lo
+ -rm -f gnu/java/awt/color/LinearRGBConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/LinearRGBConverter.lo
+ -rm -f gnu/java/awt/color/ProfileHeader.$(OBJEXT)
+ -rm -f gnu/java/awt/color/ProfileHeader.lo
+ -rm -f gnu/java/awt/color/PyccConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/PyccConverter.lo
+ -rm -f gnu/java/awt/color/RgbProfileConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/RgbProfileConverter.lo
+ -rm -f gnu/java/awt/color/SrgbConverter.$(OBJEXT)
+ -rm -f gnu/java/awt/color/SrgbConverter.lo
+ -rm -f gnu/java/awt/color/TagEntry.$(OBJEXT)
+ -rm -f gnu/java/awt/color/TagEntry.lo
+ -rm -f gnu/java/awt/color/ToneReproductionCurve.$(OBJEXT)
+ -rm -f gnu/java/awt/color/ToneReproductionCurve.lo
-rm -f gnu/java/awt/image/ImageDecoder.$(OBJEXT)
-rm -f gnu/java/awt/image/ImageDecoder.lo
-rm -f gnu/java/awt/image/XBMDecoder.$(OBJEXT)
-rm -f gnu/java/awt/image/XBMDecoder.lo
-rm -f gnu/java/awt/peer/ClasspathFontPeer.$(OBJEXT)
-rm -f gnu/java/awt/peer/ClasspathFontPeer.lo
+ -rm -f gnu/java/awt/peer/ClasspathTextLayoutPeer.$(OBJEXT)
+ -rm -f gnu/java/awt/peer/ClasspathTextLayoutPeer.lo
-rm -f gnu/java/awt/peer/EmbeddedWindowPeer.$(OBJEXT)
-rm -f gnu/java/awt/peer/EmbeddedWindowPeer.lo
-rm -f gnu/java/awt/peer/GLightweightPeer.$(OBJEXT)
@@ -14738,12 +14913,10 @@ mostlyclean-compile:
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GThreadMutex.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GThreadNativeMethodRunner.$(OBJEXT)
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GThreadNativeMethodRunner.lo
- -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.$(OBJEXT)
- -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.lo
- -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.$(OBJEXT)
- -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.$(OBJEXT)
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.lo
+ -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.$(OBJEXT)
+ -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.$(OBJEXT)
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGraphics.$(OBJEXT)
@@ -14754,6 +14927,8 @@ mostlyclean-compile:
-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-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)
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkButtonPeer.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkCanvasPeer.$(OBJEXT)
@@ -14778,8 +14953,6 @@ mostlyclean-compile:
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkEmbeddedWindowPeer.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFileDialogPeer.$(OBJEXT)
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFileDialogPeer.lo
- -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.$(OBJEXT)
- -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.$(OBJEXT)
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.lo
-rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkGenericPeer.$(OBJEXT)
@@ -15998,20 +16171,30 @@ mostlyclean-compile:
-rm -f java/awt/image/AffineTransformOp.lo
-rm -f java/awt/image/AreaAveragingScaleFilter.$(OBJEXT)
-rm -f java/awt/image/AreaAveragingScaleFilter.lo
+ -rm -f java/awt/image/BandCombineOp.$(OBJEXT)
+ -rm -f java/awt/image/BandCombineOp.lo
+ -rm -f java/awt/image/BandedSampleModel.$(OBJEXT)
+ -rm -f java/awt/image/BandedSampleModel.lo
-rm -f java/awt/image/BufferStrategy.$(OBJEXT)
-rm -f java/awt/image/BufferStrategy.lo
-rm -f java/awt/image/BufferedImage.$(OBJEXT)
-rm -f java/awt/image/BufferedImage.lo
+ -rm -f java/awt/image/BufferedImageFilter.$(OBJEXT)
+ -rm -f java/awt/image/BufferedImageFilter.lo
-rm -f java/awt/image/BufferedImageOp.$(OBJEXT)
-rm -f java/awt/image/BufferedImageOp.lo
-rm -f java/awt/image/ByteLookupTable.$(OBJEXT)
-rm -f java/awt/image/ByteLookupTable.lo
+ -rm -f java/awt/image/ColorConvertOp.$(OBJEXT)
+ -rm -f java/awt/image/ColorConvertOp.lo
-rm -f java/awt/image/ColorModel.$(OBJEXT)
-rm -f java/awt/image/ColorModel.lo
-rm -f java/awt/image/ComponentColorModel.$(OBJEXT)
-rm -f java/awt/image/ComponentColorModel.lo
-rm -f java/awt/image/ComponentSampleModel.$(OBJEXT)
-rm -f java/awt/image/ComponentSampleModel.lo
+ -rm -f java/awt/image/ConvolveOp.$(OBJEXT)
+ -rm -f java/awt/image/ConvolveOp.lo
-rm -f java/awt/image/CropImageFilter.$(OBJEXT)
-rm -f java/awt/image/CropImageFilter.lo
-rm -f java/awt/image/DataBuffer.$(OBJEXT)
@@ -16046,10 +16229,14 @@ mostlyclean-compile:
-rm -f java/awt/image/IndexColorModel.lo
-rm -f java/awt/image/Kernel.$(OBJEXT)
-rm -f java/awt/image/Kernel.lo
+ -rm -f java/awt/image/LookupOp.$(OBJEXT)
+ -rm -f java/awt/image/LookupOp.lo
-rm -f java/awt/image/LookupTable.$(OBJEXT)
-rm -f java/awt/image/LookupTable.lo
-rm -f java/awt/image/MemoryImageSource.$(OBJEXT)
-rm -f java/awt/image/MemoryImageSource.lo
+ -rm -f java/awt/image/MultiPixelPackedSampleModel.$(OBJEXT)
+ -rm -f java/awt/image/MultiPixelPackedSampleModel.lo
-rm -f java/awt/image/PackedColorModel.$(OBJEXT)
-rm -f java/awt/image/PackedColorModel.lo
-rm -f java/awt/image/PixelGrabber.$(OBJEXT)
@@ -16068,6 +16255,8 @@ mostlyclean-compile:
-rm -f java/awt/image/RenderedImage.lo
-rm -f java/awt/image/ReplicateScaleFilter.$(OBJEXT)
-rm -f java/awt/image/ReplicateScaleFilter.lo
+ -rm -f java/awt/image/RescaleOp.$(OBJEXT)
+ -rm -f java/awt/image/RescaleOp.lo
-rm -f java/awt/image/SampleModel.$(OBJEXT)
-rm -f java/awt/image/SampleModel.lo
-rm -f java/awt/image/ShortLookupTable.$(OBJEXT)
@@ -18788,6 +18977,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/SpinnerListModel.$(OBJEXT)
+ -rm -f javax/swing/SpinnerListModel.lo
-rm -f javax/swing/SpinnerModel.$(OBJEXT)
-rm -f javax/swing/SpinnerModel.lo
-rm -f javax/swing/SpinnerNumberModel.$(OBJEXT)
@@ -19116,6 +19307,8 @@ mostlyclean-compile:
-rm -f javax/swing/plaf/basic/BasicTextAreaUI.lo
-rm -f javax/swing/plaf/basic/BasicTextFieldUI.$(OBJEXT)
-rm -f javax/swing/plaf/basic/BasicTextFieldUI.lo
+ -rm -f javax/swing/plaf/basic/BasicTextPaneUI.$(OBJEXT)
+ -rm -f javax/swing/plaf/basic/BasicTextPaneUI.lo
-rm -f javax/swing/plaf/basic/BasicTextUI.$(OBJEXT)
-rm -f javax/swing/plaf/basic/BasicTextUI.lo
-rm -f javax/swing/plaf/basic/BasicToggleButtonUI.$(OBJEXT)
@@ -19194,6 +19387,8 @@ mostlyclean-compile:
-rm -f javax/swing/text/MutableAttributeSet.lo
-rm -f javax/swing/text/NavigationFilter.$(OBJEXT)
-rm -f javax/swing/text/NavigationFilter.lo
+ -rm -f javax/swing/text/PasswordView.$(OBJEXT)
+ -rm -f javax/swing/text/PasswordView.lo
-rm -f javax/swing/text/PlainDocument.$(OBJEXT)
-rm -f javax/swing/text/PlainDocument.lo
-rm -f javax/swing/text/PlainView.$(OBJEXT)
@@ -19330,20 +19525,22 @@ 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_GdkClasspathFontPeer.$(OBJEXT)
- -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.lo
- -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.$(OBJEXT)
- -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.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)
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo
+ -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.$(OBJEXT)
+ -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_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)
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkButtonPeer.lo
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkCanvasPeer.$(OBJEXT)
@@ -19366,6 +19563,8 @@ mostlyclean-compile:
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkEvents.lo
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFileDialogPeer.$(OBJEXT)
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo
+ -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.$(OBJEXT)
+ -rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.lo
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.$(OBJEXT)
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.lo
-rm -f jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkImagePainter.$(OBJEXT)
@@ -19683,21 +19882,35 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/$(DEPDIR)/EmbeddedWindow.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/$(DEPDIR)/EmbeddedWindowSupport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/$(DEPDIR)/EventModifier.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/CieXyzConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/ClutProfileConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/ColorLookUpTable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/ColorSpaceConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/GrayProfileConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/GrayScaleConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/LinearRGBConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/ProfileHeader.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/PyccConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/RgbProfileConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/SrgbConverter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/TagEntry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/color/$(DEPDIR)/ToneReproductionCurve.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/image/$(DEPDIR)/ImageDecoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/image/$(DEPDIR)/XBMDecoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/$(DEPDIR)/ClasspathFontPeer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/$(DEPDIR)/ClasspathTextLayoutPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/$(DEPDIR)/EmbeddedWindowPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/$(DEPDIR)/GLightweightPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GThreadMutex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GThreadNativeMethodRunner.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.Plo@am__quote@
@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-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-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@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkCheckboxGroupPeer.Plo@am__quote@
@@ -19710,7 +19923,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkDialogPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkEmbeddedWindowPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFileDialogPeer.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkGenericPeer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkImage.Plo@am__quote@
@@ -20320,13 +20532,18 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/im/spi/$(DEPDIR)/InputMethodDescriptor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/AffineTransformOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/AreaAveragingScaleFilter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/BandCombineOp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/BandedSampleModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/BufferStrategy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/BufferedImage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/BufferedImageFilter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/BufferedImageOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ByteLookupTable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ColorConvertOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ColorModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ComponentColorModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ComponentSampleModel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ConvolveOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/CropImageFilter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/DataBuffer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/DataBufferByte.Plo@am__quote@
@@ -20344,8 +20561,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ImagingOpException.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/IndexColorModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/Kernel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/LookupOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/LookupTable.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/MemoryImageSource.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/MultiPixelPackedSampleModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/PackedColorModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/PixelGrabber.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/PixelInterleavedSampleModel.Plo@am__quote@
@@ -20355,6 +20574,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/RasterOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/RenderedImage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ReplicateScaleFilter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/RescaleOp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/SampleModel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/ShortLookupTable.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/awt/image/$(DEPDIR)/SinglePixelPackedSampleModel.Plo@am__quote@
@@ -21715,6 +21935,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)/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@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/$(DEPDIR)/Spring.Plo@am__quote@
@@ -21879,6 +22100,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicTableUI.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicTextAreaUI.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicTextFieldUI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicTextPaneUI.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicTextUI.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicToggleButtonUI.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/plaf/basic/$(DEPDIR)/BasicToolBarSeparatorUI.Plo@am__quote@
@@ -21918,6 +22140,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/LayeredHighlighter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/MutableAttributeSet.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/NavigationFilter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/PasswordView.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/PlainDocument.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/PlainView.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/Position.Plo@am__quote@
@@ -21986,13 +22209,14 @@ 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_GdkClasspathFontPeer.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_GdkClasspathFontPeerMetrics.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_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@
@AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.Plo@am__quote@
@@ -22004,6 +22228,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.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_GtkEvents.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_GtkFileDialogPeer.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_GtkFramePeer.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_GtkGenericPeer.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_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@
@@ -22112,27 +22337,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.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_GdkClasspathFontPeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c; \
-@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeer.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_GdkClasspathFontPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c
-
-jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.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_GdkClasspathFontPeerMetrics.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c; \
-@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.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_GdkClasspathFontPeerMetrics.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.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_GdkGraphics2D.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.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_GdkGraphics2D.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c; \
@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Tpo"; exit 1; fi
@@ -22140,6 +22344,13 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics2D.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_GdkGraphics2D.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.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_GdkTextLayout.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.Tpo" -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; \
+@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkTextLayout.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_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
@@ -22147,6 +22358,20 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontMetrics.l
@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
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkFontPeer.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_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
@@ -22154,6 +22379,13 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphics.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_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
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.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_GdkGraphicsEnvironment.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c; \
+@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.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_GdkGraphicsEnvironment.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
+
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.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_GdkPixbufDecoder.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Tpo" -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; \
@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GdkPixbufDecoder.Tpo"; exit 1; fi
@@ -22238,6 +22470,13 @@ jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFileDialogPee
@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_GtkFileDialogPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.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_GtkFramePeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c; \
+@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c' object='jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkFramePeer.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_GtkFramePeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+
jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.lo: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.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_GtkGenericPeer.lo -MD -MP -MF "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.Tpo" -c -o jni/gtk-peer/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.lo `test -f 'jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c' || echo '$(srcdir)/'`jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c; \
@am__fastdepCC_TRUE@ then mv -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.Tpo" "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.Plo"; else rm -f "jni/gtk-peer/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-gnu_java_awt_peer_gtk_GtkGenericPeer.Tpo"; exit 1; fi
@@ -22594,19 +22833,12 @@ gnu/gcj/xlib/lib_gnu_awt_xlib_la-natXUnmapEvent.lo: gnu/gcj/xlib/natXUnmapEvent.
@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepGCJ_FALSE@ $(LTGCJCOMPILE) -c -o $@ $<
-gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.lo: gnu/java/awt/peer/gtk/GdkClasspathFontPeer.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-GdkClasspathFontPeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.lo `test -f 'gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java; \
-@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeer.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-GdkClasspathFontPeer.lo `test -f 'gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java
-
-gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.lo: gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.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-GdkClasspathFontPeerMetrics.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.lo `test -f 'gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java; \
-@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkClasspathFontPeerMetrics.lo' libtool=yes @AMDEPBACKSLASH@
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.lo: gnu/java/awt/peer/gtk/GdkTextLayout.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-GdkTextLayout.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.lo `test -f 'gnu/java/awt/peer/gtk/GdkTextLayout.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkTextLayout.java; \
+@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='gnu/java/awt/peer/gtk/GdkTextLayout.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkTextLayout.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-GdkClasspathFontPeerMetrics.lo `test -f 'gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java
+@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-GdkTextLayout.lo `test -f 'gnu/java/awt/peer/gtk/GdkTextLayout.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkTextLayout.java
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.lo: gnu/java/awt/peer/gtk/GdkFontMetrics.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-GdkFontMetrics.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.lo `test -f 'gnu/java/awt/peer/gtk/GdkFontMetrics.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkFontMetrics.java; \
@@ -22615,6 +22847,13 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontMetrics.lo: gnu/java/a
@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-GdkFontMetrics.lo `test -f 'gnu/java/awt/peer/gtk/GdkFontMetrics.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkFontMetrics.java
+gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.lo: gnu/java/awt/peer/gtk/GdkFontPeer.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-GdkFontPeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.lo `test -f 'gnu/java/awt/peer/gtk/GdkFontPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkFontPeer.java; \
+@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='gnu/java/awt/peer/gtk/GdkFontPeer.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkFontPeer.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-GdkFontPeer.lo `test -f 'gnu/java/awt/peer/gtk/GdkFontPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkFontPeer.java
+
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.lo: gnu/java/awt/peer/gtk/GdkGlyphVector.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-GdkGlyphVector.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.lo `test -f 'gnu/java/awt/peer/gtk/GdkGlyphVector.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GdkGlyphVector.java; \
@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GdkGlyphVector.Tpo"; exit 1; fi
@@ -22734,13 +22973,6 @@ gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFileDialogPeer.lo: gnu/jav
@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-GtkFileDialogPeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkFileDialogPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
-gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.lo: gnu/java/awt/peer/gtk/GtkFontPeer.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-GtkFontPeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkFontPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkFontPeer.java; \
-@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='gnu/java/awt/peer/gtk/GtkFontPeer.java' object='gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFontPeer.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-GtkFontPeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkFontPeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkFontPeer.java
-
gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.lo: gnu/java/awt/peer/gtk/GtkFramePeer.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-GtkFramePeer.lo -MD -MP -MF "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.Tpo" -c -o gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.lo `test -f 'gnu/java/awt/peer/gtk/GtkFramePeer.java' || echo '$(srcdir)/'`gnu/java/awt/peer/gtk/GtkFramePeer.java; \
@am__fastdepGCJ_TRUE@ then mv -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.Tpo" "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.Plo"; else rm -f "gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkFramePeer.Tpo"; exit 1; fi
@@ -22918,6 +23150,7 @@ clean-libtool:
-rm -rf gnu/gcj/util/.libs gnu/gcj/util/_libs
-rm -rf gnu/gcj/xlib/.libs gnu/gcj/xlib/_libs
-rm -rf gnu/java/awt/.libs gnu/java/awt/_libs
+ -rm -rf gnu/java/awt/color/.libs gnu/java/awt/color/_libs
-rm -rf gnu/java/awt/image/.libs gnu/java/awt/image/_libs
-rm -rf gnu/java/awt/peer/.libs gnu/java/awt/peer/_libs
-rm -rf gnu/java/awt/peer/gtk/.libs gnu/java/awt/peer/gtk/_libs
@@ -23425,6 +23658,8 @@ distclean-generic:
-rm -f gnu/gcj/xlib/$(am__dirstamp)
-rm -f gnu/java/awt/$(DEPDIR)/$(am__dirstamp)
-rm -f gnu/java/awt/$(am__dirstamp)
+ -rm -f gnu/java/awt/color/$(DEPDIR)/$(am__dirstamp)
+ -rm -f gnu/java/awt/color/$(am__dirstamp)
-rm -f gnu/java/awt/image/$(DEPDIR)/$(am__dirstamp)
-rm -f gnu/java/awt/image/$(am__dirstamp)
-rm -f gnu/java/awt/peer/$(DEPDIR)/$(am__dirstamp)
@@ -23709,7 +23944,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/beans/info/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) org/w3c/dom/$(DEPDIR) org/w3c/dom/ranges/$(DEPDIR) org/w3c/dom/traversal/$(DEPDIR) org/xml/sax/$(DEPDIR) org/xml/sax/ext/$(DEPDIR) org/xml/sax/helpers/$(DEPDIR) sysdep/$(DEPDIR)
+ -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/beans/info/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) org/w3c/dom/$(DEPDIR) org/w3c/dom/ranges/$(DEPDIR) org/w3c/dom/traversal/$(DEPDIR) org/xml/sax/$(DEPDIR) org/xml/sax/ext/$(DEPDIR) org/xml/sax/helpers/$(DEPDIR) sysdep/$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-local distclean-tags
@@ -23739,7 +23974,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
- -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/beans/info/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) org/w3c/dom/$(DEPDIR) org/w3c/dom/ranges/$(DEPDIR) org/w3c/dom/traversal/$(DEPDIR) org/xml/sax/$(DEPDIR) org/xml/sax/ext/$(DEPDIR) org/xml/sax/helpers/$(DEPDIR) sysdep/$(DEPDIR)
+ -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/beans/info/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) org/w3c/dom/$(DEPDIR) org/w3c/dom/ranges/$(DEPDIR) org/w3c/dom/traversal/$(DEPDIR) org/xml/sax/$(DEPDIR) org/xml/sax/ext/$(DEPDIR) org/xml/sax/helpers/$(DEPDIR) sysdep/$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -23787,11 +24022,95 @@ uninstall-info: uninstall-info-recursive
uninstall-toolexecmainlibDATA
-$(gtk_jni_headers): $(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
+jniinclude/gnu_java_awt_peer_gtk_GdkPixbufDecoder.h: gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+jniinclude/gnu_java_awt_peer_gtk_GtkButtonPeer.h: gnu/java/awt/peer/gtk/GtkButtonPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCanvasPeer.h: gnu/java/awt/peer/gtk/GtkCanvasPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h: gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.h: gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkChoicePeer.h: gnu/java/awt/peer/gtk/GtkChoicePeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkClipboard.h: gnu/java/awt/peer/gtk/GtkClipboard.java
+jniinclude/gnu_java_awt_peer_gtk_GtkComponentPeer.h: gnu/java/awt/peer/gtk/GtkComponentPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkContainerPeer.h: gnu/java/awt/peer/gtk/GtkContainerPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkDialogPeer.h: gnu/java/awt/peer/gtk/GtkDialogPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.h: gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h: gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkFontPeer.h: gnu/java/awt/peer/gtk/GtkFontPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkFramePeer.h: gnu/java/awt/peer/gtk/GtkFramePeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkGenericPeer.h: gnu/java/awt/peer/gtk/GtkGenericPeer.java
+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
+jniinclude/gnu_java_awt_peer_gtk_GtkMenuPeer.h: gnu/java/awt/peer/gtk/GtkMenuPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkOffScreenImage.h: gnu/java/awt/peer/gtk/GtkOffScreenImage.java
+jniinclude/gnu_java_awt_peer_gtk_GtkPanelPeer.h: gnu/java/awt/peer/gtk/GtkPanelPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h: gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkScrollPanePeer.h: gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkScrollbarPeer.h: gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h: gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkTextComponentPeer.h: gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h: gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GtkToolkit.h: gnu/java/awt/peer/gtk/GtkToolkit.java
+jniinclude/gnu_java_awt_peer_gtk_GtkWindowPeer.h: gnu/java/awt/peer/gtk/GtkWindowPeer.java
+jniinclude/gnu_java_awt_peer_gtk_GThreadMutex.h: gnu/java/awt/peer/gtk/GThreadMutex.java
+jniinclude/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h: gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java
+jniinclude/gnu_java_awt_peer_gtk_GdkTextLayout.h: gnu/java/awt/peer/gtk/GdkTextLayout.java
+jniinclude/gnu_java_awt_peer_gtk_GdkFontPeer.h: gnu/java/awt/peer/gtk/GdkFontPeer.java
+
+$(gtk_jni_headers): %.h:
@input=`echo $@ | sed -e 's,jniinclude/,,' -e 's,_,.,g' -e 's,.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
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkPixbufDecoder.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GdkTextLayout.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkButtonPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCanvasPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkChoicePeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkClipboard.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkFileDialogPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkFramePeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkGenericPeer.h
+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
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkMenuPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkPanelPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkScrollbarPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkScrollPanePeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkTextComponentPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkToolkit.h
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.lo: $(top_builddir)/jniinclude/gnu_java_awt_peer_gtk_GtkWindowPeer.h
+
$(lib_gnu_java_awt_peer_gtk_la_OBJECTS): $(lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES)
%.properties.lo: %.properties
diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java
index 1856d97..a1d2440 100644
--- a/libjava/gnu/awt/xlib/XToolkit.java
+++ b/libjava/gnu/awt/xlib/XToolkit.java
@@ -19,6 +19,7 @@ import java.awt.image.ImageObserver;
import java.net.*;
import java.awt.datatransfer.Clipboard;
import java.io.InputStream;
+import java.text.AttributedString;
import java.util.Map;
import java.util.Properties;
import gnu.gcj.xlib.Display;
@@ -26,6 +27,7 @@ import gnu.gcj.xlib.Screen;
import gnu.gcj.xlib.Visual;
import gnu.java.awt.ClasspathToolkit;
import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.java.awt.peer.ClasspathTextLayoutPeer;
public class XToolkit extends ClasspathToolkit
{
@@ -400,6 +402,12 @@ public class XToolkit extends ClasspathToolkit
return new XFontPeer (name,style,size);
}
+
+ public ClasspathTextLayoutPeer
+ getClasspathTextLayoutPeer (AttributedString str, FontRenderContext frc)
+ {
+ throw new Error("not implemented");
+ }
/** Creates a font, reading the glyph definitions from a stream.
*
diff --git a/libjava/gnu/java/awt/BitwiseXORComposite.java b/libjava/gnu/java/awt/BitwiseXORComposite.java
index dd4f015..6a05ee6 100644
--- a/libjava/gnu/java/awt/BitwiseXORComposite.java
+++ b/libjava/gnu/java/awt/BitwiseXORComposite.java
@@ -1,5 +1,5 @@
/* BitwiseXORComposite.java -- Composite for emulating old-style XOR.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,6 @@ package gnu.java.awt;
import java.awt.Color;
import java.awt.Composite;
import java.awt.CompositeContext;
-import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.image.ColorModel;
diff --git a/libjava/gnu/java/awt/ClasspathToolkit.java b/libjava/gnu/java/awt/ClasspathToolkit.java
index 9293459..c249231 100644
--- a/libjava/gnu/java/awt/ClasspathToolkit.java
+++ b/libjava/gnu/java/awt/ClasspathToolkit.java
@@ -1,5 +1,5 @@
/* ClasspathToolkit.java -- Abstract superclass for Classpath toolkits.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,27 +38,27 @@ exception statement from your version. */
package gnu.java.awt;
+import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.java.awt.peer.ClasspathTextLayoutPeer;
+
import java.awt.Image;
import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.Font;
-import java.awt.FontFormatException;
import java.awt.FontMetrics;
import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
import java.awt.Toolkit;
+import java.awt.font.FontRenderContext;
import java.awt.image.ColorModel;
import java.awt.image.ImageProducer;
import java.io.File;
import java.io.InputStream;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
-import gnu.java.awt.peer.ClasspathFontPeer;
-
/**
* An abstract superclass for Classpath toolkits.
@@ -171,6 +171,9 @@ public abstract class ClasspathToolkit
public abstract ClasspathFontPeer getClasspathFontPeer (String name, Map attrs);
+ public abstract ClasspathTextLayoutPeer
+ getClasspathTextLayoutPeer (AttributedString str, FontRenderContext frc);
+
/**
* Creates a {@link Font}, in a platform-specific manner.
diff --git a/libjava/gnu/java/awt/color/CieXyzConverter.java b/libjava/gnu/java/awt/color/CieXyzConverter.java
new file mode 100644
index 0000000..ee183cd
--- /dev/null
+++ b/libjava/gnu/java/awt/color/CieXyzConverter.java
@@ -0,0 +1,74 @@
+/* CieXyzConverter.java -- CieXyz conversion class
+ Copyright (C) 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.color;
+
+
+/**
+ * CieXyzConverter - converts to/from a D50-relative CIE XYZ color space.
+ *
+ * The sRGB<->CIE XYZ conversions in SrgbConverter are used.
+ *
+ * @author Sven de Marothy
+ */
+public class CieXyzConverter implements ColorSpaceConverter
+{
+ public float[] toCIEXYZ(float[] in)
+ {
+ float[] out = new float[3];
+ System.arraycopy(in, 0, out, 0, 3);
+ return out;
+ }
+
+ public float[] fromCIEXYZ(float[] in)
+ {
+ float[] out = new float[3];
+ System.arraycopy(in, 0, out, 0, 3);
+ return out;
+ }
+
+ public float[] toRGB(float[] in)
+ {
+ return SrgbConverter.XYZtoRGB(in);
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ return SrgbConverter.RGBtoXYZ(in);
+ }
+}
diff --git a/libjava/gnu/java/awt/color/ClutProfileConverter.java b/libjava/gnu/java/awt/color/ClutProfileConverter.java
new file mode 100644
index 0000000..d33a688
--- /dev/null
+++ b/libjava/gnu/java/awt/color/ClutProfileConverter.java
@@ -0,0 +1,154 @@
+/* ClutProfileConverter.java -- Conversion routines for CLUT-Based profiles
+ Copyright (C) 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.color;
+
+import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
+
+
+/**
+ * ClutProfileConverter - conversions through a CLUT-based profile
+ *
+ * @author Sven de Marothy
+ */
+public class ClutProfileConverter implements ColorSpaceConverter
+{
+ private ColorLookUpTable toPCS;
+ private ColorLookUpTable fromPCS;
+ private int nChannels;
+
+ public ClutProfileConverter(ICC_Profile profile)
+ {
+ nChannels = profile.getNumComponents();
+
+ // Sun does not specifiy which rendering intent should be used,
+ // neither does the ICC v2 spec really.
+ // Try intent 0
+ try
+ {
+ toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag);
+ }
+ catch (Exception e)
+ {
+ toPCS = null;
+ }
+
+ try
+ {
+ fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag);
+ }
+ catch (Exception e)
+ {
+ fromPCS = null;
+ }
+
+ if (toPCS != null || fromPCS != null)
+ return;
+
+ // If no intent 0 clut is available, look for a intent 1 clut.
+ try
+ {
+ toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB1Tag);
+ }
+ catch (Exception e)
+ {
+ toPCS = null;
+ }
+
+ try
+ {
+ fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA1Tag);
+ }
+ catch (Exception e)
+ {
+ fromPCS = null;
+ }
+
+ if (toPCS != null || fromPCS != null)
+ return;
+
+ // Last shot.. intent 2 CLUT.
+ try
+ {
+ toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB2Tag);
+ }
+ catch (Exception e)
+ {
+ toPCS = null;
+ }
+
+ try
+ {
+ fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA2Tag);
+ }
+ catch (Exception e)
+ {
+ fromPCS = null;
+ }
+
+ if (toPCS == null && fromPCS == null)
+ throw new IllegalArgumentException("No CLUTs in profile!");
+ }
+
+ public float[] toCIEXYZ(float[] in)
+ {
+ if (toPCS != null)
+ return toPCS.lookup(in);
+ else
+ return new float[3];
+ }
+
+ public float[] toRGB(float[] in)
+ {
+ return SrgbConverter.XYZtoRGB(toCIEXYZ(in));
+ }
+
+ public float[] fromCIEXYZ(float[] in)
+ {
+ if (fromPCS != null)
+ return fromPCS.lookup(in);
+ else
+ return new float[nChannels];
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ return fromCIEXYZ(SrgbConverter.RGBtoXYZ(in));
+ }
+}
diff --git a/libjava/gnu/java/awt/color/ColorLookUpTable.java b/libjava/gnu/java/awt/color/ColorLookUpTable.java
new file mode 100644
index 0000000..138d27a
--- /dev/null
+++ b/libjava/gnu/java/awt/color/ColorLookUpTable.java
@@ -0,0 +1,430 @@
+/* ColorLookUpTable.java -- ICC v2 CLUT
+ Copyright (C) 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.color;
+
+import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
+import java.nio.ByteBuffer;
+
+
+/**
+ * ColorLookUpTable handles color lookups through a color lookup table,
+ * as defined in the ICC specification.
+ * Both 'mft2' and 'mft1' (8 and 16-bit) type CLUTs are handled.
+ *
+ * This will have to be updated later for ICC 4.0.0
+ *
+ * @author Sven de Marothy
+ */
+public class ColorLookUpTable
+{
+ /**
+ * CIE 1931 D50 white point (in Lab coordinates)
+ */
+ private static float[] D50 = { 0.96422f, 1.00f, 0.82521f };
+
+ /**
+ * Number of input/output channels
+ */
+ int nIn;
+
+ /**
+ * Number of input/output channels
+ */
+ int nOut;
+ int nInTableEntries; // Number of input table entries
+ int nOutTableEntries; // Number of output table entries
+ int gridpoints; // Number of gridpoints
+ int nClut; // This is nOut*(gridpoints**nIn)
+ double[][] inTable; // 1D input table ([channel][table])
+ short[][] outTable; // 1D input table ([channel][table])
+ double[] clut; // The color lookup table
+ float[][] inMatrix; // input matrix (XYZ only)
+ boolean useMatrix; // Whether to use the matrix or not.
+ int[] multiplier;
+ int[] offsets; // Hypercube offsets
+ boolean inputLab; // Set if the CLUT input CS is Lab
+ boolean outputLab; // Set if the CLUT output CS is Lab
+
+ /**
+ * Constructor
+ * Requires a profile file to get the CLUT from and the tag of the
+ * CLUT to create. (icSigXToYZTag where X,Y = [A | B], Z = [0,1,2])
+ */
+ public ColorLookUpTable(ICC_Profile profile, int tag)
+ {
+ useMatrix = false;
+
+ switch (tag)
+ {
+ case ICC_Profile.icSigAToB0Tag:
+ case ICC_Profile.icSigAToB1Tag:
+ case ICC_Profile.icSigAToB2Tag:
+ if (profile.getColorSpaceType() == ColorSpace.TYPE_XYZ)
+ useMatrix = true;
+ inputLab = false;
+ outputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab);
+ break;
+ case ICC_Profile.icSigBToA0Tag:
+ case ICC_Profile.icSigBToA1Tag:
+ case ICC_Profile.icSigBToA2Tag:
+ if (profile.getPCSType() == ColorSpace.TYPE_XYZ)
+ useMatrix = true;
+ inputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab);
+ outputLab = false;
+ break;
+ default:
+ throw new IllegalArgumentException("Not a clut-type tag.");
+ }
+
+ byte[] data = profile.getData(tag);
+ if (data == null)
+ throw new IllegalArgumentException("Unsuitable profile, does not contain a CLUT.");
+
+ // check 'mft'
+ if (data[0] != 0x6d || data[1] != 0x66 || data[2] != 0x74)
+ throw new IllegalArgumentException("Unsuitable profile, invalid CLUT data.");
+
+ if (data[3] == 0x32)
+ readClut16(data);
+ else if (data[3] == 0x31)
+ readClut8(data);
+ else
+ throw new IllegalArgumentException("Unknown/invalid CLUT type.");
+ }
+
+ /**
+ * Loads a 16-bit CLUT into our data structures
+ */
+ private void readClut16(byte[] data)
+ {
+ ByteBuffer buf = ByteBuffer.wrap(data);
+
+ nIn = data[8] & (0xFF);
+ nOut = data[9] & (0xFF);
+ nInTableEntries = buf.getShort(48);
+ nOutTableEntries = buf.getShort(50);
+ gridpoints = data[10] & (0xFF);
+
+ inMatrix = new float[3][3];
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 3; j++)
+ inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f;
+
+ inTable = new double[nIn][nInTableEntries];
+ for (int channel = 0; channel < nIn; channel++)
+ for (int i = 0; i < nInTableEntries; i++)
+ inTable[channel][i] = (double) ((int) buf.getShort(52
+ + (channel * nInTableEntries
+ + i) * 2)
+ & (0xFFFF)) / 65536.0;
+
+ nClut = nOut;
+ multiplier = new int[nIn];
+ multiplier[nIn - 1] = nOut;
+ for (int i = 0; i < nIn; i++)
+ {
+ nClut *= gridpoints;
+ if (i > 0)
+ multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints;
+ }
+
+ int clutOffset = 52 + nIn * nInTableEntries * 2;
+ clut = new double[nClut];
+ for (int i = 0; i < nClut; i++)
+ clut[i] = (double) ((int) buf.getShort(clutOffset + i * 2) & (0xFFFF)) / 65536.0;
+
+ outTable = new short[nOut][nOutTableEntries];
+ for (int channel = 0; channel < nOut; channel++)
+ for (int i = 0; i < nOutTableEntries; i++)
+ outTable[channel][i] = buf.getShort(clutOffset
+ + (nClut
+ + channel * nOutTableEntries + i) * 2);
+
+ // calculate the hypercube corner offsets
+ offsets = new int[(1 << nIn)];
+ offsets[0] = 0;
+ for (int j = 0; j < nIn; j++)
+ {
+ int factor = 1 << j;
+ for (int i = 0; i < factor; i++)
+ offsets[factor + i] = offsets[i] + multiplier[j];
+ }
+ }
+
+ /**
+ * Loads a 8-bit CLUT into our data structures.
+ */
+ private void readClut8(byte[] data)
+ {
+ ByteBuffer buf = ByteBuffer.wrap(data);
+
+ nIn = (data[8] & (0xFF));
+ nOut = (data[9] & (0xFF));
+ nInTableEntries = 256; // always 256
+ nOutTableEntries = 256; // always 256
+ gridpoints = (data[10] & (0xFF));
+
+ inMatrix = new float[3][3];
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 3; j++)
+ inMatrix[i][j] = ((float) (buf.getInt(12 + (i * 3 + j) * 4))) / 65536.0f;
+
+ inTable = new double[nIn][nInTableEntries];
+ for (int channel = 0; channel < nIn; channel++)
+ for (int i = 0; i < nInTableEntries; i++)
+ inTable[channel][i] = (double) ((int) buf.get(48
+ + (channel * nInTableEntries
+ + i)) & (0xFF)) / 255.0;
+
+ nClut = nOut;
+ multiplier = new int[nIn];
+ multiplier[nIn - 1] = nOut;
+ for (int i = 0; i < nIn; i++)
+ {
+ nClut *= gridpoints;
+ if (i > 0)
+ multiplier[nIn - i - 1] = multiplier[nIn - i] * gridpoints;
+ }
+
+ int clutOffset = 48 + nIn * nInTableEntries;
+ clut = new double[nClut];
+ for (int i = 0; i < nClut; i++)
+ clut[i] = (double) ((int) buf.get(clutOffset + i) & (0xFF)) / 255.0;
+
+ outTable = new short[nOut][nOutTableEntries];
+ for (int channel = 0; channel < nOut; channel++)
+ for (int i = 0; i < nOutTableEntries; i++)
+ outTable[channel][i] = (short) (buf.get(clutOffset + nClut
+ + channel * nOutTableEntries
+ + i) * 257);
+
+ // calculate the hypercube corner offsets
+ offsets = new int[(1 << nIn)];
+ offsets[0] = 0;
+ for (int j = 0; j < nIn; j++)
+ {
+ int factor = 1 << j;
+ for (int i = 0; i < factor; i++)
+ offsets[factor + i] = offsets[i] + multiplier[j];
+ }
+ }
+
+ /**
+ * Performs a lookup through the Color LookUp Table.
+ * If the CLUT tag type is AtoB the conversion will be from the device
+ * color space to the PCS, BtoA type goes in the opposite direction.
+ *
+ * For convenience, the PCS values for input or output will always be
+ * CIE XYZ (D50), if the actual PCS is Lab, the values will be converted.
+ *
+ * N-dimensional linear interpolation is used.
+ */
+ float[] lookup(float[] in)
+ {
+ float[] in2 = new float[in.length];
+ if (useMatrix)
+ {
+ for (int i = 0; i < 3; i++)
+ in2[i] = in[0] * inMatrix[i][0] + in[1] * inMatrix[i][1]
+ + in[2] * inMatrix[i][2];
+ }
+ else if (inputLab)
+ in2 = XYZtoLab(in);
+ else
+ System.arraycopy(in, 0, in2, 0, in.length);
+
+ // input table
+ for (int i = 0; i < nIn; i++)
+ {
+ int index = (int) Math.floor(in2[i] * (double) (nInTableEntries - 1)); // floor in
+
+ // clip values.
+ if (index >= nInTableEntries - 1)
+ in2[i] = (float) inTable[i][nInTableEntries - 1];
+ else if (index < 0)
+ in2[i] = (float) inTable[i][0];
+ else
+ {
+ // linear interpolation
+ double alpha = in2[i] * ((double) nInTableEntries - 1.0) - index;
+ in2[i] = (float) (inTable[i][index] * (1 - alpha)
+ + inTable[i][index + 1] * alpha);
+ }
+ }
+
+ // CLUT lookup
+ double[] output2 = new double[nOut];
+ double[] weights = new double[(1 << nIn)];
+ double[] clutalpha = new double[nIn]; // interpolation values
+ int offset = 0; // = gp
+ for (int i = 0; i < nIn; i++)
+ {
+ int index = (int) Math.floor(in2[i] * ((double) gridpoints - 1.0));
+ double alpha = in2[i] * ((double) gridpoints - 1.0) - (double) index;
+
+ // clip values.
+ if (index >= gridpoints - 1)
+ {
+ index = gridpoints - 1;
+ alpha = 1.0;
+ }
+ else if (index < 0)
+ index = 0;
+ clutalpha[i] = alpha;
+ offset += index * multiplier[i];
+ }
+
+ // Calculate interpolation weights
+ weights[0] = 1.0;
+ for (int j = 0; j < nIn; j++)
+ {
+ int factor = 1 << j;
+ for (int i = 0; i < factor; i++)
+ {
+ weights[factor + i] = weights[i] * clutalpha[j];
+ weights[i] *= (1.0 - clutalpha[j]);
+ }
+ }
+
+ for (int i = 0; i < nOut; i++)
+ output2[i] = weights[0] * clut[offset + i];
+
+ for (int i = 1; i < (1 << nIn); i++)
+ {
+ int offset2 = offset + offsets[i];
+ for (int f = 0; f < nOut; f++)
+ output2[f] += weights[i] * clut[offset2 + f];
+ }
+
+ // output table
+ float[] output = new float[nOut];
+ for (int i = 0; i < nOut; i++)
+ {
+ int index = (int) Math.floor(output2[i] * ((double) nOutTableEntries
+ - 1.0));
+
+ // clip values.
+ if (index >= nOutTableEntries - 1)
+ output[i] = outTable[i][nOutTableEntries - 1];
+ else if (index < 0)
+ output[i] = outTable[i][0];
+ else
+ {
+ // linear interpolation
+ double a = output2[i] * ((double) nOutTableEntries - 1.0)
+ - (double) index;
+ output[i] = (float) ((double) ((int) outTable[i][index] & (0xFFFF)) * (1
+ - a)
+ + (double) ((int) outTable[i][index + 1] & (0xFFFF)) * a) / 65536f;
+ }
+ }
+
+ if (outputLab)
+ return LabtoXYZ(output);
+ return output;
+ }
+
+ /**
+ * Converts CIE Lab coordinates to (D50) XYZ ones.
+ */
+ private float[] LabtoXYZ(float[] in)
+ {
+ // Convert from byte-packed format to a
+ // more convenient one (actual Lab values)
+ // (See ICC spec for details)
+ // factor is 100 * 65536 / 65280
+ in[0] = (float) (100.392156862745 * in[0]);
+ in[1] = (in[1] * 256.0f) - 128.0f;
+ in[2] = (in[2] * 256.0f) - 128.0f;
+
+ float[] out = new float[3];
+
+ out[1] = (in[0] + 16.0f) / 116.0f;
+ out[0] = in[1] / 500.0f + out[1];
+ out[2] = out[1] - in[2] / 200.0f;
+
+ for (int i = 0; i < 3; i++)
+ {
+ double exp = out[i] * out[i] * out[i];
+ if (exp <= 0.008856)
+ out[i] = (out[i] - 16.0f / 116.0f) / 7.787f;
+ else
+ out[i] = (float) exp;
+ out[i] = D50[i] * out[i];
+ }
+ return out;
+ }
+
+ /**
+ * Converts CIE XYZ coordinates to Lab ones.
+ */
+ private float[] XYZtoLab(float[] in)
+ {
+ float[] temp = new float[3];
+
+ for (int i = 0; i < 3; i++)
+ {
+ temp[i] = in[i] / D50[i];
+
+ if (temp[i] <= 0.008856f)
+ temp[i] = (7.7870689f * temp[i]) + (16f / 116.0f);
+ else
+ temp[i] = (float) Math.exp((1.0 / 3.0) * Math.log(temp[i]));
+ }
+
+ float[] out = new float[3];
+ out[0] = (116.0f * temp[1]) - 16f;
+ out[1] = 500.0f * (temp[0] - temp[1]);
+ out[2] = 200.0f * (temp[1] - temp[2]);
+
+ // Normalize to packed format
+ out[0] = (float) (out[0] / 100.392156862745);
+ out[1] = (out[1] + 128f) / 256f;
+ out[2] = (out[2] + 128f) / 256f;
+ for (int i = 0; i < 3; i++)
+ {
+ if (out[i] < 0f)
+ out[i] = 0f;
+ if (out[i] > 1f)
+ out[i] = 1f;
+ }
+ return out;
+ }
+}
diff --git a/libjava/gnu/java/awt/color/ColorSpaceConverter.java b/libjava/gnu/java/awt/color/ColorSpaceConverter.java
new file mode 100644
index 0000000..1fee7492
--- /dev/null
+++ b/libjava/gnu/java/awt/color/ColorSpaceConverter.java
@@ -0,0 +1,70 @@
+/* ColorSpaceConverter.java -- an interface for colorspace conversion
+ Copyright (C) 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.color;
+
+
+/**
+ * ColorSpaceConverter - used by java.awt.color.ICC_ColorSpace
+ *
+ * Color space conversion can occur in several ways:
+ *
+ * -Directly (for the built in spaces sRGB, linear RGB, gray, CIE XYZ and PYCC
+ * -ICC_ProfileRGB works through TRC curves and a matrix
+ * -ICC_ProfileGray works through a single TRC
+ * -Everything else is done through Color lookup tables.
+ *
+ * The different conversion methods are implemented through
+ * an interface. The built-in colorspaces are implemented directly
+ * with the relevant conversion equations.
+ *
+ * In this way, we hopefully will always use the fastest and most
+ * accurate method available.
+ *
+ * @author Sven de Marothy
+ */
+public interface ColorSpaceConverter
+{
+ float[] toCIEXYZ(float[] in);
+
+ float[] fromCIEXYZ(float[] in);
+
+ float[] toRGB(float[] in);
+
+ float[] fromRGB(float[] in);
+}
diff --git a/libjava/gnu/java/awt/color/GrayProfileConverter.java b/libjava/gnu/java/awt/color/GrayProfileConverter.java
new file mode 100644
index 0000000..22dd493
--- /dev/null
+++ b/libjava/gnu/java/awt/color/GrayProfileConverter.java
@@ -0,0 +1,138 @@
+/* GrayProfileConverter.java -- Gray profile conversion class
+ Copyright (C) 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.color;
+
+import java.awt.color.ProfileDataException;
+import java.awt.color.ICC_Profile;
+import java.awt.color.ICC_ProfileGray;
+
+
+/**
+ * GrayProfileConverter - converts Grayscale profiles (ICC_ProfileGray)
+ *
+ * This type of profile contains a single tone reproduction curve (TRC).
+ * Conversion consists of simple TRC lookup.
+ *
+ * This implementation is very lazy and does everything applying the TRC and
+ * utilizing the built-in linear grayscale color space.
+ *
+ * @author Sven de Marothy
+ */
+public class GrayProfileConverter implements ColorSpaceConverter
+{
+ private GrayScaleConverter gc;
+ private ToneReproductionCurve trc;
+ private ColorLookUpTable toPCS;
+ private ColorLookUpTable fromPCS;
+
+ /**
+ * Constructs the converter described by an ICC_ProfileGray object
+ */
+ public GrayProfileConverter(ICC_ProfileGray profile)
+ {
+ try
+ {
+ trc = new ToneReproductionCurve(profile.getGamma());
+ }
+ catch (ProfileDataException e)
+ {
+ trc = new ToneReproductionCurve(profile.getTRC());
+ }
+
+ // linear grayscale converter
+ gc = new GrayScaleConverter();
+
+ // If a CLUT is available, it should be used, and the TRCs ignored.
+ // Note: A valid profile may only have CLUTs in one direction, and
+ // TRC:s without useful info, making reverse-transforms impossible.
+ // In this case the TRC will be used for the reverse-transform with
+ // unpredictable results. This is in line with the Java specification,
+ try
+ {
+ toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag);
+ }
+ catch (Exception e)
+ {
+ toPCS = null;
+ }
+
+ try
+ {
+ fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag);
+ }
+ catch (Exception e)
+ {
+ fromPCS = null;
+ }
+ }
+
+ public float[] toCIEXYZ(float[] in)
+ {
+ if (toPCS != null)
+ return toPCS.lookup(in);
+ float[] gray = new float[1];
+ gray[0] = trc.lookup(in[0]);
+ return gc.toCIEXYZ(gray);
+ }
+
+ public float[] toRGB(float[] in)
+ {
+ float[] gray = new float[1];
+ gray[0] = trc.lookup(in[0]);
+ return gc.toRGB(gray);
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ // get linear grayscale value
+ float[] gray = gc.fromRGB(in);
+ gray[0] = trc.reverseLookup(gray[0]);
+ return gray;
+ }
+
+ public float[] fromCIEXYZ(float[] in)
+ {
+ if (fromPCS != null)
+ return fromPCS.lookup(in);
+
+ float[] gray = gc.fromCIEXYZ(in);
+ gray[0] = trc.reverseLookup(gray[0]);
+ return gray;
+ }
+}
diff --git a/libjava/gnu/java/awt/color/GrayScaleConverter.java b/libjava/gnu/java/awt/color/GrayScaleConverter.java
new file mode 100644
index 0000000..446c3f6
--- /dev/null
+++ b/libjava/gnu/java/awt/color/GrayScaleConverter.java
@@ -0,0 +1,111 @@
+/* GrayScaleConverter.java -- Linear grayscale conversion class
+ Copyright (C) 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.color;
+
+
+/**
+ * Linear Grayscale converter
+ *
+ * @author Sven de Marothy
+ */
+public class GrayScaleConverter implements ColorSpaceConverter
+{
+ // intensity factors (ITU Rec. BT.709)
+ double[] coeff = { 0.2125f, 0.7154f, 0.0721f };
+
+ /**
+ * CIE 1931 D50 white point (in Lab coordinates)
+ */
+ private static float[] D50 = { 0.96422f, 1.00f, 0.82521f };
+
+ public float[] toCIEXYZ(float[] in)
+ {
+ float g = in[0];
+ if (g < 0)
+ g = 1 + g;
+ float[] out = { g * D50[0], g * D50[1], g * D50[2] }; // White spot
+ return out;
+ }
+
+ public float[] toRGB(float[] in)
+ {
+ float[] out = new float[3];
+ if (in[0] <= 0.00304f)
+ out[0] = in[0] * 12.92f;
+ else
+ out[0] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(in[0])))
+ - 0.055f;
+ out[1] = out[2] = out[0];
+ return out;
+ }
+
+ public float[] fromCIEXYZ(float[] in)
+ {
+ float[] temp = new float[3];
+ temp[0] = 3.1338f * in[0] - 1.6171f * in[1] - 0.4907f * in[2];
+ temp[1] = -0.9785f * in[0] + 1.9160f * in[1] + 0.0334f * in[2];
+ temp[2] = 0.0720f * in[0] - 0.2290f * in[1] + 1.4056f * in[2];
+ float[] out = new float[1];
+ for (int i = 0; i < 3; i++)
+ out[0] = (float) (temp[i] * coeff[i]);
+ return out;
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ float[] out = new float[1];
+
+ // Convert non-linear RGB coordinates to linear ones,
+ // numbers from the w3 spec.
+ out[0] = 0;
+ for (int i = 0; i < 3; i++)
+ {
+ float n = in[i];
+ if (n < 0)
+ n = 0f;
+ if (n > 1)
+ n = 1f;
+ if (n <= 0.03928f)
+ out[0] += (float) (coeff[i] * n / 12.92);
+ else
+ out[0] += (float) (coeff[i] * Math.exp(2.4 * Math.log((n + 0.055) / 1.055)));
+ }
+ return out;
+ }
+}
diff --git a/libjava/gnu/java/awt/color/LinearRGBConverter.java b/libjava/gnu/java/awt/color/LinearRGBConverter.java
new file mode 100644
index 0000000..b40c2f0
--- /dev/null
+++ b/libjava/gnu/java/awt/color/LinearRGBConverter.java
@@ -0,0 +1,152 @@
+/* LinearRGBConverter.java -- conversion to a linear RGB color space
+ Copyright (C) 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.color;
+
+
+/**
+ * LinearRGBConverter - conversion routines for a linear sRGB colorspace
+ * sRGB is a standard for RGB colorspaces, adopted by the w3c.
+ *
+ * The specification is available at:
+ * http://www.w3.org/Graphics/Color/sRGB.html
+ *
+ * @author Sven de Marothy
+ */
+public class LinearRGBConverter implements ColorSpaceConverter
+{
+ /**
+ * linear RGB --> sRGB
+ * Use the inverse gamma curve
+ */
+ public float[] toRGB(float[] in)
+ {
+ float[] out = new float[3];
+ for (int i = 0; i < 3; i++)
+ {
+ float n = in[i];
+ if (n < 0)
+ n = 0f;
+ if (n > 1)
+ n = 1f;
+ if (n <= 0.00304f)
+ out[i] = in[0] * 12.92f;
+ else
+ out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(n)))
+ - 0.055f;
+ }
+ return out;
+ }
+
+ /**
+ * sRGB --> linear RGB
+ * Use the gamma curve (gamma=2.4 in sRGB)
+ */
+ public float[] fromRGB(float[] in)
+ {
+ float[] out = new float[3];
+
+ // Convert non-linear RGB coordinates to linear ones,
+ // numbers from the w3 spec.
+ for (int i = 0; i < 3; i++)
+ {
+ float n = in[i];
+ if (n < 0)
+ n = 0f;
+ if (n > 1)
+ n = 1f;
+ if (n <= 0.03928f)
+ out[i] = (float) (n / 12.92);
+ else
+ out[i] = (float) (Math.exp(2.4 * Math.log((n + 0.055) / 1.055)));
+ }
+ return out;
+ }
+
+ /**
+ * Linear RGB --> CIE XYZ (D50 relative)
+ * This is a simple matrix transform, the matrix (relative D65)
+ * is given in the sRGB spec. This has been combined with a
+ * linear Bradford transform for the D65-->D50 mapping, resulting
+ * in a single matrix which does the whole thing.
+ *
+ */
+ public float[] fromCIEXYZ(float[] in)
+ {
+ /*
+ * Note: The numbers which were used to calculate this only had four
+ * digits of accuracy. So don't be fooled by the number of digits here.
+ * If someone has more accurate source, feel free to update this.
+ */
+ float[] out = new float[3];
+ out[0] = (float) (3.13383065124221 * in[0] - 1.61711949411313 * in[1]
+ - 0.49071914111101 * in[2]);
+ out[1] = (float) (-0.97847026691142 * in[0] + 1.91597856031996 * in[1]
+ + 0.03340430640699 * in[2]);
+ out[2] = (float) (0.07203679486279 * in[0] - 0.22903073553113 * in[1]
+ + 1.40557835776234 * in[2]);
+ if (out[0] < 0)
+ out[0] = 0f;
+ if (out[1] < 0)
+ out[1] = 0f;
+ if (out[2] < 0)
+ out[2] = 0f;
+ if (out[0] > 1.0f)
+ out[0] = 1.0f;
+ if (out[1] > 1.0f)
+ out[1] = 1.0f;
+ if (out[2] > 1.0f)
+ out[2] = 1.0f;
+ return out;
+ }
+
+ /**
+ * Linear RGB --> CIE XYZ (D50 relative)
+ * Uses the inverse of the above matrix.
+ */
+ public float[] toCIEXYZ(float[] in)
+ {
+ float[] out = new float[3];
+ out[0] = (float) (0.43606375022190 * in[0] + 0.38514960146481 * in[1]
+ + 0.14308641888799 * in[2]);
+ out[1] = (float) (0.22245089403542 * in[0] + 0.71692584775182 * in[1]
+ + 0.06062451125578 * in[2]);
+ out[2] = (float) (0.01389851860679 * in[0] + 0.09707969011198 * in[1]
+ + 0.71399604572506 * in[2]);
+ return out;
+ }
+}
diff --git a/libjava/gnu/java/awt/color/ProfileHeader.java b/libjava/gnu/java/awt/color/ProfileHeader.java
new file mode 100644
index 0000000..fc4c0c3
--- /dev/null
+++ b/libjava/gnu/java/awt/color/ProfileHeader.java
@@ -0,0 +1,399 @@
+/* ProfileHeader.java -- Encapsules ICC Profile header data
+ Copyright (C) 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.color;
+
+import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
+import java.nio.ByteBuffer;
+
+
+/**
+ * Header, abstracts and validates the header data.
+ *
+ * @author Sven de Marothy
+ */
+public class ProfileHeader
+{
+ /**
+ * Magic identifier (ASCII 'acsp')
+ */
+ private static final int icMagicNumber = 0x61637370;
+
+ /**
+ * Mapping from ICC Profile signatures to ColorSpace types
+ */
+ private static final int[] csTypeMap =
+ {
+ ICC_Profile.icSigXYZData,
+ ColorSpace.TYPE_XYZ,
+ ICC_Profile.icSigLabData,
+ ColorSpace.TYPE_Lab,
+ ICC_Profile.icSigLuvData,
+ ColorSpace.TYPE_Luv,
+ ICC_Profile.icSigYCbCrData,
+ ColorSpace.TYPE_YCbCr,
+ ICC_Profile.icSigYxyData,
+ ColorSpace.TYPE_Yxy,
+ ICC_Profile.icSigRgbData,
+ ColorSpace.TYPE_RGB,
+ ICC_Profile.icSigGrayData,
+ ColorSpace.TYPE_GRAY,
+ ICC_Profile.icSigHsvData,
+ ColorSpace.TYPE_HSV,
+ ICC_Profile.icSigHlsData,
+ ColorSpace.TYPE_HLS,
+ ICC_Profile.icSigCmykData,
+ ColorSpace.TYPE_CMYK,
+ ICC_Profile.icSigCmyData,
+ ColorSpace.TYPE_CMY,
+ ICC_Profile.icSigSpace2CLR,
+ ColorSpace.TYPE_2CLR,
+ ICC_Profile.icSigSpace3CLR,
+ ColorSpace.TYPE_3CLR,
+ ICC_Profile.icSigSpace4CLR,
+ ColorSpace.TYPE_4CLR,
+ ICC_Profile.icSigSpace5CLR,
+ ColorSpace.TYPE_5CLR,
+ ICC_Profile.icSigSpace6CLR,
+ ColorSpace.TYPE_6CLR,
+ ICC_Profile.icSigSpace7CLR,
+ ColorSpace.TYPE_7CLR,
+ ICC_Profile.icSigSpace8CLR,
+ ColorSpace.TYPE_8CLR,
+ ICC_Profile.icSigSpace9CLR,
+ ColorSpace.TYPE_9CLR,
+ ICC_Profile.icSigSpaceACLR,
+ ColorSpace.TYPE_ACLR,
+ ICC_Profile.icSigSpaceBCLR,
+ ColorSpace.TYPE_BCLR,
+ ICC_Profile.icSigSpaceCCLR,
+ ColorSpace.TYPE_CCLR,
+ ICC_Profile.icSigSpaceDCLR,
+ ColorSpace.TYPE_DCLR,
+ ICC_Profile.icSigSpaceECLR,
+ ColorSpace.TYPE_ECLR,
+ ICC_Profile.icSigSpaceFCLR,
+ ColorSpace.TYPE_FCLR
+ };
+
+ /**
+ * Size of an ICC header (128 bytes)
+ */
+ public static final int HEADERSIZE = 128;
+
+ /**
+ * Mapping of ICC class signatures to profile class constants
+ */
+ private static final int[] classMap =
+ {
+ ICC_Profile.icSigInputClass,
+ ICC_Profile.CLASS_INPUT,
+ ICC_Profile.icSigDisplayClass,
+ ICC_Profile.CLASS_DISPLAY,
+ ICC_Profile.icSigOutputClass,
+ ICC_Profile.CLASS_OUTPUT,
+ ICC_Profile.icSigLinkClass,
+ ICC_Profile.CLASS_DEVICELINK,
+ ICC_Profile.icSigColorSpaceClass,
+ ICC_Profile.CLASS_COLORSPACECONVERSION,
+ ICC_Profile.icSigAbstractClass,
+ ICC_Profile.CLASS_ABSTRACT,
+ ICC_Profile.icSigNamedColorClass,
+ ICC_Profile.CLASS_NAMEDCOLOR
+ };
+ private int size;
+ private int cmmId;
+
+ // Major/Minor version, The ICC-1998 spec is major v2
+ private int majorVersion;
+
+ // Major/Minor version, The ICC-1998 spec is major v2
+ private int minorVersion;
+ private int profileClass; // profile device class
+ private int colorSpace; // data color space type
+ private int profileColorSpace; // profile connection space (PCS) type
+ private byte[] timestamp; // original creation timestamp
+ private int platform; // platform signature
+ private int flags; // flags
+ private int magic; // magic number.
+ private int manufacturerSig; // manufacturer sig
+ private int modelSig; // model sig
+ private byte[] attributes; // Attributes
+ private int intent; // rendering intent
+ private byte[] illuminant; // illuminant info (Coordinates of D50 in the PCS)
+ private int creatorSig; // Creator sig (same type as manufacturer)
+
+ /**
+ * Creates a 'default' header for use with our predefined profiles.
+ * Note the device and profile color spaces are not set.
+ */
+ public ProfileHeader()
+ {
+ creatorSig = 0;
+ intent = 0;
+ modelSig = manufacturerSig = (int) 0x6E6f6E65; // 'none'
+ magic = icMagicNumber;
+ cmmId = 0;
+ platform = 0; // no preferred platform
+ timestamp = new byte[8];
+ majorVersion = 2;
+ minorVersion = 0x10;
+ flags = 0;
+
+ // D50 in XYZ format (encoded)
+ illuminant = new byte[]
+ {
+ (byte) 0x00, (byte) 0x00, (byte) 0xf6, (byte) 0xd6,
+ (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0xd3, (byte) 0x2d
+ };
+ attributes = new byte[8];
+ profileClass = ICC_Profile.CLASS_DISPLAY;
+ }
+
+ /**
+ * Creates a header from profile data. Only the header portion (128 bytes)
+ * is read, so the array passed need not be the full profile.
+ */
+ public ProfileHeader(byte[] data)
+ {
+ ByteBuffer buf = ByteBuffer.wrap(data);
+
+ // Get size (the sign bit shouldn't matter.
+ // A valid profile can never be +2Gb)
+ size = buf.getInt(ICC_Profile.icHdrSize);
+
+ // CMM ID
+ cmmId = buf.getInt(ICC_Profile.icHdrCmmId);
+
+ // Version number
+ majorVersion = (int) (data[ICC_Profile.icHdrVersion]);
+ minorVersion = (int) (data[ICC_Profile.icHdrVersion + 1]);
+
+ // Profile/Device class
+ int classSig = buf.getInt(ICC_Profile.icHdrDeviceClass);
+ profileClass = -1;
+ for (int i = 0; i < classMap.length; i += 2)
+ if (classMap[i] == classSig)
+ {
+ profileClass = classMap[i + 1];
+ break;
+ }
+
+ // get the data color space
+ int csSig = buf.getInt(ICC_Profile.icHdrColorSpace);
+ colorSpace = -1;
+ for (int i = 0; i < csTypeMap.length; i += 2)
+ if (csTypeMap[i] == csSig)
+ {
+ colorSpace = csTypeMap[i + 1];
+ break;
+ }
+
+ // get the profile color space (PCS), must be xyz or lab except
+ // for device-link-class profiles
+ int pcsSig = buf.getInt(ICC_Profile.icHdrPcs);
+ profileColorSpace = -1;
+ if (profileClass != ICC_Profile.CLASS_DEVICELINK)
+ {
+ if (pcsSig == ICC_Profile.icSigXYZData)
+ profileColorSpace = ColorSpace.TYPE_XYZ;
+ if (pcsSig == ICC_Profile.icSigLabData)
+ profileColorSpace = ColorSpace.TYPE_Lab;
+ }
+ else
+ {
+ for (int i = 0; i < csTypeMap.length; i += 2)
+ if (csTypeMap[i] == pcsSig)
+ {
+ profileColorSpace = csTypeMap[i + 1];
+ break;
+ }
+ }
+
+ // creation timestamp
+ timestamp = new byte[8];
+ System.arraycopy(data, ICC_Profile.icHdrDate, timestamp, 0, 8);
+
+ // magic number
+ magic = buf.getInt(ICC_Profile.icHdrMagic);
+
+ // platform info
+ platform = buf.getInt(ICC_Profile.icHdrPlatform);
+ // get flags
+ flags = buf.getInt(ICC_Profile.icHdrFlags);
+ // get manufacturer sign
+ manufacturerSig = buf.getInt(ICC_Profile.icHdrManufacturer);
+ // get header model
+ modelSig = buf.getInt(ICC_Profile.icHdrModel);
+ // attributes
+ attributes = new byte[8];
+ System.arraycopy(data, ICC_Profile.icHdrAttributes, attributes, 0, 8);
+ // rendering intent
+ intent = buf.getInt(ICC_Profile.icHdrRenderingIntent);
+ // illuminant info
+ illuminant = new byte[12];
+ System.arraycopy(data, ICC_Profile.icHdrIlluminant, illuminant, 0, 12);
+ // Creator signature
+ creatorSig = buf.getInt(ICC_Profile.icHdrCreator);
+ // The rest of the header (Total size: 128 bytes) is unused..
+ }
+
+ /**
+ * Verify that the header is valid
+ * @param size equals the file size if it is to be verified, -1 otherwise
+ * @throws IllegalArgumentException if the header is found to be invalid.
+ */
+ public void verifyHeader(int size) throws IllegalArgumentException
+ {
+ // verify size
+ if (size != -1 && this.size != size)
+ throw new IllegalArgumentException("Invalid profile length:" + size);
+
+ // Check version number
+ if (majorVersion != 2)
+ throw new IllegalArgumentException("Wrong major version number:"
+ + majorVersion);
+
+ // Profile/Device class
+ if (profileClass == -1)
+ throw new IllegalArgumentException("Invalid profile/device class");
+
+ // get the data color space
+ if (colorSpace == -1)
+ throw new IllegalArgumentException("Invalid colorspace");
+
+ // profile color space
+ if (profileColorSpace == -1)
+ throw new IllegalArgumentException("Invalid PCS.");
+
+ // check magic number
+ if (magic != icMagicNumber)
+ throw new IllegalArgumentException("Invalid magic number!");
+ }
+
+ /**
+ * Creates a header, setting the header file size at the same time.
+ * @param size the profile file size.
+ */
+ public byte[] getData(int size)
+ {
+ byte[] data = new byte[HEADERSIZE];
+ ByteBuffer buf = ByteBuffer.wrap(data);
+ buf.putInt(ICC_Profile.icHdrSize, size);
+ buf.putInt(ICC_Profile.icHdrCmmId, cmmId);
+ buf.putShort(ICC_Profile.icHdrVersion,
+ (short) (majorVersion << 8 | minorVersion));
+ for (int i = 1; i < classMap.length; i += 2)
+ if (profileClass == classMap[i])
+ buf.putInt(ICC_Profile.icHdrDeviceClass, classMap[i - 1]);
+ for (int i = 1; i < csTypeMap.length; i += 2)
+ if (csTypeMap[i] == colorSpace)
+ buf.putInt(ICC_Profile.icHdrColorSpace, csTypeMap[i - 1]);
+ for (int i = 1; i < csTypeMap.length; i += 2)
+ if (csTypeMap[i] == profileColorSpace)
+ buf.putInt(ICC_Profile.icHdrPcs, csTypeMap[i - 1]);
+
+ System.arraycopy(timestamp, 0, data, ICC_Profile.icHdrDate,
+ timestamp.length);
+ buf.putInt(ICC_Profile.icHdrMagic, icMagicNumber);
+ buf.putInt(ICC_Profile.icHdrPlatform, platform);
+ buf.putInt(ICC_Profile.icHdrFlags, flags);
+ buf.putInt(ICC_Profile.icHdrManufacturer, manufacturerSig);
+ buf.putInt(ICC_Profile.icHdrModel, modelSig);
+ System.arraycopy(attributes, 0, data, ICC_Profile.icHdrAttributes,
+ attributes.length);
+ buf.putInt(ICC_Profile.icHdrRenderingIntent, intent);
+ System.arraycopy(illuminant, 0, data, ICC_Profile.icHdrIlluminant,
+ illuminant.length);
+ buf.putInt(ICC_Profile.icHdrCreator, creatorSig);
+ return buf.array();
+ }
+
+ public int getSize()
+ {
+ return size;
+ }
+
+ public void setSize(int s)
+ {
+ size = s;
+ }
+
+ public int getMajorVersion()
+ {
+ return majorVersion;
+ }
+
+ public int getMinorVersion()
+ {
+ return minorVersion;
+ }
+
+ public int getProfileClass()
+ {
+ return profileClass;
+ }
+
+ public void setProfileClass(int pc)
+ {
+ profileClass = pc;
+ }
+
+ public int getColorSpace()
+ {
+ return colorSpace;
+ }
+
+ public int getProfileColorSpace()
+ {
+ return profileColorSpace;
+ }
+
+ public void setColorSpace(int cs)
+ {
+ colorSpace = cs;
+ }
+
+ public void setProfileColorSpace(int pcs)
+ {
+ profileColorSpace = pcs;
+ }
+
+}
diff --git a/libjava/gnu/java/awt/color/PyccConverter.java b/libjava/gnu/java/awt/color/PyccConverter.java
new file mode 100644
index 0000000..638d944
--- /dev/null
+++ b/libjava/gnu/java/awt/color/PyccConverter.java
@@ -0,0 +1,73 @@
+/* PyccConverter.java -- PhotoYCC conversion class
+ Copyright (C) 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.color;
+
+
+/**
+ * PyccConverter - conversion routines for the PhotoYCC colorspace
+ *
+ * Also known as PhotoCD YCC, it is an expansion of the conventional
+ * YCC color space to also include colors with over 100% white.
+ *
+ * XXX FIXME: Not yet implemented, implementation pending.
+ *
+ * @author Sven de Marothy
+ */
+public class PyccConverter implements ColorSpaceConverter
+{
+ public float[] toRGB(float[] in)
+ {
+ return null;
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ return null;
+ }
+
+ public float[] toCIEXYZ(float[] in)
+ {
+ return null;
+ }
+
+ public float[] fromCIEXYZ(float[] in)
+ {
+ return null;
+ }
+}
diff --git a/libjava/gnu/java/awt/color/RgbProfileConverter.java b/libjava/gnu/java/awt/color/RgbProfileConverter.java
new file mode 100644
index 0000000..0482b3f
--- /dev/null
+++ b/libjava/gnu/java/awt/color/RgbProfileConverter.java
@@ -0,0 +1,245 @@
+/* RgbProfileConverter.java -- RGB Profile conversion class
+ Copyright (C) 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.color;
+
+import java.awt.color.ProfileDataException;
+import java.awt.color.ICC_Profile;
+import java.awt.color.ICC_ProfileRGB;
+
+
+/**
+ * RgbProfileConverter - converts RGB profiles (ICC_ProfileRGB)
+ *
+ * This type of profile contains a matrix and three
+ * tone reproduction curves (TRCs).
+ *
+ * Device RGB --> CIE XYZ is done through first multiplying with
+ * a matrix, then each component is looked-up against it's TRC.
+ *
+ * The opposite transform is done using the inverse of the matrix,
+ * and TRC:s.
+ *
+ * @author Sven de Marothy
+ */
+public class RgbProfileConverter implements ColorSpaceConverter
+{
+ private float[][] matrix;
+ private float[][] inv_matrix;
+ private ToneReproductionCurve rTRC;
+ private ToneReproductionCurve gTRC;
+ private ToneReproductionCurve bTRC;
+ private ColorLookUpTable toPCS;
+ private ColorLookUpTable fromPCS;
+
+ /**
+ * CIE 1931 D50 white point (in Lab coordinates)
+ */
+ private static float[] D50 = { 0.96422f, 1.00f, 0.82521f };
+
+ /**
+ * Constructs an RgbProfileConverter from a given ICC_ProfileRGB
+ */
+ public RgbProfileConverter(ICC_ProfileRGB profile)
+ {
+ toPCS = fromPCS = null;
+ matrix = profile.getMatrix();
+
+ // get TRCs
+ try
+ {
+ rTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.REDCOMPONENT));
+ }
+ catch (ProfileDataException e)
+ {
+ rTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.REDCOMPONENT));
+ }
+ try
+ {
+ gTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.GREENCOMPONENT));
+ }
+ catch (ProfileDataException e)
+ {
+ gTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.GREENCOMPONENT));
+ }
+ try
+ {
+ bTRC = new ToneReproductionCurve(profile.getGamma(ICC_ProfileRGB.BLUECOMPONENT));
+ }
+ catch (ProfileDataException e)
+ {
+ bTRC = new ToneReproductionCurve(profile.getTRC(ICC_ProfileRGB.BLUECOMPONENT));
+ }
+
+ // If a CLUT is available, it should be used, and the TRCs ignored.
+ // Note: A valid profile may only have CLUTs in one direction, and
+ // TRC:s without useful info, making reverse-transforms impossible.
+ // In this case the TRC will be used for the reverse-transform with
+ // unpredictable results. This is in line with the Java specification,
+ try
+ {
+ toPCS = new ColorLookUpTable(profile, ICC_Profile.icSigAToB0Tag);
+ }
+ catch (Exception e)
+ {
+ toPCS = null;
+ }
+
+ try
+ {
+ fromPCS = new ColorLookUpTable(profile, ICC_Profile.icSigBToA0Tag);
+ }
+ catch (Exception e)
+ {
+ fromPCS = null;
+ }
+
+ // Calculate the inverse matrix if no reverse CLUT is available
+ if(fromPCS == null)
+ inv_matrix = invertMatrix(matrix);
+ else
+ {
+ // otherwise just set it to an identity matrix
+ inv_matrix = new float[3][3];
+ inv_matrix[0][0] = inv_matrix[1][1] = inv_matrix[2][2] = 1.0f;
+ }
+ }
+
+ public float[] toCIEXYZ(float[] in)
+ {
+ // CLUT takes precedence
+ if (toPCS != null)
+ return toPCS.lookup(in);
+
+ float[] temp = new float[3];
+ float[] out = new float[3];
+
+ // device space --> linear gamma
+ temp[0] = rTRC.lookup(in[0]);
+ temp[1] = gTRC.lookup(in[1]);
+ temp[2] = bTRC.lookup(in[2]);
+
+ // matrix multiplication
+ out[0] = matrix[0][0] * temp[0] + matrix[0][1] * temp[1]
+ + matrix[0][2] * temp[2];
+ out[1] = matrix[1][0] * temp[0] + matrix[1][1] * temp[1]
+ + matrix[1][2] * temp[2];
+ out[2] = matrix[2][0] * temp[0] + matrix[2][1] * temp[1]
+ + matrix[2][2] * temp[2];
+
+ return out;
+ }
+
+ public float[] toRGB(float[] in)
+ {
+ return SrgbConverter.XYZtoRGB(toCIEXYZ(in));
+ }
+
+ public float[] fromCIEXYZ(float[] in)
+ {
+ if (fromPCS != null)
+ return fromPCS.lookup(in);
+
+ float[] temp = new float[3];
+ float[] out = new float[3];
+
+ // matrix multiplication
+ temp[0] = inv_matrix[0][0] * in[0] + inv_matrix[0][1] * in[1]
+ + inv_matrix[0][2] * in[2];
+ temp[1] = inv_matrix[1][0] * in[0] + inv_matrix[1][1] * in[1]
+ + inv_matrix[1][2] * in[2];
+ temp[2] = inv_matrix[2][0] * in[0] + inv_matrix[2][1] * in[1]
+ + inv_matrix[2][2] * in[2];
+
+ // device space --> linear gamma
+ out[0] = rTRC.reverseLookup(temp[0]);
+ out[1] = gTRC.reverseLookup(temp[1]);
+ out[2] = bTRC.reverseLookup(temp[2]);
+
+ // FIXME: Sun appears to clip the return values to [0,1]
+ // I don't believe that is a Good Thing,
+ // (some colorspaces may allow values outside that range.)
+ // So we return the actual values here.
+ return out;
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ return fromCIEXYZ(SrgbConverter.RGBtoXYZ(in));
+ }
+
+ /**
+ * Inverts a 3x3 matrix, returns the inverse,
+ * throws an IllegalArgumentException if the matrix is not
+ * invertible (this shouldn't happen for a valid profile)
+ */
+ private float[][] invertMatrix(float[][] matrix)
+ {
+ float[][] out = new float[3][3];
+ double determinant = matrix[0][0] * (matrix[1][1] * matrix[2][2]
+ - matrix[2][1] * matrix[1][2])
+ - matrix[0][1] * (matrix[1][0] * matrix[2][2]
+ - matrix[2][0] * matrix[1][2])
+ + matrix[0][2] * (matrix[1][0] * matrix[2][1]
+ - matrix[2][0] * matrix[1][1]);
+
+ if (determinant == 0.0)
+ throw new IllegalArgumentException("Can't invert conversion matrix.");
+ float invdet = (float) (1.0 / determinant);
+
+ out[0][0] = invdet * (matrix[1][1] * matrix[2][2]
+ - matrix[1][2] * matrix[2][1]);
+ out[0][1] = invdet * (matrix[0][2] * matrix[2][1]
+ - matrix[0][1] * matrix[2][2]);
+ out[0][2] = invdet * (matrix[0][1] * matrix[1][2]
+ - matrix[0][2] * matrix[1][1]);
+ out[1][0] = invdet * (matrix[1][2] * matrix[2][0]
+ - matrix[1][0] * matrix[2][2]);
+ out[1][1] = invdet * (matrix[0][0] * matrix[2][2]
+ - matrix[0][2] * matrix[2][0]);
+ out[1][2] = invdet * (matrix[0][2] * matrix[1][0]
+ - matrix[0][0] * matrix[1][2]);
+ out[2][0] = invdet * (matrix[1][0] * matrix[2][1]
+ - matrix[1][1] * matrix[2][0]);
+ out[2][1] = invdet * (matrix[0][1] * matrix[2][0]
+ - matrix[0][0] * matrix[2][1]);
+ out[2][2] = invdet * (matrix[0][0] * matrix[1][1]
+ - matrix[0][1] * matrix[1][0]);
+ return out;
+ }
+}
diff --git a/libjava/gnu/java/awt/color/SrgbConverter.java b/libjava/gnu/java/awt/color/SrgbConverter.java
new file mode 100644
index 0000000..65123e2
--- /dev/null
+++ b/libjava/gnu/java/awt/color/SrgbConverter.java
@@ -0,0 +1,153 @@
+/* SrgbConverter.java -- sRGB conversion class
+ Copyright (C) 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.color;
+
+
+/**
+ * SrgbConverter - conversion routines for the sRGB colorspace
+ * sRGB is a standard for RGB colorspaces, adopted by the w3c.
+ *
+ * The specification is available at:
+ * http://www.w3.org/Graphics/Color/sRGB.html
+ *
+ * @author Sven de Marothy
+ */
+/**
+ *
+ * Note the matrix numbers used here are NOT identical to those in the
+ * w3 spec, as those numbers are CIE XYZ relative a D65 white point.
+ * The CIE XYZ we use is relative a D50 white point, so therefore a
+ * linear Bradford transform matrix for D65->D50 mapping has been applied.
+ * (The ICC documents describe this transform)
+ *
+ * Linearized Bradford transform:
+ * 0.8951 0.2664 -0.1614
+ * -0.7502 1.7135 0.0367
+ * 0.0389 -0.0685 1.0296
+ *
+ * Inverse:
+ * 0.9870 -0.1471 0.1600
+ * 0.4323 0.5184 0.0493
+ * -0.00853 0.0400 0.9685
+ */
+public class SrgbConverter implements ColorSpaceConverter
+{
+ public float[] fromCIEXYZ(float[] in)
+ {
+ return XYZtoRGB(in);
+ }
+
+ public float[] toCIEXYZ(float[] in)
+ {
+ return RGBtoXYZ(in);
+ }
+
+ public float[] toRGB(float[] in)
+ {
+ float[] out = new float[3];
+ System.arraycopy(in, 0, out, 0, 3);
+ return out;
+ }
+
+ public float[] fromRGB(float[] in)
+ {
+ float[] out = new float[3];
+ System.arraycopy(in, 0, out, 0, 3);
+ return out;
+ }
+
+ /**
+ * CIE XYZ (D50 relative) --> sRGB
+ *
+ * Static as it's used by other ColorSpaceConverters to
+ * convert to sRGB if the color space is defined in XYZ.
+ */
+ public static float[] XYZtoRGB(float[] in)
+ {
+ float[] temp = new float[3];
+ temp[0] = 3.1338f * in[0] - 1.6171f * in[1] - 0.4907f * in[2];
+ temp[1] = -0.9785f * in[0] + 1.9160f * in[1] + 0.0334f * in[2];
+ temp[2] = 0.0720f * in[0] - 0.2290f * in[1] + 1.4056f * in[2];
+
+ float[] out = new float[3];
+ for (int i = 0; i < 3; i++)
+ {
+ if (temp[i] < 0)
+ temp[i] = 0.0f;
+ if (temp[i] > 1)
+ temp[i] = 1.0f;
+ if (temp[i] <= 0.00304f)
+ out[i] = temp[i] * 12.92f;
+ else
+ out[i] = 1.055f * ((float) Math.exp((1 / 2.4) * Math.log(temp[i])))
+ - 0.055f;
+ }
+ return out;
+ }
+
+ /**
+ * sRGB --> CIE XYZ (D50 relative)
+ *
+ * Static as it's used by other ColorSpaceConverters to
+ * convert to XYZ if the color space is defined in RGB.
+ */
+ public static float[] RGBtoXYZ(float[] in)
+ {
+ float[] temp = new float[3];
+ float[] out = new float[3];
+ for (int i = 0; i < 3; i++)
+ if (in[i] <= 0.03928f)
+ temp[i] = in[i] / 12.92f;
+ else
+ temp[i] = (float) Math.exp(2.4 * Math.log((in[i] + 0.055) / 1.055));
+
+ /*
+ * Note: The numbers which were used to calculate this only had four
+ * digits of accuracy. So don't be fooled by the number of digits here.
+ * If someone has more accurate source, feel free to update this.
+ */
+ out[0] = (float) (0.436063750222 * temp[0] + 0.385149601465 * temp[1]
+ + 0.143086418888 * temp[2]);
+ out[1] = (float) (0.222450894035 * temp[0] + 0.71692584775 * temp[1]
+ + 0.060624511256 * temp[2]);
+ out[2] = (float) (0.0138985186 * temp[0] + 0.097079690112 * temp[1]
+ + 0.713996045725 * temp[2]);
+ return out;
+ }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java b/libjava/gnu/java/awt/color/TagEntry.java
index 2f019e4..7726e45 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java
+++ b/libjava/gnu/java/awt/color/TagEntry.java
@@ -1,5 +1,5 @@
-/* GdkClasspathFontPeerMetrics.java
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+/* TagEntry.java -- A utility class used for storing the tags in ICC_Profile
+ Copyright (C) 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -33,84 +33,90 @@
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. */
+ exception statement from your version.
+*/
+package gnu.java.awt.color;
-package gnu.java.awt.peer.gtk;
-import java.awt.*;
-import java.awt.font.*;
-import java.awt.geom.*;
-
-public class GdkClasspathFontPeerMetrics extends FontMetrics
+/**
+ * TagEntry - stores a profile tag.
+ * These are conveniently stored in a hashtable with the tag signature
+ * as a key. A legal profile can only have one tag with a given sig,
+ * so we can conveniently ignore collisions.
+ *
+ * @author Sven de Marothy
+ */
+public class TagEntry
{
- private final int native_state = GtkGenericPeer.getUniqueInteger();
-
- private static final int ASCENT = 0, MAX_ASCENT = 1,
- DESCENT = 2, MAX_DESCENT = 3,
- MAX_ADVANCE = 4;
-
- private int[] metrics;
- private native int[] initState (Object font);
-
- public GdkClasspathFontPeerMetrics (Font font)
+ // tag table entry size
+ public static final int entrySize = 12;
+ private int signature;
+ private int size;
+ private int offset;
+ private byte[] data;
+
+ public TagEntry(int sig, int offset, int size, byte[] data)
{
- super (font);
- metrics = initState (font.getPeer());
+ this.signature = sig;
+ this.offset = offset;
+ this.size = size;
+ this.data = new byte[size];
+ System.arraycopy(data, offset, this.data, 0, size);
}
- public int stringWidth (String str)
+ public TagEntry(int sig, byte[] data)
{
- GlyphVector gv = font.createGlyphVector
- (new FontRenderContext
- (new AffineTransform (), false, false), str);
- Rectangle2D r = gv.getVisualBounds ();
- return (int) r.getWidth ();
+ this.signature = sig;
+ this.size = data.length;
+ this.data = new byte[size];
+ System.arraycopy(data, offset, this.data, 0, size);
}
- public int charWidth (char ch)
+ public byte[] getData()
{
- return stringWidth (new String (new char[] { ch }));
+ byte[] d = new byte[size];
+ System.arraycopy(this.data, 0, d, 0, size);
+ return d;
}
- public int charsWidth (char data[], int off, int len)
+ public String hashKey()
{
- return stringWidth (new String (data, off, len));
+ return tagHashKey(signature);
}
- /*
- Sun's Motif implementation always returns 0 or 1 here (???), but
- going by the X11 man pages, it seems as though we should return
- font.ascent + font.descent.
- */
- public int getLeading ()
+ public String toString()
{
- return 1;
-// return metrics[ASCENT] + metrics[DESCENT];
+ String s = "";
+ s = s + (char) ((byte) ((signature >> 24) & 0xFF));
+ s = s + (char) ((byte) ((signature >> 16) & 0xFF));
+ s = s + (char) ((byte) ((signature >> 8) & 0xFF));
+ s = s + (char) ((byte) (signature & 0xFF));
+ return s;
}
- public int getAscent ()
+ public int getSignature()
{
- return metrics[ASCENT];
+ return signature;
}
- public int getMaxAscent ()
+ public int getSize()
{
- return metrics[MAX_ASCENT];
+ return size;
}
- public int getDescent ()
+ public int getOffset()
{
- return metrics[DESCENT];
+ return offset;
}
- public int getMaxDescent ()
+ public void setOffset(int offset)
{
- return metrics[MAX_DESCENT];
+ this.offset = offset;
}
- public int getMaxAdvance ()
+ public static String tagHashKey(int sig)
{
- return metrics[MAX_ADVANCE];
+ return "" + sig;
}
}
diff --git a/libjava/gnu/java/awt/color/ToneReproductionCurve.java b/libjava/gnu/java/awt/color/ToneReproductionCurve.java
new file mode 100644
index 0000000..a29598c
--- /dev/null
+++ b/libjava/gnu/java/awt/color/ToneReproductionCurve.java
@@ -0,0 +1,178 @@
+/* ToneReproductionCurve.java -- Representation of an ICC 'curv' type TRC
+ Copyright (C) 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.color;
+
+
+/**
+ * ToneReproductionCurve - TRCs are used to describe RGB
+ * and Grayscale profiles. The TRC is essentially the gamma
+ * function of the color space.
+ *
+ * For example, Apple RGB has a gamma of 1.8, most monitors are ~2.2,
+ * sRGB is 2.4 with a small linear part near 0.
+ * Linear spaces are of course 1.0.
+ * (The exact function is implemented in SrgbConverter)
+ *
+ * The ICC specification allows the TRC to be described as a single
+ * Gamma value, where the function is thus out = in**gamma.
+ * Alternatively, the gamma function may be represented by a lookup table
+ * of values, in which case linear interpolation is used.
+ *
+ * @author Sven de Marothy
+ */
+public class ToneReproductionCurve
+{
+ private float[] trc;
+ private float gamma;
+ private float[] reverseTrc;
+
+ /**
+ * Constructs a TRC from a gamma values
+ */
+ public ToneReproductionCurve(float gamma)
+ {
+ trc = null;
+ reverseTrc = null;
+ this.gamma = gamma;
+ }
+
+ /**
+ * Constructs a TRC from a set of float values
+ */
+ public ToneReproductionCurve(float[] trcValues)
+ {
+ trc = new float[trcValues.length];
+ System.arraycopy(trcValues, 0, trc, 0, trcValues.length);
+ setupReverseTrc();
+ }
+
+ /**
+ * Constructs a TRC from a set of short values normalized to
+ * the 0-65535 range (as in the ICC profile file).
+ * (Note the values are treated as unsigned)
+ */
+ public ToneReproductionCurve(short[] trcValues)
+ {
+ trc = new float[trcValues.length];
+ for (int i = 0; i < trcValues.length; i++)
+ trc[i] = (float) ((int) trcValues[i] & (0xFFFF)) / 65535.0f;
+ setupReverseTrc();
+ }
+
+ /**
+ * Performs a TRC lookup
+ */
+ public float lookup(float in)
+ {
+ float out;
+
+ if (trc == null)
+ {
+ if (in == 0f)
+ return 0.0f;
+ return (float) Math.exp(gamma * Math.log(in));
+ }
+ else
+ {
+ double alpha = in * (trc.length - 1);
+ int index = (int) Math.floor(alpha);
+ alpha = alpha - (double) index;
+ if (index >= trc.length - 1)
+ return trc[trc.length - 1];
+ if (index <= 0)
+ return trc[0];
+ out = (float) (trc[index] * (1.0 - alpha) + trc[index + 1] * alpha);
+ }
+ return out;
+ }
+
+ /**
+ * Performs an reverse lookup
+ */
+ public float reverseLookup(float in)
+ {
+ float out;
+
+ if (trc == null)
+ {
+ if (in == 0f)
+ return 0.0f;
+ return (float) Math.exp((1.0 / gamma) * Math.log(in));
+ }
+ else
+ {
+ double alpha = in * (reverseTrc.length - 1);
+ int index = (int) Math.floor(alpha);
+ alpha = alpha - (double) index;
+ if (index >= reverseTrc.length - 1)
+ return reverseTrc[reverseTrc.length - 1];
+ if (index <= 0)
+ return reverseTrc[0];
+ out = (float) (reverseTrc[index] * (1.0 - alpha)
+ + reverseTrc[index + 1] * alpha);
+ }
+ return out;
+ }
+
+ /**
+ * Calculates a reverse-lookup table.
+ * We use a whopping 10,000 entries.. This is should be more than any
+ * real-life TRC table (typically around 256-1024) so we won't be losing
+ * any precision.
+ *
+ * This will of course generate completely invalid results if the curve
+ * is not monotonic and invertable. But what's the alternative?
+ */
+ public void setupReverseTrc()
+ {
+ reverseTrc = new float[10000];
+ int j = 0;
+ for (int i = 0; i < 10000; i++)
+ {
+ float n = ((float) i) / 10000f;
+ while (trc[j + 1] < n && j < trc.length - 2)
+ j++;
+
+ if (j == trc.length - 2)
+ reverseTrc[i] = trc[trc.length - 1];
+ else
+ reverseTrc[i] = (j + (n - trc[j]) / (trc[j + 1] - trc[j])) / ((float) trc.length);
+ }
+ }
+}
diff --git a/libjava/gnu/java/awt/image/XBMDecoder.java b/libjava/gnu/java/awt/image/XBMDecoder.java
index b80fd55..da58dbb 100644
--- a/libjava/gnu/java/awt/image/XBMDecoder.java
+++ b/libjava/gnu/java/awt/image/XBMDecoder.java
@@ -1,5 +1,5 @@
/* XBMDecoder -- Decodes X-bitmaps
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,13 +35,19 @@ 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.image;
-import java.awt.*;
-import java.awt.image.*;
-import java.util.*;
-import java.io.*;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageConsumer;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.Reader;
import java.net.URL;
+import java.util.StringTokenizer;
+import java.util.Vector;
public class XBMDecoder extends ImageDecoder
{
diff --git a/libjava/gnu/java/awt/peer/ClasspathFontPeer.java b/libjava/gnu/java/awt/peer/ClasspathFontPeer.java
index 6b753aa..79b1adf 100644
--- a/libjava/gnu/java/awt/peer/ClasspathFontPeer.java
+++ b/libjava/gnu/java/awt/peer/ClasspathFontPeer.java
@@ -160,7 +160,7 @@ public abstract class ClasspathFontPeer
return name;
}
- protected static void copyStyleToAttrs (int style, Map attrs)
+ public static void copyStyleToAttrs (int style, Map attrs)
{
if ((style & Font.BOLD) == Font.BOLD)
attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
@@ -179,7 +179,7 @@ public abstract class ClasspathFontPeer
attrs.put (TextAttribute.FAMILY, fam);
}
- protected static void copySizeToAttrs (float size, Map attrs)
+ public static void copySizeToAttrs (float size, Map attrs)
{
attrs.put (TextAttribute.SIZE, new Float (size));
}
@@ -218,7 +218,7 @@ public abstract class ClasspathFontPeer
AffineTransform trans = this.transform;
float size = this.size;
int style = this.style;
-
+
if (attribs.containsKey (TextAttribute.FAMILY))
family = (String) attribs.get (TextAttribute.FAMILY);
@@ -243,7 +243,13 @@ public abstract class ClasspathFontPeer
{
Float sz = (Float) attribs.get (TextAttribute.SIZE);
size = sz.floatValue ();
+
+ // Pango doesn't accept 0 as a font size.
+ if (size < 1)
+ size = 1;
}
+ else
+ size = 12;
if (attribs.containsKey (TextAttribute.TRANSFORM))
{
diff --git a/libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java b/libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java
new file mode 100644
index 0000000..143412c
--- /dev/null
+++ b/libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java
@@ -0,0 +1,111 @@
+/* ClasspathTextLayoutPeer.java
+ Copyright (C) 2003 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;
+
+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
+ */
+
+public interface ClasspathTextLayoutPeer
+{
+ TextHitInfo getStrongCaret (TextHitInfo hit1,
+ TextHitInfo hit2);
+
+ void draw (Graphics2D g2, float x, float y);
+
+ byte getBaseline ();
+
+ boolean isLeftToRight ();
+ boolean isVertical ();
+
+ float getAdvance ();
+ float getAscent ();
+ float getDescent ();
+ float getLeading ();
+
+ int getCharacterCount ();
+ byte getCharacterLevel (int index);
+
+ float[] getBaselineOffsets ();
+ Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint);
+ Rectangle2D getBounds ();
+
+ float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds);
+ Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds);
+ Shape[] getCaretShapes (int offset, Rectangle2D bounds,
+ TextLayout.CaretPolicy policy);
+
+ Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
+ Rectangle2D bounds);
+ int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
+ TextHitInfo secondEndpoint);
+
+ TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy);
+ TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy);
+ TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds);
+ TextHitInfo getVisualOtherHit (TextHitInfo hit);
+
+ float getVisibleAdvance ();
+ Shape getOutline (AffineTransform tx);
+ Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
+ TextHitInfo secondEndpoint,
+ Rectangle2D bounds);
+
+ TextLayout getJustifiedLayout (float justificationWidth);
+ void handleJustify (float justificationWidth);
+
+ Object clone ();
+ int hashCode ();
+ boolean equals (ClasspathTextLayoutPeer tl);
+ String toString ();
+}
diff --git a/libjava/gnu/java/awt/peer/GLightweightPeer.java b/libjava/gnu/java/awt/peer/GLightweightPeer.java
index 643c40f..c3219d1 100644
--- a/libjava/gnu/java/awt/peer/GLightweightPeer.java
+++ b/libjava/gnu/java/awt/peer/GLightweightPeer.java
@@ -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 gnu.java.awt.peer;
import java.awt.AWTEvent;
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
index c7a73a3..3cd2f9a 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
@@ -1,5 +1,5 @@
/* GdkFontMetrics.java
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,33 +38,63 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.java.awt.ClasspathToolkit;
+
import java.awt.Font;
import java.awt.FontMetrics;
+import java.awt.Toolkit;
public class GdkFontMetrics extends FontMetrics
{
- private final int native_state = GtkGenericPeer.getUniqueInteger();
-
- private static final int ASCENT = 0, MAX_ASCENT = 1,
- DESCENT = 2, MAX_DESCENT = 3,
- MAX_ADVANCE = 4;
-
- private int[] metrics;
- private native int[] initState (String fname, int style, int size);
+
+ private int[] font_metrics;
+ GdkFontPeer peer;
+
+ static final int FONT_METRICS_ASCENT = 0;
+ static final int FONT_METRICS_MAX_ASCENT = 1;
+ static final int FONT_METRICS_DESCENT = 2;
+ static final int FONT_METRICS_MAX_DESCENT = 3;
+ static final int FONT_METRICS_MAX_ADVANCE = 4;
+
+ static final int TEXT_METRICS_X_BEARING = 0;
+ static final int TEXT_METRICS_Y_BEARING = 1;
+ static final int TEXT_METRICS_WIDTH = 2;
+ static final int TEXT_METRICS_HEIGHT = 3;
+ 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)
- {
- super (font);
- metrics = initState (font.getName (), font.getStyle (), font.getSize ());
+ {
+ super (font.getPeer() instanceof GdkFontPeer
+ ? font
+ : ((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
+ .getFont (font.getName(), font.getAttributes ()));
+
+ peer = (GdkFontPeer) this.font.getPeer();
+
+ font_metrics = new int[5];
+ double [] hires = new double[5];
+
+ if (GtkToolkit.useGraphics2D ())
+ GdkGraphics2D.getPeerFontMetrics(peer, hires);
+ else
+ getPeerFontMetrics (peer, hires);
+
+ for (int i = 0; i < 5; ++i)
+ font_metrics[i] = (int) hires[i];
}
-
- native public int stringWidth (String fname, int style, int size,
- String str);
-
+
public int stringWidth (String str)
{
- return stringWidth (font.getName (), font.getStyle (), font.getSize (),
- str);
+ double [] hires = new double[6];
+ if (GtkToolkit.useGraphics2D())
+ GdkGraphics2D.getPeerTextMetrics(peer, str, hires);
+ else
+ getPeerTextMetrics(peer, str, hires);
+ return (int) hires [TEXT_METRICS_WIDTH];
}
public int charWidth (char ch)
@@ -77,34 +107,39 @@ public class GdkFontMetrics extends FontMetrics
return stringWidth (new String (data, off, len));
}
- // Sun's Motif implementation always returns 0 or 1 here (???).
+ /*
+ Sun's Motif implementation always returns 0 or 1 here (???), but
+ going by the X11 man pages, it seems as though we should return
+ font.ascent + font.descent.
+ */
public int getLeading ()
{
- return 0;
+ return 1;
+// return metrics[ASCENT] + metrics[DESCENT];
}
public int getAscent ()
{
- return metrics[ASCENT];
+ return font_metrics[FONT_METRICS_ASCENT];
}
public int getMaxAscent ()
{
- return metrics[MAX_ASCENT];
+ return font_metrics[FONT_METRICS_MAX_ASCENT];
}
public int getDescent ()
{
- return metrics[DESCENT];
+ return font_metrics[FONT_METRICS_DESCENT];
}
public int getMaxDescent ()
{
- return metrics[MAX_DESCENT];
+ return font_metrics[FONT_METRICS_MAX_DESCENT];
}
public int getMaxAdvance ()
{
- return metrics[MAX_ADVANCE];
+ return font_metrics[FONT_METRICS_MAX_ADVANCE];
}
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java
index 1cf24a9..ee05145 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java
@@ -1,68 +1,62 @@
-/* GdkClasspathFontPeer.java -- backend implementation for Font object
- Copyright (C) 2003 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. */
+/* GdkFontPeer.java -- Implements FontPeer with GTK+
+ Copyright (C) 1999, 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.peer.FontPeer;
import java.awt.*;
-import java.awt.font.*;
import java.awt.geom.*;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.Serializable;
+import java.awt.font.*;
import java.util.Locale;
import java.util.Map;
-import java.util.StringTokenizer;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
import java.text.CharacterIterator;
import java.text.AttributedCharacterIterator;
import java.text.StringCharacterIterator;
-import java.awt.font.TextAttribute;
import gnu.classpath.Configuration;
import gnu.java.awt.peer.ClasspathFontPeer;
-/**
- * This class represents a windowing system font using the Pango
- * unicode/glyph/font library and the Cairo rendering library.
- *
- * @author Graydon Hoare (graydon@redhat.com)
- */
-
-public class GdkClasspathFontPeer extends ClasspathFontPeer
+public class GdkFontPeer extends ClasspathFontPeer
{
+
+ native static void initStaticState ();
+ private final int native_state = GtkGenericPeer.getUniqueInteger ();
+ private static ResourceBundle bundle;
static
{
@@ -71,26 +65,26 @@ public class GdkClasspathFontPeer extends ClasspathFontPeer
System.loadLibrary("gtkpeer");
}
- if (GtkToolkit.useGraphics2D ())
- initStaticState ();
- }
- native static void initStaticState ();
- private final int native_state = GtkGenericPeer.getUniqueInteger ();
-
+ initStaticState ();
- /* Instance Variables */
+ try
+ {
+ bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
+ }
+ catch (Throwable ignored)
+ {
+ bundle = null;
+ }
+ }
private native void initState ();
private native void dispose ();
- private native void setFont (String family, int style, int size);
-
- protected void sync ()
- {
- this.setFont (this.familyName, this.style, (int)this.size);
- }
+ private native void setFont (String family, int style, int size, boolean useGraphics2D);
protected void finalize ()
{
+ if (GtkToolkit.useGraphics2D ())
+ GdkGraphics2D.releasePeerGraphicsResource(this);
dispose ();
}
@@ -101,49 +95,57 @@ public class GdkClasspathFontPeer extends ClasspathFontPeer
* triplicate.
*/
- private String buildString(CharacterIterator i) {
- String s = new String ();
- for(char c = i.first(); c != CharacterIterator.DONE; c = i.next())
- s += c;
- return s;
+ private String buildString(CharacterIterator iter)
+ {
+ StringBuffer sb = new StringBuffer();
+ for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
+ sb.append(c);
+ return sb.toString();
}
- private String buildString(CharacterIterator iter, int begin, int limit) {
- String s = new String ();
+ private String buildString(CharacterIterator iter, int begin, int limit)
+ {
+ StringBuffer sb = new StringBuffer();
int i = 0;
for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++)
{
if (begin <= i)
- s += c;
+ sb.append(c);
if (limit <= i)
break;
}
- return s;
+ return sb.toString();
}
- private String buildString(char[] chars, int begin, int limit) {
- String s = new String ();
- for(int i = begin; i <= limit; i++)
- s += chars[i];
- return s;
+ private String buildString(char[] chars, int begin, int limit)
+ {
+ return new String(chars, begin, limit - begin);
}
/* Public API */
- public GdkClasspathFontPeer (String name, int style, int size)
+ public GdkFontPeer (String name, int style)
+ {
+ // All fonts get a default size of 12 if size is not specified.
+ this(name, style, 12);
+ }
+
+ public GdkFontPeer (String name, int style, int size)
{
super(name, style, size);
initState ();
- setFont (this.familyName, this.style, (int)this.size);
+ setFont (this.familyName, this.style, (int)this.size,
+ GtkToolkit.useGraphics2D());
}
- public GdkClasspathFontPeer (String name, Map attributes)
+ public GdkFontPeer (String name, Map attributes)
{
super(name, attributes);
initState ();
- setFont (this.familyName, this.style, (int)this.size);
+ setFont (this.familyName, this.style, (int)this.size,
+ GtkToolkit.useGraphics2D());
}
-
+
public String getSubFamilyName(Font font, Locale locale)
{
return null;
@@ -228,7 +230,6 @@ public class GdkClasspathFontPeer extends ClasspathFontPeer
}
-
public LineMetrics getLineMetrics (Font font, CharacterIterator ci,
int begin, int limit, FontRenderContext rc)
{
@@ -288,8 +289,7 @@ public class GdkClasspathFontPeer extends ClasspathFontPeer
public FontMetrics getFontMetrics (Font font)
{
- return new GdkClasspathFontPeerMetrics (font);
+ return new GdkFontMetrics (font);
}
}
-
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java b/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
index ff6b4cd..c37de52 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
@@ -1,57 +1,57 @@
/* GdkGlyphVector.java -- Glyph vector object
- Copyright (C) 2003 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. */
+ 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. */
package gnu.java.awt.peer.gtk;
-import java.awt.*;
-import java.awt.font.*;
-import java.awt.geom.*;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
import gnu.classpath.Configuration;
-public class GdkGlyphVector extends GlyphVector
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphMetrics;
+import java.awt.font.GlyphVector;
+import java.awt.font.GlyphJustificationInfo;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+public class GdkGlyphVector extends GlyphVector
{
static
@@ -70,7 +70,7 @@ public class GdkGlyphVector extends GlyphVector
private Font font;
private FontRenderContext ctx;
- private native void initState (GdkClasspathFontPeer peer, 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 ();
@@ -109,7 +109,7 @@ public class GdkGlyphVector extends GlyphVector
*/
- public GdkGlyphVector (Font f, GdkClasspathFontPeer peer, FontRenderContext c, String s)
+ public GdkGlyphVector (Font f, GdkFontPeer peer, FontRenderContext c, String s)
{
font = f;
ctx = c;
@@ -117,7 +117,7 @@ public class GdkGlyphVector extends GlyphVector
setChars (s);
}
- public GdkGlyphVector (Font f, GdkClasspathFontPeer peer, FontRenderContext c, int codes[])
+ public GdkGlyphVector (Font f, GdkFontPeer peer, FontRenderContext c, int codes[])
{
font = f;
ctx = c;
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
index c374ba2..5aacf52 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
@@ -90,17 +90,31 @@ public class GdkGraphics extends Graphics
GdkGraphics (GtkComponentPeer component)
{
this.component = component;
+ font = component.awtComponent.getFont ();
+
+ if (component.isRealized ())
+ initComponentGraphics ();
+ else
+ connectSignals (component);
+ }
+
+ void initComponentGraphics ()
+ {
initState (component);
color = component.awtComponent.getForeground ();
- font = component.awtComponent.getFont ();
Dimension d = component.awtComponent.getSize ();
clip = new Rectangle (0, 0, d.width, d.height);
}
+ native void connectSignals (GtkComponentPeer component);
+
public native void clearRect (int x, int y, int width, int height);
public void clipRect (int x, int y, int width, int height)
{
+ if (component != null && ! component.isRealized ())
+ return;
+
clip = clip.intersection (new Rectangle (x, y, width, height));
setClipRectangle (clip.x, clip.y, clip.width, clip.height);
}
@@ -113,16 +127,6 @@ public class GdkGraphics extends Graphics
return new GdkGraphics (this);
}
-// public Graphics create (int x, int y, int width, int height)
-// {
-// GdkGraphics g = new GdkGraphics (this);
-// System.out.println ("translating by: " + x +" " + y);
-// g.translate (x, y);
-// g.clipRect (0, 0, width, height);
-
-// return g;
-// }
-
native public void dispose ();
native void copyPixmap (Graphics g, int x, int y, int width, int height);
@@ -134,24 +138,45 @@ public class GdkGraphics extends Graphics
public boolean drawImage (Image img, int x, int y,
Color bgcolor, ImageObserver observer)
{
+ if (component != null && ! component.isRealized ())
+ return false;
+
if (img instanceof GtkOffScreenImage)
{
+ int width = img.getWidth (null);
+ int height = img.getHeight (null);
copyPixmap (img.getGraphics (),
- x, y, img.getWidth (null), img.getHeight (null));
+ x, y, width, height);
+ // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+ if (observer != null)
+ observer.imageUpdate (img,
+ ImageObserver.FRAMEBITS,
+ x, y, width, height);
return true;
}
GtkImage image = (GtkImage) img;
- new GtkImagePainter (image, this, x, y, -1, -1, bgcolor);
+ new GtkImagePainter (image, this, x, y, -1, -1, bgcolor, observer);
return image.isLoaded ();
}
public boolean drawImage (Image img, int x, int y, ImageObserver observer)
{
+ if (component != null && ! component.isRealized ())
+ return false;
+
if (img instanceof GtkOffScreenImage)
{
+ int width = img.getWidth (null);
+ int height = img.getHeight (null);
copyPixmap (img.getGraphics (),
- x, y, img.getWidth (null), img.getHeight (null));
+ x, y, width, height);
+
+ // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+ if (observer != null)
+ observer.imageUpdate (img,
+ ImageObserver.FRAMEBITS,
+ x, y, width, height);
return true;
}
@@ -164,22 +189,33 @@ public class GdkGraphics extends Graphics
public boolean drawImage (Image img, int x, int y, int width, int height,
Color bgcolor, ImageObserver observer)
{
+ if (component != null && ! component.isRealized ())
+ return false;
+
if (img instanceof GtkOffScreenImage)
{
copyAndScalePixmap (img.getGraphics (), false, false,
0, 0, img.getWidth (null), img.getHeight (null),
x, y, width, height);
+ // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+ if (observer != null)
+ observer.imageUpdate (img,
+ ImageObserver.FRAMEBITS,
+ x, y, width, height);
return true;
}
GtkImage image = (GtkImage) img;
- new GtkImagePainter (image, this, x, y, width, height, bgcolor);
+ new GtkImagePainter (image, this, x, y, width, height, bgcolor, observer);
return image.isLoaded ();
}
public boolean drawImage (Image img, int x, int y, int width, int height,
ImageObserver observer)
{
+ if (component != null && ! component.isRealized ())
+ return false;
+
if (component != null)
return drawImage (img, x, y, width, height, component.getBackground (),
observer);
@@ -192,6 +228,9 @@ public class GdkGraphics extends Graphics
int sx1, int sy1, int sx2, int sy2,
Color bgcolor, ImageObserver observer)
{
+ if (component != null && ! component.isRealized ())
+ return false;
+
if (img instanceof GtkOffScreenImage)
{
int dx_start, dy_start, d_width, d_height;
@@ -247,12 +286,18 @@ public class GdkGraphics extends Graphics
copyAndScalePixmap (img.getGraphics (), x_flip, y_flip,
sx_start, sy_start, s_width, s_height,
dx_start, dy_start, d_width, d_height);
+
+ // FIXME: need to differentiate between SOMEBITS and FRAMEBITS.
+ if (observer != null)
+ observer.imageUpdate (img,
+ ImageObserver.FRAMEBITS,
+ dx_start, dy_start, d_width, d_height);
return true;
}
GtkImage image = (GtkImage) img;
new GtkImagePainter (image, this, dx1, dy1, dx2, dy2,
- sx1, sy1, sx2, sy2, bgcolor);
+ sx1, sy1, sx2, sy2, bgcolor, observer);
return image.isLoaded ();
}
@@ -260,6 +305,9 @@ public class GdkGraphics extends Graphics
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
+ if (component != null && ! component.isRealized ())
+ return false;
+
if (component != null)
return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
component.getBackground (), observer);
@@ -285,11 +333,17 @@ public class GdkGraphics extends Graphics
native public void drawRect(int x, int y, int width, int height);
native public void fillRect (int x, int y, int width, int height);
- native void drawString (String str, int x, int y, String fname, int style, int size);
+ GdkFontPeer getFontPeer()
+ {
+ return (GdkFontPeer) getFont().getPeer();
+ }
+
+ native void drawString (GdkFontPeer f, String str, int x, int y);
public void drawString (String str, int x, int y)
{
- drawString (str, x, y, font.getName(), font.getStyle(), font.getSize());
+ drawString(getFontPeer(), str, x, y);
}
+
public void drawString (AttributedCharacterIterator ci, int x, int y)
{
@@ -350,7 +404,6 @@ public class GdkGraphics extends Graphics
public Rectangle getClipBounds ()
{
-// System.out.println ("returning CLIP: " + clip);
return new Rectangle (clip.x, clip.y, clip.width, clip.height);
}
@@ -373,6 +426,9 @@ public class GdkGraphics extends Graphics
public void setClip (int x, int y, int width, int height)
{
+ if (component != null && ! component.isRealized ())
+ return;
+
clip.x = x;
clip.y = y;
clip.width = width;
@@ -396,7 +452,7 @@ public class GdkGraphics extends Graphics
public void setColor (Color c)
{
if (c == null)
- color = new Color (0, 0, 0);
+ color = Color.BLACK;
else
color = c;
@@ -407,7 +463,7 @@ public class GdkGraphics extends Graphics
color.getGreen () ^ xorColor.getGreen (),
color.getBlue () ^ xorColor.getBlue ());
}
-
+
public void setFont (Font font)
{
this.font = font;
@@ -437,6 +493,9 @@ public class GdkGraphics extends Graphics
public void translate (int x, int y)
{
+ if (component != null && ! component.isRealized ())
+ return;
+
clip.x -= x;
clip.y -= y;
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java
index 0986960..82de03d 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java
@@ -1,5 +1,5 @@
/* GdkGraphics2D.java
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,21 +38,60 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.font.*;
-import java.awt.color.*;
-import java.awt.image.*;
-import java.awt.image.renderable.*;
-import java.util.HashMap;
-import java.util.Map;
+import gnu.classpath.Configuration;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathFontPeer;
+import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Paint;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+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.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;
+import java.awt.image.ColorModel;
+import java.awt.image.CropImageFilter;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferInt;
+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.Raster;
+import java.awt.image.RenderedImage;
+import java.awt.image.WritableRaster;
+import java.awt.image.renderable.RenderableImage;
+import java.awt.image.renderable.RenderContext;
import java.text.AttributedCharacterIterator;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Stack;
-import java.lang.Integer;
-import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathFontPeer;
-import gnu.classpath.Configuration;
public class GdkGraphics2D extends Graphics2D
{
@@ -85,6 +124,8 @@ public class GdkGraphics2D extends Graphics2D
private RenderingHints hints;
private BufferedImage bimage;
+ private Composite comp;
+
private Stack stateStack;
native private void initState (GtkComponentPeer component);
@@ -93,6 +134,7 @@ public class GdkGraphics2D extends Graphics2D
native public void dispose ();
native private int[] getImagePixels();
native private void cairoSurfaceSetFilter(int filter);
+ native void connectSignals (GtkComponentPeer component);
public void finalize ()
{
@@ -113,7 +155,7 @@ public class GdkGraphics2D extends Graphics2D
{
paint = g.paint;
stroke = g.stroke;
- hints = g.hints;
+ setRenderingHints (g.hints);
if (g.fg.getAlpha() != -1)
fg = new Color (g.fg.getRed (), g.fg.getGreen (),
@@ -145,8 +187,8 @@ public class GdkGraphics2D extends Graphics2D
setBackground (bg);
setPaint (paint);
setStroke (stroke);
- setClip (clip);
setTransform (transform);
+ setClip (clip);
stateStack = new Stack();
}
@@ -168,12 +210,22 @@ public class GdkGraphics2D extends Graphics2D
GdkGraphics2D (GtkComponentPeer component)
{
this.component = component;
+
+ setFont (new Font("SansSerif", Font.PLAIN, 12));
+
+ if (component.isRealized ())
+ initComponentGraphics2D ();
+ else
+ connectSignals (component);
+ }
+
+ void initComponentGraphics2D ()
+ {
initState (component);
setColor (component.awtComponent.getForeground ());
setBackground (component.awtComponent.getBackground ());
setPaint (getColor());
- setFont (new Font("SansSerif", Font.PLAIN, 12));
setTransform (new AffineTransform ());
setStroke (new BasicStroke ());
setRenderingHints (getDefaultHints());
@@ -224,9 +276,6 @@ public class GdkGraphics2D extends Graphics2D
private native void cairoSave ();
private native void cairoRestore ();
private native void cairoSetMatrix (double m[]);
- private native void cairoSetFont (GdkClasspathFontPeer peer);
- private native void cairoShowGlyphs (int codes[],
- float positions[]);
private native void cairoSetOperator (int cairoOperator);
private native void cairoSetRGBColor (double red, double green, double blue);
private native void cairoSetAlpha (double alpha);
@@ -268,6 +317,7 @@ public class GdkGraphics2D extends Graphics2D
private Shape clip;
private AffineTransform transform;
private Font font;
+ private Composite comp;
DrawState (GdkGraphics2D g)
{
this.paint = g.paint;
@@ -278,6 +328,7 @@ public class GdkGraphics2D extends Graphics2D
if (g.transform != null)
this.transform = (AffineTransform) g.transform.clone();
this.font = g.font;
+ this.comp = g.comp;
}
public void restore(GdkGraphics2D g)
{
@@ -288,6 +339,7 @@ public class GdkGraphics2D extends Graphics2D
g.clip = this.clip;
g.transform = this.transform;
g.font = this.font;
+ g.comp = this.comp;
}
}
@@ -303,17 +355,23 @@ public class GdkGraphics2D extends Graphics2D
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.
- double x;
- double y;
- private void setPos (double nx, double ny)
+ private boolean shiftDrawCalls = false;
+ private final double shifted(double coord, boolean doShift)
{
- x = nx;
- y = ny;
+ if (doShift)
+ return Math.floor(coord) + 0.5;
+ else
+ return coord;
}
- private void walkPath(PathIterator p)
+ private final void walkPath(PathIterator p, boolean doShift)
{
+ double x = 0;
+ double y = 0;
double coords[] = new double[6];
cairoSetFillRule (p.getWindingRule ());
@@ -324,13 +382,15 @@ public class GdkGraphics2D extends Graphics2D
{
case PathIterator.SEG_MOVETO:
- setPos(coords[0], coords[1]);
- cairoMoveTo (coords[0], coords[1]);
+ x = shifted(coords[0], doShift);
+ y = shifted(coords[1], doShift);
+ cairoMoveTo (x, y);
break;
case PathIterator.SEG_LINETO:
- setPos(coords[0], coords[1]);
- cairoLineTo (coords[0], coords[1]);
+ x = shifted(coords[0], doShift);
+ y = shifted(coords[1], doShift);
+ cairoLineTo (x, y);
break;
case PathIterator.SEG_QUADTO:
@@ -338,23 +398,25 @@ public class GdkGraphics2D extends Graphics2D
// splitting a quadratic bezier into a cubic:
// see: http://pfaedit.sourceforge.net/bezier.html
- double x1 = x + (2.0/3.0) * (coords[0] - x);
- double y1 = y + (2.0/3.0) * (coords[1] - y);
+ 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) * (coords[2] - x);
- double y2 = y1 + (1.0/3.0) * (coords[3] - 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);
- setPos(coords[2], coords[3]);
+ x = shifted(coords[2], doShift);
+ y = shifted(coords[3], doShift);
cairoCurveTo (x1, y1,
x2, y2,
- coords[2], coords[3]);
+ x, y);
break;
case PathIterator.SEG_CUBICTO:
- setPos(coords[4], coords[5]);
- cairoCurveTo (coords[0], coords[1],
- coords[2], coords[3],
- coords[4], coords[5]);
+ 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:
@@ -365,7 +427,7 @@ public class GdkGraphics2D extends Graphics2D
}
- private Map getDefaultHints()
+ private final Map getDefaultHints()
{
HashMap defaultHints = new HashMap ();
@@ -388,23 +450,19 @@ public class GdkGraphics2D extends Graphics2D
}
- private void updateBufferedImage()
+ private final void updateBufferedImage()
{
int[] pixels = getImagePixels();
updateImagePixels(pixels);
}
- private boolean isBufferedImageGraphics ()
+ private final boolean isBufferedImageGraphics ()
{
-
- if (bimage != null)
- return true;
- else
- return false;
+ return bimage != null;
}
- private void updateImagePixels (int[] pixels)
+ private final void updateImagePixels (int[] pixels)
{
// This function can only be used if
@@ -439,11 +497,15 @@ public class GdkGraphics2D extends Graphics2D
}
- private boolean drawImage(Image img,
- AffineTransform xform,
- Color bgcolor,
- ImageObserver obs)
+ 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
@@ -461,8 +523,8 @@ public class GdkGraphics2D extends Graphics2D
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
@@ -475,23 +537,22 @@ public class GdkGraphics2D extends Graphics2D
try
{
- invertedXform = xform.createInverse();
+ 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);
+ BufferedImage b = (BufferedImage) img;
+ return drawRaster (b.getColorModel (),
+ b.getData (),
+ invertedXform,
+ bgcolor);
}
else
{
- // begin progressive loading in a separate thread
- new PainterThread (this, img, invertedXform, bgcolor);
- return false;
+ return this.drawImage(GdkPixbufDecoder.createBufferedImage(img.getSource()),
+ xform, bgcolor,obs);
}
}
catch (NoninvertibleTransformException e)
@@ -517,38 +578,25 @@ public class GdkGraphics2D extends Graphics2D
return;
}
- stateSave ();
cairoNewPath ();
-
- boolean normalize;
- normalize = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE)
- || hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT);
-
- if (normalize)
- translate (0.5,0.5);
if (s instanceof Rectangle2D)
{
Rectangle2D r = (Rectangle2D)s;
- cairoRectangle (r.getX (), r.getY (), r.getWidth (), r.getHeight ());
+ cairoRectangle (shifted(r.getX (), shiftDrawCalls),
+ shifted(r.getY (), shiftDrawCalls),
+ r.getWidth (), r.getHeight ());
}
else
- walkPath (s.getPathIterator (null));
+ walkPath (s.getPathIterator (null), shiftDrawCalls);
cairoStroke ();
- if (normalize)
- translate (-0.5,-0.5);
-
- stateRestore ();
-
if (isBufferedImageGraphics ())
updateBufferedImage();
-
}
public void fill (Shape s)
{
- stateSave();
cairoNewPath ();
if (s instanceof Rectangle2D)
{
@@ -556,9 +604,8 @@ public class GdkGraphics2D extends Graphics2D
cairoRectangle (r.getX (), r.getY (), r.getWidth (), r.getHeight ());
}
else
- walkPath (s.getPathIterator (null));
+ walkPath (s.getPathIterator (null), false);
cairoFill ();
- stateRestore ();
if (isBufferedImageGraphics ())
updateBufferedImage();
@@ -592,8 +639,8 @@ public class GdkGraphics2D extends Graphics2D
r.getWidth (), r.getHeight ());
}
else
- walkPath (clip.getPathIterator (null));
- cairoClosePath ();
+ walkPath (clip.getPathIterator (null), false);
+ // cairoClosePath ();
cairoClip ();
}
}
@@ -739,7 +786,7 @@ public class GdkGraphics2D extends Graphics2D
{
BasicStroke bs = (BasicStroke) stroke;
cairoSetLineCap (bs.getEndCap());
- cairoSetLineWidth (bs.getLineWidth() / 2.0);
+ cairoSetLineWidth (bs.getLineWidth());
cairoSetLineJoin (bs.getLineJoin());
cairoSetMiterLimit (bs.getMiterLimit());
float dashes[] = bs.getDashArray();
@@ -771,6 +818,9 @@ public class GdkGraphics2D extends Graphics2D
public void setColor (Color c)
{
+ if (c == null)
+ c = Color.BLACK;
+
fg = c;
paint = c;
cairoSetRGBColor (fg.getRed() / 255.0,
@@ -802,23 +852,23 @@ public class GdkGraphics2D extends Graphics2D
return clip.getBounds ();
}
- protected Rectangle2D getClipInDevSpace ()
- {
- 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 ());
- }
- }
+ protected Rectangle2D getClipInDevSpace ()
+ {
+ 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 ());
+ }
+ }
public void setClip (int x, int y, int width, int height)
{
@@ -839,96 +889,34 @@ public class GdkGraphics2D extends Graphics2D
r.getWidth (), r.getHeight ());
}
else
- walkPath (s.getPathIterator (null));
- cairoClosePath ();
+ 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)
{
- Color std = fg;
- Color light = std.brighter();
- Color dark = std.darker();
-
- if (!raised)
- {
- Color t = light;
- light = dark;
- dark = t;
- }
-
- double x1 = (double) x;
- double x2 = (double) x + width;
-
- double y1 = (double) y;
- double y2 = (double) y + height;
-
- stateSave ();
-
- cairoNewPath ();
-
- boolean normalize;
- normalize = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE)
- || hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT);
-
- if (normalize)
- {
- x1 += 0.5;
- y1 += 0.5;
- x2 += 0.5;
- y2 += 0.5;
- }
-
- setColor (light);
- cairoMoveTo (x1, y1);
- cairoLineTo (x2, y1);
- cairoLineTo (x2, y2);
- cairoStroke ();
-
- cairoNewPath ();
- setColor (dark);
- cairoMoveTo (x1, y1);
- cairoLineTo (x1, y2);
- cairoLineTo (x2, y2);
- cairoStroke ();
-
- stateRestore ();
-
+ Stroke tmp = stroke;
+ setStroke(draw3DRectStroke);
+ super.draw3DRect(x, y, width, height, raised);
+ setStroke(tmp);
if (isBufferedImageGraphics ())
updateBufferedImage();
-
}
public void fill3DRect(int x, int y, int width,
int height, boolean raised)
{
- double step = 1.0;
- if (stroke != null && stroke instanceof BasicStroke)
- {
- BasicStroke bs = (BasicStroke) stroke;
- step = bs.getLineWidth();
- }
-
- Color bright = fg.brighter ();
- Color dark = fg.darker ();
-
- draw3DRect (x, y, width, height, raised);
-
- stateSave ();
- translate (step/2.0, step/2.0);
- cairoNewPath ();
- cairoRectangle ((double) x, (double) y,
- ((double) width) - step,
- ((double) height) - step );
- cairoClosePath ();
- cairoFill ();
- stateRestore ();
-
+ Stroke tmp = stroke;
+ setStroke(draw3DRectStroke);
+ super.fill3DRect(x, y, width, height, raised);
+ setStroke(tmp);
if (isBufferedImageGraphics ())
updateBufferedImage();
-
}
@@ -939,21 +927,21 @@ public class GdkGraphics2D extends Graphics2D
public void fillRect (int x, int y, int width, int height)
{
- fill(new Rectangle (x, y, width, height));
+ cairoNewPath ();
+ cairoRectangle (x, y, width, height);
+ cairoFill ();
}
public void clearRect (int x, int y, int width, int height)
{
- stateSave ();
cairoSetRGBColor (bg.getRed() / 255.0,
bg.getGreen() / 255.0,
bg.getBlue() / 255.0);
cairoSetAlpha (1.0);
cairoNewPath ();
cairoRectangle (x, y, width, height);
- cairoClosePath ();
cairoFill ();
- stateRestore ();
+ setColor (fg);
if (isBufferedImageGraphics ())
updateBufferedImage();
@@ -970,8 +958,8 @@ public class GdkGraphics2D extends Graphics2D
return bg;
}
- private void doPolygon(int[] xPoints, int[] yPoints, int nPoints,
- boolean close, boolean fill)
+ private final void doPolygon(int[] xPoints, int[] yPoints, int nPoints,
+ boolean close, boolean fill)
{
if (nPoints < 1)
return;
@@ -1026,9 +1014,9 @@ public class GdkGraphics2D extends Graphics2D
doPolygon (xPoints, yPoints, nPoints, false, false);
}
- private 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;
@@ -1087,10 +1075,7 @@ public class GdkGraphics2D extends Graphics2D
}
}
- stateSave ();
- translate (x, y);
drawPixels (pixels, r.getWidth (), r.getHeight (), r.getWidth (), i2u);
- stateRestore ();
if (isBufferedImageGraphics ())
updateBufferedImage();
@@ -1133,113 +1118,6 @@ public class GdkGraphics2D extends Graphics2D
}
- ////////////////////////////////////////
- ////// Supporting Private Classes //////
- ////////////////////////////////////////
-
- private class PainterThread implements Runnable, ImageConsumer
- {
-
- // this is a helper which is spun off when someone tries to do
- // Graphics2D.drawImage on an image we cannot determine to be either
- // one of our own offscreen images or a BufferedImage; that is, when
- // someone wants to draw an image which is possibly still loading over
- // a network or something. you run it in a separate thread and it
- // writes through to the underlying Graphics2D as pixels becomg
- // available.
-
- GdkGraphics2D gr;
- Image image;
- ColorModel defaultModel;
- AffineTransform xform;
- Color bgcolor;
-
- public PainterThread (GdkGraphics2D g, Image im,
- AffineTransform xf, Color bg)
- {
- image = im;
- xform = xf;
- bgcolor = bg;
- this.gr = (GdkGraphics2D) g.create ();
- new Thread (this).start ();
- }
-
- public void imageComplete (int status)
- {
- }
-
- public void setColorModel (ColorModel model)
- {
- defaultModel = model;
- }
-
- public void setDimensions (int width, int height)
- {
- }
-
- public void setHints (int hintflags)
- {
- }
-
- public void setPixels (int x, int y, int w, int h, ColorModel model,
- byte[] pixels, int off, int scansize)
- {
- }
-
- public void setPixels (int x, int y, int w, int h, ColorModel model,
- int[] pixels, int off, int scansize)
- {
- gr.stateSave ();
- gr.translate (x, y);
-
- 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;
-
- // change all transparent pixels in the image to the
- // specified bgcolor
-
- if (bgcolor != null)
- {
- for (int i = 0; i < pixels2.length; i++)
- {
- if (model.getAlpha (pixels2[i]) == 0)
- pixels2[i] = bgcolor.getRGB ();
- }
- }
-
- double[] xf = new double[6];
- xform.getMatrix(xf);
- gr.drawPixels (pixels2, w, h, scansize, xf);
- gr.stateRestore ();
- }
-
- public void setProperties (java.util.Hashtable props)
- {
- }
-
- public void run ()
- {
- image.getSource ().startProduction (this);
- gr.dispose ();
- }
- }
-
-
-
///////////////////////////////////////////////
////// Unimplemented Stubs and Overloads //////
///////////////////////////////////////////////
@@ -1259,6 +1137,8 @@ public class GdkGraphics2D extends Graphics2D
public void setComposite(Composite comp)
{
+ this.comp = comp;
+
if (comp instanceof AlphaComposite)
{
AlphaComposite a = (AlphaComposite) comp;
@@ -1297,8 +1177,11 @@ public class GdkGraphics2D extends Graphics2D
else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
cairoSurfaceSetFilter(4);
- }
+ }
+ shiftDrawCalls = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE)
+ || hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT);
+
}
public Object getRenderingHint(RenderingHints.Key hintKey)
@@ -1331,6 +1214,9 @@ public class GdkGraphics2D extends Graphics2D
else if(hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
cairoSurfaceSetFilter(4);
}
+
+ shiftDrawCalls = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE)
+ || hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT);
}
public void addRenderingHints(Map hints)
@@ -1345,7 +1231,10 @@ public class GdkGraphics2D extends Graphics2D
public Composite getComposite()
{
- throw new java.lang.UnsupportedOperationException ();
+ if (comp == null)
+ return AlphaComposite.SrcOver;
+ else
+ return comp;
}
public FontRenderContext getFontRenderContext ()
@@ -1353,23 +1242,6 @@ public class GdkGraphics2D extends Graphics2D
return new FontRenderContext (transform, true, true);
}
- public void drawGlyphVector (GlyphVector g, float x, float y)
- {
- stateSave ();
- setFont (g.getFont ());
- translate ((double)x, (double)y);
- cairoMoveTo (0, 0);
- int nglyphs = g.getNumGlyphs ();
- int codes[] = g.getGlyphCodes (0, nglyphs, (int []) null);
- float posns[] = g.getGlyphPositions (0, nglyphs, (float []) null);
- cairoShowGlyphs (codes, posns);
-
- if (isBufferedImageGraphics ())
- updateBufferedImage();
-
- stateRestore ();
- }
-
public void copyArea (int x, int y, int width, int height, int dx, int dy)
{
throw new java.lang.UnsupportedOperationException ();
@@ -1418,6 +1290,9 @@ public class GdkGraphics2D extends Graphics2D
Color bgcolor, ImageObserver observer)
{
+ if (img == null)
+ return false;
+
Image subImage;
int sourceWidth = sx2 - sx1;
@@ -1501,15 +1376,40 @@ public class GdkGraphics2D extends Graphics2D
drawLine (x1, y + height, x2, y + height);
}
- public void drawString (String str, int x, int y)
+ // 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);
+
+ GdkFontPeer getFontPeer()
{
- drawString (str, (float)x, (float)y);
+ return (GdkFontPeer) getFont().getPeer();
+ }
+
+ public void drawGdkGlyphVector(GdkGlyphVector gv, float x, float y)
+ {
+ cairoDrawGdkGlyphVector(getFontPeer(), gv, x, y);
+ if (isBufferedImageGraphics ())
+ updateBufferedImage();
+ }
+
+ public void drawGdkTextLayout(GdkTextLayout gl, float x, float y)
+ {
+ cairoDrawGdkTextLayout(getFontPeer(), gl, x, y);
+ if (isBufferedImageGraphics ())
+ updateBufferedImage();
}
public void drawString (String str, float x, float y)
{
- GlyphVector gv = font.createGlyphVector (getFontRenderContext(), str);
- drawGlyphVector (gv, x, y);
+ cairoDrawString(getFontPeer(), str, x, y);
+ if (isBufferedImageGraphics ())
+ updateBufferedImage();
+ }
+
+ public void drawString (String str, int x, int y)
+ {
+ drawString (str, (float)x, (float)y);
}
public void drawString (AttributedCharacterIterator ci, int x, int y)
@@ -1517,6 +1417,14 @@ public class GdkGraphics2D extends Graphics2D
drawString (ci, (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 ();
+ }
+
public void drawString (AttributedCharacterIterator ci, float x, float y)
{
GlyphVector gv = font.createGlyphVector (getFontRenderContext(), ci);
@@ -1562,30 +1470,38 @@ public class GdkGraphics2D extends Graphics2D
return font;
}
+ // Until such time as pango is happy to talk directly to cairo, we
+ // actually need to redirect some calls from the GtkFontPeer and
+ // 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 ()
{
+ // 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);
}
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);
}
public void setFont (Font f)
{
- if (f.getPeer() instanceof GdkClasspathFontPeer)
+ if (f.getPeer() instanceof GdkFontPeer)
font = f;
else
font =
((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
- .getFont (f.getName(), f.getAttributes ());
-
- if (f != null &&
- f.getPeer() instanceof GdkClasspathFontPeer)
- cairoSetFont ((GdkClasspathFontPeer) f.getPeer());
+ .getFont (f.getName(), f.getAttributes ());
}
-
+
public String toString()
{
return getClass ().getName () +
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
index dbcd2d1..45e0c21 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
@@ -38,18 +38,20 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
-import java.awt.*;
+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.image.BufferedImage;
import java.util.Locale;
-
public class GdkGraphicsEnvironment extends GraphicsEnvironment
{
-
public GdkGraphicsEnvironment ()
{
- super();
+ super();
}
public GraphicsDevice[] getScreenDevices ()
@@ -66,22 +68,28 @@ public class GdkGraphicsEnvironment extends GraphicsEnvironment
{
return new GdkGraphics2D (image);
}
+ native private int nativeGetNumFontFamilies ();
+ native private void nativeGetFontFamilies (String[] family_names);
public Font[] getAllFonts ()
{
throw new java.lang.UnsupportedOperationException ();
}
- public String[] getAvailableFontFamilyNames ()
- {
- throw new java.lang.UnsupportedOperationException ();
- }
+ public String[] getAvailableFontFamilyNames ()
+ {
+ String[] family_names;
+ int array_size;
+
+ array_size = nativeGetNumFontFamilies();
+ family_names = new String[array_size];
+
+ nativeGetFontFamilies(family_names);
+ return family_names;
+ }
public String[] getAvailableFontFamilyNames (Locale l)
{
throw new java.lang.UnsupportedOperationException ();
}
-
-
-} // class GdkGraphicsEnvironment
-
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
index 5c7fd96..a7b93e5 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
@@ -1,52 +1,57 @@
/* GdkPixbufDecoder.java -- Image data decoding object
- Copyright (C) 2003 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. */
+ 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. */
package gnu.java.awt.peer.gtk;
-import java.awt.image.*;
+import gnu.classpath.Configuration;
+
+import java.awt.image.BufferedImage;
+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.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
-import java.util.Vector;
import java.util.Hashtable;
-import gnu.classpath.Configuration;
+import java.util.Vector;
public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java b/libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java
new file mode 100644
index 0000000..26cfc16
--- /dev/null
+++ b/libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java
@@ -0,0 +1,435 @@
+/* GdkTextLayout.java
+ Copyright (C) 2003 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.Font;
+import java.awt.Graphics2D;
+import java.awt.Shape;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphMetrics;
+import java.awt.font.GlyphVector;
+import java.awt.font.TextHitInfo;
+import java.awt.font.TextLayout;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+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;
+import gnu.java.awt.peer.ClasspathTextLayoutPeer;
+
+/**
+ * This is an implementation of the text layout peer interface which
+ * delegates all the hard work to pango.
+ *
+ * @author Graydon Hoare
+ */
+
+public class GdkTextLayout
+ implements ClasspathTextLayoutPeer
+{
+ // native side, plumbing, etc.
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
+ initStaticState ();
+ }
+ private native void setText(String str);
+ private native void getExtents(double[] inkExtents,
+ double[] logExtents);
+ private native void indexToPos(int idx, double[] pos);
+ private native void initState ();
+ private native void dispose ();
+ native static void initStaticState ();
+ private final int native_state = GtkGenericPeer.getUniqueInteger ();
+ protected void finalize ()
+ {
+ dispose ();
+ }
+
+ // we hold on to these to make sure we can render when presented
+ // with non-GdkGraphics2D paint targets
+ private AttributedString attributedString;
+ private FontRenderContext fontRenderContext;
+
+ public GdkTextLayout(AttributedString str, FontRenderContext frc)
+ {
+ initState();
+ attributedString = str;
+ fontRenderContext = frc;
+ }
+
+ protected class CharacterIteratorProxy
+ implements CharacterIterator
+ {
+ public CharacterIterator target;
+ public int begin;
+ public int limit;
+ public int index;
+
+ public CharacterIteratorProxy (CharacterIterator ci)
+ {
+ target = ci;
+ }
+
+ public int getBeginIndex ()
+ {
+ return begin;
+ }
+
+ public int getEndIndex ()
+ {
+ return limit;
+ }
+
+ public int getIndex ()
+ {
+ return index;
+ }
+
+ public char setIndex (int idx)
+ throws IllegalArgumentException
+ {
+ if (idx < begin || idx >= limit)
+ throw new IllegalArgumentException ();
+ char ch = target.setIndex (idx);
+ index = idx;
+ return ch;
+ }
+
+ public char first ()
+ {
+ int save = target.getIndex ();
+ char ch = target.setIndex (begin);
+ target.setIndex (save);
+ return ch;
+ }
+
+ public char last ()
+ {
+ if (begin == limit)
+ return this.first ();
+
+ int save = target.getIndex ();
+ char ch = target.setIndex (limit - 1);
+ target.setIndex (save);
+ return ch;
+ }
+
+ public char current ()
+ {
+ return target.current();
+ }
+
+ public char next ()
+ {
+ if (index >= limit - 1)
+ return CharacterIterator.DONE;
+ else
+ {
+ index++;
+ return target.next();
+ }
+ }
+
+ public char previous ()
+ {
+ if (index <= begin)
+ return CharacterIterator.DONE;
+ else
+ {
+ index--;
+ return target.previous ();
+ }
+ }
+
+ public Object clone ()
+ {
+ CharacterIteratorProxy cip = new CharacterIteratorProxy (this.target);
+ cip.begin = this.begin;
+ cip.limit = this.limit;
+ cip.index = this.index;
+ return cip;
+ }
+
+ }
+
+
+ // public side
+
+ public void draw (Graphics2D g2, float x, float y)
+ {
+ if (g2 instanceof GdkGraphics2D)
+ {
+ // we share pango structures directly with GdkGraphics2D
+ // when legal
+ GdkGraphics2D gg2 = (GdkGraphics2D) g2;
+ gg2.drawGdkTextLayout(this, x, y);
+ }
+ else
+ {
+ // falling back to a rather tedious layout algorithm when
+ // not legal
+ AttributedCharacterIterator ci = attributedString.getIterator ();
+ CharacterIteratorProxy proxy = new CharacterIteratorProxy (ci);
+ Font defFont = g2.getFont ();
+
+ /* Note: this implementation currently only interprets FONT text
+ * attributes. There is a reasonable argument to be made for some
+ * attributes being interpreted out here, where we have control of the
+ * Graphics2D and can construct or derive new fonts, and some
+ * attributes being interpreted by the GlyphVector itself. So far, for
+ * all attributes except FONT we do neither.
+ */
+
+ for (char c = ci.first ();
+ c != CharacterIterator.DONE;
+ c = ci.next ())
+ {
+ proxy.begin = ci.getIndex ();
+ proxy.limit = ci.getRunLimit(TextAttribute.FONT);
+ if (proxy.limit <= proxy.begin)
+ continue;
+
+ proxy.index = proxy.begin;
+
+ Object fnt = ci.getAttribute(TextAttribute.FONT);
+ GlyphVector gv;
+ if (fnt instanceof Font)
+ gv = ((Font)fnt).createGlyphVector (fontRenderContext, proxy);
+ else
+ gv = defFont.createGlyphVector (fontRenderContext, proxy);
+
+ g2.drawGlyphVector (gv, x, y);
+
+ int n = gv.getNumGlyphs ();
+ for (int i = 0; i < n; ++i)
+ {
+ GlyphMetrics gm = gv.getGlyphMetrics (i);
+ if (gm.getAdvanceX() == gm.getAdvance ())
+ x += gm.getAdvanceX ();
+ else
+ y += gm.getAdvanceY ();
+ }
+ }
+ }
+ }
+
+ public TextHitInfo getStrongCaret (TextHitInfo hit1,
+ TextHitInfo hit2)
+ {
+ throw new Error("not implemented");
+ }
+
+ public byte getBaseline ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean isLeftToRight ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean isVertical ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public float getAdvance ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public float getAscent ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public float getDescent ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public float getLeading ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getCharacterCount ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public byte getCharacterLevel (int index)
+ {
+ throw new Error("not implemented");
+ }
+
+ public float[] getBaselineOffsets ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Rectangle2D getBounds ()
+ {
+ double[] inkExtents = new double[4];
+ double[] logExtents = new double[4];
+ getExtents(inkExtents, logExtents);
+ return new Rectangle2D.Double(logExtents[0], logExtents[1],
+ logExtents[2], logExtents[3]);
+ }
+
+ public float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Shape[] getCaretShapes (int offset, Rectangle2D bounds,
+ TextLayout.CaretPolicy policy)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
+ Rectangle2D bounds)
+ {
+ AffineTransform at = new AffineTransform();
+ GeneralPath gp = new GeneralPath();
+ double [] rect = new double[4];
+ Rectangle2D tmp = new Rectangle2D.Double();
+ for (int i = firstEndpoint; i <= secondEndpoint; ++i)
+ {
+ indexToPos(i, rect);
+ tmp.setRect(rect[0], rect[1], rect[2], rect[3]);
+ Rectangle2D.intersect(tmp, bounds, tmp);
+ gp.append(tmp.getPathIterator(at), false);
+ }
+ return gp;
+ }
+
+ public int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
+ TextHitInfo secondEndpoint)
+ {
+ throw new Error("not implemented");
+ }
+
+ public TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy)
+ {
+ throw new Error("not implemented");
+ }
+ public TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy)
+ {
+ throw new Error("not implemented");
+ }
+ public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
+ {
+ throw new Error("not implemented");
+ }
+ public TextHitInfo getVisualOtherHit (TextHitInfo hit)
+ {
+ throw new Error("not implemented");
+ }
+
+ public float getVisibleAdvance ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Shape getOutline (AffineTransform tx)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
+ TextHitInfo secondEndpoint,
+ Rectangle2D bounds)
+ {
+ throw new Error("not implemented");
+ }
+
+
+ public TextLayout getJustifiedLayout (float justificationWidth)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void handleJustify (float justificationWidth)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Object clone ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int hashCode ()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean equals (ClasspathTextLayoutPeer tl)
+ {
+ throw new Error("not implemented");
+ }
+
+ public String toString ()
+ {
+ throw new Error("not implemented");
+ }
+
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
index db8aed6..9fba828 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
@@ -1,5 +1,5 @@
/* GtkButtonPeer.java -- Implements ButtonPeer with GTK
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,8 +43,8 @@ import java.awt.Button;
import java.awt.Component;
import java.awt.Font;
import java.awt.Point;
-import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.awt.peer.ButtonPeer;
public class GtkButtonPeer extends GtkComponentPeer
@@ -52,13 +52,15 @@ public class GtkButtonPeer extends GtkComponentPeer
{
native void create (String label);
- public native void connectJObject ();
public native void connectSignals ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkSetLabel (String label);
native void gtkWidgetSetForeground (int red, int green, int blue);
+ native void gtkWidgetSetBackground (int red, int green, int blue);
native void gtkActivate ();
+ native void gtkWidgetRequestFocus ();
+ native void setNativeBounds (int x, int y, int width, int height);
public GtkButtonPeer (Button b)
{
@@ -86,8 +88,8 @@ public class GtkButtonPeer extends GtkComponentPeer
if (!me.isConsumed ()
&& (me.getModifiersEx () & MouseEvent.BUTTON1_DOWN_MASK) != 0
&& awtComponent.getBounds().contains(p))
- postActionEvent (((Button)awtComponent).getActionCommand (),
- me.getModifiersEx ());
+ postActionEvent (((Button) awtComponent).getActionCommand (),
+ me.getModifiersEx ());
}
if (e.getID () == KeyEvent.KEY_PRESSED)
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
index 361136f..a6fd1ba 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
@@ -55,7 +55,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer
public native void create (GtkCheckboxGroupPeer group);
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
public native void connectSignals ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkButtonSetLabel (String label);
native void gtkToggleButtonSetActive (boolean is_active);
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
index 2ecea5c..0546414 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
@@ -59,6 +59,10 @@ public class GtkChoicePeer extends GtkComponentPeer
append (items);
}
+
+ int selected = c.getSelectedIndex();
+ if (selected >= 0)
+ select(selected);
}
native void create ();
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java b/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
index 86678f8..ecc4c5c 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
@@ -43,9 +43,9 @@ import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.IOException;
public class GtkClipboard extends Clipboard
{
@@ -60,15 +60,13 @@ public class GtkClipboard extends Clipboard
static boolean hasSelection = false;
- protected
- GtkClipboard ()
+ protected GtkClipboard()
{
- super ("System Clipboard");
- initNativeState ();
+ super("System Clipboard");
+ initNativeState();
}
- public Transferable
- getContents (Object requestor)
+ public Transferable getContents(Object requestor)
{
synchronized (this)
{
@@ -77,72 +75,76 @@ public class GtkClipboard extends Clipboard
}
/* Java doesn't own the selection, so we need to ask X11 */
+ // XXX: Does this hold with Swing too ?
synchronized (selectionLock)
{
- requestStringConversion ();
+ requestStringConversion();
+
try
{
- selectionLock.wait (SELECTION_RECEIVED_TIMEOUT);
+ selectionLock.wait(SELECTION_RECEIVED_TIMEOUT);
}
catch (InterruptedException e)
{
return null;
}
- return (selection == null) ? null : new StringSelection (selection);
+ return selection == null ? null : new StringSelection(selection);
}
}
- void
- stringSelectionReceived (String newSelection)
+ void stringSelectionReceived(String newSelection)
{
synchronized (selectionLock)
{
selection = newSelection;
- selectionLock.notify ();
+ selectionLock.notify();
}
}
/* convert Java clipboard data into a String suitable for sending
to another application */
- synchronized String
- stringSelectionHandler () throws IOException
+ synchronized String stringSelectionHandler() throws IOException
{
String selection = null;
- try {
- if (contents.isDataFlavorSupported (DataFlavor.stringFlavor))
- selection = (String)contents.getTransferData (DataFlavor.stringFlavor);
- else if (contents.isDataFlavorSupported (DataFlavor.plainTextFlavor))
- {
- StringBuffer sbuf = new StringBuffer ();
- InputStreamReader reader;
- char readBuf[] = new char[512];
- int numChars;
+ try
+ {
+ if (contents.isDataFlavorSupported(DataFlavor.stringFlavor))
+ selection = (String)contents.getTransferData(DataFlavor.stringFlavor);
+ else if (contents.isDataFlavorSupported(DataFlavor.plainTextFlavor))
+ {
+ StringBuffer sbuf = new StringBuffer();
+ InputStreamReader reader;
+ char readBuf[] = new char[512];
+ int numChars;
- reader = new InputStreamReader
- ((InputStream)
- contents.getTransferData (DataFlavor.plainTextFlavor), "UNICODE");
+ reader = new InputStreamReader
+ ((InputStream)
+ contents.getTransferData(DataFlavor.plainTextFlavor), "UNICODE");
- while (true)
- {
- numChars = reader.read (readBuf);
- if (numChars == -1)
- break;
- sbuf.append (readBuf, 0, numChars);
- }
+ while (true)
+ {
+ numChars = reader.read(readBuf);
+ if (numChars == -1)
+ break;
+ sbuf.append(readBuf, 0, numChars);
+ }
- selection = new String (sbuf);
- }
- } catch (Exception e) { }
+ selection = new String(sbuf);
+ }
+ }
+ catch (Exception e)
+ {
+ }
return selection;
}
- public synchronized void
- setContents (Transferable contents, ClipboardOwner owner)
+ public synchronized void setContents(Transferable contents,
+ ClipboardOwner owner)
{
- selectionGet ();
+ selectionGet();
this.contents = contents;
this.owner = owner;
@@ -150,20 +152,19 @@ public class GtkClipboard extends Clipboard
hasSelection = true;
}
- synchronized
- void selectionClear ()
+ synchronized void selectionClear()
{
hasSelection = false;
if (owner != null)
{
- owner.lostOwnership (this, contents);
+ owner.lostOwnership(this, contents);
owner = null;
contents = null;
}
}
- native void initNativeState ();
- native static void requestStringConversion ();
- native static void selectionGet ();
+ native void initNativeState();
+ native static void requestStringConversion();
+ native static void selectionGet();
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index eae5a94..31d59ce 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -77,6 +77,8 @@ public class GtkComponentPeer extends GtkGenericPeer
Insets insets;
+ boolean isInRepaint;
+
/* this isEnabled differs from Component.isEnabled, in that it
knows if a parent is disabled. In that case Component.isEnabled
may return true, but our isEnabled will always return false */
@@ -85,7 +87,6 @@ public class GtkComponentPeer extends GtkGenericPeer
native int[] gtkWidgetGetForeground ();
native int[] gtkWidgetGetBackground ();
- native void gtkWidgetSetVisible (boolean b);
native void gtkWidgetGetDimensions (int[] dim);
native void gtkWidgetGetPreferredDimensions (int[] dim);
native void gtkWidgetGetLocationOnScreen (int[] point);
@@ -97,17 +98,14 @@ public class GtkComponentPeer extends GtkGenericPeer
native void gtkWidgetRequestFocus ();
native void gtkWidgetDispatchKeyEvent (int id, long when, int mods,
int keyCode, int keyLocation);
- native void gtkSetFont (String name, int style, int size);
- native void gtkWidgetQueueDrawArea(int x, int y, int width, int height);
- native void addExposeFilter();
- native void removeExposeFilter();
+
+ native boolean isRealized ();
void create ()
{
throw new RuntimeException ();
}
- native void connectJObject ();
native void connectSignals ();
protected GtkComponentPeer (Component awtComponent)
@@ -118,9 +116,6 @@ public class GtkComponentPeer extends GtkGenericPeer
create ();
- setParent ();
-
- connectJObject ();
connectSignals ();
if (awtComponent.getForeground () != null)
@@ -130,12 +125,22 @@ public class GtkComponentPeer extends GtkGenericPeer
if (awtComponent.getFont() != null)
setFont(awtComponent.getFont());
- setCursor (awtComponent.getCursor ());
+ Component parent = awtComponent.getParent ();
+
+ // Only set our parent on the GTK side if our parent on the AWT
+ // side is not showing. Otherwise the gtk peer will be shown
+ // before we've had a chance to position and size it properly.
+ if (awtComponent instanceof Window
+ || (parent != null && ! parent.isShowing ()))
+ setParentAndBounds ();
+ }
+
+ void setParentAndBounds ()
+ {
+ setParent ();
setComponentBounds ();
- Rectangle bounds = awtComponent.getBounds ();
- setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
setVisibleAndEnabled ();
}
@@ -154,15 +159,32 @@ public class GtkComponentPeer extends GtkGenericPeer
gtkWidgetSetParent (p);
}
+ void beginNativeRepaint ()
+ {
+ isInRepaint = true;
+ }
+
+ void endNativeRepaint ()
+ {
+ isInRepaint = false;
+ }
+
/*
* Set the bounds of this peer's AWT Component based on dimensions
* returned by the native windowing system. Most Components impose
- * their dimensions on the peers so the default implementation does
- * nothing. However some peers, like GtkFileDialogPeer, need to
- * pass their size back to the AWT Component.
+ * their dimensions on the peers which is what the default
+ * implementation does. However some peers, like GtkFileDialogPeer,
+ * need to pass their size back to the AWT Component.
*/
void setComponentBounds ()
{
+ Rectangle bounds = awtComponent.getBounds ();
+
+ if (bounds.x == 0 && bounds.y == 0
+ && bounds.width == 0 && bounds.height == 0)
+ return;
+
+ setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
}
void setVisibleAndEnabled ()
@@ -180,7 +202,9 @@ public class GtkComponentPeer extends GtkGenericPeer
public Image createImage (ImageProducer producer)
{
- return new GtkImage (producer, null);
+ GtkImage image = new GtkImage (producer, null);
+ producer.startProduction (image);
+ return image;
}
public Image createImage (int width, int height)
@@ -195,6 +219,9 @@ public class GtkComponentPeer extends GtkGenericPeer
else
g = new GdkGraphics (width, height);
+ g.setColor(getBackground());
+ g.fillRect(0, 0, width, height);
+
return new GtkOffScreenImage (null, g, width, height);
}
@@ -215,7 +242,7 @@ public class GtkComponentPeer extends GtkGenericPeer
public FontMetrics getFontMetrics (Font font)
{
- return new GdkFontMetrics (font);
+ return getToolkit().getFontMetrics(font);
}
public Graphics getGraphics ()
@@ -265,8 +292,8 @@ public class GtkComponentPeer extends GtkGenericPeer
// Some peers like GtkFileDialogPeer are repainted by Gtk itself
if (g == null)
break;
-
- g.setClip (((PaintEvent)event).getUpdateRect());
+
+ g.setClip (((PaintEvent) event).getUpdateRect());
if (id == PaintEvent.PAINT)
awtComponent.paint (g);
@@ -310,21 +337,6 @@ public class GtkComponentPeer extends GtkGenericPeer
public void paint (Graphics g)
{
- Component parent = awtComponent.getParent();
- GtkComponentPeer parentPeer = null;
- if ((parent instanceof Container) && !parent.isLightweight())
- parentPeer = (GtkComponentPeer) parent.getPeer();
-
- addExposeFilter();
- if (parentPeer != null)
- parentPeer.addExposeFilter();
-
- Rectangle clip = g.getClipBounds();
- gtkWidgetQueueDrawArea(clip.x, clip.y, clip.width, clip.height);
-
- removeExposeFilter();
- if (parentPeer != null)
- parentPeer.removeExposeFilter();
}
public Dimension preferredSize ()
@@ -371,8 +383,11 @@ public class GtkComponentPeer extends GtkGenericPeer
public void repaint (long tm, int x, int y, int width, int height)
{
+ if (x == 0 && y == 0 && width == 0 && height == 0)
+ return;
+
q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
- new Rectangle (x, y, width, height)));
+ new Rectangle (x, y, width, height)));
}
public void requestFocus ()
@@ -391,7 +406,7 @@ public class GtkComponentPeer extends GtkGenericPeer
gtkWidgetSetBackground (c.getRed(), c.getGreen(), c.getBlue());
}
- native public void setNativeBounds (int x, int y, int width, int height);
+ native void setNativeBounds (int x, int y, int width, int height);
public void setBounds (int x, int y, int width, int height)
{
@@ -426,13 +441,24 @@ public class GtkComponentPeer extends GtkGenericPeer
if (parent instanceof Window && !lightweightChild)
{
Insets insets = ((Window) parent).getInsets ();
- // Convert from Java coordinates to GTK coordinates.
- setNativeBounds (x - insets.left, y - insets.top, width, height);
+ GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer ();
+ int menuBarHeight = 0;
+ if (peer instanceof GtkFramePeer)
+ menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight ();
+
+ // Convert from Java coordinates to GTK coordinates.
+ setNativeBounds (x - insets.left, y - insets.top + menuBarHeight,
+ width, height);
}
else
setNativeBounds (x, y, width, height);
}
+ void setCursor ()
+ {
+ setCursor (awtComponent.getCursor ());
+ }
+
public void setCursor (Cursor cursor)
{
gtkWidgetSetCursor (cursor.getType ());
@@ -448,7 +474,7 @@ public class GtkComponentPeer extends GtkGenericPeer
// FIXME: This should really affect the widget tree below me.
// Currently this is only handled if the call is made directly on
// a text widget, which implements setFont() itself.
- gtkSetFont(f.getName(), f.getStyle(), f.getSize());
+ gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
}
public void setForeground (Color c)
@@ -488,8 +514,9 @@ public class GtkComponentPeer extends GtkGenericPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
- q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x, y, width, height)));
+ if (!isInRepaint)
+ q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+ new Rectangle (x, y, width, height)));
}
protected void postKeyEvent (int id, long when, int mods,
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
index 0404997..7fddd56 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
@@ -45,13 +45,16 @@ import java.awt.Container;
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;
public class GtkContainerPeer extends GtkComponentPeer
implements ContainerPeer
{
Container c;
+ boolean isValidating;
public GtkContainerPeer(Container c)
{
@@ -59,22 +62,38 @@ public class GtkContainerPeer extends GtkComponentPeer
this.c = c;
}
- public void beginValidate()
+ public void beginValidate ()
{
+ isValidating = true;
}
- public void endValidate()
+ public void endValidate ()
{
-// q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
-// new Rectangle (x, y, width, height)));
-// Graphics gc = getGraphics ();
-// if (gc != null)
-// {
-// awtComponent.update (gc);
-// gc.dispose ();
-// }
-// System.out.println ("got here");
-// awtComponent.repaint ();
+ Component parent = awtComponent.getParent ();
+
+ // Only set our parent on the GTK side if our parent on the AWT
+ // side is not showing. Otherwise the gtk peer will be shown
+ // before we've had a chance to position and size it properly.
+ if (parent != null && parent.isShowing ())
+ {
+ Component[] components = ((Container) awtComponent).getComponents ();
+ int ncomponents = components.length;
+
+ for (int i = 0; i < ncomponents; i++)
+ {
+ ComponentPeer peer = components[i].getPeer ();
+
+ // Skip lightweight peers.
+ if (peer instanceof GtkComponentPeer)
+ ((GtkComponentPeer) peer).setParentAndBounds ();
+ }
+
+ // GTK windows don't have parents.
+ if (!(awtComponent instanceof Window))
+ setParentAndBounds ();
+ }
+
+ isValidating = false;
}
public Insets getInsets()
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
index 1d6ce8b..af22a27 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
@@ -42,9 +42,9 @@ import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Graphics;
-import java.awt.peer.DialogPeer;
import java.awt.Rectangle;
import java.awt.event.PaintEvent;
+import java.awt.peer.DialogPeer;
public class GtkDialogPeer extends GtkWindowPeer
implements DialogPeer
@@ -75,11 +75,12 @@ public class GtkDialogPeer extends GtkWindowPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
- q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x + insets.left,
- y + insets.top,
- width, height)));
- }
+ if (!isInRepaint)
+ q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+ new Rectangle (x + insets.left,
+ y + insets.top,
+ width, height)));
+ }
void create ()
{
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
index d31e0c5..1992556 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
@@ -45,8 +45,8 @@ import java.awt.Graphics;
import java.awt.Window;
import java.awt.event.WindowEvent;
import java.awt.peer.FileDialogPeer;
-import java.io.FilenameFilter;
import java.io.File;
+import java.io.FilenameFilter;
public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
{
@@ -57,7 +57,6 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
private FilenameFilter filter;
native void create (GtkContainerPeer parent);
- native void connectJObject ();
native void connectSignals ();
native void nativeSetFile (String file);
native public String nativeGetDirectory();
@@ -94,6 +93,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
awtComponent.getY (),
dims[0], dims[1]);
}
+ super.setComponentBounds ();
}
public void setFile (String fileName)
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
index 5de3301..605d738 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
@@ -1,5 +1,5 @@
/* GtkFontPeer.java -- Implements FontPeer with GTK+
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,20 +37,25 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+
+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.awt.peer.FontPeer;
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.font.*;
+import java.text.CharacterIterator;
import java.util.Locale;
-import java.util.ResourceBundle;
import java.util.MissingResourceException;
-import java.text.*;
-import gnu.java.awt.peer.ClasspathFontPeer;
+import java.util.ResourceBundle;
public class GtkFontPeer extends ClasspathFontPeer
{
private static ResourceBundle bundle;
-
+
static
{
try
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
index e1a877e..c0c1437 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -39,6 +39,7 @@ 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;
@@ -57,51 +58,72 @@ public class GtkFramePeer extends GtkWindowPeer
private int menuBarHeight;
private MenuBarPeer menuBar;
native int getMenuBarHeight (MenuBarPeer bar);
-
+ native void setMenuBarWidth (MenuBarPeer bar, int width);
native void setMenuBarPeer (MenuBarPeer bar);
native void removeMenuBarPeer ();
- native void moveLayout (int offset);
- native void gtkLayoutSetVisible (boolean vis);
+ native void gtkFixedSetVisible (boolean visible);
+
+ int getMenuBarHeight ()
+ {
+ return menuBar == null ? 0 : getMenuBarHeight (menuBar);
+ }
public void setMenuBar (MenuBar bar)
{
- if (bar == null)
- {
- if (menuBar != null)
+ if (bar == null && menuBar != null)
{
- gtkLayoutSetVisible(false);
- removeMenuBarPeer();
+ // We're removing the menubar.
+ gtkFixedSetVisible (false);
menuBar = null;
- moveLayout(menuBarHeight);
+ removeMenuBarPeer ();
insets.top -= menuBarHeight;
- menuBarHeight = 0;
- awtComponent.doLayout();
- gtkLayoutSetVisible(true);
+ menuBarHeight = 0;
+ awtComponent.validate ();
+ gtkFixedSetVisible (true);
}
- }
- else
- {
- gtkLayoutSetVisible(false);
- int oldHeight = 0;
- if (menuBar != null)
+ else if (bar != null && menuBar == null)
+ {
+ // We're adding a menubar where there was no menubar before.
+ gtkFixedSetVisible (false);
+ menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
+ setMenuBarPeer (menuBar);
+ int menuBarWidth =
+ awtComponent.getWidth () - insets.left - insets.right;
+ if (menuBarWidth > 0)
+ setMenuBarWidth (menuBar, menuBarWidth);
+ menuBarHeight = getMenuBarHeight ();
+ insets.top += menuBarHeight;
+ awtComponent.validate ();
+ gtkFixedSetVisible (true);
+ }
+ else if (bar != null && menuBar != null)
{
+ // We're swapping the menubar.
+ gtkFixedSetVisible (false);
removeMenuBarPeer();
- oldHeight = menuBarHeight;
- insets.top -= menuBarHeight;
+ int oldHeight = menuBarHeight;
+ int menuBarWidth =
+ awtComponent.getWidth () - insets.left - insets.right;
+ menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer ();
+ setMenuBarPeer (menuBar);
+ if (menuBarWidth > 0)
+ setMenuBarWidth (menuBar, menuBarWidth);
+ menuBarHeight = getMenuBarHeight ();
+ if (oldHeight != menuBarHeight)
+ {
+ insets.top += (menuBarHeight - oldHeight);
+ awtComponent.validate ();
+ }
+ gtkFixedSetVisible (true);
}
- menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
- setMenuBarPeer(menuBar);
- menuBarHeight = getMenuBarHeight (menuBar);
- if (oldHeight != menuBarHeight)
- moveLayout(oldHeight - menuBarHeight);
- insets.top += menuBarHeight;
- awtComponent.doLayout();
- gtkLayoutSetVisible(true);
- }
}
public void setBounds (int x, int y, int width, int height)
{
+ int menuBarWidth = width - insets.left - insets.right;
+ if (menuBar != null && menuBarWidth > 0)
+ setMenuBarWidth (menuBar, menuBarWidth);
+
nativeSetBounds (x, y,
width - insets.left - insets.right,
height - insets.top - insets.bottom
@@ -151,7 +173,7 @@ public class GtkFramePeer extends GtkWindowPeer
native void nativeSetIconImageFromData (int[] pixels, int width, int height);
public void setIconImage (Image image)
{
- if (image != null)
+ if (image != null && image instanceof GtkImage)
{
GtkImage img = (GtkImage) image;
// FIXME: Image should be loaded, but if not, do image loading here.
@@ -206,15 +228,20 @@ public class GtkFramePeer extends GtkWindowPeer
|| frame_width != awtComponent.getWidth()
|| frame_height != awtComponent.getHeight())
{
+ if (frame_width != awtComponent.getWidth() && menuBar != null
+ && width > 0)
+ setMenuBarWidth (menuBar, width);
+
setBoundsCallback ((Window) awtComponent,
frame_x,
frame_y,
frame_width,
frame_height);
}
+
awtComponent.validate();
}
-
+
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
{
@@ -225,10 +252,11 @@ public class GtkFramePeer extends GtkWindowPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
- q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x + insets.left,
- y + insets.top,
- width, height)));
+ if (!isInRepaint)
+ q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+ new Rectangle (x + insets.left,
+ y + insets.top,
+ width, height)));
}
public int getState ()
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
index f7a7b22..657e830 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
@@ -82,4 +82,6 @@ public class GtkGenericPeer
// Let's assume this will never wrap.
return next_native_state++;
}
+
+ native void gtkWidgetModifyFont (String name, int style, int size);
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImage.java b/libjava/gnu/java/awt/peer/gtk/GtkImage.java
index 9234d24..510646c 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkImage.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkImage.java
@@ -230,7 +230,7 @@ public class GtkImage extends Image implements ImageConsumer
int offset, int scansize)
{
setPixels (x, y, width, height, cm, convertPixels (pixels), offset,
- scansize);
+ scansize);
if (observer != null)
observer.imageUpdate (this,
@@ -255,7 +255,8 @@ public class GtkImage extends Image implements ImageConsumer
if (scansize == width && height == 1)
{
- System.arraycopy (pixels, offset,
+ // Copy contents of pixels array into pixel cache.
+ System.arraycopy (pixels, offset,
pixelCache, y * this.width + x,
pixels.length - offset);
}
@@ -274,7 +275,7 @@ public class GtkImage extends Image implements ImageConsumer
if (status == ImageConsumer.STATICIMAGEDONE && isCacheable)
isLoaded = true;
- if (status == ImageConsumer.SINGLEFRAMEDONE)
+ if (status == ImageConsumer.SINGLEFRAME)
isCacheable = false;
if (observer != null)
@@ -289,7 +290,7 @@ public class GtkImage extends Image implements ImageConsumer
-1, -1, -1, -1);
}
- if (source != null)
+ if (source != null && status != ImageConsumer.SINGLEFRAME)
source.removeConsumer (this);
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java b/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
index d15cb4a..1e5eb4f 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
@@ -42,6 +42,7 @@ import java.awt.Color;
import java.awt.Rectangle;
import java.awt.image.ColorModel;
import java.awt.image.ImageConsumer;
+import java.awt.image.ImageObserver;
import java.util.Hashtable;
public class GtkImagePainter implements Runnable, ImageConsumer
@@ -57,10 +58,11 @@ public class GtkImagePainter implements Runnable, ImageConsumer
boolean flipX, flipY;
Rectangle clip;
int s_width, s_height;
+ ImageObserver observer;
public
GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y,
- int width, int height, Color bgcolor)
+ int width, int height, Color bgcolor, ImageObserver o)
{
this.image = image;
this.gc = (GdkGraphics) gc.create ();
@@ -74,15 +76,16 @@ public class GtkImagePainter implements Runnable, ImageConsumer
flipX = flipY = false;
s_width = s_height = 0;
clip = null;
+ observer = o;
- new Thread (this).start ();
+ run ();
}
public
GtkImagePainter (GtkImage image, GdkGraphics gc,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
- Color bgcolor)
+ Color bgcolor, ImageObserver o)
{
this.image = image;
this.gc = (GdkGraphics) gc.create ();
@@ -91,6 +94,7 @@ public class GtkImagePainter implements Runnable, ImageConsumer
redBG = bgcolor.getRed ();
greenBG = bgcolor.getGreen ();
blueBG = bgcolor.getBlue ();
+ observer = o;
this.width = Math.abs (dx2 - dx1);
this.height = Math.abs (dy2 - dy1);
@@ -105,7 +109,7 @@ public class GtkImagePainter implements Runnable, ImageConsumer
s_height = Math.abs (sy2 - sy1);
clip = new Rectangle (sx1, sy1, s_width, s_height);
- new Thread (this).start ();
+ run ();
}
public void
@@ -126,7 +130,7 @@ public class GtkImagePainter implements Runnable, ImageConsumer
if (model.equals (ColorModel.getRGBdefault ()))
return pixels;
-
+
int ret[] = new int[pixels.length];
for (int i = 0; i < pixels.length; i++)
@@ -180,6 +184,11 @@ public class GtkImagePainter implements Runnable, ImageConsumer
startX + x, startY + y,
width, height, convertPixels (pixels, model), offset,
scansize, affine);
+
+ if (observer != null)
+ observer.imageUpdate (image,
+ ImageObserver.SOMEBITS,
+ x, y, width, height);
}
public void
@@ -247,5 +256,17 @@ public class GtkImagePainter implements Runnable, ImageConsumer
imageComplete (int status)
{
image.imageComplete(status);
+
+ if (observer != null)
+ {
+ if (status == ImageConsumer.IMAGEERROR)
+ observer.imageUpdate (null,
+ ImageObserver.ERROR,
+ -1, -1, -1, -1);
+ else
+ observer.imageUpdate (null,
+ ImageObserver.ALLBITS,
+ -1, -1, -1, -1);
+ }
}
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
index c28b7f5..25473d7 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
@@ -47,10 +47,11 @@ public class GtkLabelPeer extends GtkComponentPeer
implements LabelPeer
{
native void create (String text, float alignment);
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void nativeSetAlignment (float alignment);
native public void setText (String text);
+ native void setNativeBounds (int x, int y, int width, int height);
void create ()
{
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
index a85aba9..13055d3 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
@@ -41,8 +41,8 @@ package gnu.java.awt.peer.gtk;
import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.List;
-import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.awt.peer.ListPeer;
public class GtkListPeer extends GtkComponentPeer
@@ -58,9 +58,8 @@ public class GtkListPeer extends GtkComponentPeer
}
native void create (int rows);
- native void connectJObject ();
native void connectSignals ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkWidgetRequestFocus ();
native void getSize (int rows, int visibleRows, int dims[]);
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
index b9cca1a..90ad0c0 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import java.awt.Font;
import java.awt.Menu;
import java.awt.MenuBar;
+import java.awt.MenuComponent;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuPeer;
@@ -53,15 +55,25 @@ public class GtkMenuBarPeer extends GtkMenuComponentPeer
public GtkMenuBarPeer (MenuBar target)
{
super (target);
- create ();
}
- native void nativeSetHelpMenu(MenuPeer menuPeer);
+ void setFont ()
+ {
+ MenuComponent mc = (MenuComponent) awtWidget;
+ Font f = mc.getFont ();
+
+ if (f == null)
+ mc.setFont (new Font ("Dialog", Font.PLAIN, 12));
+ }
+ // FIXME: remove this method or replace it with one that does
+ // something useful.
/* In Gnome, help menus are no longer right flushed. */
+ native void nativeSetHelpMenu(MenuPeer menuPeer);
+
public void addHelpMenu (Menu menu)
{
- nativeSetHelpMenu((MenuPeer) menu.getPeer());
+ // nativeSetHelpMenu((MenuPeer) menu.getPeer());
}
native public void delMenu (int index);
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
index 92f0223..dd061ed 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
@@ -38,15 +38,28 @@ 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
implements MenuComponentPeer
{
+ void create ()
+ {
+ throw new RuntimeException ();
+ }
+
+ void setFont ()
+ {
+ }
+
public GtkMenuComponentPeer (Object awtWidget)
{
super (awtWidget);
+ create ();
+ setFont ();
}
-
+
public native void dispose();
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
index c32839e..81da90d 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
@@ -38,24 +38,31 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import java.awt.Font;
import java.awt.Menu;
+import java.awt.MenuComponent;
import java.awt.MenuBar;
import java.awt.MenuItem;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuComponentPeer;
import java.awt.peer.MenuBarPeer;
+import java.awt.peer.MenuComponentPeer;
+import java.awt.peer.MenuItemPeer;
import java.awt.peer.MenuPeer;
public class GtkMenuItemPeer extends GtkMenuComponentPeer
implements MenuItemPeer
{
native void create (String label);
- public native void connectSignals ();
+ native void connectSignals ();
+ native void gtkWidgetModifyFont (String name, int style, int size);
+
+ void create ()
+ {
+ create (((MenuItem) awtWidget).getLabel());
+ }
public GtkMenuItemPeer (MenuItem item)
{
super (item);
- create (item.getLabel ());
setEnabled (item.isEnabled ());
setParent (item);
@@ -63,6 +70,21 @@ public class GtkMenuItemPeer extends GtkMenuComponentPeer
connectSignals();
}
+ void setFont ()
+ {
+ MenuComponent mc = ((MenuComponent) awtWidget);
+ Font f = mc.getFont ();
+
+ if (f == null)
+ {
+ MenuComponent parent = (MenuComponent) mc.getParent ();
+ Font pf = parent.getFont ();
+ gtkWidgetModifyFont (pf.getName (), pf.getStyle (), pf.getSize ());
+ }
+ else
+ gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
+ }
+
void setParent (MenuItem item)
{
// add ourself differently, based on what type of parent we have
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
index 0b5d0af..fbdfcf4 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
@@ -47,7 +47,6 @@ public class GtkPanelPeer extends GtkContainerPeer
implements PanelPeer
{
native void create ();
- native void connectJObject ();
public GtkPanelPeer (Panel p)
{
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
index d0cbde0..233bed7 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
@@ -54,7 +54,7 @@ public class GtkScrollPanePeer extends GtkContainerPeer
create (awtComponent.getWidth (), awtComponent.getHeight ());
}
- native void gtkScrolledWindowSetScrollPosition(int x, int y);
+ // native void gtkScrolledWindowSetScrollPosition(int x, int y);
native void gtkScrolledWindowSetHScrollIncrement (int u);
native void gtkScrolledWindowSetVScrollIncrement (int u);
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
index 0e1b651..ef42896 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
@@ -60,7 +60,6 @@ public class GtkScrollbarPeer extends GtkComponentPeer
int min, int max, int stepIncr, int pageIncr,
int visibleAmount);
- native void connectJObject ();
native void connectSignals ();
public GtkScrollbarPeer (Scrollbar s)
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
index b08728b..94874de 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
@@ -52,7 +52,7 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
native void create (int width, int height, int scrollbarVisibility);
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkWidgetRequestFocus ();
void create ()
@@ -68,11 +68,7 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
awtComponent.setFont (f);
}
- FontMetrics fm;
- if (GtkToolkit.useGraphics2D ())
- fm = new GdkClasspathFontPeerMetrics (f);
- else
- fm = new GdkFontMetrics (f);
+ FontMetrics fm = getFontMetrics (f);
TextArea ta = ((TextArea) awtComponent);
int sizeRows = ta.getRows ();
@@ -130,11 +126,7 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
if (f == null)
return new Dimension (width, height);
- FontMetrics fm;
- if (GtkToolkit.useGraphics2D ())
- fm = new GdkClasspathFontPeerMetrics (f);
- else
- fm = new GdkFontMetrics (f);
+ FontMetrics fm = getFontMetrics (f);
int sizeRows = rows == 0 ? DEFAULT_ROWS : rows;
int sizeCols = cols == 0 ? DEFAULT_COLS : cols;
@@ -163,11 +155,7 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
if (f == null)
return new Dimension (width, height);
- FontMetrics fm;
- if (GtkToolkit.useGraphics2D ())
- fm = new GdkClasspathFontPeerMetrics (f);
- else
- fm = new GdkFontMetrics (f);
+ FontMetrics fm = getFontMetrics (f);
int sizeRows = rows == 0 ? DEFAULT_ROWS : rows;
int sizeCols = cols == 0 ? DEFAULT_COLS : cols;
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
index d4a702d..bd1ac81 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
@@ -66,11 +66,7 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
awtComponent.setFont (f);
}
- FontMetrics fm;
- if (GtkToolkit.useGraphics2D ())
- fm = new GdkClasspathFontPeerMetrics (f);
- else
- fm = new GdkFontMetrics (f);
+ FontMetrics fm = getFontMetrics (f);
TextField tf = ((TextField) awtComponent);
int cols = tf.getColumns ();
@@ -84,7 +80,7 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
native int gtkEntryGetBorderWidth ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
public GtkTextFieldPeer (TextField tf)
{
@@ -117,11 +113,7 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
if (f == null)
return new Dimension (2 * gtkEntryGetBorderWidth (), dim[1]);
- FontMetrics fm;
- if (GtkToolkit.useGraphics2D ())
- fm = new GdkClasspathFontPeerMetrics (f);
- else
- fm = new GdkFontMetrics (f);
+ FontMetrics fm = getFontMetrics (f);
int text_width = cols * fm.getMaxAdvance ();
@@ -140,11 +132,7 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
if (f == null)
return new Dimension (2 * gtkEntryGetBorderWidth (), dim[1]);
- FontMetrics fm;
- if (GtkToolkit.useGraphics2D ())
- fm = new GdkClasspathFontPeerMetrics (f);
- else
- fm = new GdkFontMetrics (f);
+ FontMetrics fm = getFontMetrics (f);
int text_width = cols * fm.getMaxAdvance ();
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
index 3f82159..def22e9 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
@@ -1,5 +1,5 @@
/* GtkToolkit.java -- Implements an AWT Toolkit using GTK for peers
- Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,36 +38,40 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.classpath.Configuration;
+import gnu.java.awt.EmbeddedWindow;
+import gnu.java.awt.EmbeddedWindowSupport;
+import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.java.awt.peer.ClasspathTextLayoutPeer;
+import gnu.java.awt.peer.EmbeddedWindowPeer;
+import gnu.java.awt.peer.gtk.GdkPixbufDecoder;
+
import java.awt.*;
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;
-import java.awt.image.ImageObserver;
import java.awt.image.ImageConsumer;
+import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
-import java.awt.GraphicsEnvironment;
import java.awt.peer.*;
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.Map;
import java.util.MissingResourceException;
import java.util.Properties;
-import gnu.java.awt.EmbeddedWindow;
-import gnu.java.awt.EmbeddedWindowSupport;
-import gnu.java.awt.peer.EmbeddedWindowPeer;
-import gnu.java.awt.peer.ClasspathFontPeer;
-import gnu.classpath.Configuration;
-import gnu.java.awt.peer.gtk.GdkPixbufDecoder;
/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
This merits comment. We are basically calling Sun's bluff on this one.
- We think Sun has deprecated it simply to discourage its use as it is
+ We think Sun has deprecated it simply to discourage its use as it is
bad programming style. However, we need to get at a component's peer in
this class. If getPeer() ever goes away, we can implement a hash table
that will keep up with every window's peer, but for now this is faster. */
@@ -79,7 +83,6 @@ import gnu.java.awt.peer.gtk.GdkPixbufDecoder;
* drawing contexts. Any other value will cause the older GdkGraphics
* object to be used.
*/
-
public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
implements EmbeddedWindowSupport
{
@@ -87,7 +90,6 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
Hashtable containers = new Hashtable();
static EventQueue q = new EventQueue();
static Clipboard systemClipboard;
-
static boolean useGraphics2dSet;
static boolean useGraphics2d;
@@ -120,14 +122,21 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
- int status = ((GtkImage) image).checkImage ();
+ int status = ImageObserver.ALLBITS
+ | ImageObserver.WIDTH
+ | ImageObserver.HEIGHT;
+
+ if (image instanceof GtkImage)
+ {
+ status = ((GtkImage) image).checkImage ();
+ }
if (observer != null)
observer.imageUpdate (image, status,
-1, -1,
image.getWidth (observer),
image.getHeight (observer));
-
+
return status;
}
@@ -304,22 +313,59 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
"SansSerif" });
}
+ private class LRUCache extends java.util.LinkedHashMap
+ {
+ int max_entries;
+ public LRUCache(int max)
+ {
+ super(max, 0.75f, true);
+ max_entries = max;
+ }
+ protected boolean removeEldestEntry(Map.Entry eldest)
+ {
+ return size() > max_entries;
+ }
+ }
+
+ private LRUCache fontCache = new LRUCache(50);
+ private LRUCache metricsCache = new LRUCache(50);
+ private LRUCache imageCache = new LRUCache(50);
+
public FontMetrics getFontMetrics (Font font)
{
- if (useGraphics2D())
- return new GdkClasspathFontPeerMetrics (font);
+ if (metricsCache.containsKey(font))
+ return (FontMetrics) metricsCache.get(font);
else
- return new GdkFontMetrics (font);
+ {
+ FontMetrics m;
+ m = new GdkFontMetrics (font);
+ metricsCache.put(font, m);
+ return m;
+ }
}
public Image getImage (String filename)
{
- return createImage (filename);
+ if (imageCache.containsKey(filename))
+ return (Image) imageCache.get(filename);
+ else
+ {
+ Image im = createImage(filename);
+ imageCache.put(filename, im);
+ return im;
+ }
}
public Image getImage (URL url)
{
- return createImage (url);
+ if (imageCache.containsKey(url))
+ return (Image) imageCache.get(url);
+ else
+ {
+ Image im = createImage(url);
+ imageCache.put(url, im);
+ return im;
+ }
}
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
@@ -510,8 +556,10 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
*/
private FontPeer getFontPeer (String name, int style, int size)
{
- GtkFontPeer fp = new GtkFontPeer (name, style, size);
- return fp;
+ Map attrs = new HashMap ();
+ ClasspathFontPeer.copyStyleToAttrs (style, attrs);
+ ClasspathFontPeer.copySizeToAttrs (size, attrs);
+ return getClasspathFontPeer (name, attrs);
}
/**
@@ -522,40 +570,28 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs)
{
- if (useGraphics2D())
- return new GdkClasspathFontPeer (name, attrs);
+ Map keyMap = new HashMap (attrs);
+ // We don't know what kind of "name" the user requested (logical, face,
+ // family), and we don't actually *need* to know here. The worst case
+ // involves failure to consolidate fonts with the same backend in our
+ // cache. This is harmless.
+ keyMap.put ("GtkToolkit.RequestedFontName", name);
+ if (fontCache.containsKey (keyMap))
+ return (ClasspathFontPeer) fontCache.get (keyMap);
else
{
- // Default values
- int size = 12;
- int style = Font.PLAIN;
- if (name == null)
- name = "Default";
-
- if (attrs.containsKey (TextAttribute.WEIGHT))
- {
- Float weight = (Float) attrs.get (TextAttribute.WEIGHT);
- if (weight.floatValue () >= TextAttribute.WEIGHT_BOLD.floatValue ())
- style += Font.BOLD;
- }
-
- if (attrs.containsKey (TextAttribute.POSTURE))
- {
- Float posture = (Float) attrs.get (TextAttribute.POSTURE);
- if (posture.floatValue () >= TextAttribute.POSTURE_OBLIQUE.floatValue ())
- style += Font.ITALIC;
- }
-
- if (attrs.containsKey (TextAttribute.SIZE))
- {
- Float fsize = (Float) attrs.get (TextAttribute.SIZE);
- size = fsize.intValue();
- }
-
- return (ClasspathFontPeer) this.getFontPeer (name, style, size);
+ ClasspathFontPeer newPeer = new GdkFontPeer (name, attrs);
+ fontCache.put (keyMap, newPeer);
+ return newPeer;
}
}
+ public ClasspathTextLayoutPeer getClasspathTextLayoutPeer (AttributedString str,
+ FontRenderContext frc)
+ {
+ return new GdkTextLayout(str, frc);
+ }
+
protected EventQueue getSystemEventQueueImpl()
{
return q;
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
index a235769..c61eecd 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
@@ -40,8 +40,8 @@ package gnu.java.awt.peer.gtk;
import java.awt.Component;
import java.awt.Dimension;
-import java.awt.Window;
import java.awt.Frame;
+import java.awt.Window;
import java.awt.event.WindowEvent;
import java.awt.peer.WindowPeer;
@@ -106,7 +106,6 @@ public class GtkWindowPeer extends GtkContainerPeer
{
}
- native void connectJObject ();
native void connectSignals ();
public GtkWindowPeer (Window window)
diff --git a/libjava/gnu/java/beans/IntrospectionIncubator.java b/libjava/gnu/java/beans/IntrospectionIncubator.java
index 21bf984..ac08f7a 100644
--- a/libjava/gnu/java/beans/IntrospectionIncubator.java
+++ b/libjava/gnu/java/beans/IntrospectionIncubator.java
@@ -99,7 +99,8 @@ public class IntrospectionIncubator {
* @param method The method instance to examine.
*/
public void addMethod(Method method) {
- if(Modifier.isPublic(method.getModifiers())) {
+ if(Modifier.isPublic(method.getModifiers()) &&
+ !Modifier.isStatic(method.getModifiers())) {
String name = ClassHelper.getTruncatedName(method.getName());
Class retType = method.getReturnType();
Class[] params = method.getParameterTypes();
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in
index 8722869..7e9b70d 100644
--- a/libjava/include/config.h.in
+++ b/libjava/include/config.h.in
@@ -429,6 +429,18 @@
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
+/* whether byteorder is bigendian */
+#undef WORDS_BIGENDIAN
+
+/* Define if the host machine stores words of multi-word integers in
+ big-endian order. */
+#undef HOST_WORDS_BIG_ENDIAN
+
+/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
+#undef BYTEORDER
+
+/* Short GCJ version ID */
+#undef GCJVERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
diff --git a/libjava/java/applet/Applet.java b/libjava/java/applet/Applet.java
index 4fbf17c..a7609d9 100644
--- a/libjava/java/applet/Applet.java
+++ b/libjava/java/applet/Applet.java
@@ -78,6 +78,12 @@ public class Applet extends Panel
/** The applet stub for this applet. */
private transient AppletStub stub;
+ /** Some applets call setSize in their constructors. In that case,
+ these fields are used to store width and height values until a
+ stub is set. */
+ private transient int width;
+ private transient int height;
+
/**
* The accessibility context for this applet.
*
@@ -107,6 +113,9 @@ public class Applet extends Panel
public final void setStub(AppletStub stub)
{
this.stub = stub;
+
+ if (width != 0 && height != 0)
+ stub.appletResize (width, height);
}
/**
@@ -174,7 +183,13 @@ public class Applet extends Panel
*/
public void resize(int width, int height)
{
- stub.appletResize(width, height);
+ if (stub == null)
+ {
+ this.width = width;
+ this.height = height;
+ }
+ else
+ stub.appletResize(width, height);
}
/**
diff --git a/libjava/java/awt/AWTEventMulticaster.java b/libjava/java/awt/AWTEventMulticaster.java
index 58950ef..b26d1f3 100644
--- a/libjava/java/awt/AWTEventMulticaster.java
+++ b/libjava/java/awt/AWTEventMulticaster.java
@@ -181,7 +181,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentResized(ComponentEvent e)
{
@@ -193,7 +193,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentMoved(ComponentEvent e)
{
@@ -205,7 +205,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentShown(ComponentEvent e)
{
@@ -217,7 +217,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentHidden(ComponentEvent e)
{
@@ -229,7 +229,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentAdded(ContainerEvent e)
{
@@ -241,7 +241,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentRemoved(ContainerEvent e)
{
@@ -253,7 +253,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void focusGained(FocusEvent e)
{
@@ -265,7 +265,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void focusLost(FocusEvent e)
{
@@ -277,7 +277,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void keyTyped(KeyEvent e)
{
@@ -289,7 +289,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void keyPressed(KeyEvent e)
{
@@ -301,7 +301,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void keyReleased(KeyEvent e)
{
@@ -313,7 +313,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseClicked(MouseEvent e)
{
@@ -325,7 +325,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mousePressed(MouseEvent e)
{
@@ -337,7 +337,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseReleased(MouseEvent e)
{
@@ -349,7 +349,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseEntered(MouseEvent e)
{
@@ -361,7 +361,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseExited(MouseEvent e)
{
@@ -373,7 +373,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseDragged(MouseEvent e)
{
@@ -385,7 +385,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseMoved(MouseEvent e)
{
@@ -397,7 +397,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowOpened(WindowEvent e)
{
@@ -409,7 +409,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowClosing(WindowEvent e)
{
@@ -421,7 +421,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowClosed(WindowEvent e)
{
@@ -433,7 +433,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowIconified(WindowEvent e)
{
@@ -445,7 +445,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowDeiconified(WindowEvent e)
{
@@ -457,7 +457,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowActivated(WindowEvent e)
{
@@ -469,7 +469,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowDeactivated(WindowEvent e)
{
@@ -481,7 +481,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void windowStateChanged(WindowEvent e)
@@ -494,7 +494,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void windowGainedFocus(WindowEvent e)
@@ -507,7 +507,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void windowLostFocus(WindowEvent e)
@@ -520,7 +520,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void actionPerformed(ActionEvent e)
{
@@ -532,7 +532,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void itemStateChanged(ItemEvent e)
{
@@ -544,7 +544,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void adjustmentValueChanged(AdjustmentEvent e)
{
@@ -556,7 +556,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void textValueChanged(TextEvent e)
{
@@ -568,7 +568,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.2
*/
public void inputMethodTextChanged(InputMethodEvent e)
@@ -581,7 +581,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.2
*/
public void caretPositionChanged(InputMethodEvent e)
@@ -594,7 +594,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.3
*/
public void hierarchyChanged(HierarchyEvent e)
@@ -607,7 +607,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.3
*/
public void ancestorMoved(HierarchyEvent e)
@@ -620,7 +620,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.3
*/
public void ancestorResized(HierarchyEvent e)
@@ -633,7 +633,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void mouseWheelMoved(MouseWheelEvent e)
diff --git a/libjava/java/awt/AWTKeyStroke.java b/libjava/java/awt/AWTKeyStroke.java
index 23ae92b..53e64b7 100644
--- a/libjava/java/awt/AWTKeyStroke.java
+++ b/libjava/java/awt/AWTKeyStroke.java
@@ -1,5 +1,5 @@
/* AWTKeyStroke.java -- an immutable key stroke
- Copyright (C) 2002 Free Software Foundation
+ Copyright (C) 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -48,9 +48,9 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.util.Map;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.StringTokenizer;
/**
diff --git a/libjava/java/awt/Adjustable.java b/libjava/java/awt/Adjustable.java
index 58116e4..815c77c 100644
--- a/libjava/java/awt/Adjustable.java
+++ b/libjava/java/awt/Adjustable.java
@@ -157,7 +157,7 @@ public interface Adjustable
* Adds a listener that will receive adjustment events for this object.
*
* @param listener the adjustment listener to add
- * @see AdjustmentEvent
+ * @see java.awt.event.AdjustmentEvent
*/
void addAdjustmentListener(AdjustmentListener listener);
@@ -165,7 +165,7 @@ public interface Adjustable
* Removes an adjustment listener from this object.
*
* @param listener the adjustment listener to remove
- * @see AdjustmentEvent
+ * @see java.awt.event.AdjustmentEvent
*/
void removeAdjustmentListener(AdjustmentListener listener);
} // interface Adjustable
diff --git a/libjava/java/awt/BasicStroke.java b/libjava/java/awt/BasicStroke.java
index 2978c64..e302a0eb 100644
--- a/libjava/java/awt/BasicStroke.java
+++ b/libjava/java/awt/BasicStroke.java
@@ -1,5 +1,5 @@
/* BasicStroke.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,7 +69,7 @@ public class BasicStroke implements Stroke
* greater than or equal to 1.0f.
* @param dash The array representing the dashing pattern. There must be at
* least one non-zero entry.
- * @param dash_phase is negative and dash is not null.
+ * @param dashPhase is negative and dash is not null.
*
* @exception IllegalArgumentException If one input parameter doesn't meet
* its needs.
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
index 0bb5766..86cb37c 100644
--- a/libjava/java/awt/Button.java
+++ b/libjava/java/awt/Button.java
@@ -1,5 +1,5 @@
/* Button.java -- AWT button widget
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,13 +44,21 @@ import java.awt.peer.ButtonPeer;
import java.lang.reflect.Array;
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;
+
/**
* This class provides a button widget for the AWT.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
*/
-public class Button extends Component implements java.io.Serializable
+public class Button extends Component
+ implements java.io.Serializable, Accessible
{
/*
@@ -84,7 +92,102 @@ private transient ActionListener action_listeners;
/*
* The number used to generate the name returned by getName.
*/
- private static transient long next_button_number = 0;
+ private static transient long next_button_number;
+
+ protected class AccessibleAWTButton extends AccessibleAWTComponent
+ implements AccessibleAction, AccessibleValue
+ {
+ protected AccessibleAWTButton() { }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
+ */
+ public int getAccessibleActionCount()
+ {
+ // Only 1 action possible
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ // JDK 1.4.2 returns the string "click" for action 0. However, the API
+ // docs don't say what the string to be returned is, beyond being a
+ // description of the action. So we return the same thing for
+ // compatibility with 1.4.2.
+ if (i == 0)
+ return "click";
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ if (i != 0)
+ return false;
+ processActionEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
+ return true;
+ }
+
+ public String getAccessibleName()
+ {
+ return label;
+ }
+
+ public AccessibleAction getAccessibleAction()
+ {
+ return this;
+ }
+
+ public AccessibleValue getAccessibleValue()
+ {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
+ */
+ public Number getCurrentAccessibleValue()
+ {
+ // Docs say return 1 if selected, but buttons can't be selected, right?
+ return new Integer(0);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
+ */
+ public boolean setCurrentAccessibleValue(Number number)
+ {
+ // Since there's no selection with buttons, we're ignoring this.
+ // TODO someone who knows shoulw check this.
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
+ */
+ public Number getMinimumAccessibleValue()
+ {
+ return new Integer(0);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
+ */
+ public Number getMaximumAccessibleValue()
+ {
+ return new Integer(0);
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.PUSH_BUTTON;
+ }
+ }
/*************************************************************************/
@@ -215,6 +318,13 @@ removeActionListener(ActionListener listener)
action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
}
+ /**
+ * Returns all added <code>ActionListener</code> objects.
+ *
+ * @return an array of listeners
+ *
+ * @since 1.4
+ */
public synchronized ActionListener[] getActionListeners()
{
return (ActionListener[])
@@ -222,10 +332,15 @@ removeActionListener(ActionListener listener)
ActionListener.class);
}
-/** Returns all registered EventListers of the given listenerType.
+/**
+ * Returns all registered EventListers of the given listenerType.
* listenerType must be a subclass of EventListener, or a
* ClassClassException is thrown.
*
+ * @param listenerType the listener type to return
+ *
+ * @return an array of listeners
+ *
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements @see java.util.EventListener.
*
@@ -314,6 +429,11 @@ paramString()
+ getWidth () + "x" + getHeight () + ",label=" + getLabel ();
}
+public AccessibleContext getAccessibleContext()
+{
+ return new AccessibleAWTButton();
+}
+
/**
* Generate a unique name for this button.
*
diff --git a/libjava/java/awt/Canvas.java b/libjava/java/awt/Canvas.java
index dad86c6..d177c9b 100644
--- a/libjava/java/awt/Canvas.java
+++ b/libjava/java/awt/Canvas.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* Canvas.java --
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,17 +38,61 @@ exception statement from your version. */
package java.awt;
+import java.awt.image.BufferStrategy;
import java.awt.peer.ComponentPeer;
-
-public class Canvas extends Component implements java.io.Serializable
+import java.io.Serializable;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
+/**
+ * The <code>Canvas</code> component provides a blank rectangular
+ * area, which the client application can use for drawing and for
+ * capturing events. By overriding the <code>paint()</code> method,
+ * the canvas can be used for anything from simple line drawings to
+ * full-scale custom components.
+ *
+ * @author Original author unknown
+ * @author Tom Tromey <tromey@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @since 1.0
+ */
+
+public class Canvas
+ extends Component
+ implements Serializable, Accessible
{
+
+ /**
+ * Compatible with Sun's JDK.
+ */
+ private static final long serialVersionUID = -2284879212465893870L;
+
+ /**
+ * The graphics configuration associated with the canvas.
+ */
transient GraphicsConfiguration graphicsConfiguration;
/**
+ * The buffer strategy associated with this canvas.
+ */
+ transient BufferStrategy bufferStrategy;
+
+ /**
* Initializes a new instance of <code>Canvas</code>.
*/
- public Canvas() { }
+ public Canvas()
+ {
+ }
+ /**
+ * Initializes a new instance of <code>Canvas</code>
+ * with the supplied graphics configuration.
+ *
+ * @param graphicsConfiguration the graphics configuration to use
+ * for this particular canvas.
+ */
public Canvas(GraphicsConfiguration graphicsConfiguration)
{
this.graphicsConfiguration = graphicsConfiguration;
@@ -71,9 +116,11 @@ public class Canvas extends Component implements java.io.Serializable
}
/**
- * Repaints the canvas window. This method should be overriden by
+ * Repaints the canvas window. This method should be overridden by
* a subclass to do something useful, as this method simply paints
* the window with the background color.
+ *
+ * @param gfx the <code>Graphics</code> to use for painting
*/
public void paint(Graphics gfx)
{
@@ -86,6 +133,86 @@ public class Canvas extends Component implements java.io.Serializable
gfx.fillRect(0, 0, size.width, size.height);
}
- // Serialization constant
- private static final long serialVersionUID = -2284879212465893870L;
+ /**
+ * This class provides accessibility support for the canvas.
+ */
+ protected class AccessibleAWTCanvas
+ extends AccessibleAWTComponent
+ {
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = -6325592262103146699L;
+
+ /**
+ * Constructor for the accessible canvas.
+ */
+ protected AccessibleAWTCanvas()
+ {
+ }
+
+ /**
+ * Returns the accessible role for the canvas.
+ *
+ * @return an instance of <code>AccessibleRole</code>, describing
+ * the role of the canvas.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.CANVAS;
+ }
+
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this <code>Canvas</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)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleAWTCanvas();
+ }
+ return accessibleContext;
+ }
+
+ /**
+ * Returns the buffer strategy used by the canvas.
+ *
+ * @return the buffer strategy.
+ * @since 1.4
+ */
+ public BufferStrategy getBufferStrategy()
+ {
+ return bufferStrategy;
+ }
+
+ /**
+ * Updates the canvas in response to a request to
+ * <code>repaint()</code> it. The canvas is cleared
+ * with the current background colour, before <code>paint()</code>
+ * is called to add the new contents. Subclasses
+ * which override this method should either call this
+ * method via <code>super.update(graphics)</code> or re-implement
+ * this behaviour, so as to ensure that the canvas is
+ * clear before painting takes place.
+ *
+ * @param graphics the graphics context.
+ */
+ public void update(Graphics graphics)
+ {
+ Dimension size;
+
+ /* Clear the canvas */
+ size = getSize();
+ graphics.clearRect(0, 0, size.width, size.height);
+ /* Call the paint method */
+ paint(graphics);
+ }
+
}
diff --git a/libjava/java/awt/CardLayout.java b/libjava/java/awt/CardLayout.java
index fa4f4ec..e1f3831 100644
--- a/libjava/java/awt/CardLayout.java
+++ b/libjava/java/awt/CardLayout.java
@@ -1,6 +1,5 @@
-// CardLayout.java - Card-based layout engine
-
-/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
+/* CardLayout.java -- Card-based layout engine
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -39,21 +38,22 @@ exception statement from your version. */
package java.awt;
+import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
-import java.io.Serializable;
-/** This class implements a card-based layout scheme. Each included
+/**
+ * This class implements a card-based layout scheme. Each included
* component is treated as a card. Only one card can be shown at a
* time. This class includes methods for changing which card is
* shown.
*
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class CardLayout implements LayoutManager2, Serializable
{
- static final long serialVersionUID = -4328196481005934313L;
+ private static final long serialVersionUID = -4328196481005934313L;
/**
* Initializes a new instance of <code>CardLayout</code> with horizontal
@@ -67,6 +67,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Create a new <code>CardLayout</code> object with the specified
* horizontal and vertical gaps.
+ *
* @param hgap The horizontal gap
* @param vgap The vertical gap
*/
@@ -77,11 +78,14 @@ public class CardLayout implements LayoutManager2, Serializable
this.tab = new Hashtable ();
}
- /** Add a new component to the layout. The constraint must be a
+ /**
+ * Add a new component to the layout. The constraint must be a
* string which is used to name the component. This string can
* later be used to refer to the particular component.
+ *
* @param comp The component to add
* @param constraints The name by which the component can later be called
+ *
* @exception IllegalArgumentException If `constraints' is not a
* <code>String</code>
*/
@@ -93,10 +97,13 @@ public class CardLayout implements LayoutManager2, Serializable
addLayoutComponent ((String) constraints, comp);
}
- /** Add a new component to the layout. The name can be used later
+ /**
+ * Add a new component to the layout. The name can be used later
* to refer to the component.
+ *
* @param name The name by which the component can later be called
* @param comp The component to add
+ *
* @deprecated This method is deprecated in favor of
* <code>addLayoutComponent(Component, Object)</code>.
*/
@@ -104,13 +111,12 @@ public class CardLayout implements LayoutManager2, Serializable
{
tab.put (name, comp);
// First component added is the default component.
- if (tab.size() == 1)
- comp.setVisible(true);
- else
- comp.setVisible(false);
+ comp.setVisible(tab.size() == 1);
}
- /** Cause the first component in the container to be displayed.
+ /**
+ * Cause the first component in the container to be displayed.
+ *
* @param parent The parent container
*/
public void first (Container parent)
@@ -118,43 +124,63 @@ public class CardLayout implements LayoutManager2, Serializable
gotoComponent (parent, FIRST);
}
- /** Return this layout manager's horizontal gap. */
+ /**
+ * Return this layout manager's horizontal gap.
+ *
+ * @return the horizontal gap
+ */
public int getHgap ()
{
return hgap;
}
- /** Return this layout manager's x alignment. This method always
+ /**
+ * Return this layout manager's x alignment. This method always
* returns Component.CENTER_ALIGNMENT.
+ *
* @param parent Container using this layout manager instance
+ *
+ * @return the x-axis alignment
*/
public float getLayoutAlignmentX (Container parent)
{
return Component.CENTER_ALIGNMENT;
}
- /** Returns this layout manager's y alignment. This method always
+ /**
+ * Returns this layout manager's y alignment. This method always
* returns Component.CENTER_ALIGNMENT.
+ *
* @param parent Container using this layout manager instance
+ *
+ * @return the y-axis alignment
*/
public float getLayoutAlignmentY (Container parent)
{
return Component.CENTER_ALIGNMENT;
}
- /** Return this layout manager's vertical gap. */
+ /**
+ * Return this layout manager's vertical gap.
+ *
+ * @return the vertical gap
+ */
public int getVgap ()
{
return vgap;
}
- /** Invalidate this layout manager's state. */
+ /**
+ * Invalidate this layout manager's state.
+ */
public void invalidateLayout (Container target)
{
// Do nothing.
}
- /** Cause the last component in the container to be displayed.
+ /**
+ * Cause the last component in the container to be displayed.
+ *
* @param parent The parent container
*/
public void last (Container parent)
@@ -190,8 +216,12 @@ public class CardLayout implements LayoutManager2, Serializable
}
}
- /** Get the maximum layout size of the container.
+ /**
+ * Get the maximum layout size of the container.
+ *
* @param target The parent container
+ *
+ * @return the maximum layout size
*/
public Dimension maximumLayoutSize (Container target)
{
@@ -200,17 +230,23 @@ public class CardLayout implements LayoutManager2, Serializable
return getSize (target, MAX);
}
- /** Get the minimum layout size of the container.
+ /**
+ * Get the minimum layout size of the container.
+ *
* @param target The parent container
+ *
+ * @return the minimum layout size
*/
public Dimension minimumLayoutSize (Container target)
{
return getSize (target, MIN);
}
- /** Cause the next component in the container to be displayed. If
+ /**
+ * Cause the next component in the container to be displayed. If
* this current card is the last one in the deck, the first
* component is displayed.
+ *
* @param parent The parent container
*/
public void next (Container parent)
@@ -218,17 +254,23 @@ public class CardLayout implements LayoutManager2, Serializable
gotoComponent (parent, NEXT);
}
- /** Get the preferred layout size of the container.
- * @param target The parent container
+ /**
+ * Get the preferred layout size of the container.
+ *
+ * @param parent The parent container
+ *
+ * @return the preferred layout size
*/
public Dimension preferredLayoutSize (Container parent)
{
return getSize (parent, PREF);
}
- /** Cause the previous component in the container to be displayed.
+ /**
+ * Cause the previous component in the container to be displayed.
* If this current card is the first one in the deck, the last
* component is displayed.
+ *
* @param parent The parent container
*/
public void previous (Container parent)
@@ -236,7 +278,9 @@ public class CardLayout implements LayoutManager2, Serializable
gotoComponent (parent, PREV);
}
- /** Remove the indicated component from this layout manager.
+ /**
+ * Remove the indicated component from this layout manager.
+ *
* @param comp The component to remove
*/
public void removeLayoutComponent (Component comp)
@@ -255,7 +299,9 @@ public class CardLayout implements LayoutManager2, Serializable
}
}
- /** Set this layout manager's horizontal gap.
+ /**
+ * Set this layout manager's horizontal gap.
+ *
* @param hgap The new gap
*/
public void setHgap (int hgap)
@@ -263,7 +309,9 @@ public class CardLayout implements LayoutManager2, Serializable
this.hgap = hgap;
}
- /** Set this layout manager's vertical gap.
+ /**
+ * Set this layout manager's vertical gap.
+ *
* @param vgap The new gap
*/
public void setVgap (int vgap)
@@ -271,8 +319,10 @@ public class CardLayout implements LayoutManager2, Serializable
this.vgap = vgap;
}
- /** Cause the named component to be shown. If the component name is
+ /**
+ * Cause the named component to be shown. If the component name is
* unknown, this method does nothing.
+ *
* @param parent The parent container
* @param name The name of the component to show
*/
@@ -307,7 +357,9 @@ public class CardLayout implements LayoutManager2, Serializable
return getClass ().getName () + "[" + hgap + "," + vgap + "]";
}
- /** This implements first(), last(), next(), and previous().
+ /**
+ * This implements first(), last(), next(), and previous().
+ *
* @param parent The parent container
* @param what The type of goto: FIRST, LAST, NEXT or PREV
*/
@@ -419,13 +471,13 @@ public class CardLayout implements LayoutManager2, Serializable
private Hashtable tab;
// These constants are used by the private gotoComponent method.
- private int FIRST = 0;
- private int LAST = 1;
- private int NEXT = 2;
- private int PREV = 3;
+ private static final int FIRST = 0;
+ private static final int LAST = 1;
+ private static final int NEXT = 2;
+ private static final int PREV = 3;
// These constants are used by the private getSize method.
- private int MIN = 0;
- private int MAX = 1;
- private int PREF = 2;
+ private static final int MIN = 0;
+ private static final int MAX = 1;
+ private static final int PREF = 2;
}
diff --git a/libjava/java/awt/Checkbox.java b/libjava/java/awt/Checkbox.java
index 5e80e16..04ace46 100644
--- a/libjava/java/awt/Checkbox.java
+++ b/libjava/java/awt/Checkbox.java
@@ -43,6 +43,13 @@ import java.awt.event.ItemListener;
import java.awt.peer.CheckboxPeer;
import java.io.Serializable;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleValue;
+
/**
* This class implements a component which has an on/off state. Two
* or more Checkboxes can be grouped by a CheckboxGroup.
@@ -50,7 +57,8 @@ import java.io.Serializable;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@redhat.com>
*/
-public class Checkbox extends Component implements ItemSelectable, Serializable
+public class Checkbox extends Component
+ implements ItemSelectable, Accessible, Serializable
{
// FIXME: Need readObject/writeObject for this.
@@ -86,6 +94,96 @@ private boolean state;
// The list of listeners for this object.
private transient ItemListener item_listeners;
+protected class AccessibleAWTCheckBox
+ extends AccessibleAWTComponent
+ implements ItemListener, AccessibleAction, AccessibleValue
+{
+
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ */
+ public void itemStateChanged(ItemEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_STATE_PROPERTY,
+ state ? null : AccessibleState.CHECKED,
+ state ? AccessibleState.CHECKED : null);
+ }
+
+ public AccessibleAction getAccessibleAction()
+ {
+ return this;
+ }
+
+ public AccessibleValue getAccessibleValue()
+ {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
+ */
+ public int getAccessibleActionCount()
+ {
+ // 1.4.1 does this
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
+ */
+ public Number getCurrentAccessibleValue()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
+ */
+ public boolean setCurrentAccessibleValue(Number number)
+ {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
+ */
+ public Number getMinimumAccessibleValue()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
+ */
+ public Number getMaximumAccessibleValue()
+ {
+ return null;
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.CHECK_BOX;
+ }
+
+}
+
/*************************************************************************/
/*
@@ -392,4 +490,11 @@ paramString()
+ "," + super.paramString());
}
+public AccessibleContext getAccessibleContext()
+{
+ AccessibleAWTCheckBox ac = new AccessibleAWTCheckBox();
+ addItemListener(ac);
+ return ac;
+}
+
} // class Checkbox
diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java
index c7df075..ab4cb60 100644
--- a/libjava/java/awt/CheckboxMenuItem.java
+++ b/libjava/java/awt/CheckboxMenuItem.java
@@ -1,5 +1,5 @@
/* CheckboxMenuItem.java -- A menu option with a checkbox on it.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,6 @@ package java.awt;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.peer.CheckboxMenuItemPeer;
-import java.awt.peer.MenuItemPeer;
import java.util.EventListener;
/**
@@ -175,7 +174,7 @@ setState(boolean state)
* Returns an array of length 1 with the menu item label for this object
* if the state is on. Otherwise <code>null</code> is returned.
*
- * @param An array with this menu item's label if it has a state of on,
+ * @return An array with this menu item's label if it has a state of on,
* or <code>null</code> otherwise.
*/
public Object[]
@@ -198,12 +197,9 @@ getSelectedObjects()
public synchronized void
addNotify()
{
- if (peer != null)
- {
- // This choice of toolkit seems unsatisfying, but I'm not sure
- // what else to do.
- peer = getToolkit().createCheckboxMenuItem(this);
- }
+ if (peer == null)
+ peer = getToolkit().createCheckboxMenuItem(this);
+
super.addNotify ();
}
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index b2b597e..89e91ca 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -1,5 +1,5 @@
/* Choice.java -- Java choice button widget.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,10 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Vector;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
/**
* This class implements a drop down choice list.
*
@@ -79,6 +83,53 @@ private int selectedIndex = -1;
// Listener chain
private ItemListener item_listeners;
+ protected class AccessibleAWTChoice
+ extends Component.AccessibleAWTComponent
+ implements AccessibleAction
+ {
+ public AccessibleAction getAccessibleAction()
+ {
+ return this;
+ }
+
+ // FIXME: I think this is right, but should be checked by someone who
+ // knows better.
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.POPUP_MENU;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
+ */
+ public int getAccessibleActionCount()
+ {
+ return pItems.size();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ return (String) pItems.get(i);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ if (i < 0 || i >= pItems.size())
+ return false;
+
+ Choice.this.processItemEvent(new ItemEvent(Choice.this,
+ ItemEvent.ITEM_STATE_CHANGED,
+ this, ItemEvent.SELECTED));
+ return true;
+ }
+ }
+
/*************************************************************************/
/*
@@ -169,6 +220,8 @@ add(String item)
ChoicePeer cp = (ChoicePeer) peer;
cp.add (item, i);
}
+ else if (selectedIndex == -1)
+ select(0);
}
/*************************************************************************/
@@ -218,6 +271,8 @@ insert(String item, int index)
ChoicePeer cp = (ChoicePeer) peer;
cp.add (item, index);
}
+ else if (selectedIndex == -1 || selectedIndex >= index)
+ select(0);
}
/*************************************************************************/
@@ -261,6 +316,13 @@ remove(int index)
ChoicePeer cp = (ChoicePeer) peer;
cp.remove (index);
}
+ else
+ {
+ if (getItemCount() == 0)
+ selectedIndex = -1;
+ else if (index == selectedIndex)
+ select(0);
+ }
if (selectedIndex > index)
--selectedIndex;
@@ -501,4 +563,9 @@ paramString()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleAWTChoice();
+ }
} // class Choice
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
index 90aaaf9..cb47f77 100644
--- a/libjava/java/awt/Component.java
+++ b/libjava/java/awt/Component.java
@@ -1,5 +1,5 @@
/* Component.java -- a graphics component
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -47,16 +47,16 @@ import java.awt.event.FocusListener;
import java.awt.event.HierarchyBoundsListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
import java.awt.event.InputEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent;
import java.awt.im.InputContext;
@@ -70,8 +70,8 @@ import java.awt.peer.ComponentPeer;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.ObjectInputStream;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
@@ -84,6 +84,7 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Set;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
@@ -293,7 +294,7 @@ public abstract class Component
* @see #getLocale()
* @see #setLocale(Locale)
*/
- Locale locale;
+ Locale locale = Locale.getDefault ();
/**
* True if the object should ignore repaint events (usually because it is
@@ -575,8 +576,6 @@ public abstract class Component
{
incrementalDraw = Boolean.getBoolean ("awt.image.incrementalDraw");
redrawRate = Long.getLong ("awt.image.redrawrate");
- // Set the default KeyboardFocusManager.
- KeyboardFocusManager.setCurrentKeyboardFocusManager (null);
}
// Public and protected API.
@@ -785,13 +784,15 @@ public abstract class Component
* events).
*
* @param enabled true to enable this component
+ *
* @see #isEnabled()
* @see #isLightweight()
+ *
* @since 1.1
*/
- public void setEnabled(boolean b)
+ public void setEnabled(boolean enabled)
{
- enable (b);
+ enable(enabled);
}
/**
@@ -810,14 +811,15 @@ public abstract class Component
* Enables or disables this component.
*
* @param enabled true to enable this component
+ *
* @deprecated use {@link #setEnabled(boolean)} instead
*/
- public void enable(boolean b)
+ public void enable(boolean enabled)
{
- if (b)
- enable ();
+ if (enabled)
+ enable();
else
- disable ();
+ disable();
}
/**
@@ -865,15 +867,17 @@ public abstract class Component
* not show the component, if a parent is invisible.
*
* @param visible true to make this component visible
+ *
* @see #isVisible()
+ *
* @since 1.1
*/
- public void setVisible(boolean b)
+ public void setVisible(boolean visible)
{
// Inspection by subclassing shows that Sun's implementation calls
// show(boolean) which then calls show() or hide(). It is the show()
// method that is overriden in subclasses like Window.
- show (b);
+ show(visible);
}
/**
@@ -904,14 +908,15 @@ public abstract class Component
* Makes this component visible or invisible.
*
* @param visible true to make this component visible
+ *
* @deprecated use {@link #setVisible(boolean)} instead
*/
- public void show(boolean b)
+ public void show(boolean visible)
{
- if (b)
- show ();
+ if (visible)
+ show();
else
- hide ();
+ hide();
}
/**
@@ -1041,16 +1046,21 @@ public abstract class Component
* Sets the font for this component to the specified font. This is a bound
* property.
*
- * @param font the new font for this component
+ * @param newFont the new font for this component
+ *
* @see #getFont()
*/
- public void setFont(Font f)
+ public void setFont(Font newFont)
{
- firePropertyChange("font", font, f);
+ if (font == newFont)
+ return;
+
+ Font oldFont = font;
+ font = newFont;
if (peer != null)
- peer.setFont(f);
+ peer.setFont(font);
+ firePropertyChange("font", oldFont, newFont);
invalidate();
- font = f;
}
/**
@@ -1087,12 +1097,16 @@ public abstract class Component
* Sets the locale for this component to the specified locale. This is a
* bound property.
*
- * @param locale the new locale for this component
+ * @param newLocale the new locale for this component
*/
- public void setLocale(Locale l)
+ public void setLocale(Locale newLocale)
{
- firePropertyChange("locale", locale, l);
- locale = l;
+ if (locale == newLocale)
+ return;
+
+ Locale oldLocale = locale;
+ locale = newLocale;
+ firePropertyChange("locale", oldLocale, newLocale);
// New writing/layout direction or more/less room for localized labels.
invalidate();
}
@@ -1366,7 +1380,7 @@ public abstract class Component
shouldRepaintSelf = parentBounds.intersects(newBounds);
}
- if (shouldRepaintParent)
+ if (shouldRepaintParent && parent != null)
parent.repaint(oldx, oldy, oldwidth, oldheight);
if (shouldRepaintSelf)
repaint();
@@ -1787,7 +1801,8 @@ public abstract class Component
* relative to this component. Subclasses should call either
* <code>super.update(g)</code> or <code>paint(g)</code>.
*
- * @param graphics the graphics context for this update
+ * @param g the graphics context for this update
+ *
* @see #paint(Graphics)
* @see #repaint()
*/
@@ -1808,7 +1823,8 @@ public abstract class Component
/**
* Paints this entire component, including any sub-components.
*
- * @param graphics the graphics context for this paint job
+ * @param g the graphics context for this paint job
+ *
* @see #paint(Graphics)
*/
public void paintAll(Graphics g)
@@ -1870,8 +1886,8 @@ public abstract class Component
* @param tm milliseconds before this component should be repainted
* @param x the X coordinate of the upper left of the region to repaint
* @param y the Y coordinate of the upper left of the region to repaint
- * @param w the width of the region to repaint
- * @param h the height of the region to repaint
+ * @param width the width of the region to repaint
+ * @param height the height of the region to repaint
* @see #update(Graphics)
*/
public void repaint(long tm, int x, int y, int width, int height)
@@ -1891,7 +1907,8 @@ public abstract class Component
* done in a different manner from painting. However, the implementation
* in this class simply calls the <code>paint()</code> method.
*
- * @param graphics the graphics context of the print device
+ * @param g the graphics context of the print device
+ *
* @see #paint(Graphics)
*/
public void print(Graphics g)
@@ -1905,7 +1922,8 @@ public abstract class Component
* painting. However, the implementation in this class simply calls the
* <code>paintAll()</code> method.
*
- * @param graphics the graphics context of the print device
+ * @param g the graphics context of the print device
+ *
* @see #paintAll(Graphics)
*/
public void printAll(Graphics g)
@@ -1923,7 +1941,7 @@ public abstract class Component
*
* <p>The coordinate system used depends on the particular flags.
*
- * @param image the image that has been updated
+ * @param img the image that has been updated
* @param flags tlags as specified in <code>ImageObserver</code>
* @param x the X coordinate
* @param y the Y coordinate
@@ -2270,7 +2288,7 @@ public abstract class Component
{
boolean handled = handleEvent (e);
- if (!handled)
+ if (!handled && getParent() != null)
// FIXME: need to translate event coordinates to parent's
// coordinate space.
handled = getParent ().postEvent (e);
@@ -2289,9 +2307,9 @@ public abstract class Component
* @see #getComponentListeners()
* @since 1.1
*/
- public synchronized void addComponentListener(ComponentListener l)
+ public synchronized void addComponentListener(ComponentListener listener)
{
- componentListener = AWTEventMulticaster.add(componentListener, l);
+ componentListener = AWTEventMulticaster.add(componentListener, listener);
if (componentListener != null)
enableEvents(AWTEvent.COMPONENT_EVENT_MASK);
}
@@ -2306,9 +2324,9 @@ public abstract class Component
* @see #getComponentListeners()
* @since 1.1
*/
- public synchronized void removeComponentListener(ComponentListener l)
+ public synchronized void removeComponentListener(ComponentListener listener)
{
- componentListener = AWTEventMulticaster.remove(componentListener, l);
+ componentListener = AWTEventMulticaster.remove(componentListener, listener);
}
/**
@@ -2337,9 +2355,9 @@ public abstract class Component
* @see #getFocusListeners()
* @since 1.1
*/
- public synchronized void addFocusListener(FocusListener l)
+ public synchronized void addFocusListener(FocusListener listener)
{
- focusListener = AWTEventMulticaster.add(focusListener, l);
+ focusListener = AWTEventMulticaster.add(focusListener, listener);
if (focusListener != null)
enableEvents(AWTEvent.FOCUS_EVENT_MASK);
}
@@ -2354,9 +2372,9 @@ public abstract class Component
* @see #getFocusListeners()
* @since 1.1
*/
- public synchronized void removeFocusListener(FocusListener l)
+ public synchronized void removeFocusListener(FocusListener listener)
{
- focusListener = AWTEventMulticaster.remove(focusListener, l);
+ focusListener = AWTEventMulticaster.remove(focusListener, listener);
}
/**
@@ -2384,9 +2402,9 @@ public abstract class Component
* @see #getHierarchyListeners()
* @since 1.3
*/
- public synchronized void addHierarchyListener(HierarchyListener l)
+ public synchronized void addHierarchyListener(HierarchyListener listener)
{
- hierarchyListener = AWTEventMulticaster.add(hierarchyListener, l);
+ hierarchyListener = AWTEventMulticaster.add(hierarchyListener, listener);
if (hierarchyListener != null)
enableEvents(AWTEvent.HIERARCHY_EVENT_MASK);
}
@@ -2401,9 +2419,9 @@ public abstract class Component
* @see #getHierarchyListeners()
* @since 1.3
*/
- public synchronized void removeHierarchyListener(HierarchyListener l)
+ public synchronized void removeHierarchyListener(HierarchyListener listener)
{
- hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, l);
+ hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, listener);
}
/**
@@ -2433,10 +2451,10 @@ public abstract class Component
* @since 1.3
*/
public synchronized void
- addHierarchyBoundsListener(HierarchyBoundsListener l)
+ addHierarchyBoundsListener(HierarchyBoundsListener listener)
{
hierarchyBoundsListener =
- AWTEventMulticaster.add(hierarchyBoundsListener, l);
+ AWTEventMulticaster.add(hierarchyBoundsListener, listener);
if (hierarchyBoundsListener != null)
enableEvents(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK);
}
@@ -2452,10 +2470,10 @@ public abstract class Component
* @since 1.3
*/
public synchronized void
- removeHierarchyBoundsListener(HierarchyBoundsListener l)
+ removeHierarchyBoundsListener(HierarchyBoundsListener listener)
{
hierarchyBoundsListener =
- AWTEventMulticaster.remove(hierarchyBoundsListener, l);
+ AWTEventMulticaster.remove(hierarchyBoundsListener, listener);
}
/**
@@ -2484,9 +2502,9 @@ public abstract class Component
* @see #getKeyListeners()
* @since 1.1
*/
- public synchronized void addKeyListener(KeyListener l)
+ public synchronized void addKeyListener(KeyListener listener)
{
- keyListener = AWTEventMulticaster.add(keyListener, l);
+ keyListener = AWTEventMulticaster.add(keyListener, listener);
if (keyListener != null)
enableEvents(AWTEvent.KEY_EVENT_MASK);
}
@@ -2501,9 +2519,9 @@ public abstract class Component
* @see #getKeyListeners()
* @since 1.1
*/
- public synchronized void removeKeyListener(KeyListener l)
+ public synchronized void removeKeyListener(KeyListener listener)
{
- keyListener = AWTEventMulticaster.remove(keyListener, l);
+ keyListener = AWTEventMulticaster.remove(keyListener, listener);
}
/**
@@ -2531,9 +2549,9 @@ public abstract class Component
* @see #getMouseListeners()
* @since 1.1
*/
- public synchronized void addMouseListener(MouseListener l)
+ public synchronized void addMouseListener(MouseListener listener)
{
- mouseListener = AWTEventMulticaster.add(mouseListener, l);
+ mouseListener = AWTEventMulticaster.add(mouseListener, listener);
if (mouseListener != null)
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
}
@@ -2548,9 +2566,9 @@ public abstract class Component
* @see #getMouseListeners()
* @since 1.1
*/
- public synchronized void removeMouseListener(MouseListener l)
+ public synchronized void removeMouseListener(MouseListener listener)
{
- mouseListener = AWTEventMulticaster.remove(mouseListener, l);
+ mouseListener = AWTEventMulticaster.remove(mouseListener, listener);
}
/**
@@ -2578,9 +2596,9 @@ public abstract class Component
* @see #getMouseMotionListeners()
* @since 1.1
*/
- public synchronized void addMouseMotionListener(MouseMotionListener l)
+ public synchronized void addMouseMotionListener(MouseMotionListener listener)
{
- mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, l);
+ mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener);
if (mouseMotionListener != null)
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
}
@@ -2595,9 +2613,9 @@ public abstract class Component
* @see #getMouseMotionListeners()
* @since 1.1
*/
- public synchronized void removeMouseMotionListener(MouseMotionListener l)
+ public synchronized void removeMouseMotionListener(MouseMotionListener listener)
{
- mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, l);
+ mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, listener);
}
/**
@@ -2627,9 +2645,9 @@ public abstract class Component
* @see #getMouseWheelListeners()
* @since 1.4
*/
- public synchronized void addMouseWheelListener(MouseWheelListener l)
+ public synchronized void addMouseWheelListener(MouseWheelListener listener)
{
- mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, l);
+ mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, listener);
if (mouseWheelListener != null)
enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
}
@@ -2645,9 +2663,9 @@ public abstract class Component
* @see #getMouseWheelListeners()
* @since 1.4
*/
- public synchronized void removeMouseWheelListener(MouseWheelListener l)
+ public synchronized void removeMouseWheelListener(MouseWheelListener listener)
{
- mouseWheelListener = AWTEventMulticaster.remove(mouseWheelListener, l);
+ mouseWheelListener = AWTEventMulticaster.remove(mouseWheelListener, listener);
}
/**
@@ -2677,9 +2695,9 @@ public abstract class Component
* @see #getInputMethodRequests()
* @since 1.2
*/
- public synchronized void addInputMethodListener(InputMethodListener l)
+ public synchronized void addInputMethodListener(InputMethodListener listener)
{
- inputMethodListener = AWTEventMulticaster.add(inputMethodListener, l);
+ inputMethodListener = AWTEventMulticaster.add(inputMethodListener, listener);
if (inputMethodListener != null)
enableEvents(AWTEvent.INPUT_METHOD_EVENT_MASK);
}
@@ -2694,9 +2712,9 @@ public abstract class Component
* @see #getInputMethodRequests()
* @since 1.2
*/
- public synchronized void removeInputMethodListener(InputMethodListener l)
+ public synchronized void removeInputMethodListener(InputMethodListener listener)
{
- inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, l);
+ inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, listener);
}
/**
@@ -2858,7 +2876,7 @@ public abstract class Component
* Processes the specified event. In this class, this method simply
* calls one of the more specific event handlers.
*
- * @param event the event to process
+ * @param e the event to process
* @throws NullPointerException if e is null
* @see #processComponentEvent(ComponentEvent)
* @see #processFocusEvent(FocusEvent)
@@ -2909,7 +2927,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners
* that are attached.
*
- * @param event the <code>ComponentEvent</code> to process
+ * @param e the <code>ComponentEvent</code> to process
* @throws NullPointerException if e is null
* @see ComponentListener
* @see #addComponentListener(ComponentListener)
@@ -2942,7 +2960,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners
* that are attached.
*
- * @param event the <code>FocusEvent</code> to process
+ * @param e the <code>FocusEvent</code> to process
* @throws NullPointerException if e is null
* @see FocusListener
* @see #addFocusListener(FocusListener)
@@ -2970,7 +2988,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners
* that are attached.
*
- * @param event the <code>KeyEvent</code> to process
+ * @param e the <code>KeyEvent</code> to process
* @throws NullPointerException if e is null
* @see KeyListener
* @see #addKeyListener(KeyListener)
@@ -3000,7 +3018,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners
* that are attached.
*
- * @param event the <code>MouseEvent</code> to process
+ * @param e the <code>MouseEvent</code> to process
* @throws NullPointerException if e is null
* @see MouseListener
* @see #addMouseListener(MouseListener)
@@ -3037,7 +3055,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners
* that are attached.
*
- * @param event the <code>MouseMotionEvent</code> to process
+ * @param e the <code>MouseMotionEvent</code> to process
* @throws NullPointerException if e is null
* @see MouseMotionListener
* @see #addMouseMotionListener(MouseMotionListener)
@@ -3065,7 +3083,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners that are
* attached.
*
- * @param event the <code>MouseWheelEvent</code> to process
+ * @param e the <code>MouseWheelEvent</code> to process
* @throws NullPointerException if e is null
* @see MouseWheelListener
* @see #addMouseWheelListener(MouseWheelListener)
@@ -3087,7 +3105,7 @@ public abstract class Component
* enabled. This method passes the event along to any listeners that are
* attached.
*
- * @param event the <code>InputMethodEvent</code> to process
+ * @param e the <code>InputMethodEvent</code> to process
* @throws NullPointerException if e is null
* @see InputMethodListener
* @see #addInputMethodListener(InputMethodListener)
@@ -3114,7 +3132,7 @@ public abstract class Component
* are enabled. This method passes the event along to any listeners that are
* attached.
*
- * @param event the <code>HierarchyEvent</code> to process
+ * @param e the <code>HierarchyEvent</code> to process
* @throws NullPointerException if e is null
* @see HierarchyListener
* @see #addHierarchyListener(HierarchyListener)
@@ -3134,7 +3152,7 @@ public abstract class Component
* are enabled. This method passes the event along to any listeners that are
* attached.
*
- * @param event the <code>HierarchyEvent</code> to process
+ * @param e the <code>HierarchyEvent</code> to process
* @throws NullPointerException if e is null
* @see HierarchyBoundsListener
* @see #addHierarchyBoundsListener(HierarchyBoundsListener)
@@ -3587,11 +3605,16 @@ public abstract class Component
*
* @param id one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS,
* or UP_CYCLE_TRAVERSAL_KEYS
+ *
+ * @return set of traversal keys
+ *
* @throws IllegalArgumentException if id is invalid
+ *
* @see #setFocusTraversalKeys (int, Set)
* @see KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
* @see KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
* @see KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
+ *
* @since 1.4
*/
public Set getFocusTraversalKeys (int id)
@@ -4087,8 +4110,10 @@ public abstract class Component
/**
* Adds the specified popup menu to this component.
*
- * @param menu the popup menu to be added
+ * @param popup the popup menu to be added
+ *
* @see #remove(MenuComponent)
+ *
* @since 1.1
*/
public synchronized void add(PopupMenu popup)
@@ -4107,7 +4132,7 @@ public abstract class Component
/**
* Removes the specified popup menu from this component.
*
- * @param menu the popup menu to remove
+ * @param popup the popup menu to remove
* @see #add(PopupMenu)
* @since 1.1
*/
@@ -4168,7 +4193,7 @@ public abstract class Component
/**
* Prints a listing of this component to the specified print stream.
*
- * @param stream the <code>PrintStream</code> to print to
+ * @param out the <code>PrintStream</code> to print to
*/
public void list(PrintStream out)
{
@@ -4179,7 +4204,7 @@ public abstract class Component
* Prints a listing of this component to the specified print stream,
* starting at the specified indentation point.
*
- * @param stream the <code>PrintStream</code> to print to
+ * @param out the <code>PrintStream</code> to print to
* @param indent the indentation point
*/
public void list(PrintStream out, int indent)
@@ -4192,7 +4217,7 @@ public abstract class Component
/**
* Prints a listing of this component to the specified print writer.
*
- * @param writer the <code>PrintWrinter</code> to print to
+ * @param out the <code>PrintWrinter</code> to print to
* @since 1.1
*/
public void list(PrintWriter out)
@@ -4204,7 +4229,7 @@ public abstract class Component
* Prints a listing of this component to the specified print writer,
* starting at the specified indentation point.
*
- * @param writer the <code>PrintWriter</code> to print to
+ * @param out the <code>PrintWriter</code> to print to
* @param indent the indentation point
* @since 1.1
*/
@@ -4505,7 +4530,7 @@ p * <li>the set of backward traversal keys
*
* @return an AWT 1.0 event representing e
*/
- private Event translateEvent (AWTEvent e)
+ static Event translateEvent (AWTEvent e)
{
Component target = (Component) e.getSource ();
Event translated = null;
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index e0ad22c..6c835d2 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -35,28 +35,29 @@ 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 java.awt;
-import java.awt.event.AWTEventListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
-import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.awt.peer.ContainerPeer;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.ObjectInputStream;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.util.Collections;
import java.util.EventListener;
-import java.util.Iterator;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
+
import javax.accessibility.Accessible;
import javax.swing.SwingUtilities;
@@ -146,7 +147,7 @@ public class Container extends Component
/**
* Returns the component at the specified index.
*
- * @param index The index of the component to retrieve.
+ * @param n The index of the component to retrieve.
*
* @return The requested component.
*
@@ -230,7 +231,7 @@ public class Container extends Component
* Adds the specified component to this container at the end of the
* component list.
*
- * @param component The component to add to the container.
+ * @param comp The component to add to the container.
*
* @return The same component that was added.
*/
@@ -246,7 +247,7 @@ public class Container extends Component
* <code>add(Component, Object)</code>.
*
* @param name The name of the component to be added.
- * @param component The component to be added.
+ * @param comp The component to be added.
*
* @return The same component that was added.
*
@@ -262,7 +263,7 @@ public class Container extends Component
* Adds the specified component to this container at the specified index
* in the component list.
*
- * @param component The component to be added.
+ * @param comp The component to be added.
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
*
@@ -281,7 +282,7 @@ public class Container extends Component
* component list. The layout manager will use the specified constraints
* when laying out this component.
*
- * @param component The component to be added to this container.
+ * @param comp The component to be added to this container.
* @param constraints The layout constraints for this component.
*/
public void add(Component comp, Object constraints)
@@ -294,7 +295,7 @@ public class Container extends Component
* in the component list. The layout manager will use the specified
* constraints when layout out this component.
*
- * @param component The component to be added.
+ * @param comp The component to be added.
* @param constraints The layout constraints for this component.
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
@@ -313,7 +314,7 @@ public class Container extends Component
* method. Any subclass doing this must call the superclass version of
* this method in order to ensure proper functioning of the container.
*
- * @param component The component to be added.
+ * @param comp The component to be added.
* @param constraints The layout constraints for this component, or
* <code>null</code> if there are no constraints.
* @param index The index in the component list to insert this child
@@ -339,8 +340,6 @@ public class Container extends Component
comp.parent = this;
if (peer != null)
{
- comp.addNotify();
-
if (comp.isLightweight ())
{
enableEvents (comp.eventMask);
@@ -527,7 +526,7 @@ public class Container extends Component
/**
* Recursively invalidates the container tree.
*/
- private void invalidateTree()
+ void invalidateTree()
{
for (int i = 0; i < ncomponents; i++)
{
@@ -554,10 +553,19 @@ public class Container extends Component
cPeer.beginValidate();
}
- doLayout();
for (int i = 0; i < ncomponents; ++i)
{
Component comp = component[i];
+
+ if (comp.getPeer () == null)
+ comp.addNotify();
+ }
+
+ doLayout ();
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ Component comp = component[i];
+
if (! comp.isValid())
{
if (comp instanceof Container)
@@ -572,8 +580,8 @@ public class Container extends Component
}
/* children will call invalidate() when they are layed out. It
- is therefore imporant that valid is not set to true
- before after the children has been layed out. */
+ is therefore important that valid is not set to true
+ until after the children have been layed out. */
valid = true;
if (cPeer != null)
@@ -698,12 +706,14 @@ public class Container extends Component
* a superclass method so that lightweight components are properly
* drawn.
*
- * @param graphics The graphics context for this paint job.
+ * @param g The graphics context for this paint job.
*/
public void paint(Graphics g)
{
if (!isShowing())
return;
+ // Paint self first.
+ super.paint(g);
// Visit heavyweights as well, in case they were
// erased when we cleared the background for this container.
visitChildren(g, GfxPaintVisitor.INSTANCE, false);
@@ -716,7 +726,7 @@ public class Container extends Component
* a superclass method so that lightweight components are properly
* drawn.
*
- * @param graphics The graphics context for this update.
+ * @param g The graphics context for this update.
*/
public void update(Graphics g)
{
@@ -730,7 +740,7 @@ public class Container extends Component
* a superclass method so that lightweight components are properly
* drawn.
*
- * @param graphics The graphics context for this print job.
+ * @param g The graphics context for this print job.
*/
public void print(Graphics g)
{
@@ -741,7 +751,7 @@ public class Container extends Component
/**
* Paints all of the components in this container.
*
- * @param graphics The graphics context for this paint job.
+ * @param g The graphics context for this paint job.
*/
public void paintComponents(Graphics g)
{
@@ -752,7 +762,7 @@ public class Container extends Component
/**
* Prints all of the components in this container.
*
- * @param graphics The graphics context for this print job.
+ * @param g The graphics context for this print job.
*/
public void printComponents(Graphics g)
{
@@ -766,9 +776,9 @@ public class Container extends Component
*
* @param listener The listener to add.
*/
- public synchronized void addContainerListener(ContainerListener l)
+ public synchronized void addContainerListener(ContainerListener listener)
{
- containerListener = AWTEventMulticaster.add(containerListener, l);
+ containerListener = AWTEventMulticaster.add(containerListener, listener);
}
/**
@@ -777,9 +787,9 @@ public class Container extends Component
*
* @param listener The listener to remove.
*/
- public synchronized void removeContainerListener(ContainerListener l)
+ public synchronized void removeContainerListener(ContainerListener listener)
{
- containerListener = AWTEventMulticaster.remove(containerListener, l);
+ containerListener = AWTEventMulticaster.remove(containerListener, listener);
}
/**
@@ -815,7 +825,7 @@ public class Container extends Component
* <code>ContainerEvent</code>, otherwise it calls the superclass
* method.
*
- * @param event The event to be processed.
+ * @param e The event to be processed.
*/
protected void processEvent(AWTEvent e)
{
@@ -829,7 +839,7 @@ public class Container extends Component
* Called when a container event occurs if container events are enabled.
* This method calls any registered listeners.
*
- * @param event The event that occurred.
+ * @param e The event that occurred.
*/
protected void processContainerEvent(ContainerEvent e)
{
@@ -850,7 +860,7 @@ public class Container extends Component
/**
* AWT 1.0 event processor.
*
- * @param event The event that occurred.
+ * @param e The event that occurred.
*
* @deprecated use {@link #dispatchEvent(AWTEvent)} instead
*/
@@ -895,7 +905,8 @@ public class Container extends Component
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
*
- * @param point The point to return the component at.
+ * @param x The x position of the point to return the component at.
+ * @param y The y position of the point to return the component at.
*
* @return The component containing the specified point, or <code>null</code>
* if there is no such point.
@@ -931,7 +942,7 @@ public class Container extends Component
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
*
- * @param point The point to return the component at.
+ * @param p The point to return the component at.
* @return The component containing the specified point, or <code>null</code>
* if there is no such point.
*/
@@ -1007,7 +1018,7 @@ public class Container extends Component
* Tests whether or not the specified component is contained within
* this components subtree.
*
- * @param component The component to test.
+ * @param comp The component to test.
*
* @return <code>true</code> if this container is an ancestor of the
* specified component, <code>false</code> otherwise.
@@ -1046,7 +1057,7 @@ public class Container extends Component
* Writes a listing of this container to the specified stream starting
* at the specified indentation point.
*
- * @param stream The <code>PrintStream</code> to write to.
+ * @param out The <code>PrintStream</code> to write to.
* @param indent The indentation point.
*/
public void list(PrintStream out, int indent)
@@ -1063,7 +1074,7 @@ public class Container extends Component
* Writes a listing of this container to the specified stream starting
* at the specified indentation point.
*
- * @param stream The <code>PrintWriter</code> to write to.
+ * @param out The <code>PrintWriter</code> to write to.
* @param indent The indentation point.
*/
public void list(PrintWriter out, int indent)
diff --git a/libjava/java/awt/DefaultKeyboardFocusManager.java b/libjava/java/awt/DefaultKeyboardFocusManager.java
index 7912e29..800b01d 100644
--- a/libjava/java/awt/DefaultKeyboardFocusManager.java
+++ b/libjava/java/awt/DefaultKeyboardFocusManager.java
@@ -1,5 +1,5 @@
/* DefaultKeyboardFocusManager.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,15 @@ exception statement from your version. */
package java.awt;
-import java.util.*;
-import java.awt.event.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
// FIXME: finish documentation
public class DefaultKeyboardFocusManager extends KeyboardFocusManager
@@ -164,18 +171,15 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
if (e.id == FocusEvent.FOCUS_GAINED)
{
- if (((FocusEvent) e).isTemporary ())
- setGlobalFocusOwner (target);
- else
- setGlobalPermanentFocusOwner (target);
- }
- else if (e.id == FocusEvent.FOCUS_LOST)
- {
- // We need to set the window's focus owner here; we can't
- // set it when the window loses focus because by that time
- // the previous focus owner has already lost focus
- // (FOCUS_LOST events are delivered before
- // WINDOW_LOST_FOCUS events).
+ if (! (target instanceof Window))
+ {
+ if (((FocusEvent) e).isTemporary ())
+ setGlobalFocusOwner (target);
+ else
+ setGlobalPermanentFocusOwner (target);
+ }
+
+ // Keep track of this window's focus owner.
// Find the target Component's top-level ancestor.
Container parent = target.getParent ();
@@ -188,9 +192,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
(Window) target : (Window) parent;
Component focusOwner = getFocusOwner ();
- if (focusOwner != null)
+ if (focusOwner != null
+ && ! (focusOwner instanceof Window))
toplevel.setFocusOwner (focusOwner);
-
+ }
+ else if (e.id == FocusEvent.FOCUS_LOST)
+ {
if (((FocusEvent) e).isTemporary ())
setGlobalFocusOwner (null);
else
diff --git a/libjava/java/awt/EventDispatchThread.java b/libjava/java/awt/EventDispatchThread.java
index 89b6095..0803ff6 100644
--- a/libjava/java/awt/EventDispatchThread.java
+++ b/libjava/java/awt/EventDispatchThread.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* EventDispatchThread.java -
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,22 +35,22 @@ 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. */
-/** @author Bryce McKinlay */
-
-/* Status: believed complete, but untested. */
-
package java.awt;
+/**
+ * @author Bryce McKinlay
+ * @status believed complete, but untested.
+ */
class EventDispatchThread extends Thread
{
- private static int dispatchThreadNum = 1;
+ private static int dispatchThreadNum;
private EventQueue queue;
EventDispatchThread(EventQueue queue)
{
super();
- setName("AWT-EventQueue-" + dispatchThreadNum++);
+ setName("AWT-EventQueue-" + ++dispatchThreadNum);
this.queue = queue;
setPriority(NORM_PRIORITY + 1);
start();
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java
index 1c794d4..fd1c806 100644
--- a/libjava/java/awt/EventQueue.java
+++ b/libjava/java/awt/EventQueue.java
@@ -155,7 +155,7 @@ public class EventQueue
/**
* Posts a new event to the queue.
*
- * @param event The event to post to the queue.
+ * @param evt The event to post to the queue.
*
* @exception NullPointerException If event is null.
*/
diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java
index 854d092..e345018 100644
--- a/libjava/java/awt/FileDialog.java
+++ b/libjava/java/awt/FileDialog.java
@@ -1,5 +1,5 @@
/* FileDialog.java -- A filename selection dialog box
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FileDialogPeer;
-import java.awt.peer.DialogPeer;
import java.io.FilenameFilter;
import java.io.Serializable;
@@ -262,7 +261,7 @@ setFile(String file)
/**
* Returns the filename filter being used by this dialog.
*
- * @param The filename filter being used by this dialog.
+ * @return The filename filter being used by this dialog.
*/
public FilenameFilter
getFilenameFilter()
diff --git a/libjava/java/awt/FlowLayout.java b/libjava/java/awt/FlowLayout.java
index 98d7494..eb2bc98 100644
--- a/libjava/java/awt/FlowLayout.java
+++ b/libjava/java/awt/FlowLayout.java
@@ -1,6 +1,5 @@
-// FlowLayout.java - Grid-based layout engine
-
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+/* FlowLayout.java -- Grid-based layout engine
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -47,7 +46,7 @@ import java.io.Serializable;
* supports horizontal and vertical gaps. These are used for spacing
* between components.
*
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class FlowLayout implements LayoutManager, Serializable
@@ -69,8 +68,12 @@ public class FlowLayout implements LayoutManager, Serializable
// Serialization constant
private static final long serialVersionUID = -7262534875583282631L;
- /** Add a new component to the layout. This particular implementation
+ /**
+ * Add a new component to the layout. This particular implementation
* does nothing.
+ *
+ * @param name the name
+ * @param comp the component
*/
public void addLayoutComponent (String name, Component comp)
{
diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java
index 754e078..4b2ad5a 100644
--- a/libjava/java/awt/Font.java
+++ b/libjava/java/awt/Font.java
@@ -38,35 +38,33 @@ exception statement from your version. */
package java.awt;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathFontPeer;
+
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.font.LineMetrics;
-import java.awt.font.TextAttribute;
-import java.awt.font.TransformAttribute;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.peer.FontPeer;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Serializable;
+import java.text.AttributedCharacterIterator;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.HashMap;
import java.util.StringTokenizer;
-import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
-import java.text.StringCharacterIterator;
-
-import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathFontPeer;
/**
- * This class represents a windowing system font.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Graydon Hoare <graydon@redhat.com>
- */
+ * This class represents a windowing system font.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Graydon Hoare (graydon@redhat.com)
+ */
public class Font implements Serializable
{
@@ -163,6 +161,26 @@ public static final int HANGING_BASELINE = 2;
*/
public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
+ /**
+ * The logical name of this font.
+ *
+ * @since 1.0
+ */
+ protected String name;
+
+ /**
+ * The size of this font in pixels.
+ *
+ * @since 1.0
+ */
+ protected int size;
+
+ /**
+ * The style of this font -- PLAIN, BOLD, ITALIC or BOLD+ITALIC.
+ *
+ * @since 1.0
+ */
+ protected int style;
// Serialization constant
private static final long serialVersionUID = -4206021311591459213L;
@@ -235,7 +253,11 @@ private static final long serialVersionUID = -4206021311591459213L;
size = tokenval;
}
- return getFontFromToolkit (name, attrsToMap (style, size));
+ HashMap attrs = new HashMap();
+ ClasspathFontPeer.copyStyleToAttrs (style, attrs);
+ ClasspathFontPeer.copySizeToAttrs (size, attrs);
+
+ return getFontFromToolkit (name, attrs);
}
/* These methods delegate to the toolkit. */
@@ -245,23 +267,6 @@ private static final long serialVersionUID = -4206021311591459213L;
return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
}
- protected static Map attrsToMap(int style, int size)
- {
- Map attrs = new HashMap();
- attrs.put (TextAttribute.SIZE, new Float ((float)size));
-
- if ((style & BOLD) == BOLD)
- attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
- else
- attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR);
-
- if ((style & ITALIC) == ITALIC)
- attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
- else
- attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
- return attrs;
- }
-
/* Every factory method in Font should eventually call this. */
protected static Font getFontFromToolkit (String name, Map attribs)
{
@@ -281,7 +286,7 @@ private static final long serialVersionUID = -4206021311591459213L;
* Returns a <code>Font</code> object from the passed property name.
*
* @param propname The name of the system property.
- * @param default Value to use if the property is not found.
+ * @param defval Value to use if the property is not found.
*
* @return The requested font, or <code>default</code> if the property
* not exist or is malformed.
@@ -326,7 +331,10 @@ private static final long serialVersionUID = -4206021311591459213L;
public Font (String name, int style, int size)
{
- this.peer = getPeerFromToolkit (name, attrsToMap (style, size));
+ HashMap attrs = new HashMap();
+ ClasspathFontPeer.copyStyleToAttrs (style, attrs);
+ ClasspathFontPeer.copySizeToAttrs (size, attrs);
+ this.peer = getPeerFromToolkit (name, attrs);
}
public Font (Map attrs)
@@ -629,7 +637,7 @@ private static final long serialVersionUID = -4206021311591459213L;
* GlyphVector} with a mapped glyph for each input glyph code.
*
* @param ctx The rendering context used for precise glyph placement.
- * @param chars Array of characters to convert to glyphs.
+ * @param glyphCodes Array of characters to convert to glyphs.
*
* @return A new {@link GlyphVector} containing glyphs mapped from str,
* through the font's cmap table.
diff --git a/libjava/java/awt/FontMetrics.java b/libjava/java/awt/FontMetrics.java
index cb76f50..1520d59 100644
--- a/libjava/java/awt/FontMetrics.java
+++ b/libjava/java/awt/FontMetrics.java
@@ -38,6 +38,10 @@ exception statement from your version. */
package java.awt;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.text.CharacterIterator;
+
// FIXME: I leave many methods basically unimplemented. This
// should be reviewed.
@@ -349,6 +353,111 @@ toString()
+ ",descent=" + getDescent() + ",height=" + getHeight() + "]");
}
-} // class FontMetrics
+// Generic FontRenderContext used when getLineMetrics is called with a
+// plain Graphics object.
+private static final FontRenderContext gRC = new FontRenderContext(null,
+ false,
+ false);
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param text The string to calculate metrics from.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ */
+public LineMetrics getLineMetrics(String text, Graphics g)
+{
+ return getLineMetrics(text, 0, text.length(), g);
+}
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param text The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
+public LineMetrics getLineMetrics(String text, int begin,
+ int limit, Graphics g)
+{
+ FontRenderContext rc;
+ if (g instanceof Graphics2D)
+ rc = ((Graphics2D) g).getFontRenderContext();
+ else
+ rc = gRC;
+ return font.getLineMetrics(text, begin, limit, rc);
+}
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param chars The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
+public LineMetrics getLineMetrics(char[] chars, int begin,
+ int limit, Graphics g)
+{
+ FontRenderContext rc;
+ if (g instanceof Graphics2D)
+ rc = ((Graphics2D) g).getFontRenderContext();
+ else
+ rc = gRC;
+ return font.getLineMetrics(chars, begin, limit, rc);
+}
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param ci An iterator over the string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
+public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
+ int limit, Graphics g)
+{
+ FontRenderContext rc;
+ if (g instanceof Graphics2D)
+ rc = ((Graphics2D) g).getFontRenderContext();
+ else
+ rc = gRC;
+ return font.getLineMetrics(ci, begin, limit, rc);
+}
+}
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
index dd8cdeb..80d2c99 100644
--- a/libjava/java/awt/Frame.java
+++ b/libjava/java/awt/Frame.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FramePeer;
-import java.util.Enumeration;
import java.util.Vector;
/**
@@ -199,8 +198,8 @@ private String title = "";
/*
* The number used to generate the name returned by getName.
- */
- private static transient long next_frame_number = 0;
+ */
+ private static transient long next_frame_number;
/**
* Initializes a new instance of <code>Frame</code> that is not visible
@@ -317,6 +316,7 @@ setMenuBar(MenuBar menuBar)
this.menuBar.removeNotify();
if (menuBar != null)
menuBar.addNotify();
+ invalidateTree ();
((FramePeer) peer).setMenuBar(menuBar);
}
this.menuBar = menuBar;
diff --git a/libjava/java/awt/Graphics.java b/libjava/java/awt/Graphics.java
index c75d34e..8dc703c 100644
--- a/libjava/java/awt/Graphics.java
+++ b/libjava/java/awt/Graphics.java
@@ -243,7 +243,7 @@ getClipRect()
* region and the rectangle determined by the specified parameters.
*
* @param x The X coordinate of the upper left corner of the intersect rect.
- * @param Y The Y coordinate of the upper left corner of the intersect rect.
+ * @param y The Y coordinate of the upper left corner of the intersect rect.
* @param width The width of the intersect rect.
* @param height The height of the intersect rect.
*/
@@ -279,7 +279,7 @@ getClip();
/**
* Sets the clipping region to the specified <code>Shape</code>.
*
- * @param shape The new clipping region.
+ * @param clip The new clipping region.
*/
public abstract void
setClip(Shape clip);
@@ -371,7 +371,7 @@ clearRect(int x, int y, int width, int height);
* @param width The width of the draw rect.
* @param height The height of the draw rect.
* @param arcWidth The width of the corner arcs.
- * @param arcHeigth The height of the corner arcs.
+ * @param arcHeight The height of the corner arcs.
*/
public abstract void
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
@@ -386,7 +386,7 @@ drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
* @param width The width of the fill rect.
* @param height The height of the fill rect.
* @param arcWidth The width of the corner arcs.
- * @param arcHeigth The height of the corner arcs.
+ * @param arcHeight The height of the corner arcs.
*/
public abstract void
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
@@ -480,7 +480,7 @@ fillOval(int x, int y, int width, int height);
* @param arcAngle The extent of the arc.
*/
public abstract void
-drawArc(int x, int y, int width, int height, int startAngle, int arcAngle);
+drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
/*************************************************************************/
@@ -498,7 +498,7 @@ drawArc(int x, int y, int width, int height, int startAngle, int arcAngle);
* @param arcAngle The extent of the arc.
*/
public abstract void
-fillArc(int x, int y, int width, int height, int startAngle, int arcAngle);
+fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
/*************************************************************************/
@@ -734,7 +734,7 @@ finalize()
/**
* Returns a string representation of this object.
*
- * @param A string representation of this object.
+ * @return A string representation of this object.
*/
public String
toString()
diff --git a/libjava/java/awt/Graphics2D.java b/libjava/java/awt/Graphics2D.java
index b35f08a..e16c2d8 100644
--- a/libjava/java/awt/Graphics2D.java
+++ b/libjava/java/awt/Graphics2D.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,6 +34,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 java.awt;
import java.awt.font.FontRenderContext;
@@ -41,12 +42,10 @@ import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
-import java.awt.image.RenderedImage;
import java.awt.image.ImageObserver;
+import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
-
import java.text.AttributedCharacterIterator;
-
import java.util.Map;
/**
diff --git a/libjava/java/awt/GraphicsEnvironment.java b/libjava/java/awt/GraphicsEnvironment.java
index 2b4ce51..b963f4b 100644
--- a/libjava/java/awt/GraphicsEnvironment.java
+++ b/libjava/java/awt/GraphicsEnvironment.java
@@ -1,5 +1,5 @@
/* GraphicsEnvironment.java -- information about the graphics environment
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,16 +38,17 @@ exception statement from your version. */
package java.awt;
+import gnu.java.awt.ClasspathToolkit;
+
import java.awt.image.BufferedImage;
import java.util.Locale;
-import gnu.java.awt.ClasspathToolkit;
/**
* This descibes the collection of GraphicsDevice and Font objects available
* on a given platform. The resources might be local or remote, and specify
* the valid configurations for displaying graphics.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see GraphicsDevice
* @see GraphicsConfiguration
* @since 1.4
diff --git a/libjava/java/awt/GridBagConstraints.java b/libjava/java/awt/GridBagConstraints.java
index 651cfdc..2795b9e 100644
--- a/libjava/java/awt/GridBagConstraints.java
+++ b/libjava/java/awt/GridBagConstraints.java
@@ -1,6 +1,5 @@
-// GridBagConstraints.java - Constraints for GridBag layout manager
-
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
+/* GridBagConstraints.java -- Constraints for GridBag layout manager
+ Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -41,8 +40,10 @@ package java.awt;
import java.io.Serializable;
-/** This specifies the constraints for a component managed by the
- * GridBagLayout layout manager. */
+/**
+ * This specifies the constraints for a component managed by the
+ * GridBagLayout layout manager.
+ */
public class GridBagConstraints implements Cloneable, Serializable
{
static final long serialVersionUID = -1000070633030801713L;
diff --git a/libjava/java/awt/GridBagLayout.java b/libjava/java/awt/GridBagLayout.java
index 1239f2c..85fdfb5 100644
--- a/libjava/java/awt/GridBagLayout.java
+++ b/libjava/java/awt/GridBagLayout.java
@@ -1,5 +1,5 @@
/* GridBagLayout - Layout manager for components according to GridBagConstraints
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,8 +40,8 @@ package java.awt;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Hashtable;
import java.util.HashMap;
+import java.util.Hashtable;
/**
* @author Michael Koch <konqueror@gmx.de>
diff --git a/libjava/java/awt/GridLayout.java b/libjava/java/awt/GridLayout.java
index a8befc4..a9e9eac 100644
--- a/libjava/java/awt/GridLayout.java
+++ b/libjava/java/awt/GridLayout.java
@@ -1,6 +1,5 @@
-// GridLayout.java - Grid-based layout engine
-
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* GridLayout.java -- Grid-based layout engine
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -63,7 +62,7 @@ public class GridLayout implements LayoutManager, Serializable
/** Add a new component to the layout. This particular implementation
* does nothing.
* @param name The name of the component to add.
- * @param component The component to add.
+ * @param comp The component to add.
*/
public void addLayoutComponent (String name, Component comp)
{
diff --git a/libjava/java/awt/Image.java b/libjava/java/awt/Image.java
index 451b092..3761771 100644
--- a/libjava/java/awt/Image.java
+++ b/libjava/java/awt/Image.java
@@ -1,5 +1,5 @@
/* Image.java -- superclass for images
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.image.AreaAveragingScaleFilter;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
diff --git a/libjava/java/awt/KeyboardFocusManager.java b/libjava/java/awt/KeyboardFocusManager.java
index 3ae4dd6..6fa56d8 100644
--- a/libjava/java/awt/KeyboardFocusManager.java
+++ b/libjava/java/awt/KeyboardFocusManager.java
@@ -1,5 +1,5 @@
/* KeyboardFocusManager.java -- manage component focusing via the keyboard
- Copyright (C) 2002 Free Software Foundation
+ Copyright (C) 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.KeyEvent;
import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
@@ -55,20 +55,64 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-// FIXME: finish documentation
-
/**
- *
- * FIXME: discuss applet contexts and thread groups and codebases
- * being insulated.
- *
- * FIXME: discuss where default focus traversal key sets apply
- * (inherited by child Components etc.)
+ * The <code>KeyboardFocusManager</code> handles the focusing of
+ * windows for receiving keyboard events. The manager handles
+ * the dispatch of all <code>FocusEvent</code>s and
+ * <code>KeyEvent</code>s, along with <code>WindowEvent</code>s
+ * relating to the focused window. Users can use the manager
+ * to ascertain the current focus owner and fire events.
+ * <br />
+ * <br />
+ * The focus owner is the <code>Component</code> that receives
+ * key events. The focus owner is either the currently focused
+ * window or a component within this window.
+ * <br />
+ * <br />
+ * The underlying native windowing system may denote the active
+ * window or its children with special decorations (e.g. a highlighted
+ * title bar). The active window is always either a <code>Frame</code>
+ * or <code>Dialog</code>, and is either the currently focused
+ * window or its owner.
+ * <br />
+ * <br />
+ * Applets may be partitioned into different applet contexts, according
+ * to their code base. In this case, each context has its own
+ * <code>KeyboardFocusManager</code>, as opposed to the global
+ * manager maintained by applets which share the same context.
+ * Each context is insulated from the others, and they don't interact.
+ * The resulting behaviour, as with context division, depends on the browser
+ * supporting the applets. Regardless, there can only ever be
+ * one focused window, one active window and one focus owner
+ * per <code>ClassLoader</code>.
+ * <br />
+ * <br />
+ * To support this separation of focus managers, the manager instances
+ * and the internal state information is grouped by the
+ * <code>ThreadGroup</code> to which it pertains. With respect to
+ * applets, each code base has its own <code>ThreadGroup</code>, so the
+ * isolation of each context is enforced within the manager.
+ * <br />
+ * <br />
+ * By default, the manager defines TAB and Ctrl+TAB as the
+ * forward focus traversal keys and Shift+TAB and Ctrl+Shift+TAB
+ * as the backward focus traversal keys. No up or down cycle
+ * traversal keys are defined by default. Traversal takes effect
+ * on the firing of a relevant <code>KEY_PRESSED</code> event.
+ * However, all other key events related to the use of the
+ * defined focus traversal key sequence are consumed and not
+ * dispatched.
+ * <br />
+ * <br />
+ * These default traversal keys come into effect on all windows
+ * for which no alternative set of keys is defined. This also
+ * applies recursively to any child components of such a window,
+ * which define no traversal keys of their own.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @author Thomas Fitzsimmons <fitzsim@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
* @since 1.4
- * @status partially updated to 1.4, needs documentation.
*/
public abstract class KeyboardFocusManager
implements KeyEventDispatcher, KeyEventPostProcessor
@@ -182,7 +226,14 @@ public abstract class KeyboardFocusManager
Collections.EMPTY_SET, Collections.EMPTY_SET
};
+ /**
+ * A utility class to support the handling of events relating to property changes.
+ */
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport (this);
+
+ /**
+ * A utility class to support the handling of events relating to vetoable changes.
+ */
private final VetoableChangeSupport vetoableChangeSupport = new VetoableChangeSupport (this);
/** A list of {@link KeyEventDispatcher}s that process {@link
@@ -211,6 +262,10 @@ public abstract class KeyboardFocusManager
public static KeyboardFocusManager getCurrentKeyboardFocusManager ()
{
ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup ();
+
+ if (currentKeyboardFocusManagers.get (currentGroup) == null)
+ setCurrentKeyboardFocusManager (null);
+
return (KeyboardFocusManager) currentKeyboardFocusManagers.get (currentGroup);
}
@@ -623,29 +678,99 @@ public abstract class KeyboardFocusManager
setGlobalObject (currentFocusCycleRoots, cycleRoot, "currentFocusCycleRoot");
}
+ /**
+ * Registers the supplied property change listener for receiving
+ * events caused by the following property changes:
+ *
+ * <ul>
+ * <li>the current focus owner ("focusOwner")</li>
+ * <li>the permanent focus owner ("permanentFocusOwner")</li>
+ * <li>the focused window ("focusedWindow")</li>
+ * <li>the active window ("activeWindow")</li>
+ * <li>the default focus traversal policy ("defaultFocusTraversalPolicy")</li>
+ * <li>the default set of forward traversal keys ("forwardDefaultFocusTraversalKeys")</li>
+ * <li>the default set of backward traversal keys ("backwardDefaultFocusTraversalKeys")</li>
+ * <li>the default set of up cycle traversal keys ("upCycleDefaultFocusTraversalKeys")</li>
+ * <li>the default set of down cycle traversal keys ("downCycleDefaultFocusTraversalKeys")</li>
+ * <li>the current focus cycle root ("currentFocusCycleRoot")</li>
+ * </ul>
+ *
+ * If the supplied listener is null, nothing occurs.
+ *
+ * @param l the new listener to register.
+ * @see KeyboardFocusManager#addPropertyChangeListener(String, java.beans.PropertyChangeListener)
+ */
public void addPropertyChangeListener(PropertyChangeListener l)
{
if (l != null)
propertyChangeSupport.addPropertyChangeListener(l);
}
+ /**
+ * Removes the supplied property change listener from the list
+ * of registered listeners. If the supplied listener is null,
+ * nothing occurs.
+ *
+ * @param l the listener to remove.
+ */
public void removePropertyChangeListener(PropertyChangeListener l)
{
if (l != null)
propertyChangeSupport.removePropertyChangeListener(l);
}
+ /**
+ * Returns the currently registered property change listeners
+ * in array form. The returned array is empty if no listeners are
+ * currently registered.
+ *
+ * @return an array of registered property change listeners.
+ */
public PropertyChangeListener[] getPropertyChangeListeners()
{
return propertyChangeSupport.getPropertyChangeListeners();
}
+ /**
+ * Registers a property change listener for receiving events relating
+ * to a change to a specified property. The supplied property name can be
+ * either user-defined or one from the following list of properties
+ * relevant to this class:
+ *
+ * <ul>
+ * <li>the current focus owner ("focusOwner")</li>
+ * <li>the permanent focus owner ("permanentFocusOwner")</li>
+ * <li>the focused window ("focusedWindow")</li>
+ * <li>the active window ("activeWindow")</li>
+ * <li>the default focus traversal policy ("defaultFocusTraversalPolicy")</li>
+ * <li>the default set of forward traversal keys ("forwardDefaultFocusTraversalKeys")</li>
+ * <li>the default set of backward traversal keys ("backwardDefaultFocusTraversalKeys")</li>
+ * <li>the default set of up cycle traversal keys ("upCycleDefaultFocusTraversalKeys")</li>
+ * <li>the default set of down cycle traversal keys ("downCycleDefaultFocusTraversalKeys")</li>
+ * <li>the current focus cycle root ("currentFocusCycleRoot")</li>
+ * </ul>
+ *
+ * Nothing occurs if a null listener is supplied. null is regarded as a valid property name.
+ *
+ * @param name the name of the property to handle change events for.
+ * @param l the listener to register for changes to the specified property.
+ * @see KeyboardFocusManager#addPropertyChangeListener(java.beans.PropertyChangeListener)
+ */
public void addPropertyChangeListener(String name, PropertyChangeListener l)
{
if (l != null)
propertyChangeSupport.addPropertyChangeListener(name, l);
}
+ /**
+ * Removes the supplied property change listener registered for the
+ * specified property from the list of registered listeners. If the
+ * supplied listener is null, nothing occurs.
+ *
+ * @param name the name of the property the listener is
+ * monitoring changes to.
+ * @param l the listener to remove.
+ */
public void removePropertyChangeListener(String name,
PropertyChangeListener l)
{
@@ -653,39 +778,117 @@ public abstract class KeyboardFocusManager
propertyChangeSupport.removePropertyChangeListener(name, l);
}
+ /**
+ * Returns the currently registered property change listeners
+ * in array form, which listen for changes to the supplied property.
+ * The returned array is empty, if no listeners are currently registered
+ * for events pertaining to the supplied property.
+ *
+ * @param name The property the returned listeners monitor for changes.
+ * @return an array of registered property change listeners which
+ * listen for changes to the supplied property.
+ */
public PropertyChangeListener[] getPropertyChangeListeners(String name)
{
return propertyChangeSupport.getPropertyChangeListeners(name);
}
+ /**
+ * Fires a property change event as a response to a change to
+ * to the specified property. The event is only fired if a
+ * change has actually occurred (i.e. o and n are different).
+ *
+ * @param name The name of the property to which a change occurred.
+ * @param o The old value of the property.
+ * @param n The new value of the property.
+ */
protected void firePropertyChange(String name, Object o, Object n)
{
propertyChangeSupport.firePropertyChange(name, o, n);
}
+ /**
+ * Registers a vetoable property change listener for receiving events
+ * relating to the following properties:
+ *
+ * <ul>
+ * <li>the current focus owner ("focusOwner")</li>
+ * <li>the permanent focus owner ("permanentFocusOwner")</li>
+ * <li>the focused window ("focusedWindow")</li>
+ * <li>the active window ("activeWindow")</li>
+ * </ul>
+ *
+ * Nothing occurs if a null listener is supplied.
+ *
+ * @param l the listener to register.
+ * @see KeyboardFocusManager#addVetoableChangeListener(String, java.beans.VetoableChangeListener)
+ */
public void addVetoableChangeListener(VetoableChangeListener l)
{
if (l != null)
vetoableChangeSupport.addVetoableChangeListener(l);
}
+ /**
+ * Removes the supplied vetoable property change listener from
+ * the list of registered listeners. If the supplied listener
+ * is null, nothing occurs.
+ *
+ * @param l the listener to remove.
+ */
public void removeVetoableChangeListener(VetoableChangeListener l)
{
if (l != null)
vetoableChangeSupport.removeVetoableChangeListener(l);
}
+ /**
+ * Returns the currently registered vetoable property change listeners
+ * in array form. The returned array is empty if no listeners are
+ * currently registered.
+ *
+ * @return an array of registered vetoable property change listeners.
+ * @since 1.4
+ */
public VetoableChangeListener[] getVetoableChangeListeners()
{
return vetoableChangeSupport.getVetoableChangeListeners();
}
+ /**
+ * Registers a vetoable property change listener for receiving events relating
+ * to a vetoable change to a specified property. The supplied property name can be
+ * either user-defined or one from the following list of properties
+ * relevant to this class:
+ *
+ * <ul>
+ * <li>the current focus owner ("focusOwner")</li>
+ * <li>the permanent focus owner ("permanentFocusOwner")</li>
+ * <li>the focused window ("focusedWindow")</li>
+ * <li>the active window ("activeWindow")</li>
+ * </ul>
+ *
+ * Nothing occurs if a null listener is supplied. null is regarded as a valid property name.
+ *
+ * @param name the name of the property to handle change events for.
+ * @param l the listener to register for changes to the specified property.
+ * @see KeyboardFocusManager#addVetoableChangeListener(java.beans.VetoableChangeListener)
+ */
public void addVetoableChangeListener(String name, VetoableChangeListener l)
{
if (l != null)
vetoableChangeSupport.addVetoableChangeListener(name, l);
}
+ /**
+ * Removes the supplied vetoable property change listener registered
+ * for the specified property from the list of registered listeners.
+ * If the supplied listener is null, nothing occurs.
+ *
+ * @param name the name of the vetoable property the listener is
+ * monitoring changes to.
+ * @param l the listener to remove.
+ */
public void removeVetoableChangeListener(String name,
VetoableChangeListener l)
{
@@ -693,51 +896,210 @@ public abstract class KeyboardFocusManager
vetoableChangeSupport.removeVetoableChangeListener(name, l);
}
+ /**
+ * Returns the currently registered vetoable property change listeners
+ * in array form, which listen for changes to the supplied property.
+ * The returned array is empty, if no listeners are currently registered
+ * for events pertaining to the supplied property.
+ *
+ * @param name The property the returned listeners monitor for changes.
+ * @return an array of registered property change listeners which
+ * listen for changes to the supplied property.
+ * @since 1.4
+ */
public VetoableChangeListener[] getVetoableChangeListeners(String name)
{
return vetoableChangeSupport.getVetoableChangeListeners(name);
}
+ /**
+ * Fires a property change event as a response to a vetoable change to
+ * to the specified property. The event is only fired if a
+ * change has actually occurred (i.e. o and n are different).
+ * In the event that the property change is vetoed, the following
+ * occurs:
+ *
+ * <ol>
+ * <li>
+ * This method throws a <code>PropertyVetoException</code> to
+ * the proposed change.
+ * </li>
+ * <li>
+ * A new event is fired to reverse the previous change.
+ * </li>
+ * <li>
+ * This method again throws a <code>PropertyVetoException</code>
+ * in response to the reversion.
+ * </li>
+ * </ol>
+ *
+ * @param name The name of the property to which a change occurred.
+ * @param o The old value of the property.
+ * @param n The new value of the property.
+ * @throws PropertyVetoException if one of the listeners vetos
+ * the change by throwing this exception.
+ */
protected void fireVetoableChange(String name, Object o, Object n)
throws PropertyVetoException
{
vetoableChangeSupport.fireVetoableChange(name, o, n);
}
+ /**
+ * Adds a key event dispatcher to the list of registered dispatchers.
+ * When a key event is fired, each dispatcher's <code>dispatchKeyEvent</code>
+ * method is called in the order that they were added, prior to the manager
+ * dispatching the event itself. Notifications halt when one of the
+ * dispatchers returns true.
+ * <br />
+ * <br />
+ * The same dispatcher can exist multiple times within the list
+ * of registered dispatchers, and there is no limit on the length
+ * of this list. A null dispatcher is simply ignored.
+ *
+ * @param dispatcher The dispatcher to register.
+ */
public void addKeyEventDispatcher(KeyEventDispatcher dispatcher)
{
if (dispatcher != null)
keyEventDispatchers.add(dispatcher);
}
+ /**
+ * Removes the specified key event dispatcher from the list of
+ * registered dispatchers. The manager always dispatches events,
+ * regardless of its existence within the list. The manager
+ * can be added and removed from the list, as with any other
+ * dispatcher, but this does not affect its ability to dispatch
+ * key events. Non-existent and null dispatchers are simply ignored
+ * by this method.
+ *
+ * @param dispatcher The dispatcher to remove.
+ */
public void removeKeyEventDispatcher(KeyEventDispatcher dispatcher)
{
keyEventDispatchers.remove(dispatcher);
}
+ /**
+ * Returns the currently registered key event dispatchers in <code>List</code>
+ * form. At present, this only includes dispatchers explicitly registered
+ * via the <code>addKeyEventDispatcher()</code> method, but this behaviour
+ * is subject to change and should not be depended on. The manager itself
+ * may be a member of the list, but only if explicitly registered. If no
+ * dispatchers have been registered, the list will be empty.
+ *
+ * @return A list of explicitly registered key event dispatchers.
+ * @see KeyboardFocusManager#addKeyEventDispatcher(java.awt.KeyEventDispatcher)
+ */
protected List getKeyEventDispatchers ()
{
return (List) keyEventDispatchers.clone ();
}
+ /**
+ * Adds a key event post processor to the list of registered post processors.
+ * Post processors work in the same way as key event dispatchers, except
+ * that they are invoked after the manager has dispatched the key event,
+ * and not prior to this. Each post processor's <code>postProcessKeyEvent</code>
+ * method is called to see if any post processing needs to be performed. THe
+ * processors are called in the order in which they were added to the list,
+ * and notifications continue until one returns true. As with key event
+ * dispatchers, the manager is implicitly called following this process,
+ * regardless of whether or not it is present within the list.
+ * <br />
+ * <br />
+ * The same post processor can exist multiple times within the list
+ * of registered post processors, and there is no limit on the length
+ * of this list. A null post processor is simply ignored.
+ *
+ * @param postProcessor the post processor to register.
+ * @see KeyboardFocusManager#addKeyEventDispatcher(java.awt.KeyEventDispatcher)
+ */
public void addKeyEventPostProcessor (KeyEventPostProcessor postProcessor)
{
if (postProcessor != null)
keyEventPostProcessors.add (postProcessor);
}
+ /**
+ * Removes the specified key event post processor from the list of
+ * registered post processors. The manager always post processes events,
+ * regardless of its existence within the list. The manager
+ * can be added and removed from the list, as with any other
+ * post processor, but this does not affect its ability to post process
+ * key events. Non-existent and null post processors are simply ignored
+ * by this method.
+ *
+ * @param postProcessor the post processor to remove.
+ */
public void removeKeyEventPostProcessor (KeyEventPostProcessor postProcessor)
{
keyEventPostProcessors.remove (postProcessor);
}
+ /**
+ * Returns the currently registered key event post processors in <code>List</code>
+ * form. At present, this only includes post processors explicitly registered
+ * via the <code>addKeyEventPostProcessor()</code> method, but this behaviour
+ * is subject to change and should not be depended on. The manager itself
+ * may be a member of the list, but only if explicitly registered. If no
+ * post processors have been registered, the list will be empty.
+ *
+ * @return A list of explicitly registered key event post processors.
+ * @see KeyboardFocusManager#addKeyEventPostProcessor(java.awt.KeyEventPostProcessor)
+ */
protected List getKeyEventPostProcessors ()
{
return (List) keyEventPostProcessors.clone ();
}
+ /**
+ * The AWT event dispatcher uses this method to request that the manager
+ * handle a particular event. If the manager fails or refuses to
+ * dispatch the supplied event (this method returns false), the
+ * AWT event dispatcher will try to dispatch the event itself.
+ * <br />
+ * <br />
+ * The manager is expected to handle all <code>FocusEvent</code>s
+ * and <code>KeyEvent</code>s, and <code>WindowEvent</code>s
+ * relating to the focus. Dispatch is done with regard to the
+ * the focus owner and the currently focused and active windows.
+ * In handling the event, the source of the event may be overridden.
+ * <br />
+ * <br />
+ * The actual dispatching is performed by calling
+ * <code>redispatchEvent()</code>. This avoids the infinite recursion
+ * of dispatch requests which may occur if this method is called on
+ * the target component.
+ *
+ * @param e the event to dispatch.
+ * @return true if the event was dispatched.
+ * @see KeyboardFocusManager#redispatchEvent(java.awt.Component, java.awt.AWTEvent)
+ * @see KeyEvent
+ * @see FocusEvent
+ * @see WindowEvent
+ */
public abstract boolean dispatchEvent (AWTEvent e);
+ /**
+ * Handles redispatching of an event so that recursion of
+ * dispatch requests does not occur. Event dispatch methods
+ * within this manager (<code>dispatchEvent()</code>) and
+ * the key event dispatchers should use this method to handle
+ * dispatching rather than the dispatch method of the target
+ * component.
+ * <br />
+ * <br />
+ * <strong>
+ * This method is not intended for general consumption, and is
+ * only for the use of the aforementioned classes.
+ * </strong>
+ *
+ * @param target the target component to which the event is
+ * dispatched.
+ * @param e the event to dispatch.
+ */
public final void redispatchEvent (Component target, AWTEvent e)
{
synchronized (e)
@@ -747,42 +1109,203 @@ public abstract class KeyboardFocusManager
}
}
+ /**
+ * Attempts to dispatch key events for which no key event dispatcher
+ * has so far succeeded. This method is usually called by
+ * <code>dispatchEvent()</code> following the sending of the key
+ * event to any registered key event dispatchers. If the key
+ * event reaches this stage, none of the dispatchers returned
+ * true. This is, of course, always the case if there are no
+ * registered dispatchers.
+ * <br />
+ * <br />
+ * If this method also fails to handle the key event, then
+ * false is returned to the caller. In the case of
+ * <code>dispatchEvent()</code>, the calling method may try
+ * to handle the event itself or simply forward on the
+ * false result to its caller. When the event is dispatched
+ * by this method, a true result is propogated through the
+ * calling methods.
+ *
+ * @param e the key event to dispatch.
+ * @return true if the event was dispatched successfully.
+ */
public abstract boolean dispatchKeyEvent (KeyEvent e);
+ /**
+ * Handles the post processing of key events. By default,
+ * this method will map unhandled key events to appropriate
+ * <code>MenuShortcut</code>s. The event is consumed
+ * in the process and the shortcut is activated. This
+ * method is usually called by <code>dispatchKeyEvent</code>.
+ *
+ * @param e the key event to post process.
+ * @return true by default, as the event was handled.
+ */
public abstract boolean postProcessKeyEvent (KeyEvent e);
+ /**
+ * Handles focus traversal operations for key events which
+ * represent focus traversal keys in relation to the supplied
+ * component. The supplied component is assumed to have the
+ * focus, whether it does so or not, and the operation is
+ * carried out as appropriate, with this in mind.
+ *
+ * @param focused the component on which to perform focus traversal,
+ * on the assumption that this component has the focus.
+ * @param e the possible focus traversal key event.
+ */
public abstract void processKeyEvent (Component focused, KeyEvent e);
+ /**
+ * Delays all key events following the specified timestamp until the
+ * supplied component has focus. The AWT calls this method when it is
+ * determined that a focus change may occur within the native windowing
+ * system. Any key events which occur following the time specified by
+ * after are delayed until a <code>FOCUS_GAINED</code> event is received
+ * for the untilFocused component. The manager is responsible for ensuring
+ * this takes place.
+ *
+ * @param after the timestamp beyond which all key events are delayed until
+ * the supplied component gains focus.
+ * @param untilFocused the component to wait on gaining focus.
+ */
protected abstract void enqueueKeyEvents (long after, Component untilFocused);
+ /**
+ * Removes the key event block specified by the supplied timestamp and component.
+ * All delayed key events are released for normal dispatching following its
+ * removal and subsequent key events that would have been blocked are now
+ * immediately dispatched. If the specified timestamp is below 0, then
+ * the request with the oldest timestamp is removed.
+ *
+ * @param after the timestamp of the key event block to be removed, or a
+ * value smaller than 0 if the oldest is to be removed.
+ * @param untilFocused the component of the key event block to be removed.
+ */
protected abstract void dequeueKeyEvents (long after, Component untilFocused);
+ /**
+ * Discards all key event blocks relating to focus requirements for
+ * the supplied component, regardless of timestamp.
+ *
+ * @param comp the component of the key event block(s) to be removed.
+ */
protected abstract void discardKeyEvents (Component comp);
- public abstract void focusNextComponent (Component comp);
+ /**
+ * Moves the current focus to the next component following
+ * comp, based on the current focus traversal policy. By
+ * default, only visible, displayable, accepted components
+ * can receive focus. <code>Canvas</code>es, <code>Panel</code>s,
+ * <code>Label</code>s, <code>ScrollPane</code>s, <code>Scrollbar</code>s,
+ * <code>Window</code>s and lightweight components are judged
+ * to be unacceptable by default. See the
+ * <code>DefaultFocusTraversalPolicy</code> for more details.
+ *
+ * @param comp the component prior to the one which will
+ * become the focus, following execution of this method.
+ * @see DefaultFocusTraversalPolicy
+ */
+ public abstract void focusNextComponent(Component comp);
- public abstract void focusPreviousComponent (Component comp);
+ /**
+ * Moves the current focus to the previous component, prior to
+ * comp, based on the current focus traversal policy. By
+ * default, only visible, displayable, accepted components
+ * can receive focus. <code>Canvas</code>es, <code>Panel</code>s,
+ * <code>Label</code>s, <code>ScrollPane</code>s, <code>Scrollbar</code>s,
+ * <code>Window</code>s and lightweight components are judged
+ * to be unacceptable by default. See the
+ * <code>DefaultFocusTraversalPolicy</code> for more details.
+ *
+ * @param comp the component following the one which will
+ * become the focus, following execution of this method.
+ * @see DefaultFocusTraversalPolicy
+ */
+ public abstract void focusPreviousComponent(Component comp);
- public abstract void upFocusCycle (Component comp);
+ /**
+ * Moves the current focus upwards by one focus cycle.
+ * Both the current focus owner and current focus cycle root
+ * become the focus cycle root of the supplied component.
+ * However, in the case of a <code>Window</code>, the default
+ * focus component becomes the focus owner and the focus cycle
+ * root is not changed.
+ *
+ * @param comp the component used as part of the focus traversal.
+ */
+ public abstract void upFocusCycle(Component comp);
- public abstract void downFocusCycle (Container cont);
+ /**
+ * Moves the current focus downwards by one focus cycle.
+ * If the supplied container is a focus cycle root, then this
+ * becomes the current focus cycle root and the focus goes
+ * to the default component of the specified container.
+ * Nothing happens for non-focus cycle root containers.
+ *
+ * @param cont the container used as part of the focus traversal.
+ */
+ public abstract void downFocusCycle(Container cont);
- public final void focusNextComponent ()
+ /**
+ * Moves the current focus to the next component, based on the
+ * current focus traversal policy. By default, only visible,
+ * displayable, accepted component can receive focus.
+ * <code>Canvas</code>es, <code>Panel</code>s,
+ * <code>Label</code>s, <code>ScrollPane</code>s, <code>Scrollbar</code>s,
+ * <code>Window</code>s and lightweight components are judged
+ * to be unacceptable by default. See the
+ * <code>DefaultFocusTraversalPolicy</code> for more details.
+ *
+ * @see DefaultFocusTraversalPolicy
+ */
+ public final void focusNextComponent()
{
focusNextComponent (null);
}
- public final void focusPreviousComponent ()
+ /**
+ * Moves the current focus to the previous component, based on the
+ * current focus traversal policy. By default, only visible,
+ * displayable, accepted component can receive focus.
+ * <code>Canvas</code>es, <code>Panel</code>s,
+ * <code>Label</code>s, <code>ScrollPane</code>s, <code>Scrollbar</code>s,
+ * <code>Window</code>s and lightweight components are judged
+ * to be unacceptable by default. See the
+ * <code>DefaultFocusTraversalPolicy</code> for more details.
+ *
+ * @see DefaultFocusTraversalPolicy
+ */
+ public final void focusPreviousComponent()
{
focusPreviousComponent (null);
}
- public final void upFocusCycle ()
+ /**
+ * Moves the current focus upwards by one focus cycle,
+ * so that the new focus owner is the focus cycle root
+ * of the current owner. The current focus cycle root then
+ * becomes the focus cycle root of the new focus owner.
+ * However, in the case of the focus cycle root of the
+ * current focus owner being a <code>Window</code>, the default
+ * component of this window becomes the focus owner and the
+ * focus cycle root is not changed.
+ */
+ public final void upFocusCycle()
{
upFocusCycle (null);
}
- public final void downFocusCycle ()
+ /**
+ * Moves the current focus downwards by one focus cycle,
+ * iff the current focus cycle root is a <code>Container</code>.
+ * Usually, the new focus owner is set to the default component
+ * of the container and the current focus cycle root is set
+ * to the current focus owner. Nothing occurs if the current
+ * focus cycle root is not a container.
+ */
+ public final void downFocusCycle()
{
Component focusOwner = getGlobalFocusOwner ();
if (focusOwner instanceof Container
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
index 37ff4ec..189bc10 100644
--- a/libjava/java/awt/Label.java
+++ b/libjava/java/awt/Label.java
@@ -1,5 +1,5 @@
/* Label.java -- Java label widget
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,14 +39,18 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.LabelPeer;
+
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* This component is used for displaying simple text strings that cannot
- * be edited.
+ * be edited by the user.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
*/
public class Label extends Component implements Accessible
{
@@ -240,7 +244,7 @@ addNotify()
/**
* Returns a parameter string useful for debugging.
*
- * @param A debugging string.
+ * @return A debugging string.
*/
protected String
paramString()
@@ -249,5 +253,65 @@ paramString()
getAlignment() + "," + super.paramString());
}
+/**
+ * This class provides accessibility support for the label.
+ */
+protected class AccessibleAWTLabel
+ extends AccessibleAWTComponent
+{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -3568967560160480438L;
+
+ /**
+ * Constructor for the accessible label.
+ */
+ public AccessibleAWTLabel()
+ {
+ }
+
+ /**
+ * Returns the accessible name for the label. This is
+ * the text used in the label.
+ *
+ * @return a <code>String</code> containing the accessible
+ * name for this label.
+ */
+ public String getAccessibleName()
+ {
+ return getText();
+ }
+
+ /**
+ * Returns the accessible role for the label.
+ *
+ * @return an instance of <code>AccessibleRole</code>, describing
+ * the role of the label.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LABEL;
+ }
+
+}
+
+/**
+ * Gets the AccessibleContext associated with this <code>Label</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)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleAWTLabel();
+ }
+ return accessibleContext;
+}
+
} // class Label
diff --git a/libjava/java/awt/LayoutManager2.java b/libjava/java/awt/LayoutManager2.java
index 802e25e..4caa7f2 100644
--- a/libjava/java/awt/LayoutManager2.java
+++ b/libjava/java/awt/LayoutManager2.java
@@ -42,7 +42,7 @@ package java.awt;
* Layout manager for laying out containers based on contraints. The
* constraints control how the layout will proceed.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see LayoutManager
* @see Container
* @since 1.0
@@ -57,7 +57,7 @@ public interface LayoutManager2 extends LayoutManager
* @param component the component to add
* @param constraints the constraints to satisfy
*/
- void addLayoutComponent(Component component, Object contraints);
+ void addLayoutComponent(Component component, Object constraints);
/**
* Determines the maximum size of the specified target container.
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index 47177ed..8fbbc07 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -1,5 +1,5 @@
/* List.java -- A listbox widget
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,7 @@ import java.awt.event.ItemListener;
import java.awt.peer.ListPeer;
import java.util.EventListener;
import java.util.Vector;
+
import javax.accessibility.Accessible;
/**
@@ -129,7 +130,7 @@ List()
* Initializes a new instance of <code>List</code> with the specified
* number of visible lines and multi-select disabled.
*
- * @param lines The number of visible lines in the list.
+ * @param rows The number of visible rows in the list.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
@@ -145,7 +146,7 @@ List(int rows)
* Initializes a new instance of <code>List</code> with the specified
* number of lines and the specified multi-select setting.
*
- * @param lines The number of visible lines in the list.
+ * @param rows The number of visible rows in the list.
* @param multipleMode <code>true</code> if multiple lines can be selected
* simultaneously, <code>false</code> otherwise.
*
diff --git a/libjava/java/awt/MediaTracker.java b/libjava/java/awt/MediaTracker.java
index d1df8b3..e69832d 100644
--- a/libjava/java/awt/MediaTracker.java
+++ b/libjava/java/awt/MediaTracker.java
@@ -1,5 +1,5 @@
/* MediaTracker.java -- Class used for keeping track of images
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002i, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt;
-import java.util.ArrayList;
import java.awt.image.ImageObserver;
+import java.util.ArrayList;
/**
* This class is used for keeping track of the status of various media
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
index c6c4f21..35798a06 100644
--- a/libjava/java/awt/Menu.java
+++ b/libjava/java/awt/Menu.java
@@ -40,8 +40,11 @@ package java.awt;
import java.awt.peer.MenuPeer;
import java.io.Serializable;
-import java.util.Vector;
import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* This class represents a pull down or tear off menu in Java's AWT.
@@ -72,17 +75,20 @@ private Vector items = new Vector();
/**
* @serial Flag indicating whether or not this menu is a tear off
*/
-private boolean isTearOff;
+private boolean tearOff;
/**
* @serial Indicates whether or not this is a help menu.
*/
private boolean isHelpMenu;
-// From the serialization spec. FIXME: what should it be?
-private int menuSerializedDataVersion;
+ /*
+ * @serial Unused in this implementation, but present in Sun's
+ * serialization spec. Value obtained via reflection.
+ */
+ private int menuSerializedDataVersion = 1;
-static final String separatorLabel = "-";
+static final transient String separatorLabel = "-";
/*************************************************************************/
@@ -134,7 +140,7 @@ Menu(String label, boolean isTearOff)
{
super(label);
- this.isTearOff = isTearOff;
+ tearOff = isTearOff;
if (label.equals("Help"))
isHelpMenu = true;
@@ -158,7 +164,7 @@ Menu(String label, boolean isTearOff)
public boolean
isTearOff()
{
- return(isTearOff);
+ return(tearOff);
}
/*************************************************************************/
@@ -251,8 +257,6 @@ add(String label)
* @param item The menu item to add.
* @param index The index of the menu item.
*
- * XXX: FIXME
- *
* @exception IllegalArgumentException If the index is less than zero.
* @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
*/
@@ -262,12 +266,26 @@ insert(MenuItem item, int index)
if (index < 0)
throw new IllegalArgumentException("Index is less than zero");
- items.insertElementAt(item, index);
+ MenuPeer peer = (MenuPeer) getPeer();
+ if (peer == null)
+ return;
- MenuPeer mp = (MenuPeer)getPeer();
- // FIXME: Need to add a peer method here.
-// if (mp != null)
-// mp.insertItem(item, index);
+ int count = getItemCount ();
+
+ if (index >= count)
+ peer.addItem (item);
+ else
+ {
+ for (int i = count - 1; i >= index; i--)
+ peer.delItem (i);
+
+ peer.addItem (item);
+
+ for (int i = index; i < count; i++)
+ peer.addItem ((MenuItem) items.elementAt (i));
+ }
+
+ items.insertElementAt(item, index);
}
/*************************************************************************/
@@ -305,8 +323,6 @@ addSeparator()
*
* @param index The index at which to insert a separator bar.
*
- * XXX: FIXME
- *
* @exception IllegalArgumentException If the index is less than zero.
* @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
*/
@@ -339,7 +355,7 @@ remove(int index)
/**
* Removes the specifed item from the menu. If the specified component
- * does not exist, this method does nothing. // FIXME: Right?
+ * does not exist, this method does nothing.
*
* @param item The component to remove.
*/
@@ -415,11 +431,32 @@ removeNotify()
public String
paramString()
{
- return (",isTearOff=" + isTearOff + ",isHelpMenu=" + isHelpMenu
+ return (",tearOff=" + tearOff + ",isHelpMenu=" + isHelpMenu
+ super.paramString());
}
-// Accessibility API not yet implemented.
-// public AccessibleContext getAccessibleContext()
+ /**
+ * Basic Accessibility class for Menu. Details get provided in derived
+ * classes.
+ */
+ protected class AccessibleAWTMenu extends AccessibleAWTMenuItem
+ {
+ protected AccessibleAWTMenu()
+ {
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.MENU;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.MenuComponent#getAccessibleContext()
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleAWTMenu();
+ }
} // class Menu
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
index 1c9b1c78..6a97fa9 100644
--- a/libjava/java/awt/MenuBar.java
+++ b/libjava/java/awt/MenuBar.java
@@ -45,14 +45,19 @@ import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
/**
* This class implements a menu bar in the AWT system.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
*/
public class MenuBar extends MenuComponent
- implements MenuContainer, Serializable
+ implements MenuContainer, Serializable, Accessible
{
/*
@@ -78,6 +83,14 @@ private Menu helpMenu;
*/
private Vector menus = new Vector();
+ /**
+ * The accessible context for this component.
+ *
+ * @see #getAccessibleContext()
+ * @serial ignored.
+ */
+ private transient AccessibleContext accessibleContext;
+
/*************************************************************************/
/*
@@ -118,7 +131,7 @@ getHelpMenu()
/**
* Sets the help menu for this menu bar.
*
- * @param helpMenu The new help menu for this menu bar.
+ * @param menu The new help menu for this menu bar.
*/
public synchronized void
setHelpMenu(Menu menu)
@@ -134,11 +147,11 @@ setHelpMenu(Menu menu)
menu.parent.remove (menu);
menu.parent = this;
+ MenuBarPeer peer = (MenuBarPeer) getPeer ();
if (peer != null)
{
menu.addNotify();
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.addHelpMenu (menu);
+ peer.addHelpMenu (menu);
}
}
@@ -233,8 +246,7 @@ getMenuCount()
public int
countMenus()
{
- // FIXME: How does the help menu fit in here?
- return menus.size ();
+ return menus.size () + (getHelpMenu () == null ? 0 : 1);
}
/*************************************************************************/
@@ -242,6 +254,8 @@ countMenus()
/**
* Returns the menu at the specified index.
*
+ * @param index the index of the menu
+ *
* @return The requested menu.
*
* @exception ArrayIndexOutOfBoundsException If the index is not valid.
@@ -357,4 +371,56 @@ deleteShortcut(MenuShortcut shortcut)
it.deleteShortcut ();
}
+/**
+ * Gets the AccessibleContext associated with this <code>MenuBar</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)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleAWTMenuBar();
+ }
+ return accessibleContext;
+}
+
+/**
+ * This class provides accessibility support for AWT menu bars.
+ *
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ */
+protected class AccessibleAWTMenuBar
+ extends AccessibleAWTMenuComponent
+{
+
+ /**
+ * Compatible with JDK 1.4.2 revision 5
+ */
+ private static final long serialVersionUID = -8577604491830083815L;
+
+ /**
+ * This is the default constructor, which simply calls the default
+ * constructor of the superclass.
+ */
+ protected AccessibleAWTMenuBar()
+ {
+ super();
+ }
+
+ /**
+ * Returns the accessible role relating to the menu bar.
+ *
+ * @return <code>AccessibleRole.MENU_BAR</code>.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.MENU_BAR;
+ }
+
+} // class AccessibleAWTMenuBar
+
} // class MenuBar
diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java
index ccf2b49..78adfae 100644
--- a/libjava/java/awt/MenuComponent.java
+++ b/libjava/java/awt/MenuComponent.java
@@ -1,5 +1,5 @@
/* MenuComponent.java -- Superclass of all AWT menu components
- Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,15 +38,24 @@ exception statement from your version. */
package java.awt;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.awt.peer.MenuComponentPeer;
import java.io.Serializable;
+import java.util.Locale;
-// FIXME: Java 1.0 event model unimplemented
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
/**
- * This is the superclass of all non-menu AWT widgets.
+ * This is the superclass of all menu AWT widgets.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
*/
public abstract class MenuComponent implements Serializable
{
@@ -59,31 +68,101 @@ public abstract class MenuComponent implements Serializable
private static final long serialVersionUID = -4536902356223894379L;
/*************************************************************************/
-
+
/*
* Instance Variables
*/
- // FIXME: missing serialized fields `nameExplicitlySet',
- // `newEventsOnly', and `accessibleContext'.
+/**
+ * The font for this component.
+ *
+ * @see #getFont()
+ * @see #setFont(java.awt.Font)
+ * @serial the component's font.
+ */
+ private Font font;
+
+ /**
+ * The name of the component.
+ *
+ * @see #getName()
+ * @see #setName(String)
+ * @serial the component's name.
+ */
+ private String name;
+
+ /**
+ * The parent of this component.
+ *
+ * @see #getParent()
+ * @see #setParent(java.awt.MenuContainer)
+ * @serial ignored.
+ */
+ transient MenuContainer parent;
-// The font for this component
-private Font font;
+ /**
+ * The native peer for this component.
+ *
+ * @see #getPeer()
+ * @see #setPeer(java.awt.peer.MenuComponentPeer)
+ * @serial ignored.
+ */
+ transient MenuComponentPeer peer;
-// The name of the component
-private String name;
+ /**
+ * The synchronization locking object for this component.
+ *
+ * @serial ignored.
+ */
+ private transient Object tree_lock = this;
-// The parent of this component
-transient MenuContainer parent;
+ /**
+ * The toolkit for this object.
+ *
+ * @see #getToolkit()
+ * @serial ignored.
+ */
+ private static transient Toolkit toolkit = Toolkit.getDefaultToolkit();
-// The native peer for this componet
-transient MenuComponentPeer peer;
+ /**
+ * The accessible context for this component.
+ *
+ * @see #getAccessibleContext()
+ * @serial the accessibility information for this component.
+ */
+ private AccessibleContext accessibleContext;
-// The synchronization locking object for this component
-private transient Object tree_lock = this;
+ /**
+ * Was the name of the component set? This value defaults
+ * to false and becomes true after a call to <code>setName()</code>.
+ * Please note that this does not guarantee that name will then
+ * be non-null, as this may be the value passed to <code>setName()</code>.
+ *
+ * @see #setName(String)
+ * @serial true if the name value has been explicitly set by calling
+ * <code>setName()</code>.
+ */
+ private boolean nameExplicitlySet;
-// The toolkit for this object
-private static transient Toolkit toolkit = Toolkit.getDefaultToolkit();
+ /**
+ * Does this component handle new events? Events will be handled
+ * by this component if this is true. Otherwise, they will be forwarded
+ * up the component hierarchy. This implementation does not use this
+ * variable; it is merely provided for serialization compatability.
+ *
+ * @see #dispatchEvent(AWTEvent)
+ * @serial true if events are to be processed locally. Unused.
+ */
+ private boolean newEventsOnly;
+
+ /**
+ * The focus listener chain handler which deals with focus events for
+ * the accessible context of this component.
+ *
+ * @see AccessibleAWTMenuComponent#addFocusListener(java.awt.event.FocusListener)
+ * @serial ignored.
+ */
+ private transient FocusListener focusListener;
/*************************************************************************/
@@ -117,7 +196,13 @@ MenuComponent()
public Font
getFont()
{
- return(font);
+ if (font != null)
+ return font;
+
+ if (parent != null)
+ return parent.getFont ();
+
+ return null;
}
/*************************************************************************/
@@ -157,6 +242,7 @@ public void
setName(String name)
{
this.name = name;
+ nameExplicitlySet = true;
}
/*************************************************************************/
@@ -260,13 +346,14 @@ setTreeLock(Object tree_lock)
* AWT 1.0 event dispatcher.
*
* @deprecated Deprecated in favor of <code>dispatchEvent()</code>.
+ * @return true if the event was dispatched, false otherwise.
*/
public boolean
postEvent(Event event)
{
- return(false);
+ // This is overridden by subclasses that support events.
+ return false;
}
-
/*************************************************************************/
/**
@@ -274,17 +361,35 @@ postEvent(Event event)
*
* @param event The event to dispatch
*/
-public final void
-dispatchEvent(AWTEvent event)
+public final void dispatchEvent(AWTEvent event)
{
// See comment in Component.dispatchEvent().
dispatchEventImpl(event);
}
-void
-dispatchEventImpl(AWTEvent e)
+
+/**
+ * Implementation of dispatchEvent. Allows trusted package classes
+ * to dispatch additional events first. This implementation first
+ * translates <code>event</code> to an AWT 1.0 event and sends the
+ * result to {@link #postEvent}. The event is then
+ * passed on to {@link #processEvent} for local processing.
+ *
+ * @param event the event to dispatch.
+ */
+void dispatchEventImpl(AWTEvent event)
{
+ Event oldStyleEvent;
+
// This is overridden by subclasses that support events.
+ /* Convert AWT 1.1 event to AWT 1.0 event */
+ oldStyleEvent = Component.translateEvent(event);
+ if (oldStyleEvent != null)
+ {
+ postEvent(oldStyleEvent);
+ }
+ /* Do local processing */
+ processEvent(event);
}
/*************************************************************************/
@@ -298,6 +403,25 @@ dispatchEventImpl(AWTEvent e)
protected void
processEvent(AWTEvent event)
{
+ /*
+ Pass a focus event to the focus listener for
+ the accessibility context.
+ */
+ if (event instanceof FocusEvent)
+ {
+ if (focusListener != null)
+ {
+ switch (event.id)
+ {
+ case FocusEvent.FOCUS_GAINED:
+ focusListener.focusGained((FocusEvent) event);
+ break;
+ case FocusEvent.FOCUS_LOST:
+ focusListener.focusLost((FocusEvent) event);
+ break;
+ }
+ }
+ }
}
/*************************************************************************/
@@ -316,15 +440,884 @@ toString()
/*************************************************************************/
/**
- * Returns a debugging string for this component
- */
+ * Returns a debugging string for this component
+ */
protected String
paramString()
{
return "name=" + getName();
}
-// Accessibility API not yet implemented.
-// public AccessibleContext getAccessibleContext()
+/**
+ * Gets the AccessibleContext associated with this <code>MenuComponent</code>.
+ * As an abstract class, we return null. Concrete subclasses should return
+ * their implementation of the accessibility context.
+ *
+ * @return null.
+ */
+
+public AccessibleContext getAccessibleContext()
+{
+ return null;
+}
+
+/**
+ * This class provides a base for the accessibility support of menu
+ * components.
+ *
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ */
+protected abstract class AccessibleAWTMenuComponent
+ extends AccessibleContext
+ implements Serializable, AccessibleComponent, AccessibleSelection
+{
+
+ /**
+ * Compatible with JDK 1.4.2 revision 5
+ */
+ private static final long serialVersionUID = -4269533416223798698L;
+
+ /**
+ * This is the default constructor. It should be called by
+ * concrete subclasses to ensure necessary groundwork is completed.
+ */
+ protected AccessibleAWTMenuComponent()
+ {
+ }
+
+ /**
+ * Replaces or supplements the component's selection with the
+ * <code>Accessible</code> child at the supplied index. If
+ * the component supports multiple selection, the child is
+ * added to the current selection. Otherwise, the current
+ * selection becomes the specified child. If the child is
+ * already selected, nothing happens.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the specified child within a
+ * zero-based list of the component's children.
+ */
+ public void addAccessibleSelection(int index)
+ {
+ /* Subclasses with children should implement this */
+ }
+
+ /**
+ * Registers the specified focus listener to receive
+ * focus events from this component.
+ *
+ * @param listener the new focus listener.
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ /*
+ * Chain the new focus listener to the existing chain
+ * of focus listeners. Each new focus listener is
+ * coupled via multicasting to the existing chain.
+ */
+ focusListener = AWTEventMulticaster.add(focusListener, listener);
+ }
+
+ /**
+ * Clears the component's current selection. Following
+ * the calling of this method, no children of the component
+ * will be selected.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ */
+ public void clearAccessibleSelection()
+ {
+ }
+
+ /**
+ * Returns true if the specified point lies within the
+ * component. The supplied co-ordinates are assumed to
+ * be relative to the co-ordinate system of the component
+ * itself. Thus, the point (0,0) is the upper left corner
+ * of this component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @param point the point to check against this component.
+ * @return true if the point is within this component.
+ * @see #getBounds()
+ */
+ public boolean contains(Point point)
+ {
+ /*
+ We can simply return the result of a
+ test for containment in the bounding rectangle
+ */
+ return getBounds().contains(point);
+ }
+
+ /**
+ * Returns the <code>Accessible</code> child of this component present
+ * at the specified point. The supplied co-ordinates are
+ * assumed to be relative to the co-ordinate system of this
+ * component (the parent of any returned accessible). Thus,
+ * the point (0,0) is the upper left corner of this menu
+ * component.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param point the point at which the returned accessible
+ * is located.
+ * @return null.
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the <code>Accessible</code> child at the supplied
+ * index within the list of children of this component.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the <code>Accessible</code> child
+ * to retrieve.
+ * @return null.
+ */
+ public Accessible getAccessibleChild(int index)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the number of children of this component which
+ * implement the <code>Accessible</code> interface. If
+ * all children of this component are accessible, then
+ * the returned value will be the same as the number of
+ * children.
+ * <br />
+ * <br />
+ *
+ * @return 0.
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Retrieves the <code>AccessibleComponent</code> associated
+ * with this accessible context and its component. As the
+ * context itself implements <code>AccessibleComponent</code>,
+ * this is the return value.
+ *
+ * @return the context itself.
+ */
+ public AccessibleComponent getAccessibleComponent()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the accessible name for this menu component. This
+ * is the name given to the component, which may be null if
+ * not set using <code>setName()</code>.
+ * <br />
+ * <br />
+ * The name is not the most appropriate description of this
+ * object. Subclasses should preferably provide a more
+ * accurate description. For example, a File menu could
+ * have the description `Lists commands related to the
+ * file system'.
+ *
+ * @return a description of the component. Currently,
+ * this is just the contents of the name property.
+ * @see MenuComponent#setName(String)
+ */
+ public String getAccessibleDescription()
+ {
+ return MenuComponent.this.getName();
+ }
+
+ /**
+ * Retrieves the index of this component within its parent.
+ * If no parent exists, -1 is returned.
+ *
+ * @return -1 as the parent, a <code>MenuContainer</code>
+ * is not <code>Accessible</code>.
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return -1;
+ }
+
+ /**
+ * Returns the accessible name of this component. This
+ * is the name given to the component, which may be null if
+ * not set using <code>setName()</code>.
+ * <br />
+ * <br />
+ * The name property is not the most suitable string to return
+ * for this method. The string should be localized, and
+ * relevant to the operation of the component. For example,
+ * it could be the text of a menu item. However, this can
+ * not be used at this level of abstraction, so it is the
+ * responsibility of subclasses to provide a more appropriate
+ * name.
+ *
+ * @return a localized name for this component. Currently, this
+ * is just the contents of the name property.
+ * @see MenuComponent#setName(String)
+ */
+ public String getAccessibleName()
+ {
+ return MenuComponent.this.getName();
+ }
+
+ /**
+ * Returns the <code>Accessible</code> parent of this component.
+ * As the parent of a <code>MenuComponent</code> is a
+ * <code>MenuContainer</code>, which doesn't implement
+ * <code>Accessible</code>, this method returns null.
+ *
+ * @return null.
+ */
+ public Accessible getAccessibleParent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the accessible role of this component.
+ * <br />
+ * <br />
+ * The abstract implementation of this method returns
+ * <code>AccessibleRole.AWT_COMPONENT</code>,
+ * as the abstract component has no specific role. This
+ * method should be overridden by concrete subclasses, so
+ * as to return an appropriate role for the component.
+ *
+ * @return <code>AccessibleRole.AWT_COMPONENT</code>.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.AWT_COMPONENT;
+ }
+
+ /**
+ * Retrieves the <code>AccessibleSelection</code> associated
+ * with this accessible context and its component. As the
+ * context itself implements <code>AccessibleSelection</code>,
+ * this is the return value.
+ *
+ * @return the context itself.
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /**
+ * Retrieves the <code>Accessible</code> selected child
+ * at the specified index. If there are no selected children
+ * or the index is outside the range of selected children,
+ * null is returned. Please note that the index refers
+ * to the index of the child in the list of <strong>selected
+ * children</strong>, and not the index of the child in
+ * the list of all <code>Accessible</code> children.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the selected <code>Accessible</code>
+ * child.
+ */
+ public Accessible getAccessibleSelection(int index)
+ {
+ return null;
+ }
+
+ /**
+ * Returns a count of the number of <code>Accessible</code>
+ * children of this component which are currently selected.
+ * If there are no children currently selected, 0 is returned.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @return 0.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Retrieves the current state of this component
+ * in an accessible form. For example, a given component
+ * may be visible, selected, disabled, etc.
+ * <br />
+ * <br />
+ * As this class tells us virtually nothing about the component,
+ * except for its name and font, no state information can be
+ * provided. This implementation thus returns an empty
+ * state set, and it is left to concrete subclasses to provide
+ * a more acceptable and relevant state set. Changes to these
+ * properties also need to be handled using
+ * <code>PropertyChangeListener</code>s.
+ *
+ * @return an empty <code>AccessibleStateSet</code>.
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ return new AccessibleStateSet();
+ }
+
+ /**
+ * Returns the background color of the component, or null
+ * if this property is unsupported.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns the
+ * default system background color used for rendering menus.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return the default system background color for menus.
+ * @see #setBackground(java.awt.Color)
+ */
+ public Color getBackground()
+ {
+ return SystemColor.menu;
+ }
+
+ /**
+ * Returns a <code>Rectangle</code> which represents the
+ * bounds of this component. The returned rectangle has the
+ * height and width of the component's bounds, and is positioned
+ * at a location relative to this component's parent, the
+ * <code>MenuContainer</code>. null is returned if bounds
+ * are not supported by the component.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns null.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return null.
+ * @see #setBounds(java.awt.Rectangle)
+ */
+ public Rectangle getBounds()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the <code>Cursor</code> displayed when the pointer
+ * is positioned over this component. Alternatively, null
+ * is returned if the component doesn't support the cursor
+ * property.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns the default
+ * system cursor. Concrete subclasses which handle the drawing
+ * of an onscreen menu component may override this method and provide
+ * the appropriate information.
+ *
+ * @return the default system cursor.
+ * @see #setCursor(java.awt.Cursor)
+ */
+ public Cursor getCursor()
+ {
+ return Cursor.getDefaultCursor();
+ }
+
+ /**
+ * Returns the <code>Font</code> used for text created by this component.
+ *
+ * @return the current font.
+ * @see #setFont(java.awt.Font)
+ */
+ public Font getFont()
+ {
+ return MenuComponent.this.getFont();
+ }
+
+ /**
+ * Retrieves information on the rendering and metrics of the supplied
+ * font. If font metrics are not supported by this component, null
+ * is returned.
+ * <br />
+ * <br />
+ * The abstract implementation of this method simply uses the toolkit
+ * to obtain the <code>FontMetrics</code>. Concrete subclasses may
+ * find it more efficient to invoke their peer class directly, if one
+ * is available.
+ *
+ * @param font the font about which to retrieve rendering and metric
+ * information.
+ * @return the metrics of the given font, as provided by the system
+ * toolkit.
+ * @throws NullPointerException if the supplied font was null.
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return MenuComponent.this.getToolkit().getFontMetrics(font);
+ }
+
+ /**
+ * Returns the foreground color of the component, or null
+ * if this property is unsupported.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns the
+ * default system text color used for rendering menus.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return the default system text color for menus.
+ * @see #setForeground(java.awt.Color)
+ */
+ public Color getForeground()
+ {
+ return SystemColor.menuText;
+ }
+
+ /**
+ * Returns the locale currently in use by this component.
+ * <br />
+ * <br />
+ * This abstract class has no property relating to the
+ * locale used by the component, so this method simply
+ * returns the default locale for the current instance
+ * of the Java Virtual Machine (JVM). Concrete subclasses
+ * which maintain such a property should override this method
+ * and provide the locale information more accurately.
+ *
+ * @return the default locale for this JVM instance.
+ */
+ public Locale getLocale()
+ {
+ return Locale.getDefault();
+ }
+
+ /**
+ * Returns the location of the component, with co-ordinates
+ * relative to the parent component and using the co-ordinate
+ * space of the screen. Thus, the point (0,0) is the upper
+ * left corner of the parent component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @return the location of the component, relative to its parent.
+ * @see #setLocation(java.awt.Point)
+ */
+ public Point getLocation()
+ {
+ /* Simply return the location of the bounding rectangle */
+ return getBounds().getLocation();
+ }
+
+ /**
+ * Returns the location of the component, with co-ordinates
+ * relative to the screen. Thus, the point (0,0) is the upper
+ * left corner of the screen. null is returned if the component
+ * is either not on screen or if this property is unsupported.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns null.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return the location of the component, relative to the screen.
+ */
+ public Point getLocationOnScreen()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the size of the component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @return the size of the component.
+ * @see #setSize(java.awt.Dimension)
+ */
+ public Dimension getSize()
+ {
+ /* Simply return the size of the bounding rectangle */
+ return getBounds().getSize();
+ }
+
+ /**
+ * Returns true if the accessible child specified by the supplied index
+ * is currently selected.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the accessible child to check for selection.
+ * @return false.
+ */
+ public boolean isAccessibleChildSelected(int index)
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if this component is currently enabled.
+ * <br />
+ * <br />
+ * As this abstract component has no properties related to
+ * its enabled or disabled state, the implementation of this
+ * method is left to subclasses.
+ *
+ * @return false.
+ * @see #setEnabled(boolean)
+ */
+ public boolean isEnabled()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if this component is included in the traversal
+ * of the current focus from one component to the other.
+ * <br />
+ * <br />
+ * As this abstract component has no properties related to
+ * its ability to accept the focus, the implementation of this
+ * method is left to subclasses.
+ *
+ * @return false.
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if the component is being shown on screen.
+ * A component is determined to be shown if it is visible,
+ * and each parent component is also visible. Please note
+ * that, even when a component is showing, it may still be
+ * obscured by other components in front. This method only
+ * determines if the component is being drawn on the screen.
+ * <br />
+ * <br />
+ * As this abstract component and its parent have no properties
+ * relating to visibility, the implementation of this method is
+ * left to subclasses.
+ *
+ * @return false.
+ * @see #isVisible()
+ */
+ public boolean isShowing()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if the component is visible. A component may
+ * be visible but not drawn on the screen if one of its parent
+ * components is not visible. To determine if the component is
+ * actually drawn on screen, <code>isShowing()</code> should be
+ * used.
+ * <br />
+ * <br />
+ * As this abstract component has no properties relating to its
+ * visibility, the implementation of this method is left to subclasses.
+ *
+ * @return false.
+ * @see #isShowing()
+ * @see #setVisible(boolean)
+ */
+ public boolean isVisible()
+ {
+ return false;
+ }
+
+ /**
+ * Removes the accessible child specified by the supplied index from
+ * the list of currently selected children. If the child specified
+ * is not selected, nothing happens.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the <code>Accessible</code> child.
+ */
+ public void removeAccessibleSelection(int index)
+ {
+ /* Subclasses with children should implement this */
+ }
+
+ /**
+ * Removes the specified focus listener from the list of registered
+ * focus listeners for this component.
+ *
+ * @param listener the listener to remove.
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ /* Remove the focus listener from the chain */
+ focusListener = AWTEventMulticaster.remove(focusListener, listener);
+ }
+
+ /**
+ * Requests that this component gains focus. This depends on the
+ * component being focus traversable.
+ * <br />
+ * <br />
+ * As this abstract component has no properties relating to its
+ * focus traversability, or access to a peer with request focusing
+ * abilities, the implementation of this method is left to subclasses.
+ */
+ public void requestFocus()
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Selects all <code>Accessible</code> children of this component which
+ * it is possible to select. The component needs to support multiple
+ * selections.
+ * <br />
+ * <br />
+ * This abstract component provides a simplistic implementation of this
+ * method, which ignores the ability of the component to support multiple
+ * selections and simply uses <code>addAccessibleSelection</code> to
+ * add each <code>Accessible</code> child to the selection. The last
+ * <code>Accessible</code> component is thus selected for components
+ * which don't support multiple selections. Concrete implementations should
+ * override this with a more appopriate and efficient implementation, which
+ * properly takes into account the ability of the component to support multiple
+ * selections.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ /* Simply call addAccessibleSelection() on all accessible children */
+ for (int a = 0; a < getAccessibleChildrenCount(); ++a)
+ {
+ addAccessibleSelection(a);
+ }
+ }
+
+ /**
+ * Sets the background color of the component to that specified.
+ * Unspecified behaviour occurs when null is given as the new
+ * background color.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the supplied
+ * color and continues to use the default system color.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @param color the new color to use for the background.
+ * @see getBackground()
+ */
+ public void setBackground(Color color)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the height and width of the component, and its position
+ * relative to this component's parent, to the values specified
+ * by the supplied rectangle. Unspecified behaviour occurs when
+ * null is given as the new bounds.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the new
+ * rectangle and continues to return null from <code>getBounds()</code>.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @param rectangle a rectangle which specifies the new bounds of
+ * the component.
+ * @see #getBounds()
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the <code>Cursor</code> used when the pointer is positioned over the
+ * component. Unspecified behaviour occurs when null is given as the new
+ * cursor.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the new cursor
+ * and continues to return the default system cursor. Concrete
+ * subclasses which handle the drawing of an onscreen menu component
+ * may override this method and provide the appropriate information.
+ *
+ * @param cursor the new cursor to use.
+ * @see #getCursor()
+ */
+ public void setCursor(Cursor cursor)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the enabled/disabled state of this component.
+ * <br />
+ * <br />
+ * As this abstract component has no properties related to
+ * its enabled or disabled state, the implementation of this
+ * method is left to subclasses.
+ *
+ * @param enabled true if the component should be enabled,
+ * false otherwise.
+ * @see #getEnabled()
+ */
+ public void setEnabled(boolean enabled)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the <code>Font</code> used for text created by this component.
+ * Unspecified behaviour occurs when null is given as the new
+ * font.
+ *
+ * @param font the new font to use for text.
+ * @see #getFont()
+ */
+ public void setFont(Font font)
+ {
+ /* Call the method of the enclosing component */
+ MenuComponent.this.setFont(font);
+ }
+
+ /**
+ * Sets the foreground color of the component to that specified.
+ * Unspecified behaviour occurs when null is given as the new
+ * background color.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the supplied
+ * color and continues to return the default system text color used
+ * for rendering menus.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @param color the new foreground color.
+ * @see #getForeground()
+ */
+ public void setForeground(Color color)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the location of the component, with co-ordinates
+ * relative to the parent component and using the co-ordinate
+ * space of the screen. Thus, the point (0,0) is the upper
+ * left corner of the parent component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @param point the location of the component, relative to its parent.
+ * @see #getLocation()
+ */
+ public void setLocation(Point point)
+ {
+ getBounds().setLocation(point);
+ }
+
+ /**
+ * Sets the size of the component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @param size the new size of the component.
+ * @see #getSize()
+ */
+ public void setSize(Dimension size)
+ {
+ getBounds().setSize(size);
+ }
+
+ /**
+ * Sets the visibility state of the component. A component may
+ * be visible but not drawn on the screen if one of its parent
+ * components is not visible. To determine if the component is
+ * actually drawn on screen, <code>isShowing()</code> should be
+ * used.
+ * <br />
+ * <br />
+ * As this abstract component has no properties relating to its
+ * visibility, the implementation of this method is left to subclasses.
+ *
+ * @param visibility the new visibility of the component -- true if
+ * the component is visible, false if not.
+ * @see #isShowing()
+ * @see #isVisible()
+ */
+ public void setVisible(boolean visibility)
+ {
+ /* Ignored */
+ }
+
+} /* class AccessibleAWTMenuComponent */
+
-} // class Component
+} // class MenuComponent
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
index 81a4a79..a587742 100644
--- a/libjava/java/awt/MenuItem.java
+++ b/libjava/java/awt/MenuItem.java
@@ -45,17 +45,20 @@ import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.EventListener;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleValue;
+
/**
* This class represents an item in a menu.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class MenuItem extends MenuComponent
- implements Serializable
+ implements Serializable, Accessible
{
-// FIXME: The enabled event mask is not used at this time.
-
/*
* Static Variables
*/
@@ -97,6 +100,110 @@ private MenuShortcut shortcut;
// The list of action listeners for this menu item.
private transient ActionListener action_listeners;
+ protected class AccessibleAWTMenuItem
+ extends MenuComponent.AccessibleAWTMenuComponent
+ implements AccessibleAction, AccessibleValue
+ {
+ /** Constructor */
+ public AccessibleAWTMenuItem()
+ {
+ super();
+ }
+
+
+
+ public String getAccessibleName()
+ {
+ return label;
+ }
+
+ public AccessibleAction getAccessibleAction()
+ {
+ return this;
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.MENU_ITEM;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
+ */
+ public int getAccessibleActionCount()
+ {
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ if (i == 0)
+ return label;
+ else
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ if (i != 0)
+ return false;
+ processActionEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
+ return true;
+ }
+
+ public AccessibleValue getAccessibleValue()
+ {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
+ */
+ public Number getCurrentAccessibleValue()
+ {
+ return (enabled) ? new Integer(1) : new Integer(0);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
+ */
+ public boolean setCurrentAccessibleValue(Number number)
+ {
+ if (number.intValue() == 0)
+ {
+ setEnabled(false);
+ return false;
+ }
+
+ setEnabled(true);
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
+ */
+ public Number getMinimumAccessibleValue()
+ {
+ return new Integer(0);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
+ */
+ public Number getMaximumAccessibleValue()
+ {
+ return new Integer(0);
+ }
+
+ }
+
+
/*************************************************************************/
/*
diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java
index dbe3228..1ba9fbd 100644
--- a/libjava/java/awt/Panel.java
+++ b/libjava/java/awt/Panel.java
@@ -1,5 +1,5 @@
/* Panel.java -- Simple container object
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.PaintEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -47,8 +46,8 @@ import javax.accessibility.AccessibleRole;
* A panel is a simple container class. It's default layout is the
* <code>FlowLayout</code> manager.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see FlowLayout
* @since 1.0
* @status updated to 1.4
@@ -74,7 +73,7 @@ public class Panel extends Container implements Accessible
/*
* The number used to generate the name returned by getName.
*/
- private static transient long next_panel_number = 0;
+ private static transient long next_panel_number;
/**
* Initializes a new instance of <code>Panel</code> that has a default
@@ -98,36 +97,6 @@ public class Panel extends Container implements Accessible
}
/**
- * Consume initial application-requested paint event if it has not
- * already been consumed, and if the initial system-requested paint
- * event has not already been handled. Otherwise, call
- * super.dispatchEventImpl. These extra steps are required to
- * prevent a Panel from being painted twice when it is initially
- * shown.
- *
- * @param e the event to dispatch
- */
- void dispatchEventImpl (AWTEvent e)
- {
- if (e instanceof PaintEvent)
- {
- if (e.id == PaintEvent.UPDATE)
- {
- if (!initialUpdateConsumed
- && !initialSystemUpdateDone)
- {
- e.consume ();
- initialUpdateConsumed = true;
- }
- }
- else if (e.id == PaintEvent.PAINT)
- initialSystemUpdateDone = true;
- }
- else
- super.dispatchEventImpl (e);
- }
-
- /**
* Notifies this object to create its native peer.
*
* @see #isDisplayable()
diff --git a/libjava/java/awt/Point.java b/libjava/java/awt/Point.java
index 9d51264..3731b41 100644
--- a/libjava/java/awt/Point.java
+++ b/libjava/java/awt/Point.java
@@ -95,7 +95,7 @@ public class Point extends Point2D implements Serializable
* Initializes a new instance of <code>Point</code> with coordinates
* identical to the coordinates of the specified points.
*
- * @param point the point to copy the coordinates from
+ * @param p the point to copy the coordinates from
* @throws NullPointerException if p is null
*/
public Point(Point p)
diff --git a/libjava/java/awt/Polygon.java b/libjava/java/awt/Polygon.java
index 96c370a..4b89bd6 100644
--- a/libjava/java/awt/Polygon.java
+++ b/libjava/java/awt/Polygon.java
@@ -1,5 +1,5 @@
/* Polygon.java -- class representing a polygon
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt;
import java.awt.geom.AffineTransform;
+import java.awt.geom.Line2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
@@ -100,17 +101,8 @@ public class Polygon implements Shape, Serializable
*/
protected Rectangle bounds;
- /**
- * Cached flattened version - condense points and parallel lines, so the
- * result has area if there are >= 3 condensed vertices. flat[0] is the
- * number of condensed points, and (flat[odd], flat[odd+1]) form the
- * condensed points.
- *
- * @see #condense()
- * @see #contains(double, double)
- * @see #contains(double, double, double, double)
- */
- private transient int[] condensed;
+ /** A big number, but not so big it can't survive a few float operations */
+ private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
/**
* Initializes an empty polygon.
@@ -168,7 +160,6 @@ public class Polygon implements Shape, Serializable
public void invalidate()
{
bounds = null;
- condensed = null;
}
/**
@@ -184,15 +175,14 @@ public class Polygon implements Shape, Serializable
int i = npoints;
while (--i >= 0)
{
- xpoints[i] += dx;
- ypoints[i] += dy;
+ xpoints[i] += dx;
+ ypoints[i] += dy;
}
if (bounds != null)
{
- bounds.x += dx;
- bounds.y += dy;
+ bounds.x += dx;
+ bounds.y += dy;
}
- condensed = null;
}
/**
@@ -206,45 +196,44 @@ public class Polygon implements Shape, Serializable
{
if (npoints + 1 > xpoints.length)
{
- int[] newx = new int[npoints + 1];
- System.arraycopy(xpoints, 0, newx, 0, npoints);
- xpoints = newx;
+ int[] newx = new int[npoints + 1];
+ System.arraycopy(xpoints, 0, newx, 0, npoints);
+ xpoints = newx;
}
if (npoints + 1 > ypoints.length)
{
- int[] newy = new int[npoints + 1];
- System.arraycopy(ypoints, 0, newy, 0, npoints);
- ypoints = newy;
+ int[] newy = new int[npoints + 1];
+ System.arraycopy(ypoints, 0, newy, 0, npoints);
+ ypoints = newy;
}
xpoints[npoints] = x;
ypoints[npoints] = y;
npoints++;
if (bounds != null)
{
- if (npoints == 1)
- {
- bounds.x = x;
- bounds.y = y;
- }
- else
- {
- if (x < bounds.x)
- {
- bounds.width += bounds.x - x;
- bounds.x = x;
- }
- else if (x > bounds.x + bounds.width)
- bounds.width = x - bounds.x;
- if (y < bounds.y)
- {
- bounds.height += bounds.y - y;
- bounds.y = y;
- }
- else if (y > bounds.y + bounds.height)
- bounds.height = y - bounds.y;
- }
+ if (npoints == 1)
+ {
+ bounds.x = x;
+ bounds.y = y;
+ }
+ else
+ {
+ if (x < bounds.x)
+ {
+ bounds.width += bounds.x - x;
+ bounds.x = x;
+ }
+ else if (x > bounds.x + bounds.width)
+ bounds.width = x - bounds.x;
+ if (y < bounds.y)
+ {
+ bounds.height += bounds.y - y;
+ bounds.y = y;
+ }
+ else if (y > bounds.y + bounds.height)
+ bounds.height = y - bounds.y;
+ }
}
- condensed = null;
}
/**
@@ -258,7 +247,7 @@ public class Polygon implements Shape, Serializable
*/
public Rectangle getBounds()
{
- return getBoundingBox ();
+ return getBoundingBox();
}
/**
@@ -274,27 +263,27 @@ public class Polygon implements Shape, Serializable
{
if (bounds == null)
{
- if (npoints == 0)
- return bounds = new Rectangle ();
- int i = npoints - 1;
- int minx = xpoints[i];
- int maxx = minx;
- int miny = ypoints[i];
- int maxy = miny;
- while (--i >= 0)
- {
- int x = xpoints[i];
- int y = ypoints[i];
- if (x < minx)
- minx = x;
- else if (x > maxx)
- maxx = x;
- if (y < miny)
- miny = y;
- else if (y > maxy)
- maxy = y;
- }
- bounds = new Rectangle (minx, miny, maxx - minx, maxy - miny);
+ if (npoints == 0)
+ return bounds = new Rectangle();
+ int i = npoints - 1;
+ int minx = xpoints[i];
+ int maxx = minx;
+ int miny = ypoints[i];
+ int maxy = miny;
+ while (--i >= 0)
+ {
+ int x = xpoints[i];
+ int y = ypoints[i];
+ if (x < minx)
+ minx = x;
+ else if (x > maxx)
+ maxx = x;
+ if (y < miny)
+ miny = y;
+ else if (y > maxy)
+ maxy = y;
+ }
+ bounds = new Rectangle(minx, miny, maxx - minx, maxy - miny);
}
return bounds;
}
@@ -365,64 +354,7 @@ public class Polygon implements Shape, Serializable
*/
public boolean contains(double x, double y)
{
- // First, the obvious bounds checks.
- if (! condense() || ! getBounds().contains(x, y))
- return false;
- // A point is contained if a ray to (-inf, y) crosses an odd number
- // of segments. This must obey the semantics of Shape when the point is
- // exactly on a segment or vertex: a point is inside only if the adjacent
- // point in the increasing x or y direction is also inside. Note that we
- // are guaranteed that the condensed polygon has area, and no consecutive
- // segments with identical slope.
- boolean inside = false;
- int limit = condensed[0];
- int curx = condensed[(limit << 1) - 1];
- int cury = condensed[limit << 1];
- for (int i = 1; i <= limit; i++)
- {
- int priorx = curx;
- int priory = cury;
- curx = condensed[(i << 1) - 1];
- cury = condensed[i << 1];
- if ((priorx > x && curx > x) // Left of segment, or NaN.
- || (priory > y && cury > y) // Below segment, or NaN.
- || (priory < y && cury < y)) // Above segment.
- continue;
- if (priory == cury) // Horizontal segment, y == cury == priory
- {
- if (priorx < x && curx < x) // Right of segment.
- {
- inside = ! inside;
- continue;
- }
- // Did we approach this segment from above or below?
- // This mess is necessary to obey rules of Shape.
- priory = condensed[((limit + i - 2) % limit) << 1];
- boolean above = priory > cury;
- if ((curx == x && (curx > priorx || above))
- || (priorx == x && (curx < priorx || ! above))
- || (curx > priorx && ! above) || above)
- inside = ! inside;
- continue;
- }
- if (priorx == x && priory == y) // On prior vertex.
- continue;
- if (priorx == curx // Vertical segment.
- || (priorx < x && curx < x)) // Right of segment.
- {
- inside = ! inside;
- continue;
- }
- // The point is inside the segment's bounding box, compare slopes.
- double leftx = curx > priorx ? priorx : curx;
- double lefty = curx > priorx ? priory : cury;
- double slopeseg = (double) (cury - priory) / (curx - priorx);
- double slopepoint = (double) (y - lefty) / (x - leftx);
- if ((slopeseg > 0 && slopeseg > slopepoint)
- || slopeseg < slopepoint)
- inside = ! inside;
- }
- return inside;
+ return ((evaluateCrossings(x, y, false, BIG_VALUE) & 1) != 0);
}
/**
@@ -453,67 +385,17 @@ public class Polygon implements Shape, Serializable
*/
public boolean intersects(double x, double y, double w, double h)
{
- // First, the obvious bounds checks.
- if (w <= 0 || h <= 0 || npoints == 0 ||
- ! getBounds().intersects(x, y, w, h))
- return false; // Disjoint bounds.
- if ((x <= bounds.x && x + w >= bounds.x + bounds.width
- && y <= bounds.y && y + h >= bounds.y + bounds.height)
- || contains(x, y))
- return true; // Rectangle contains the polygon, or one point matches.
- // If any vertex is in the rectangle, the two might intersect.
- int curx = 0;
- int cury = 0;
- for (int i = 0; i < npoints; i++)
- {
- curx = xpoints[i];
- cury = ypoints[i];
- if (curx >= x && curx < x + w && cury >= y && cury < y + h
- && contains(curx, cury)) // Boundary check necessary.
- return true;
- }
- // Finally, if at least one of the four bounding lines intersect any
- // segment of the polygon, return true. Be careful of the semantics of
- // Shape; coinciding lines do not necessarily return true.
- for (int i = 0; i < npoints; i++)
- {
- int priorx = curx;
- int priory = cury;
- curx = xpoints[i];
- cury = ypoints[i];
- if (priorx == curx) // Vertical segment.
- {
- if (curx < x || curx >= x + w) // Outside rectangle.
- continue;
- if ((cury >= y + h && priory <= y)
- || (cury <= y && priory >= y + h))
- return true; // Bisects rectangle.
- continue;
- }
- if (priory == cury) // Horizontal segment.
- {
- if (cury < y || cury >= y + h) // Outside rectangle.
- continue;
- if ((curx >= x + w && priorx <= x)
- || (curx <= x && priorx >= x + w))
- return true; // Bisects rectangle.
- continue;
- }
- // Slanted segment.
- double slope = (double) (cury - priory) / (curx - priorx);
- double intersect = slope * (x - curx) + cury;
- if (intersect > y && intersect < y + h) // Intersects left edge.
- return true;
- intersect = slope * (x + w - curx) + cury;
- if (intersect > y && intersect < y + h) // Intersects right edge.
- return true;
- intersect = (y - cury) / slope + curx;
- if (intersect > x && intersect < x + w) // Intersects bottom edge.
- return true;
- intersect = (y + h - cury) / slope + cury;
- if (intersect > x && intersect < x + w) // Intersects top edge.
- return true;
- }
+ /* Does any edge intersect? */
+ if (evaluateCrossings(x, y, false, w) != 0 /* top */
+ || evaluateCrossings(x, y + h, false, w) != 0 /* bottom */
+ || evaluateCrossings(x + w, y, true, h) != 0 /* right */
+ || evaluateCrossings(x, y, true, h) != 0) /* left */
+ return true;
+
+ /* No intersections, is any point inside? */
+ if ((evaluateCrossings(x, y, false, BIG_VALUE) & 1) != 0)
+ return true;
+
return false;
}
@@ -547,59 +429,21 @@ public class Polygon implements Shape, Serializable
*/
public boolean contains(double x, double y, double w, double h)
{
- // First, the obvious bounds checks.
- if (w <= 0 || h <= 0 || ! contains(x, y)
- || ! bounds.contains(x, y, w, h))
+ if (! getBounds2D().intersects(x, y, w, h))
return false;
- // Now, if any of the four bounding lines intersects a polygon segment,
- // return false. The previous check had the side effect of setting
- // the condensed array, which we use. Be careful of the semantics of
- // Shape; coinciding lines do not necessarily return false.
- int limit = condensed[0];
- int curx = condensed[(limit << 1) - 1];
- int cury = condensed[limit << 1];
- for (int i = 1; i <= limit; i++)
- {
- int priorx = curx;
- int priory = cury;
- curx = condensed[(i << 1) - 1];
- cury = condensed[i << 1];
- if (curx > x && curx < x + w && cury > y && cury < y + h)
- return false; // Vertex is in rectangle.
- if (priorx == curx) // Vertical segment.
- {
- if (curx < x || curx > x + w) // Outside rectangle.
- continue;
- if ((cury >= y + h && priory <= y)
- || (cury <= y && priory >= y + h))
- return false; // Bisects rectangle.
- continue;
- }
- if (priory == cury) // Horizontal segment.
- {
- if (cury < y || cury > y + h) // Outside rectangle.
- continue;
- if ((curx >= x + w && priorx <= x)
- || (curx <= x && priorx >= x + w))
- return false; // Bisects rectangle.
- continue;
- }
- // Slanted segment.
- double slope = (double) (cury - priory) / (curx - priorx);
- double intersect = slope * (x - curx) + cury;
- if (intersect > y && intersect < y + h) // Intersects left edge.
- return false;
- intersect = slope * (x + w - curx) + cury;
- if (intersect > y && intersect < y + h) // Intersects right edge.
- return false;
- intersect = (y - cury) / slope + curx;
- if (intersect > x && intersect < x + w) // Intersects bottom edge.
- return false;
- intersect = (y + h - cury) / slope + cury;
- if (intersect > x && intersect < x + w) // Intersects top edge.
- return false;
- }
- return true;
+
+ /* Does any edge intersect? */
+ if (evaluateCrossings(x, y, false, w) != 0 /* top */
+ || evaluateCrossings(x, y + h, false, w) != 0 /* bottom */
+ || evaluateCrossings(x + w, y, true, h) != 0 /* right */
+ || evaluateCrossings(x, y, true, h) != 0) /* left */
+ return false;
+
+ /* No intersections, is any point inside? */
+ if ((evaluateCrossings(x, y, false, BIG_VALUE) & 1) != 0)
+ return true;
+
+ return false;
}
/**
@@ -631,47 +475,47 @@ public class Polygon implements Shape, Serializable
public PathIterator getPathIterator(final AffineTransform transform)
{
return new PathIterator()
- {
- /** The current vertex of iteration. */
- private int vertex;
-
- public int getWindingRule()
{
- return WIND_EVEN_ODD;
- }
-
- public boolean isDone()
- {
- return vertex > npoints;
- }
-
- public void next()
- {
- vertex++;
- }
-
- public int currentSegment(float[] coords)
- {
- if (vertex >= npoints)
- return SEG_CLOSE;
- coords[0] = xpoints[vertex];
- coords[1] = ypoints[vertex];
- if (transform != null)
- transform.transform(coords, 0, coords, 0, 1);
- return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
- }
-
- public int currentSegment(double[] coords)
- {
- if (vertex >= npoints)
- return SEG_CLOSE;
- coords[0] = xpoints[vertex];
- coords[1] = ypoints[vertex];
- if (transform != null)
- transform.transform(coords, 0, coords, 0, 1);
- return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
- }
- };
+ /** The current vertex of iteration. */
+ private int vertex;
+
+ public int getWindingRule()
+ {
+ return WIND_EVEN_ODD;
+ }
+
+ public boolean isDone()
+ {
+ return vertex > npoints;
+ }
+
+ public void next()
+ {
+ vertex++;
+ }
+
+ public int currentSegment(float[] coords)
+ {
+ if (vertex >= npoints)
+ return SEG_CLOSE;
+ coords[0] = xpoints[vertex];
+ coords[1] = ypoints[vertex];
+ if (transform != null)
+ transform.transform(coords, 0, coords, 0, 1);
+ return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
+ }
+
+ public int currentSegment(double[] coords)
+ {
+ if (vertex >= npoints)
+ return SEG_CLOSE;
+ coords[0] = xpoints[vertex];
+ coords[1] = ypoints[vertex];
+ if (transform != null)
+ transform.transform(coords, 0, coords, 0, 1);
+ return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
+ }
+ };
}
/**
@@ -684,7 +528,7 @@ public class Polygon implements Shape, Serializable
* path iterator is not either.
*
* @param transform an optional transform to apply to the iterator
- * @param double the maximum distance for deviation from the real boundary
+ * @param flatness the maximum distance for deviation from the real boundary
* @return a new iterator over the boundary
* @since 1.2
*/
@@ -695,57 +539,75 @@ public class Polygon implements Shape, Serializable
}
/**
- * Helper for contains, which caches a condensed version of the polygon.
- * This condenses all colinear points, so that consecutive segments in
- * the condensed version always have different slope.
+ * Helper for contains, intersects, calculates the number of intersections
+ * between the polygon and a line extending from the point (x, y) along
+ * the positive X, or Y axis, within a given interval.
*
- * @return true if the condensed polygon has area
+ * @return the winding number.
* @see #condensed
* @see #contains(double, double)
*/
- private boolean condense()
+ private int evaluateCrossings(double x, double y, boolean useYaxis,
+ double distance)
{
- if (npoints <= 2)
- return false;
- if (condensed != null)
- return condensed[0] > 2;
- condensed = new int[npoints * 2 + 1];
- int curx = xpoints[npoints - 1];
- int cury = ypoints[npoints - 1];
- double curslope = Double.NaN;
- int count = 0;
- outer:
- for (int i = 0; i < npoints; i++)
+ double x0;
+ double x1;
+ double y0;
+ double y1;
+ double epsilon = 0.0;
+ int crossings = 0;
+ int[] xp;
+ int[] yp;
+
+ if (useYaxis)
{
- int priorx = curx;
- int priory = cury;
- double priorslope = curslope;
- curx = xpoints[i];
- cury = ypoints[i];
- while (curx == priorx && cury == priory)
- {
- if (++i == npoints)
- break outer;
- curx = xpoints[i];
- cury = ypoints[i];
- }
- curslope = (curx == priorx ? Double.POSITIVE_INFINITY
- : (double) (cury - priory) / (curx - priorx));
- if (priorslope == curslope)
- {
- if (count > 1 && condensed[(count << 1) - 3] == curx
- && condensed[(count << 1) - 2] == cury)
- {
- count--;
- continue;
- }
- }
- else
- count++;
- condensed[(count << 1) - 1] = curx;
- condensed[count << 1] = cury;
+ xp = ypoints;
+ yp = xpoints;
+ double swap;
+ swap = y;
+ y = x;
+ x = swap;
}
- condensed[0] = count;
- return count > 2;
+ else
+ {
+ xp = xpoints;
+ yp = ypoints;
+ }
+
+ /* Get a value which is small but not insignificant relative the path. */
+ epsilon = 1E-7;
+
+ x0 = xp[0] - x;
+ y0 = yp[0] - y;
+ for (int i = 1; i < npoints; i++)
+ {
+ x1 = xp[i] - x;
+ y1 = yp[i] - y;
+
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y1 == 0.0)
+ y1 -= epsilon;
+ if (y0 * y1 < 0)
+ if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
+ ++crossings;
+
+ x0 = xp[i] - x;
+ y0 = yp[i] - y;
+ }
+
+ // end segment
+ x1 = xp[0] - x;
+ y1 = yp[0] - y;
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y1 == 0.0)
+ y1 -= epsilon;
+ if (y0 * y1 < 0)
+ if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
+ ++crossings;
+
+ return crossings;
}
} // class Polygon
+
diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java
index 83ffb35..7508202 100644
--- a/libjava/java/awt/PopupMenu.java
+++ b/libjava/java/awt/PopupMenu.java
@@ -1,5 +1,5 @@
/* PopupMenu.java -- An AWT popup menu
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,11 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.MenuPeer;
import java.awt.peer.PopupMenuPeer;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
/**
* This class implement an AWT popup menu widget
*
@@ -136,5 +138,23 @@ show(Component component, int x, int y)
}
}
+ protected class AccessibleAWTPopupMenu extends AccessibleAWTMenu
+ {
+ protected AccessibleAWTPopupMenu()
+ {
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.POPUP_MENU;
+ }
+
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleAWTPopupMenu();
+ }
+
} // class PopupMenu
diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java
index 5dc5411..6619096 100644
--- a/libjava/java/awt/Rectangle.java
+++ b/libjava/java/awt/Rectangle.java
@@ -338,7 +338,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
* its upper left corner.
*
* @return the point where this rectangle is located
- * @see setLocation(Point)
+ * @see #setLocation(Point)
* @since 1.1
*/
public Point getLocation()
diff --git a/libjava/java/awt/RenderingHints.java b/libjava/java/awt/RenderingHints.java
index 9dc6d5f..a1ccdff 100644
--- a/libjava/java/awt/RenderingHints.java
+++ b/libjava/java/awt/RenderingHints.java
@@ -1,5 +1,5 @@
/* RenderingHints.java --
- Copyright (C) 2000, 2001, 2002 Free Software Foundation
+ Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -41,38 +41,75 @@ package java.awt;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
- * NEEDS DOCUMENTATION
+ * A collection of (key, value) items that provide 'hints' for the
+ * {@link java.awt.Graphics2D} rendering pipeline. Because these
+ * items are hints only, they may be ignored by a particular
+ * {@link java.awt.Graphics2D} implementation.
*
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
* @author Eric Blake <ebb9@email.byu.edu>
*/
public class RenderingHints implements Map, Cloneable
{
+ /**
+ * The base class used to represent keys.
+ */
public abstract static class Key
{
private final int key;
+ /**
+ * Creates a new key.
+ *
+ * @param privateKey the private key.
+ */
protected Key(int privateKey)
{
key = privateKey;
}
+ /**
+ * Returns <code>true</code> if the specified value is compatible with
+ * this key, and <code>false</code> otherwise.
+ *
+ * @param value the value (<code>null</code> permitted).
+ *
+ * @return A boolean.
+ */
public abstract boolean isCompatibleValue(Object value);
+ /**
+ * Returns the private key for this instance.
+ *
+ * @return The private key.
+ */
protected final int intKey()
{
return key;
}
+ /**
+ * Returns a hash code for the key.
+ *
+ * @return A hash code.
+ */
public final int hashCode()
{
return System.identityHashCode(this);
}
+ /**
+ * Checks this key for equality with an arbitrary object.
+ *
+ * @param other the object (<code>null</code> permitted)
+ *
+ * @return A boolean.
+ */
public final boolean equals(Object other)
{
return this == other;
@@ -96,11 +133,24 @@ public class RenderingHints implements Map, Cloneable
this.v3 = v3;
}
+ /**
+ * Returns <code>true</code> if the specified value is compatible with
+ * this key, and <code>false</code> otherwise.
+ *
+ * @param value the value (<code>null</code> permitted).
+ *
+ * @return A boolean.
+ */
public boolean isCompatibleValue(Object value)
{
return value == v1 || value == v2 || value == v3;
}
+ /**
+ * Returns a string representation of the key.
+ *
+ * @return A string.
+ */
public String toString()
{
return description;
@@ -109,102 +159,345 @@ public class RenderingHints implements Map, Cloneable
private HashMap hintMap = new HashMap();
+ /**
+ * A key for the 'antialiasing' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_ANTIALIAS_OFF}</td>
+ * <td>Render without antialiasing (better speed).</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_ANTIALIAS_ON}</td>
+ * <td>Render with antialiasing (better quality).</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_ANTIALIAS_DEFAULT}</td>
+ * <td>Use the default value for antialiasing.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_ANTIALIASING;
+ /**
+ * This value is for use with the {@link #KEY_ANTIALIASING} key.
+ */
public static final Object VALUE_ANTIALIAS_ON
= "Antialiased rendering mode";
+ /**
+ * This value is for use with the {@link #KEY_ANTIALIASING} key.
+ */
public static final Object VALUE_ANTIALIAS_OFF
= "Nonantialiased rendering mode";
+ /**
+ * This value is for use with the {@link #KEY_ANTIALIASING} key.
+ */
public static final Object VALUE_ANTIALIAS_DEFAULT
= "Default antialiasing rendering mode";
+ /**
+ * A key for the 'rendering' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_RENDER_SPEED}</td>
+ * <td>Prefer speed over quality when rendering.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_RENDER_QUALITY}</td>
+ * <td>Prefer quality over speed when rendering.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_RENDER_DEFAULT}</td>
+ * <td>Use the default value for quality vs. speed when rendering.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_RENDERING;
+ /**
+ * This value is for use with the {@link #KEY_RENDERING} key.
+ */
public static final Object VALUE_RENDER_SPEED
= "Fastest rendering methods";
+ /**
+ * This value is for use with the {@link #KEY_RENDERING} key.
+ */
public static final Object VALUE_RENDER_QUALITY
= "Highest quality rendering methods";
+ /**
+ * This value is for use with the {@link #KEY_RENDERING} key.
+ */
public static final Object VALUE_RENDER_DEFAULT
= "Default rendering methods";
+ /**
+ * A key for the 'dithering' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_DITHER_DISABLE}</td>
+ * <td>Disable dithering.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_DITHER_ENABLE}</td>
+ * <td>Enable dithering.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_DITHER_DEFAULT}</td>
+ * <td>Use the default value for dithering.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_DITHERING;
+ /**
+ * This value is for use with the {@link #KEY_DITHERING} key.
+ */
public static final Object VALUE_DITHER_DISABLE
= "Nondithered rendering mode";
+ /**
+ * This value is for use with the {@link #KEY_DITHERING} key.
+ */
public static final Object VALUE_DITHER_ENABLE
= "Dithered rendering mode";
+ /**
+ * This value is for use with the {@link #KEY_DITHERING} key.
+ */
public static final Object VALUE_DITHER_DEFAULT
= "Default dithering mode";
+ /**
+ * A key for the 'text antialiasing' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_TEXT_ANTIALIAS_ON}</td>
+ * <td>Render text with antialiasing (better quality usually).</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_TEXT_ANTIALIAS_OFF}</td>
+ * <td>Render test without antialiasing (better speed).</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_TEXT_ANTIALIAS_DEFAULT}</td>
+ * <td>Use the default value for text antialiasing.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_TEXT_ANTIALIASING;
+ /**
+ * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
+ */
public static final Object VALUE_TEXT_ANTIALIAS_ON
= "Antialiased text mode";
+ /**
+ * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
+ */
public static final Object VALUE_TEXT_ANTIALIAS_OFF
= "Nonantialiased text mode";
+ /**
+ * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
+ */
public static final Object VALUE_TEXT_ANTIALIAS_DEFAULT
= "Default antialiasing text mode";
+ /**
+ * A key for the 'fractional metrics' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_FRACTIONALMETRICS_OFF}</td>
+ * <td>Render text with fractional metrics off.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_FRACTIONALMETRICS_ON}</td>
+ * <td>Render text with fractional metrics on.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_FRACTIONALMETRICS_DEFAULT}</td>
+ * <td>Use the default value for fractional metrics.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_FRACTIONALMETRICS;
+ /**
+ * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
+ */
public static final Object VALUE_FRACTIONALMETRICS_OFF
= "Integer text metrics mode";
+ /**
+ * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
+ */
public static final Object VALUE_FRACTIONALMETRICS_ON
= "Fractional text metrics mode";
+ /**
+ * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
+ */
public static final Object VALUE_FRACTIONALMETRICS_DEFAULT
= "Default fractional text metrics mode";
+ /**
+ * A key for the 'interpolation' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_INTERPOLATION_NEAREST_NEIGHBOR}</td>
+ * <td>Use nearest neighbour interpolation.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_INTERPOLATION_BILINEAR}</td>
+ * <td>Use bilinear interpolation.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_INTERPOLATION_BICUBIC}</td>
+ * <td>Use bicubic interpolation.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_INTERPOLATION;
+ /**
+ * This value is for use with the {@link #KEY_INTERPOLATION} key.
+ */
public static final Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR
= "Nearest Neighbor image interpolation mode";
+ /**
+ * This value is for use with the {@link #KEY_INTERPOLATION} key.
+ */
public static final Object VALUE_INTERPOLATION_BILINEAR
= "Bilinear image interpolation mode";
+ /**
+ * This value is for use with the {@link #KEY_INTERPOLATION} key.
+ */
public static final Object VALUE_INTERPOLATION_BICUBIC
= "Bicubic image interpolation mode";
+ /**
+ * A key for the 'alpha interpolation' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_ALPHA_INTERPOLATION_SPEED}</td>
+ * <td>Prefer speed over quality.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_ALPHA_INTERPOLATION_QUALITY}</td>
+ * <td>Prefer quality over speed.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_ALPHA_INTERPOLATION_DEFAULT}</td>
+ * <td>Use the default setting.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_ALPHA_INTERPOLATION;
+ /**
+ * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
+ */
public static final Object VALUE_ALPHA_INTERPOLATION_SPEED
= "Fastest alpha blending methods";
+ /**
+ * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
+ */
public static final Object VALUE_ALPHA_INTERPOLATION_QUALITY
= "Highest quality alpha blending methods";
+ /**
+ * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
+ */
public static final Object VALUE_ALPHA_INTERPOLATION_DEFAULT
= "Default alpha blending methods";
+ /**
+ * A key for the 'color rendering' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_COLOR_RENDER_SPEED}</td>
+ * <td>Prefer speed over quality.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_COLOR_RENDER_QUALITY}</td>
+ * <td>Prefer quality over speed.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_COLOR_RENDER_DEFAULT}</td>
+ * <td>Use the default setting.</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_COLOR_RENDERING;
+ /**
+ * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
+ */
public static final Object VALUE_COLOR_RENDER_SPEED
= "Fastest color rendering mode";
+ /**
+ * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
+ */
public static final Object VALUE_COLOR_RENDER_QUALITY
= "Highest quality color rendering mode";
+ /**
+ * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
+ */
public static final Object VALUE_COLOR_RENDER_DEFAULT
= "Default color rendering mode";
+ /**
+ * A key for the 'stroke control' hint. Permitted values are:
+ * <p>
+ * <table>
+ * <tr>
+ * <td>{@link #VALUE_STROKE_DEFAULT}</td>
+ * <td>Use the default setting.</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_STROKE_NORMALIZE}</td>
+ * <td>XXX</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #VALUE_STROKE_PURE}</td>
+ * <td>XXX</td>
+ * </tr>
+ * </table>
+ */
public static final Key KEY_STROKE_CONTROL;
+ /**
+ * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
+ */
public static final Object VALUE_STROKE_DEFAULT
= "Default stroke normalization";
+ /**
+ * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
+ */
public static final Object VALUE_STROKE_NORMALIZE
= "Normalize strokes for consistent rendering";
+ /**
+ * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
+ */
public static final Object VALUE_STROKE_PURE
= "Pure stroke conversion for accurate paths";
@@ -250,26 +543,59 @@ public class RenderingHints implements Map, Cloneable
VALUE_STROKE_PURE);
}
+ /**
+ * Creates a new collection of hints containing all the (key, value) pairs
+ * in the specified map.
+ *
+ * @param init a map containing a collection of hints (<code>null</code>
+ * permitted).
+ */
public RenderingHints(Map init)
{
- putAll(init);
+ if (init != null)
+ putAll(init);
}
+ /**
+ * Creates a new collection containing a single (key, value) pair.
+ *
+ * @param key the key.
+ * @param value the value.
+ */
public RenderingHints(Key key, Object value)
{
put(key, value);
}
+ /**
+ * Returns the number of hints in the collection.
+ *
+ * @return The number of hints.
+ */
public int size()
{
return hintMap.size();
}
+ /**
+ * Returns <code>true</code> if there are no hints in the collection,
+ * and <code>false</code> otherwise.
+ *
+ * @return A boolean.
+ */
public boolean isEmpty()
{
return hintMap.isEmpty();
}
+ /**
+ * Returns <code>true</code> if the collection of hints contains the
+ * specified key, and <code>false</code> otherwise.
+ *
+ * @param key the key.
+ *
+ * @return A boolean.
+ */
public boolean containsKey(Object key)
{
if (key == null)
@@ -277,16 +603,42 @@ public class RenderingHints implements Map, Cloneable
return hintMap.containsKey((Key) key);
}
+ /**
+ * Returns <code>true</code> if the collection of hints contains the
+ * specified value, and <code>false</code> otherwise.
+ *
+ * @param value the value.
+ *
+ * @return A boolean.
+ */
public boolean containsValue(Object value)
{
return hintMap.containsValue(value);
}
+ /**
+ * Returns the value associated with the specified key.
+ *
+ * @param key the key.
+ *
+ * @return The value.
+ */
public Object get(Object key)
{
return hintMap.get((Key) key);
}
+ /**
+ * Adds a (key, value) pair to the collection of hints (if the
+ * collection already contains the specified key, then the
+ * value is updated).
+ *
+ * @param key the key.
+ * @param value the value.
+ *
+ * @return the previous value of the key or <code>null</code> if the key
+ * didn't have a value yet.
+ */
public Object put(Object key, Object value)
{
if (key == null || value == null)
@@ -296,51 +648,125 @@ public class RenderingHints implements Map, Cloneable
return hintMap.put(key, value);
}
+ /**
+ * Adds all the hints from a collection to this collection.
+ *
+ * @param hints the hint collection.
+ */
public void add(RenderingHints hints)
{
hintMap.putAll(hints);
}
+ /**
+ * Clears all the hints from this collection.
+ */
public void clear()
{
hintMap.clear();
}
+ /**
+ * Removes a hint from the collection.
+ *
+ * @param key the key.
+ *
+ * @return The value that was associated with the key, or <code>null</code> if
+ * the key was not part of the collection
+ *
+ * @throws ClassCastException if the key is not a subclass of
+ * {@link RenderingHints.Key}.
+ */
public Object remove(Object key)
{
- return remove((Key) key);
+ // don't remove the (Key) cast, it is necessary to throw the exception
+ // required by the spec
+ return hintMap.remove((Key) key);
}
+ /**
+ * Adds a collection of (key, value) pairs to the collection.
+ *
+ * @param m a map containing (key, value) items.
+ *
+ * @throws ClassCastException if the map contains a key that is not
+ * a subclass of {@link RenderingHints.Key}.
+ * @throws IllegalArgumentException if the map contains a value that is
+ * not compatible with its key.
+ */
public void putAll(Map m)
{
+ // preprocess map to generate appropriate exceptions
+ Iterator iterator = m.keySet().iterator();
+ while (iterator.hasNext())
+ {
+ Key key = (Key) iterator.next();
+ if (!key.isCompatibleValue(m.get(key)))
+ throw new IllegalArgumentException();
+ }
+ // map is OK, update
hintMap.putAll(m);
}
+ /**
+ * Returns a set containing the keys from this collection.
+ *
+ * @return A set of keys.
+ */
public Set keySet()
{
return hintMap.keySet();
}
+ /**
+ * Returns a collection of the values from this hint collection. The
+ * collection is backed by the <code>RenderingHints</code> instance,
+ * so updates to one will affect the other.
+ *
+ * @return A collection of values.
+ */
public Collection values()
{
return hintMap.values();
}
+ /**
+ * Returns a set of entries from the collection.
+ *
+ * @return A set of entries.
+ */
public Set entrySet()
{
return Collections.unmodifiableSet(hintMap.entrySet());
}
+ /**
+ * Checks this collection for equality with an arbitrary object.
+ *
+ * @param o the object (<code>null</code> permitted)
+ *
+ * @return A boolean.
+ */
public boolean equals(Object o)
{
return hintMap.equals(o);
}
+ /**
+ * Returns a hash code for the collection of hints.
+ *
+ * @return A hash code.
+ */
public int hashCode()
{
return hintMap.hashCode();
}
+ /**
+ * Creates a clone of this instance.
+ *
+ * @return A clone.
+ */
public Object clone()
{
try
@@ -355,6 +781,11 @@ public class RenderingHints implements Map, Cloneable
}
}
+ /**
+ * Returns a string representation of this instance.
+ *
+ * @return A string.
+ */
public String toString()
{
return hintMap.toString();
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index 457df0c..abd5514 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -1,5 +1,5 @@
/* ScrollPane.java -- Scrolling window
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,7 @@ package java.awt;
import java.awt.event.MouseEvent;
import java.awt.peer.ComponentPeer;
import java.awt.peer.ScrollPanePeer;
+
import javax.accessibility.Accessible;
/**
diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java
index a01dc3c..7cc9715 100644
--- a/libjava/java/awt/Scrollbar.java
+++ b/libjava/java/awt/Scrollbar.java
@@ -1,5 +1,6 @@
/* Scrollbar.java -- AWT Scrollbar widget
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +39,11 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
import java.awt.peer.ScrollbarPeer;
import java.util.EventListener;
+
import javax.accessibility.Accessible;
/**
@@ -123,7 +125,7 @@ private transient boolean valueIsAdjusting = false;
/*
* The number used to generate the name returned by getName.
*/
- private static transient long next_scrollbar_number = 0;
+ private static transient long next_scrollbar_number;
/*************************************************************************/
@@ -363,7 +365,7 @@ getVisible()
* Sets the width of the scrollbar's thumb, in units relative to the
* maximum and minimum value of the scrollbar.
*
- * @param visibileAmount The new visible amount value of the scrollbar.
+ * @param visibleAmount The new visible amount value of the scrollbar.
*/
public void
setVisibleAmount(int visibleAmount)
diff --git a/libjava/java/awt/Shape.java b/libjava/java/awt/Shape.java
index 8d61c4a..47c9719 100644
--- a/libjava/java/awt/Shape.java
+++ b/libjava/java/awt/Shape.java
@@ -57,8 +57,8 @@ import java.awt.geom.Rectangle2D;
* @author Aaron M. Renn <arenn@urbanophile.com>
* @see PathIterator
* @see AffineTransform
- * @see FlatteningPathIterator
- * @see GeneralPath
+ * @see java.awt.geom.FlatteningPathIterator
+ * @see java.awt.geom.GeneralPath
* @since 1.0
* @status updated to 1.4
*/
@@ -109,15 +109,15 @@ public interface Shape
* Test if a high-precision rectangle intersects the shape. This is true
* if any point in the rectangle is in the shape, with the caveat that the
* operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
* @param w the width of the rectangle, undefined results if negative
* @param h the height of the rectangle, undefined results if negative
* @return true if the rectangle intersects this shape
- * @see Area
+ * @see java.awt.geom.Area
* @since 1.2
*/
boolean intersects(double x, double y, double w, double h);
@@ -126,8 +126,8 @@ public interface Shape
* Test if a high-precision rectangle intersects the shape. This is true
* if any point in the rectangle is in the shape, with the caveat that the
* operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param r the rectangle
* @return true if the rectangle intersects this shape
@@ -141,15 +141,15 @@ public interface Shape
* Test if a high-precision rectangle lies completely in the shape. This is
* true if all points in the rectangle are in the shape, with the caveat
* that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
* @param w the width of the rectangle, undefined results if negative
* @param h the height of the rectangle, undefined results if negative
* @return true if the rectangle is contained in this shape
- * @see Area
+ * @see java.awt.geom.Area
* @since 1.2
*/
boolean contains(double x, double y, double w, double h);
@@ -158,8 +158,8 @@ public interface Shape
* Test if a high-precision rectangle lies completely in the shape. This is
* true if all points in the rectangle are in the shape, with the caveat
* that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param r the rectangle
* @return true if the rectangle is contained in this shape
@@ -195,7 +195,7 @@ public interface Shape
* iterations from future changes to the boundary, and document this fact.
*
* @param transform an optional transform to apply to the iterator
- * @param double the maximum distance for deviation from the real boundary
+ * @param flatness the maximum distance for deviation from the real boundary
* @return a new iterator over the boundary
* @since 1.2
*/
diff --git a/libjava/java/awt/SystemColor.java b/libjava/java/awt/SystemColor.java
index 5217677..3428fba 100644
--- a/libjava/java/awt/SystemColor.java
+++ b/libjava/java/awt/SystemColor.java
@@ -1,5 +1,5 @@
/* SystemColor.java -- access dynamic system color values
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.image.ColorModel;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
+import java.awt.image.ColorModel;
import java.io.Serializable;
/**
@@ -72,7 +72,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the desktop color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #desktop
*/
@@ -80,7 +80,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the active caption color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #activeCaption
*/
@@ -88,7 +88,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the active caption text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #activeCaptionText
*/
@@ -96,7 +96,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the active caption border color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #activeCaptionBorder
*/
@@ -104,7 +104,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive caption color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #inactiveCaption
*/
@@ -112,7 +112,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive caption text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #inactiveCaptionText
*/
@@ -120,7 +120,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive caption border color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #inactiveCaptionBorder
*/
@@ -128,7 +128,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the window background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #window
*/
@@ -136,7 +136,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the window border color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #windowBorder
*/
@@ -144,7 +144,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the window text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #windowText
*/
@@ -152,7 +152,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the menu background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #menu
*/
@@ -160,7 +160,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the menu text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #menuText
*/
@@ -168,7 +168,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the text background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #text
*/
@@ -176,7 +176,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the text foreground color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textText
*/
@@ -184,7 +184,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the highlighted text background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textHighlight
*/
@@ -192,7 +192,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the highlighted text foreground color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textHighlightText
*/
@@ -200,7 +200,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive text foreground color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textInactiveText
*/
@@ -208,7 +208,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #control
*/
@@ -216,7 +216,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the control text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlText
*/
@@ -224,7 +224,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the highlighted control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlHighlight
*/
@@ -232,7 +232,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the lightly highlighted control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlLtHighlight
*/
@@ -240,7 +240,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the shadowed control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlShadow
*/
@@ -248,7 +248,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the darkly shadowed control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlDkShadow
*/
@@ -256,7 +256,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the scrollbar background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #scrollbar
*/
@@ -264,7 +264,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the info background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #info
*/
@@ -272,7 +272,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the info text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #infoText
*/
@@ -280,7 +280,7 @@ public final class SystemColor extends Color implements Serializable
/**
* The number of system colors. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*/
public static final int NUM_COLORS = 26;
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
index 6355376..9efc775 100644
--- a/libjava/java/awt/TextArea.java
+++ b/libjava/java/awt/TextArea.java
@@ -1,48 +1,52 @@
/* TextArea.java -- A multi-line text entry component
Copyright (C) 1999, 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. */
+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 java.awt;
+import java.awt.event.KeyEvent;
import java.awt.peer.ComponentPeer;
import java.awt.peer.TextAreaPeer;
-import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.Set;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleStateSet;
+
/**
* A TextArea is a text component capable of displaying multiple lines
@@ -100,7 +104,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
/*
* The number used to generate the name returned by getName.
*/
- private static transient long next_text_number = 0;
+ private static transient long next_text_number;
/**
* Initialize a new instance of <code>TextArea</code> that is empty.
@@ -596,4 +600,21 @@ public class TextArea extends TextComponent implements java.io.Serializable
{
return next_text_number++;
}
+
+ protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
+ {
+ protected AccessibleAWTTextArea()
+ {
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ return super.getAccessibleStateSet();
+ }
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleAWTTextArea();
+ }
}
diff --git a/libjava/java/awt/TextComponent.java b/libjava/java/awt/TextComponent.java
index 9cdb507..8f9f875 100644
--- a/libjava/java/awt/TextComponent.java
+++ b/libjava/java/awt/TextComponent.java
@@ -42,8 +42,16 @@ import java.awt.event.TextEvent;
import java.awt.event.TextListener;
import java.awt.peer.TextComponentPeer;
import java.io.Serializable;
+import java.text.BreakIterator;
import java.util.EventListener;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
+import javax.swing.text.AttributeSet;
+
/**
* This class provides common functionality for widgets than
* contain text.
@@ -51,7 +59,7 @@ import java.util.EventListener;
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class TextComponent extends Component
- implements Serializable
+ implements Serializable, Accessible
{
/*
@@ -90,6 +98,219 @@ private String text;
*/
protected transient TextListener textListener;
+ protected class AccessibleAWTTextComponent
+ extends AccessibleAWTComponent
+ implements AccessibleText, TextListener
+ {
+ // Constructor
+ // Adds a listener for tracking caret changes
+ public AccessibleAWTTextComponent()
+ {
+ TextComponent.this.addTextListener(this);
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.TEXT;
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // TODO: Docs say PropertyChangeEvent will fire if this state changes.
+ // That means that the event has to fire when editable changes.
+ AccessibleStateSet ss = super.getAccessibleStateSet();
+ if (editable)
+ ss.add(AccessibleState.EDITABLE);
+ return ss;
+ }
+
+ public AccessibleText getAccessibleText()
+ {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getIndexAtPoint(java.awt.Point)
+ */
+ public int getIndexAtPoint(Point point)
+ {
+ return TextComponent.this.getIndexAtPoint(point);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getCharacterBounds(int)
+ */
+ public Rectangle getCharacterBounds(int index)
+ {
+ return TextComponent.this.getCharacterBounds(index);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getCharCount()
+ */
+ public int getCharCount()
+ {
+ return text.length();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getCaretPosition()
+ */
+ public int getCaretPosition()
+ {
+ return TextComponent.this.getCaretPosition();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getAtIndex(int, int)
+ */
+ public String getAtIndex(int part, int index)
+ {
+ if (index < 0 || index >= text.length())
+ return null;
+ BreakIterator it = null;
+ switch (part)
+ {
+ case CHARACTER:
+ return text.substring(index, index + 1);
+ case WORD:
+ it = BreakIterator.getWordInstance();
+ break;
+ case SENTENCE:
+ it = BreakIterator.getSentenceInstance();
+ break;
+ default:
+ return null;
+ }
+ it.setText(text);
+ int start = index;
+ if (!it.isBoundary(index))
+ start = it.preceding(index);
+ int end = it.following(index);
+ if (end == -1)
+ return text.substring(index);
+ else
+ return text.substring(index, end);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getAfterIndex(int, int)
+ */
+ public String getAfterIndex(int part, int index) {
+ if (index < 0 || index >= text.length())
+ return null;
+ BreakIterator it = null;
+ switch (part)
+ {
+ case CHARACTER:
+ return text.substring(index, index + 1);
+ case WORD:
+ it = BreakIterator.getWordInstance();
+ break;
+ case SENTENCE:
+ it = BreakIterator.getSentenceInstance();
+ break;
+ default:
+ return null;
+ }
+ it.setText(text);
+ int start = index;
+ if (!it.isBoundary(index))
+ start = it.following(index);
+ // Make sure there was a complete unit. I.e. if index is in the middle
+ // of a word, return null if there is no word after the that one.
+ if (start == -1)
+ return null;
+ int end = it.following(start);
+ if (end == -1)
+ return text.substring(index);
+ else
+ return text.substring(index, end);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getBeforeIndex(int, int)
+ */
+ public String getBeforeIndex(int part, int index)
+ {
+ if (index < 1 || index >= text.length())
+ return null;
+ BreakIterator it = null;
+ switch (part)
+ {
+ case CHARACTER:
+ return text.substring(index - 1, index);
+ case WORD:
+ it = BreakIterator.getWordInstance();
+ break;
+ case SENTENCE:
+ it = BreakIterator.getSentenceInstance();
+ break;
+ default:
+ return null;
+ }
+ it.setText(text);
+ int end = index;
+ if (!it.isBoundary(index))
+ end = it.preceding(index);
+ // Make sure there was a complete unit. I.e. if index is in the middle
+ // of a word, return null if there is no word before that one.
+ if (end == -1)
+ return null;
+ int start = it.preceding(end);
+ if (start == -1)
+ return text.substring(0, end);
+ else
+ return text.substring(start, end);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getCharacterAttribute(int)
+ */
+ public AttributeSet getCharacterAttribute(int index)
+ {
+ // FIXME: I suspect this really gets filled in by subclasses.
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getSelectionStart()
+ */
+ public int getSelectionStart() {
+ // TODO Auto-generated method stub
+ return selectionStart;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getSelectionEnd()
+ */
+ public int getSelectionEnd()
+ {
+ return selectionEnd;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.accessibility.AccessibleText#getSelectedText()
+ */
+ public String getSelectedText()
+ {
+ if (selectionEnd - selectionStart > 0)
+ return text.substring(selectionStart, selectionEnd);
+ else
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.TextListener#textValueChanged(java.awt.event.TextEvent)
+ */
+ public void textValueChanged(TextEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
/*************************************************************************/
/*
@@ -468,5 +689,30 @@ paramString()
{
return (TextListener[]) getListeners (TextListener.class);
}
+
+ /*******************************/
+ // Provide AccessibleAWTTextComponent access to several peer functions that
+ // aren't publicly exposed.
+ private synchronized int
+ getIndexAtPoint(Point p)
+ {
+ TextComponentPeer tcp = (TextComponentPeer)getPeer();
+ if (tcp != null)
+ return tcp.getIndexAtPoint(p.x, p.y);
+ return -1;
+ }
+
+ private synchronized Rectangle
+ getCharacterBounds(int i)
+ {
+ TextComponentPeer tcp = (TextComponentPeer)getPeer();
+ if (tcp != null)
+ return tcp.getCharacterBounds(i);
+ return null;
+ }
+
+
+
+
} // class TextComponent
diff --git a/libjava/java/awt/TextField.java b/libjava/java/awt/TextField.java
index 1a783e2..5c84aab 100644
--- a/libjava/java/awt/TextField.java
+++ b/libjava/java/awt/TextField.java
@@ -1,5 +1,5 @@
/* TextField.java -- A one line text entry field
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,10 +40,13 @@ package java.awt;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.peer.TextFieldPeer;
import java.awt.peer.ComponentPeer;
+import java.awt.peer.TextFieldPeer;
import java.util.EventListener;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleStateSet;
+
/**
* This class implements a single line text entry field widget
*
@@ -517,4 +520,22 @@ paramString()
{
return (ActionListener[]) getListeners (ActionListener.class);
}
+
+ protected class AccessibleAWTTextField extends AccessibleAWTTextComponent
+ {
+ protected AccessibleAWTTextField()
+ {
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ return super.getAccessibleStateSet();
+ }
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleAWTTextField();
+ }
+
} // class TextField
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
index 2ee3f50..504572a 100644
--- a/libjava/java/awt/Toolkit.java
+++ b/libjava/java/awt/Toolkit.java
@@ -53,8 +53,8 @@ import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.peer.ButtonPeer;
import java.awt.peer.CanvasPeer;
-import java.awt.peer.CheckboxPeer;
import java.awt.peer.CheckboxMenuItemPeer;
+import java.awt.peer.CheckboxPeer;
import java.awt.peer.ChoicePeer;
import java.awt.peer.DialogPeer;
import java.awt.peer.FileDialogPeer;
@@ -63,13 +63,13 @@ import java.awt.peer.FramePeer;
import java.awt.peer.LabelPeer;
import java.awt.peer.LightweightPeer;
import java.awt.peer.ListPeer;
-import java.awt.peer.MenuPeer;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuPeer;
import java.awt.peer.PanelPeer;
import java.awt.peer.PopupMenuPeer;
-import java.awt.peer.ScrollbarPeer;
import java.awt.peer.ScrollPanePeer;
+import java.awt.peer.ScrollbarPeer;
import java.awt.peer.TextAreaPeer;
import java.awt.peer.TextFieldPeer;
import java.awt.peer.WindowPeer;
@@ -371,8 +371,8 @@ public abstract class Toolkit
* should override this method and provide real system colors for the
* native GUI platform.
*
- * @param colors The array to copy the system colors into.
- * It must be at least 26 elements.
+ * @param systemColors The array to copy the system colors into.
+ * It must be at least 26 elements.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index 7397a1c..d084bb4 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -1,5 +1,5 @@
/* Window.java --
- Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -48,11 +48,12 @@ import java.awt.event.WindowStateListener;
import java.awt.peer.WindowPeer;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
-import java.util.Iterator;
import java.util.EventListener;
+import java.util.Iterator;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
@@ -141,7 +142,7 @@ public class Window extends Container implements Accessible
* Initializes a new instance of <code>Window</code> with the specified
* parent. The window will initially be invisible.
*
- * @param parent The owning <code>Frame</code> of this window.
+ * @param owner The owning <code>Frame</code> of this window.
*
* @exception IllegalArgumentException If the owner's GraphicsConfiguration
* is not from a screen device, or if owner is null; this exception is always
@@ -291,7 +292,7 @@ public class Window extends Container implements Accessible
initialFocusOwner = policy.getInitialComponent (this);
if (initialFocusOwner != null)
- initialFocusOwner.requestFocusInWindow (false);
+ initialFocusOwner.requestFocusInWindow ();
shown = true;
}
@@ -604,7 +605,7 @@ public class Window extends Container implements Accessible
* <code>processWindowEvent()</code> is called to process the event,
* otherwise the superclass version of this method is invoked.
*
- * @param event The event to process.
+ * @param evt The event to process.
*/
protected void processEvent(AWTEvent evt)
{
@@ -620,7 +621,7 @@ public class Window extends Container implements Accessible
* invoked if it is enabled via <code>enableEvents()</code> or if
* a listener has been added.
*
- * @param event The event to process.
+ * @param evt The event to process.
*/
protected void processWindowEvent(WindowEvent evt)
{
@@ -710,7 +711,7 @@ public class Window extends Container implements Accessible
/**
* Post a Java 1.0 event to the event queue.
*
- * @param event The event to post.
+ * @param e The event to post.
*
* @deprecated
*/
diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java
index 2ed247f..5cc526a 100644
--- a/libjava/java/awt/color/ICC_ColorSpace.java
+++ b/libjava/java/awt/color/ICC_ColorSpace.java
@@ -1,5 +1,5 @@
/* ICC_ColorSpace.java -- the canonical color space implementation
- Copyright (C) 2000, 2002 Free Software Foundation
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -38,9 +38,44 @@ exception statement from your version. */
package java.awt.color;
+import gnu.java.awt.color.CieXyzConverter;
+import gnu.java.awt.color.ClutProfileConverter;
+import gnu.java.awt.color.ColorSpaceConverter;
+import gnu.java.awt.color.GrayProfileConverter;
+import gnu.java.awt.color.GrayScaleConverter;
+import gnu.java.awt.color.LinearRGBConverter;
+import gnu.java.awt.color.PyccConverter;
+import gnu.java.awt.color.RgbProfileConverter;
+import gnu.java.awt.color.SrgbConverter;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
/**
- * NEEDS DOCUMENTATION
+ * ICC_ColorSpace - an implementation of ColorSpace
+ *
+ * While an ICC_Profile class abstracts the data in an ICC profile file
+ * an ICC_ColorSpace performs the color space conversions defined by
+ * an ICC_Profile instance.
+ *
+ * Typically, an ICC_Profile will either be created using getInstance,
+ * either from the built-in colorspaces, or from an ICC profile file.
+ * Then a ICC_Colorspace will be used to perform transforms from the
+ * device colorspace to and from the profile color space.
+ *
+ * The PCS used by ColorSpace is CIE XYZ relative a D50 white point.
+ * (Profiles using a CIE Lab PCS will have their input and output converted
+ * to D50 CIE XYZ accordingly.
*
+ * Note that a valid profile may not contain transforms in both directions,
+ * in which case the output may be undefined.
+ * All built-in colorspaces have bidirectional transforms, but developers
+ * using an ICC profile file may want to check the profile class using
+ * the ICC_Profile.getProfileClass() method. Input class profiles are
+ * guaranteed to have transforms to the PCS, output class profiles are
+ * guaranteed to have transforms from the PCS to device space.
+ *
+ * @author Sven de Marothy
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
* @since 1.2
*/
@@ -82,6 +117,13 @@ public class ICC_ColorSpace extends ColorSpace
private boolean needScaleInit;
/**
+ * Tells us if the PCS is CIE LAB (must be CIEXYZ otherwise)
+ */
+ private transient int type;
+ private transient int nComponents;
+ private transient ColorSpaceConverter converter;
+
+ /**
* Constructs a new ICC_ColorSpace from an ICC_Profile object.
*
* @exception IllegalArgumentException If profile is inappropriate for
@@ -89,10 +131,18 @@ public class ICC_ColorSpace extends ColorSpace
*/
public ICC_ColorSpace(ICC_Profile profile)
{
- super(CS_sRGB, profile.getNumComponents());
+ super(profile.getColorSpaceType(), profile.getNumComponents());
+
+ converter = getConverter(profile);
thisProfile = profile;
+ nComponents = profile.getNumComponents();
+ type = profile.getColorSpaceType();
+ makeArrays();
}
+ /**
+ * Return the profile
+ */
public ICC_Profile getProfile()
{
return thisProfile;
@@ -107,11 +157,7 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float[] toRGB(float[] colorvalue)
{
- if (colorvalue.length < numComponents)
- throw new IllegalArgumentException ();
-
- // FIXME: Always assumes sRGB:
- return colorvalue;
+ return converter.toRGB(colorvalue);
}
/**
@@ -123,11 +169,7 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float[] fromRGB(float[] rgbvalue)
{
- if (rgbvalue.length < 3)
- throw new IllegalArgumentException ();
-
- // FIXME: Always assumes sRGB:
- return rgbvalue;
+ return converter.fromRGB(rgbvalue);
}
/**
@@ -139,8 +181,7 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float[] toCIEXYZ(float[] colorvalue)
{
- // FIXME: Not implemented
- throw new UnsupportedOperationException();
+ return converter.toCIEXYZ(colorvalue);
}
/**
@@ -152,8 +193,12 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float[] fromCIEXYZ(float[] colorvalue)
{
- // FIXME: Not implemented
- throw new UnsupportedOperationException();
+ return converter.fromCIEXYZ(colorvalue);
+ }
+
+ public boolean isCS_sRGB()
+ {
+ return converter instanceof SrgbConverter;
}
/**
@@ -167,9 +212,11 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float getMinValue(int idx)
{
- if (type == TYPE_Lab && (idx == 1 || idx == 2))
- return -128;
- if (idx < 0 || idx >= numComponents)
+ // FIXME: Not 100% certain of this.
+ if (type == ColorSpace.TYPE_Lab && (idx == 1 || idx == 2))
+ return -128f;
+
+ if (idx < 0 || idx >= nComponents)
throw new IllegalArgumentException();
return 0;
}
@@ -185,17 +232,83 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float getMaxValue(int idx)
{
- if (type == TYPE_XYZ && idx >= 0 && idx <= 2)
+ if (type == ColorSpace.TYPE_XYZ && idx >= 0 && idx <= 2)
return 1 + 32767 / 32768f;
- else if (type == TYPE_Lab)
+ else if (type == ColorSpace.TYPE_Lab)
{
- if (idx == 0)
- return 100;
- if (idx == 1 || idx == 2)
- return 127;
+ if (idx == 0)
+ return 100;
+ if (idx == 1 || idx == 2)
+ return 127;
}
- if (idx < 0 || idx >= numComponents)
+ if (idx < 0 || idx >= nComponents)
throw new IllegalArgumentException();
return 1;
}
+
+ /**
+ * Returns a colorspace converter suitable for a given profile
+ */
+ private ColorSpaceConverter getConverter(ICC_Profile profile)
+ {
+ ColorSpaceConverter converter;
+ switch (profile.isPredefined())
+ {
+ case CS_sRGB:
+ converter = new SrgbConverter();
+ break;
+ case CS_CIEXYZ:
+ converter = new CieXyzConverter();
+ break;
+ case CS_GRAY:
+ converter = new GrayScaleConverter();
+ break;
+ case CS_LINEAR_RGB:
+ converter = new LinearRGBConverter();
+ break;
+ case CS_PYCC:
+ converter = new PyccConverter();
+ break;
+ default:
+ if (profile instanceof ICC_ProfileRGB)
+ converter = new RgbProfileConverter((ICC_ProfileRGB) profile);
+ else if (profile instanceof ICC_ProfileGray)
+ converter = new GrayProfileConverter((ICC_ProfileGray) profile);
+ else
+ converter = new ClutProfileConverter(profile);
+ break;
+ }
+ return converter;
+ }
+
+ /**
+ * Serialization compatibility requires these variable to be set,
+ * although we don't use them. Perhaps we should?
+ */
+ private void makeArrays()
+ {
+ minVal = new float[nComponents];
+ maxVal = new float[nComponents];
+
+ invDiffMinMax = diffMinMax = null;
+ for (int i = 0; i < nComponents; i++)
+ {
+ minVal[i] = getMinValue(i);
+ maxVal[i] = getMaxValue(i);
+ }
+ needScaleInit = true;
+ }
+
+ /**
+ * Deserializes the object
+ */
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ // set up objects
+ converter = getConverter(thisProfile);
+ nComponents = thisProfile.getNumComponents();
+ type = thisProfile.getColorSpaceType();
+ }
} // class ICC_ColorSpace
diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java
index eb534eb..79aa886 100644
--- a/libjava/java/awt/color/ICC_Profile.java
+++ b/libjava/java/awt/color/ICC_Profile.java
@@ -1,5 +1,5 @@
/* ICC_Profile.java -- color space profiling
- Copyright (C) 2000, 2002 Free Software Foundation
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -38,18 +38,47 @@ exception statement from your version. */
package java.awt.color;
+import gnu.java.awt.color.ProfileHeader;
+import gnu.java.awt.color.TagEntry;
+
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
import java.io.OutputStream;
import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.util.Enumeration;
+import java.util.Hashtable;
/**
- * STUBBED
+ * ICC Profile - represents an ICC Color profile.
+ * The ICC profile format is a standard file format which maps the transform
+ * from a device color space to a standard Profile Color Space (PCS), which
+ * can either be CIE L*a*b or CIE XYZ.
+ * (With the exception of device link profiles which map from one device space
+ * to another)
+ *
+ * ICC profiles calibrated to specific input/output devices are used when color
+ * fidelity is of importance.
+ *
+ * An instance of ICC_Profile can be created using the getInstance() methods,
+ * either using one of the predefined color spaces enumerated in ColorSpace,
+ * or from an ICC profile file, or from an input stream.
+ *
+ * An ICC_ColorSpace object can then be created to transform color values
+ * through the profile.
+ *
+ * The ICC_Profile class implements the version 2 format specified by
+ * International Color Consortium Specification ICC.1:1998-09,
+ * and its addendum ICC.1A:1999-04, April 1999
+ * (available at www.color.org)
+ *
+ * @author Sven de Marothy
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
* @since 1.2
*/
@@ -60,6 +89,9 @@ public class ICC_Profile implements Serializable
*/
private static final long serialVersionUID = -3938515861990936766L;
+ /**
+ * ICC Profile classes
+ */
public static final int CLASS_INPUT = 0;
public static final int CLASS_DISPLAY = 1;
public static final int CLASS_OUTPUT = 2;
@@ -68,92 +100,111 @@ public class ICC_Profile implements Serializable
public static final int CLASS_ABSTRACT = 5;
public static final int CLASS_NAMEDCOLOR = 6;
- public static final int icSigXYZData = 1482250784;
- public static final int icSigLabData = 1281450528;
- public static final int icSigLuvData = 1282766368;
- public static final int icSigYCbCrData = 1497588338;
- public static final int icSigYxyData = 1501067552;
- public static final int icSigRgbData = 1380401696;
- public static final int icSigGrayData = 1196573017;
- public static final int icSigHsvData = 1213421088;
- public static final int icSigHlsData = 1212961568;
- public static final int icSigCmykData = 1129142603;
- public static final int icSigCmyData = 1129142560;
- public static final int icSigSpace2CLR = 843271250;
- public static final int icSigSpace3CLR = 860048466;
- public static final int icSigSpace4CLR = 876825682;
- public static final int icSigSpace5CLR = 893602898;
- public static final int icSigSpace6CLR = 910380114;
- public static final int icSigSpace7CLR = 927157330;
- public static final int icSigSpace8CLR = 943934546;
- public static final int icSigSpace9CLR = 960711762;
- public static final int icSigSpaceACLR = 1094929490;
- public static final int icSigSpaceBCLR = 1111706706;
- public static final int icSigSpaceCCLR = 1128483922;
- public static final int icSigSpaceDCLR = 1145261138;
- public static final int icSigSpaceECLR = 1162038354;
- public static final int icSigSpaceFCLR = 1178815570;
-
- public static final int icSigInputClass = 1935896178;
- public static final int icSigDisplayClass = 1835955314;
- public static final int icSigOutputClass = 1886549106;
- public static final int icSigLinkClass = 1818848875;
- public static final int icSigAbstractClass = 1633842036;
- public static final int icSigColorSpaceClass = 1936744803;
- public static final int icSigNamedColorClass = 1852662636;
+ /**
+ * ICC Profile class signatures
+ */
+ public static final int icSigInputClass = 0x73636e72; // 'scnr'
+ public static final int icSigDisplayClass = 0x6d6e7472; // 'mntr'
+ public static final int icSigOutputClass = 0x70727472; // 'prtr'
+ public static final int icSigLinkClass = 0x6c696e6b; // 'link'
+ public static final int icSigColorSpaceClass = 0x73706163; // 'spac'
+ public static final int icSigAbstractClass = 0x61627374; // 'abst'
+ public static final int icSigNamedColorClass = 0x6e6d636c; // 'nmcl'
+
+ /**
+ * Color space signatures
+ */
+ public static final int icSigXYZData = 0x58595A20; // 'XYZ '
+ public static final int icSigLabData = 0x4C616220; // 'Lab '
+ public static final int icSigLuvData = 0x4C757620; // 'Luv '
+ public static final int icSigYCbCrData = 0x59436272; // 'YCbr'
+ public static final int icSigYxyData = 0x59787920; // 'Yxy '
+ public static final int icSigRgbData = 0x52474220; // 'RGB '
+ public static final int icSigGrayData = 0x47524159; // 'GRAY'
+ public static final int icSigHsvData = 0x48535620; // 'HSV '
+ public static final int icSigHlsData = 0x484C5320; // 'HLS '
+ public static final int icSigCmykData = 0x434D594B; // 'CMYK'
+ public static final int icSigCmyData = 0x434D5920; // 'CMY '
+ public static final int icSigSpace2CLR = 0x32434C52; // '2CLR'
+ public static final int icSigSpace3CLR = 0x33434C52; // '3CLR'
+ public static final int icSigSpace4CLR = 0x34434C52; // '4CLR'
+ public static final int icSigSpace5CLR = 0x35434C52; // '5CLR'
+ public static final int icSigSpace6CLR = 0x36434C52; // '6CLR'
+ public static final int icSigSpace7CLR = 0x37434C52; // '7CLR'
+ public static final int icSigSpace8CLR = 0x38434C52; // '8CLR'
+ public static final int icSigSpace9CLR = 0x39434C52; // '9CLR'
+ public static final int icSigSpaceACLR = 0x41434C52; // 'ACLR'
+ public static final int icSigSpaceBCLR = 0x42434C52; // 'BCLR'
+ public static final int icSigSpaceCCLR = 0x43434C52; // 'CCLR'
+ public static final int icSigSpaceDCLR = 0x44434C52; // 'DCLR'
+ public static final int icSigSpaceECLR = 0x45434C52; // 'ECLR'
+ public static final int icSigSpaceFCLR = 0x46434C52; // 'FCLR'
+ /**
+ * Rendering intents
+ */
public static final int icPerceptual = 0;
public static final int icRelativeColorimetric = 1;
public static final int icSaturation = 2;
public static final int icAbsoluteColorimetric = 3;
- public static final int icSigHead = 1751474532;
- public static final int icSigAToB0Tag = 1093812784;
- public static final int icSigAToB1Tag = 1093812785;
- public static final int icSigAToB2Tag = 1093812786;
- public static final int icSigBlueColorantTag = 1649957210;
- public static final int icSigBlueTRCTag = 1649693251;
- public static final int icSigBToA0Tag = 1110589744;
- public static final int icSigBToA1Tag = 1110589745;
- public static final int icSigBToA2Tag = 1110589746;
- public static final int icSigCalibrationDateTimeTag = 1667329140;
- public static final int icSigCharTargetTag = 1952543335;
- public static final int icSigCopyrightTag = 1668313716;
- public static final int icSigCrdInfoTag = 1668441193;
- public static final int icSigDeviceMfgDescTag = 1684893284;
- public static final int icSigDeviceModelDescTag = 1684890724;
- public static final int icSigDeviceSettingsTag = 1684371059;
- public static final int icSigGamutTag = 1734438260;
- public static final int icSigGrayTRCTag = 1800688195;
- public static final int icSigGreenColorantTag = 1733843290;
- public static final int icSigGreenTRCTag = 1733579331;
- public static final int icSigLuminanceTag = 1819635049;
- public static final int icSigMeasurementTag = 1835360627;
- public static final int icSigMediaBlackPointTag = 1651208308;
- public static final int icSigMediaWhitePointTag = 2004119668;
- public static final int icSigNamedColor2Tag = 1852009522;
- public static final int icSigOutputResponseTag = 1919251312;
- public static final int icSigPreview0Tag = 1886545200;
- public static final int icSigPreview1Tag = 1886545201;
- public static final int icSigPreview2Tag = 1886545202;
- public static final int icSigProfileDescriptionTag = 1684370275;
- public static final int icSigProfileSequenceDescTag = 1886610801;
- public static final int icSigPs2CRD0Tag = 1886610480;
- public static final int icSigPs2CRD1Tag = 1886610481;
- public static final int icSigPs2CRD2Tag = 1886610482;
- public static final int icSigPs2CRD3Tag = 1886610483;
- public static final int icSigPs2CSATag = 1886597747;
- public static final int icSigPs2RenderingIntentTag = 1886597737;
- public static final int icSigRedColorantTag = 1918392666;
- public static final int icSigRedTRCTag = 1918128707;
- public static final int icSigScreeningDescTag = 1935897188;
- public static final int icSigScreeningTag = 1935897198;
- public static final int icSigTechnologyTag = 1952801640;
- public static final int icSigUcrBgTag = 1650877472;
- public static final int icSigViewingCondDescTag = 1987405156;
- public static final int icSigViewingConditionsTag = 1986618743;
- public static final int icSigChromaticityTag = 1667789421;
+ /**
+ * Tag signatures
+ */
+ public static final int icSigAToB0Tag = 0x41324230; // 'A2B0'
+ public static final int icSigAToB1Tag = 0x41324231; // 'A2B1'
+ public static final int icSigAToB2Tag = 0x41324232; // 'A2B2'
+ public static final int icSigBlueColorantTag = 0x6258595A; // 'bXYZ'
+ public static final int icSigBlueTRCTag = 0x62545243; // 'bTRC'
+ public static final int icSigBToA0Tag = 0x42324130; // 'B2A0'
+ public static final int icSigBToA1Tag = 0x42324131; // 'B2A1'
+ public static final int icSigBToA2Tag = 0x42324132; // 'B2A2'
+ public static final int icSigCalibrationDateTimeTag = 0x63616C74; // 'calt'
+ public static final int icSigCharTargetTag = 0x74617267; // 'targ'
+ public static final int icSigCopyrightTag = 0x63707274; // 'cprt'
+ public static final int icSigCrdInfoTag = 0x63726469; // 'crdi'
+ public static final int icSigDeviceMfgDescTag = 0x646D6E64; // 'dmnd'
+ public static final int icSigDeviceModelDescTag = 0x646D6464; // 'dmdd'
+ public static final int icSigDeviceSettingsTag = 0x64657673; // 'devs'
+ public static final int icSigGamutTag = 0x67616D74; // 'gamt'
+ public static final int icSigGrayTRCTag = 0x6b545243; // 'kTRC'
+ public static final int icSigGreenColorantTag = 0x6758595A; // 'gXYZ'
+ public static final int icSigGreenTRCTag = 0x67545243; // 'gTRC'
+ public static final int icSigLuminanceTag = 0x6C756d69; // 'lumi'
+ public static final int icSigMeasurementTag = 0x6D656173; // 'meas'
+ public static final int icSigMediaBlackPointTag = 0x626B7074; // 'bkpt'
+ public static final int icSigMediaWhitePointTag = 0x77747074; // 'wtpt'
+ public static final int icSigNamedColor2Tag = 0x6E636C32; // 'ncl2'
+ public static final int icSigOutputResponseTag = 0x72657370; // 'resp'
+ public static final int icSigPreview0Tag = 0x70726530; // 'pre0'
+ public static final int icSigPreview1Tag = 0x70726531; // 'pre1'
+ public static final int icSigPreview2Tag = 0x70726532; // 'pre2'
+ public static final int icSigProfileDescriptionTag = 0x64657363; // 'desc'
+ public static final int icSigProfileSequenceDescTag = 0x70736571; // 'pseq'
+ public static final int icSigPs2CRD0Tag = 0x70736430; // 'psd0'
+ public static final int icSigPs2CRD1Tag = 0x70736431; // 'psd1'
+ public static final int icSigPs2CRD2Tag = 0x70736432; // 'psd2'
+ public static final int icSigPs2CRD3Tag = 0x70736433; // 'psd3'
+ public static final int icSigPs2CSATag = 0x70733273; // 'ps2s'
+ public static final int icSigPs2RenderingIntentTag = 0x70733269; // 'ps2i'
+ public static final int icSigRedColorantTag = 0x7258595A; // 'rXYZ'
+ public static final int icSigRedTRCTag = 0x72545243; // 'rTRC'
+ public static final int icSigScreeningDescTag = 0x73637264; // 'scrd'
+ public static final int icSigScreeningTag = 0x7363726E; // 'scrn'
+ public static final int icSigTechnologyTag = 0x74656368; // 'tech'
+ public static final int icSigUcrBgTag = 0x62666420; // 'bfd '
+ public static final int icSigViewingCondDescTag = 0x76756564; // 'vued'
+ public static final int icSigViewingConditionsTag = 0x76696577; // 'view'
+ public static final int icSigChromaticityTag = 0x6368726D; // 'chrm'
+ /**
+ * Non-ICC tag 'head' for use in retrieving the header with getData()
+ */
+ public static final int icSigHead = 0x68656164;
+
+ /**
+ * Header offsets
+ */
public static final int icHdrSize = 0;
public static final int icHdrCmmId = 4;
public static final int icHdrVersion = 8;
@@ -171,129 +222,1025 @@ public class ICC_Profile implements Serializable
public static final int icHdrIlluminant = 68;
public static final int icHdrCreator = 80;
+ /**
+ *
+ */
public static final int icTagType = 0;
public static final int icTagReserved = 4;
public static final int icCurveCount = 8;
public static final int icCurveData = 12;
-
public static final int icXYZNumberX = 8;
/**
+ * offset of the Tag table
+ */
+ private static final int tagTableOffset = 128;
+
+ /**
* @serial
*/
- final int iccProfileSerializedDataVersion = 1;
+ private static final int iccProfileSerializedDataVersion = 1;
+
+ /**
+ * Constants related to generating profiles for
+ * built-in colorspace profiles
+ */
+ /**
+ * Copyright notice to stick into built-in-profile files.
+ */
+ private static final String copyrightNotice = "Generated by GNU Classpath.";
+
+ /**
+ * Resolution of the TRC to use for predefined profiles.
+ * 1024 should suffice.
+ */
+ private static final int TRC_POINTS = 1024;
+
+ /**
+ * CIE 1931 D50 white point (in Lab coordinates)
+ */
+ private static final float[] D50 = { 0.96422f, 1.00f, 0.82521f };
+
+ /**
+ * Color space profile ID
+ * Set to the predefined profile class (e.g. CS_sRGB) if a predefined
+ * color space is used, set to -1 otherwise.
+ * (or if the profile has been modified)
+ */
+ private transient int profileID;
+
+ /**
+ * The profile header data
+ */
+ private transient ProfileHeader header;
- transient int profileID;
+ /**
+ * A hashtable containing the profile tags as TagEntry objects
+ */
+ private transient Hashtable tagTable;
+ /**
+ * Contructor for predefined colorspaces
+ */
ICC_Profile(int profileID)
{
- this.profileID = profileID;
+ header = null;
+ tagTable = null;
+ createProfile(profileID);
+ }
+
+ /**
+ * Constructs an ICC_Profile from a header and a table of loaded tags.
+ */
+ ICC_Profile(ProfileHeader h, Hashtable tags) throws IllegalArgumentException
+ {
+ header = h;
+ tagTable = tags;
+ profileID = -1; // Not a predefined color space
+ }
+
+ /**
+ * Constructs an ICC_Profile from a byte array of data.
+ */
+ ICC_Profile(byte[] data) throws IllegalArgumentException
+ {
+ // get header and verify it
+ header = new ProfileHeader(data);
+ header.verifyHeader(data.length);
+ tagTable = createTagTable(data);
+ profileID = -1; // Not a predefined color space
}
+ /**
+ * Free up the used memory.
+ */
protected void finalize()
{
- // XXX What resources should we free?
+ header = null;
+ tagTable = null;
}
+ /**
+ * Returns an ICC_Profile instance from a byte array of profile data.
+ *
+ * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
+ * may be returned if appropriate.
+ *
+ * @throws IllegalArgumentException if the profile data is an invalid
+ * v2 profile.
+ *
+ * @param data - the profile data
+ * @return An ICC_Profile object
+ */
public static ICC_Profile getInstance(byte[] data)
{
- throw new Error("not implemented");
+ ProfileHeader header = new ProfileHeader(data);
+
+ // verify it as a correct ICC header, including size
+ header.verifyHeader(data.length);
+
+ Hashtable tags = createTagTable(data);
+
+ if (isRGBProfile(header, tags))
+ return new ICC_ProfileRGB(data);
+ if (isGrayProfile(header, tags))
+ return new ICC_ProfileGray(data);
+
+ return new ICC_Profile(header, tags);
}
+ /**
+ * Returns an predefined ICC_Profile instance.
+ *
+ * This will construct an ICC_Profile instance from one of the predefined
+ * color spaces in the ColorSpace class. (e.g. CS_sRGB, CS_GRAY, etc)
+ *
+ * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
+ * may be returned if appropriate.
+ *
+ * @return An ICC_Profile object
+ */
public static ICC_Profile getInstance(int cspace)
{
+ if (cspace == ColorSpace.CS_sRGB || cspace == ColorSpace.CS_LINEAR_RGB)
+ return new ICC_ProfileRGB(cspace);
+ if (cspace == ColorSpace.CS_GRAY)
+ return new ICC_ProfileGray(cspace);
return new ICC_Profile(cspace);
}
- public static ICC_Profile getInstance(String filename) throws IOException
+ /**
+ * Returns an ICC_Profile instance from an ICC Profile file.
+ *
+ * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
+ * may be returned if appropriate.
+ *
+ * @throws IllegalArgumentException if the profile data is an invalid
+ * v2 profile.
+ * @throws IOException if the file could not be read.
+ *
+ * @param filename - the file name of the profile file.
+ * @return An ICC_Profile object
+ */
+ public static ICC_Profile getInstance(String filename)
+ throws IOException
{
return getInstance(new FileInputStream(filename));
}
- public static ICC_Profile getInstance(InputStream in) throws IOException
+ /**
+ * Returns an ICC_Profile instance from an InputStream.
+ *
+ * This method can be used for reading ICC profiles embedded in files
+ * which support this. (JPEG and SVG for instance).
+ *
+ * The stream is treated in the following way: The profile header
+ * (128 bytes) is read first, and the header is validated. If the profile
+ * header is valid, it will then attempt to read the rest of the profile
+ * from the stream. The stream is not closed after reading.
+ *
+ * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
+ * may be returned if appropriate.
+ *
+ * @throws IllegalArgumentException if the profile data is an invalid
+ * v2 profile.
+ * @throws IOException if the stream could not be read.
+ *
+ * @param in - the input stream to read the profile from.
+ * @return An ICC_Profile object
+ */
+ public static ICC_Profile getInstance(InputStream in)
+ throws IOException
{
- throw new Error("not implemented");
+ // read the header
+ byte[] headerData = new byte[ProfileHeader.HEADERSIZE];
+ if (in.read(headerData) != ProfileHeader.HEADERSIZE)
+ throw new IllegalArgumentException("Invalid profile header");
+
+ ProfileHeader header = new ProfileHeader(headerData);
+
+ // verify it as a correct ICC header, but do not verify the
+ // size as we are reading from a stream.
+ header.verifyHeader(-1);
+
+ // get the size
+ byte[] data = new byte[header.getSize()];
+ System.arraycopy(headerData, 0, data, 0, ProfileHeader.HEADERSIZE);
+
+ // read the rest
+ if (in.read(data, ProfileHeader.HEADERSIZE,
+ header.getSize() - ProfileHeader.HEADERSIZE) != header.getSize()
+ - ProfileHeader.HEADERSIZE)
+ throw new IOException("Incorrect profile size");
+
+ return getInstance(data);
}
+ /**
+ * Returns the major version number
+ */
public int getMajorVersion()
{
- throw new Error("not implemented");
+ return header.getMajorVersion();
}
+ /**
+ * Returns the minor version number.
+ *
+ * Only the least-significant byte contains data, in BCD form:
+ * the least-significant nibble is the BCD bug fix revision,
+ * the most-significant nibble is the BCD minor revision number.
+ *
+ * (E.g. For a v2.1.0 profile this will return <code>0x10</code>)
+ */
public int getMinorVersion()
{
- throw new Error("not implemented");
+ return header.getMinorVersion();
}
+ /**
+ * Returns the device class of this profile,
+ *
+ * (E.g. CLASS_INPUT for a scanner profile,
+ * CLASS_OUTPUT for a printer)
+ */
public int getProfileClass()
{
- throw new Error("not implemented");
+ return header.getProfileClass();
}
+ /**
+ * Returns the color space of this profile, in terms
+ * of the color space constants defined in ColorSpace.
+ * (For example, it may be a ColorSpace.TYPE_RGB)
+ */
public int getColorSpaceType()
{
- throw new Error("not implemented");
+ return header.getColorSpace();
}
+ /**
+ * Returns the color space of this profile's Profile Connection Space (OCS)
+ *
+ * In terms of the color space constants defined in ColorSpace.
+ * This may be TYPE_XYZ or TYPE_Lab
+ */
public int getPCSType()
{
- throw new Error("not implemented");
+ return header.getProfileColorSpace();
}
+ /**
+ * Writes the profile data to an ICC profile file.
+ * @param filename - The name of the file to write
+ * @throws IOException if the write failed.
+ */
public void write(String filename) throws IOException
{
- write(new FileOutputStream(filename));
+ FileOutputStream out = new FileOutputStream(filename);
+ write(out);
+ out.flush();
+ out.close();
}
+ /**
+ * Writes the profile data in ICC profile file-format to a stream.
+ * This is useful for embedding ICC profiles in file formats which
+ * support this (such as JPEG and SVG).
+ *
+ * The stream is not closed after writing.
+ * @param out - The outputstream to which the profile data should be written
+ * @throws IOException if the write failed.
+ */
public void write(OutputStream out) throws IOException
{
- throw new Error("not implemented");
+ out.write(getData());
}
+ /**
+ * Returns the data corresponding to this ICC_Profile as a byte array.
+ *
+ * @return The data in a byte array,
+ * where the first element corresponds to first byte of the profile file.
+ */
public byte[] getData()
{
- throw new Error("not implemented");
+ int size = getSize();
+ byte[] data = new byte[size];
+
+ // Header
+ System.arraycopy(header.getData(size), 0, data, 0, ProfileHeader.HEADERSIZE);
+ // # of tags
+ byte[] tt = getTagTable();
+ System.arraycopy(tt, 0, data, ProfileHeader.HEADERSIZE, tt.length);
+
+ Enumeration e = tagTable.elements();
+ while (e.hasMoreElements())
+ {
+ TagEntry tag = (TagEntry) e.nextElement();
+ System.arraycopy(tag.getData(), 0,
+ data, tag.getOffset(), tag.getSize());
+ }
+ return data;
}
+ /**
+ * Returns the ICC profile tag data
+ * The non ICC-tag icSigHead is also permitted to request the header data.
+ *
+ * @param tagSignature The ICC signature of the requested tag
+ * @return A byte array containing the tag data
+ */
public byte[] getData(int tagSignature)
{
- throw new Error("not implemented");
+ if (tagSignature == icSigHead)
+ return header.getData(getSize());
+
+ TagEntry t = (TagEntry) tagTable.get(TagEntry.tagHashKey(tagSignature));
+ if (t == null)
+ return null;
+ return t.getData();
}
+ /**
+ * Sets the ICC profile tag data.
+ *
+ * Note that an ICC profile can only contain one tag of each type, if
+ * a tag already exists with the given signature, it is replaced.
+ *
+ * @param tagSignature - The signature of the tag to set
+ * @param data - A byte array containing the tag data
+ */
public void setData(int tagSignature, byte[] data)
{
- throw new Error("not implemented");
+ profileID = -1; // Not a predefined color space if modified.
+
+ if (tagSignature == icSigHead)
+ header = new ProfileHeader(data);
+ else
+ {
+ TagEntry t = new TagEntry(tagSignature, data);
+ tagTable.put(t.hashKey(), t);
+ }
}
+ /**
+ * Get the number of components in the profile's device color space.
+ */
public int getNumComponents()
{
- switch (profileID)
+ int[] lookup =
+ {
+ ColorSpace.TYPE_RGB, 3, ColorSpace.TYPE_CMY, 3,
+ ColorSpace.TYPE_CMYK, 4, ColorSpace.TYPE_GRAY, 1,
+ ColorSpace.TYPE_YCbCr, 3, ColorSpace.TYPE_XYZ, 3,
+ ColorSpace.TYPE_Lab, 3, ColorSpace.TYPE_HSV, 3,
+ ColorSpace.TYPE_2CLR, 2, ColorSpace.TYPE_Luv, 3,
+ ColorSpace.TYPE_Yxy, 3, ColorSpace.TYPE_HLS, 3,
+ ColorSpace.TYPE_3CLR, 3, ColorSpace.TYPE_4CLR, 4,
+ ColorSpace.TYPE_5CLR, 5, ColorSpace.TYPE_6CLR, 6,
+ ColorSpace.TYPE_7CLR, 7, ColorSpace.TYPE_8CLR, 8,
+ ColorSpace.TYPE_9CLR, 9, ColorSpace.TYPE_ACLR, 10,
+ ColorSpace.TYPE_BCLR, 11, ColorSpace.TYPE_CCLR, 12,
+ ColorSpace.TYPE_DCLR, 13, ColorSpace.TYPE_ECLR, 14,
+ ColorSpace.TYPE_FCLR, 15
+ };
+ for (int i = 0; i < lookup.length; i += 2)
+ if (header.getColorSpace() == lookup[i])
+ return lookup[i + 1];
+ return 3; // should never happen.
+ }
+
+ /**
+ * After deserializing we must determine if the class we want
+ * is really one of the more specialized ICC_ProfileRGB or
+ * ICC_ProfileGray classes.
+ */
+ protected Object readResolve() throws ObjectStreamException
+ {
+ if (isRGBProfile(header, tagTable))
+ return new ICC_ProfileRGB(getData());
+ if (isGrayProfile(header, tagTable))
+ return new ICC_ProfileGray(getData());
+ return this;
+ }
+
+ /**
+ * Deserializes an instance
+ */
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ String predef = (String) s.readObject();
+ byte[] data = (byte[]) s.readObject();
+
+ if (data != null)
+ {
+ header = new ProfileHeader(data);
+ tagTable = createTagTable(data);
+ profileID = -1; // Not a predefined color space
+ }
+
+ if (predef != null)
+ {
+ predef = predef.intern();
+ if (predef.equals("CS_sRGB"))
+ createProfile(ColorSpace.CS_sRGB);
+ if (predef.equals("CS_LINEAR_RGB"))
+ createProfile(ColorSpace.CS_LINEAR_RGB);
+ if (predef.equals("CS_CIEXYZ"))
+ createProfile(ColorSpace.CS_CIEXYZ);
+ if (predef.equals("CS_GRAY"))
+ createProfile(ColorSpace.CS_GRAY);
+ if (predef.equals("CS_PYCC"))
+ createProfile(ColorSpace.CS_PYCC);
+ }
+ }
+
+ /**
+ * Serializes an instance
+ * The format is a String and a byte array,
+ * The string is non-null if the instance is one of the built-in profiles.
+ * Otherwise the byte array is non-null and represents the profile data.
+ */
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.defaultWriteObject();
+ if (profileID == ColorSpace.CS_sRGB)
+ s.writeObject("CS_sRGB");
+ else if (profileID == ColorSpace.CS_LINEAR_RGB)
+ s.writeObject("CS_LINEAR_RGB");
+ else if (profileID == ColorSpace.CS_CIEXYZ)
+ s.writeObject("CS_CIEXYZ");
+ else if (profileID == ColorSpace.CS_GRAY)
+ s.writeObject("CS_GRAY");
+ else if (profileID == ColorSpace.CS_PYCC)
+ s.writeObject("CS_PYCC");
+ else
+ {
+ s.writeObject(null); // null string
+ s.writeObject(getData()); // data
+ return;
+ }
+ s.writeObject(null); // null data
+ }
+
+ /**
+ * Sorts a ICC profile byte array into TagEntry objects stored in
+ * a hash table.
+ */
+ private static Hashtable createTagTable(byte[] data)
+ throws IllegalArgumentException
+ {
+ ByteBuffer buf = ByteBuffer.wrap(data);
+ int nTags = buf.getInt(tagTableOffset);
+
+ Hashtable tagTable = new Hashtable();
+ for (int i = 0; i < nTags; i++)
+ {
+ TagEntry te = new TagEntry(buf.getInt(tagTableOffset
+ + i * TagEntry.entrySize + 4),
+ buf.getInt(tagTableOffset
+ + i * TagEntry.entrySize + 8),
+ buf.getInt(tagTableOffset
+ + i * TagEntry.entrySize + 12),
+ data);
+
+ if (tagTable.put(te.hashKey(), te) != null)
+ throw new IllegalArgumentException("Duplicate tag in profile:" + te);
+ }
+ return tagTable;
+ }
+
+ /**
+ * Returns the total size of the padded, stored data
+ * Note: Tags must be stored on 4-byte aligned offsets.
+ */
+ private int getSize()
+ {
+ int totalSize = ProfileHeader.HEADERSIZE; // size of header
+
+ int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize; // size of tag table
+ if ((tagTableSize & 0x0003) != 0)
+ tagTableSize += 4 - (tagTableSize & 0x0003); // pad
+ totalSize += tagTableSize;
+
+ Enumeration e = tagTable.elements();
+ while (e.hasMoreElements())
+ { // tag data
+ int tagSize = ((TagEntry) e.nextElement()).getSize();
+ if ((tagSize & 0x0003) != 0)
+ tagSize += 4 - (tagSize & 0x0003); // pad
+ totalSize += tagSize;
+ }
+ return totalSize;
+ }
+
+ /**
+ * Generates the tag index table
+ */
+ private byte[] getTagTable()
+ {
+ int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize;
+ if ((tagTableSize & 0x0003) != 0)
+ tagTableSize += 4 - (tagTableSize & 0x0003); // pad
+
+ int offset = 4;
+ int tagOffset = ProfileHeader.HEADERSIZE + tagTableSize;
+ ByteBuffer buf = ByteBuffer.allocate(tagTableSize);
+ buf.putInt(tagTable.size()); // number of tags
+
+ Enumeration e = tagTable.elements();
+ while (e.hasMoreElements())
+ {
+ TagEntry tag = (TagEntry) e.nextElement();
+ buf.putInt(offset, tag.getSignature());
+ buf.putInt(offset + 4, tagOffset);
+ buf.putInt(offset + 8, tag.getSize());
+ tag.setOffset(tagOffset);
+ int tagSize = tag.getSize();
+ if ((tagSize & 0x0003) != 0)
+ tagSize += 4 - (tagSize & 0x0003); // pad
+ tagOffset += tagSize;
+ offset += 12;
+ }
+ return buf.array();
+ }
+
+ /**
+ * Returns if the criteria for an ICC_ProfileRGB are met.
+ * This means:
+ * Color space is TYPE_RGB
+ * (r,g,b)ColorantTags included
+ * (r,g,b)TRCTags included
+ * mediaWhitePointTag included
+ */
+ private static boolean isRGBProfile(ProfileHeader header, Hashtable tags)
+ {
+ if (header.getColorSpace() != ColorSpace.TYPE_RGB)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigRedColorantTag)) == null)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigGreenColorantTag)) == null)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigBlueColorantTag)) == null)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigRedTRCTag)) == null)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigGreenTRCTag)) == null)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigBlueTRCTag)) == null)
+ return false;
+ return (tags.get(TagEntry.tagHashKey(icSigMediaWhitePointTag)) != null);
+ }
+
+ /**
+ * Returns if the criteria for an ICC_ProfileGray are met.
+ * This means:
+ * Colorspace is TYPE_GRAY
+ * grayTRCTag included
+ * mediaWhitePointTag included
+ */
+ private static boolean isGrayProfile(ProfileHeader header, Hashtable tags)
+ {
+ if (header.getColorSpace() != ColorSpace.TYPE_GRAY)
+ return false;
+ if (tags.get(TagEntry.tagHashKey(icSigGrayTRCTag)) == null)
+ return false;
+ return (tags.get(TagEntry.tagHashKey(icSigMediaWhitePointTag)) != null);
+ }
+
+ /**
+ * Returns curve data for a 'curv'-type tag
+ * If it's a gamma curve, a single entry will be returned with the
+ * gamma value (including 1.0 for linear response)
+ * Otherwise the TRC table is returned.
+ *
+ * (Package private - used by ICC_ProfileRGB and ICC_ProfileGray)
+ */
+ short[] getCurve(int signature)
+ {
+ byte[] data = getData(signature);
+ short[] curve;
+
+ // can't find tag?
+ if (data == null)
+ return null;
+
+ // not an curve type tag?
+ ByteBuffer buf = ByteBuffer.wrap(data);
+ if (buf.getInt(0) != 0x63757276) // 'curv' type
+ return null;
+ int count = buf.getInt(8);
+ if (count == 0)
+ {
+ curve = new short[1];
+ curve[0] = 0x0100; // 1.00 in u8fixed8
+ return curve;
+ }
+ if (count == 1)
+ {
+ curve = new short[1];
+ curve[0] = buf.getShort(12); // other u8fixed8 gamma
+ return curve;
+ }
+ curve = new short[count];
+ for (int i = 0; i < count; i++)
+ curve[i] = buf.getShort(12 + i * 2);
+ return curve;
+ }
+
+ /**
+ * Returns XYZ tristimulus values for an 'XYZ ' type tag
+ * @return the XYZ values, or null if the tag was not an 'XYZ ' type tag.
+ *
+ * (Package private - used by ICC_ProfileXYZ and ICC_ProfileGray)
+ */
+ float[] getXYZData(int signature)
+ {
+ byte[] data = getData(signature);
+
+ // can't find tag?
+ if (data == null)
+ return null;
+
+ // not an XYZData type tag?
+ ByteBuffer buf = ByteBuffer.wrap(data);
+ if (buf.getInt(0) != icSigXYZData) // 'XYZ ' type
+ return null;
+
+ float[] point = new float[3];
+
+ // get the X,Y,Z tristimulus values
+ point[0] = ((float) buf.getInt(8)) / 65536f;
+ point[1] = ((float) buf.getInt(12)) / 65536f;
+ point[2] = ((float) buf.getInt(16)) / 65536f;
+ return point;
+ }
+
+ /**
+ * Returns the profile ID if it's a predefined profile
+ * Or -1 for a profile loaded from an ICC profile
+ *
+ * (Package private - used by ICC_ColorSpace)
+ */
+ int isPredefined()
+ {
+ return profileID;
+ }
+
+ /**
+ * Creates a tag of XYZ-value type.
+ */
+ private byte[] makeXYZData(float[] values)
+ {
+ ByteBuffer buf = ByteBuffer.allocate(20);
+ buf.putInt(0, icSigXYZData); // 'XYZ '
+ buf.putInt(4, 0);
+ buf.putInt(8, (int) (values[0] * 65536.0));
+ buf.putInt(12, (int) (values[1] * 65536.0));
+ buf.putInt(16, (int) (values[2] * 65536.0));
+ return buf.array();
+ }
+
+ /**
+ * Creates a tag of text type
+ */
+ private byte[] makeTextTag(String text)
+ {
+ int length = text.length();
+ ByteBuffer buf = ByteBuffer.allocate(8 + length + 1);
+ byte[] data;
+ try
+ {
+ data = text.getBytes("US-ASCII");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ data = new byte[length]; // shouldn't happen
+ }
+
+ buf.putInt(0, (int) 0x74657874); // 'text'
+ buf.putInt(4, 0);
+ for (int i = 0; i < length; i++)
+ buf.put(8 + i, data[i]);
+ buf.put(8 + length, (byte) 0); // null-terminate
+ return buf.array();
+ }
+
+ /**
+ * Creates a tag of textDescriptionType
+ */
+ private byte[] makeDescTag(String text)
+ {
+ int length = text.length();
+ ByteBuffer buf = ByteBuffer.allocate(90 + length + 1);
+ buf.putInt(0, (int) 0x64657363); // 'desc'
+ buf.putInt(4, 0); // reserved
+ buf.putInt(8, length + 1); // ASCII length, including null termination
+ byte[] data;
+
+ try
+ {
+ data = text.getBytes("US-ASCII");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ data = new byte[length]; // shouldn't happen
+ }
+
+ for (int i = 0; i < length; i++)
+ buf.put(12 + i, data[i]);
+ buf.put(12 + length, (byte) 0); // null-terminate
+
+ for (int i = 0; i < 39; i++)
+ buf.putShort(13 + length + (i * 2), (short) 0); // 78 bytes we can ignore
+
+ return buf.array();
+ }
+
+ /**
+ * Creates a tag of TRC type (linear curve)
+ */
+ private byte[] makeTRC()
+ {
+ ByteBuffer buf = ByteBuffer.allocate(12);
+ buf.putInt(0, 0x63757276); // 'curv' type
+ buf.putInt(4, 0); // reserved
+ buf.putInt(8, 0);
+ return buf.array();
+ }
+
+ /**
+ * Creates a tag of TRC type (single gamma value)
+ */
+ private byte[] makeTRC(float gamma)
+ {
+ short gammaValue = (short) (gamma * 256f);
+ ByteBuffer buf = ByteBuffer.allocate(14);
+ buf.putInt(0, 0x63757276); // 'curv' type
+ buf.putInt(4, 0); // reserved
+ buf.putInt(8, 1);
+ buf.putShort(12, gammaValue); // 1.00 in u8fixed8
+ return buf.array();
+ }
+
+ /**
+ * Creates a tag of TRC type (TRC curve points)
+ */
+ private byte[] makeTRC(float[] trc)
+ {
+ ByteBuffer buf = ByteBuffer.allocate(12 + 2 * trc.length);
+ buf.putInt(0, 0x63757276); // 'curv' type
+ buf.putInt(4, 0); // reserved
+ buf.putInt(8, trc.length); // number of points
+
+ // put the curve values
+ for (int i = 0; i < trc.length; i++)
+ buf.putShort(12 + i * 2, (short) (trc[i] * 65535f));
+
+ return buf.array();
+ }
+
+ /**
+ * Creates an identity color lookup table.
+ */
+ private byte[] makeIdentityClut()
+ {
+ final int nIn = 3;
+ final int nOut = 3;
+ final int nInEntries = 256;
+ final int nOutEntries = 256;
+ final int gridpoints = 16;
+
+ // gridpoints**nIn
+ final int clutSize = 2 * nOut * gridpoints * gridpoints * gridpoints;
+ final int totalSize = clutSize + 2 * nInEntries * nIn
+ + 2 * nOutEntries * nOut + 52;
+
+ ByteBuffer buf = ByteBuffer.allocate(totalSize);
+ buf.putInt(0, 0x6D667432); // 'mft2'
+ buf.putInt(4, 0); // reserved
+ buf.put(8, (byte) nIn); // number input channels
+ buf.put(9, (byte) nOut); // number output channels
+ buf.put(10, (byte) gridpoints); // number gridpoints
+ buf.put(11, (byte) 0); // padding
+
+ // identity matrix
+ buf.putInt(12, 65536); // = 1 in s15.16 fixed point
+ buf.putInt(16, 0);
+ buf.putInt(20, 0);
+ buf.putInt(24, 0);
+ buf.putInt(28, 65536);
+ buf.putInt(32, 0);
+ buf.putInt(36, 0);
+ buf.putInt(40, 0);
+ buf.putInt(44, 65536);
+
+ buf.putShort(48, (short) nInEntries); // input table entries
+ buf.putShort(50, (short) nOutEntries); // output table entries
+
+ // write the linear input channels, unsigned 16.16 fixed point,
+ // from 0.0 to FF.FF
+ for (int channel = 0; channel < 3; channel++)
+ for (int i = 0; i < nInEntries; i++)
+ {
+ short n = (short) ((i << 8) | i); // assumes 256 entries
+ buf.putShort(52 + (channel * nInEntries + i) * 2, n);
+ }
+ int clutOffset = 52 + nInEntries * nIn * 2;
+
+ for (int x = 0; x < gridpoints; x++)
+ for (int y = 0; y < gridpoints; y++)
+ for (int z = 0; z < gridpoints; z++)
+ {
+ int offset = clutOffset + z * 2 * nOut + y * gridpoints * 2 * nOut
+ + x * gridpoints * gridpoints * 2 * nOut;
+ double xf = ((double) x) / ((double) gridpoints - 1.0);
+ double yf = ((double) y) / ((double) gridpoints - 1.0);
+ double zf = ((double) z) / ((double) gridpoints - 1.0);
+ buf.putShort(offset, (short) (xf * 65535.0));
+ buf.putShort(offset + 2, (short) (yf * 65535.0));
+ buf.putShort(offset + 4, (short) (zf * 65535.0));
+ }
+
+ for (int channel = 0; channel < 3; channel++)
+ for (int i = 0; i < nOutEntries; i++)
+ {
+ short n = (short) ((i << 8) | i); // assumes 256 entries
+ buf.putShort(clutOffset + clutSize + (channel * nOutEntries + i) * 2,
+ n);
+ }
+
+ return buf.array();
+ }
+
+ /**
+ * Creates profile data corresponding to the built-in colorspaces.
+ */
+ private void createProfile(int colorSpace) throws IllegalArgumentException
+ {
+ this.profileID = colorSpace;
+ header = new ProfileHeader();
+ tagTable = new Hashtable();
+
+ switch (colorSpace)
{
case ColorSpace.CS_sRGB:
+ createRGBProfile();
+ return;
case ColorSpace.CS_LINEAR_RGB:
+ createLinearRGBProfile();
+ return;
case ColorSpace.CS_CIEXYZ:
- return 3;
+ createCIEProfile();
+ return;
case ColorSpace.CS_GRAY:
- return 1;
- case ColorSpace.CS_PYCC: // have no clue about this one
+ createGrayProfile();
+ return;
+ case ColorSpace.CS_PYCC:
+ createPyccProfile();
+ return;
default:
- throw new UnsupportedOperationException("profile not implemented");
+ throw new IllegalArgumentException("Not a predefined color space!");
}
}
- protected Object readResolve() throws ObjectStreamException
+ /**
+ * Creates an ICC_Profile representing the sRGB color space
+ */
+ private void createRGBProfile()
{
- throw new Error("not implemented");
+ header.setColorSpace( ColorSpace.TYPE_RGB );
+ header.setProfileColorSpace( ColorSpace.TYPE_XYZ );
+ ICC_ColorSpace cs = new ICC_ColorSpace(this);
+
+ float[] r = { 1f, 0f, 0f };
+ float[] g = { 0f, 1f, 0f };
+ float[] b = { 0f, 0f, 1f };
+ float[] black = { 0f, 0f, 0f };
+
+ // CIE 1931 D50 white point (in Lab coordinates)
+ float[] white = D50;
+
+ // Get tristimulus values (matrix elements)
+ r = cs.toCIEXYZ(r);
+ g = cs.toCIEXYZ(g);
+ b = cs.toCIEXYZ(b);
+
+ // Generate the sRGB TRC curve, this is the linear->nonlinear
+ // RGB transform.
+ cs = new ICC_ColorSpace(getInstance(ICC_ColorSpace.CS_LINEAR_RGB));
+ float[] points = new float[TRC_POINTS];
+ float[] in = new float[3];
+ for (int i = 0; i < TRC_POINTS; i++)
+ {
+ in[0] = in[1] = in[2] = ((float) i) / ((float) TRC_POINTS - 1);
+ in = cs.fromRGB(in);
+ // Note this value is the same for all components.
+ points[i] = in[0];
+ }
+
+ setData(icSigRedColorantTag, makeXYZData(r));
+ setData(icSigGreenColorantTag, makeXYZData(g));
+ setData(icSigBlueColorantTag, makeXYZData(b));
+ setData(icSigMediaWhitePointTag, makeXYZData(white));
+ setData(icSigMediaBlackPointTag, makeXYZData(black));
+ setData(icSigRedTRCTag, makeTRC(points));
+ setData(icSigGreenTRCTag, makeTRC(points));
+ setData(icSigBlueTRCTag, makeTRC(points));
+ setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
+ setData(icSigProfileDescriptionTag, makeDescTag("Generic sRGB"));
+ this.profileID = ColorSpace.CS_sRGB;
}
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
+ /**
+ * Creates an linear sRGB profile
+ */
+ private void createLinearRGBProfile()
{
- throw new Error("not implemented");
+ header.setColorSpace(ColorSpace.TYPE_RGB);
+ header.setProfileColorSpace(ColorSpace.TYPE_XYZ);
+ ICC_ColorSpace cs = new ICC_ColorSpace(this);
+
+ float[] r = { 1f, 0f, 0f };
+ float[] g = { 0f, 1f, 0f };
+ float[] b = { 0f, 0f, 1f };
+ float[] black = { 0f, 0f, 0f };
+
+ float[] white = D50;
+
+ // Get tristimulus values (matrix elements)
+ r = cs.toCIEXYZ(r);
+ g = cs.toCIEXYZ(g);
+ b = cs.toCIEXYZ(b);
+
+ setData(icSigRedColorantTag, makeXYZData(r));
+ setData(icSigGreenColorantTag, makeXYZData(g));
+ setData(icSigBlueColorantTag, makeXYZData(b));
+
+ setData(icSigMediaWhitePointTag, makeXYZData(white));
+ setData(icSigMediaBlackPointTag, makeXYZData(black));
+
+ setData(icSigRedTRCTag, makeTRC());
+ setData(icSigGreenTRCTag, makeTRC());
+ setData(icSigBlueTRCTag, makeTRC());
+ setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
+ setData(icSigProfileDescriptionTag, makeDescTag("Linear RGB"));
+ this.profileID = ColorSpace.CS_LINEAR_RGB;
}
- private void writeObject(ObjectOutputStream s) throws IOException
+ /**
+ * Creates an CIE XYZ identity profile
+ */
+ private void createCIEProfile()
+ {
+ header.setColorSpace( ColorSpace.TYPE_XYZ );
+ header.setProfileColorSpace( ColorSpace.TYPE_XYZ );
+ header.setProfileClass( CLASS_COLORSPACECONVERSION );
+ ICC_ColorSpace cs = new ICC_ColorSpace(this);
+
+ float[] white = D50;
+
+ setData(icSigMediaWhitePointTag, makeXYZData(white));
+ setData(icSigAToB0Tag, makeIdentityClut());
+ setData(icSigBToA0Tag, makeIdentityClut());
+ setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
+ setData(icSigProfileDescriptionTag, makeDescTag("CIE XYZ identity profile"));
+ this.profileID = ColorSpace.CS_CIEXYZ;
+ }
+
+ /**
+ * Creates a linear gray ICC_Profile
+ */
+ private void createGrayProfile()
{
- throw new Error("not implemented");
+ header.setColorSpace(ColorSpace.TYPE_GRAY);
+ header.setProfileColorSpace(ColorSpace.TYPE_XYZ);
+
+ // CIE 1931 D50 white point (in Lab coordinates)
+ float[] white = D50;
+
+ setData(icSigMediaWhitePointTag, makeXYZData(white));
+ setData(icSigGrayTRCTag, makeTRC(1.0f));
+ setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
+ setData(icSigProfileDescriptionTag, makeDescTag("Linear grayscale"));
+ this.profileID = ColorSpace.CS_GRAY;
+ }
+
+ /**
+ * XXX Implement me
+ */
+ private void createPyccProfile()
+ {
+ header.setColorSpace(ColorSpace.TYPE_3CLR);
+ header.setProfileColorSpace(ColorSpace.TYPE_XYZ);
+
+ // Create CLUTs here. :-)
+
+ setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
+ setData(icSigProfileDescriptionTag, makeDescTag("Photo YCC"));
+ this.profileID = ColorSpace.CS_PYCC;
}
} // class ICC_Profile
diff --git a/libjava/java/awt/color/ICC_ProfileGray.java b/libjava/java/awt/color/ICC_ProfileGray.java
index 6aed7ee..54c2771 100644
--- a/libjava/java/awt/color/ICC_ProfileGray.java
+++ b/libjava/java/awt/color/ICC_ProfileGray.java
@@ -1,5 +1,5 @@
/* ICC_ProfileGray.java -- the ICC profile for a Gray colorspace
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,22 @@ exception statement from your version. */
package java.awt.color;
/**
- * STUBBED
+ * ICC_ProfileGray - a special case of ICC_Profiles.
+ *
+ * The ICC_Profile.getInstance() method will return an instance of the
+ * ICC_ProfileGray subclass when all the following conditions are met:
+ * The device color space of the profile is TYPE_GRAY.
+ * The profile contains a gray TRCTag.
+ * The profile contains a mediaWhitePointTag.
+ *
+ * As per the ICC specification, the color space conversion can then
+ * be done through the following method:
+ * linearGray = grayTRC[deviceGray]
+ *
+ * Note that if the profile contains a CLUT for the color space conversion,
+ * it should be used instead, and the TRC information ignored.
+ *
+ * @author Sven de Marothy
* @since 1.2
*/
public class ICC_ProfileGray extends ICC_Profile
@@ -48,24 +63,71 @@ public class ICC_ProfileGray extends ICC_Profile
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = -1124721290732002649L;
+ private transient float[] whitePoint;
- ICC_ProfileGray()
+ /**
+ * Package-private constructor used by ICC_ColorSpace for creating an
+ * ICC_ProfileGray from a predefined ColorSpace (CS_GRAY)
+ */
+ ICC_ProfileGray(int cspace)
+ {
+ super(cspace);
+ whitePoint = getXYZData(icSigMediaWhitePointTag);
+ }
+
+ /**
+ * Package-private constructor used by ICC_ColorSpace for creating an
+ * ICC_ProfileGray from profile data.
+ */
+ ICC_ProfileGray(byte[] data)
{
- super(ColorSpace.CS_GRAY);
+ super(data);
+ whitePoint = getXYZData(icSigMediaWhitePointTag);
}
+
+ /**
+ * Returns the media white point of the profile.
+ */
public float[] getMediaWhitePoint()
{
- return null;
+ float[] wp = new float[3];
+ wp[0] = whitePoint[0];
+ wp[1] = whitePoint[1];
+ wp[2] = whitePoint[2];
+ return wp;
}
+ /**
+ * Returns the TRC gamma value.
+ * @throws ProfileDataException if the TRC is described by a lookup
+ * table and not a gamma value.
+ */
public float getGamma()
{
- return 0;
+ short[] data = getCurve(icSigGrayTRCTag);
+ if (data == null)
+ throw new IllegalArgumentException("Couldn't read Gray TRC data.");
+ if (data.length != 1)
+ throw new ProfileDataException("TRC is a table, not a gamma value.");
+
+ // convert the unsigned 7.8 fixed-point gamma to a float.
+ double gamma = (double) (data[0] & (0xFFFF)) / 256.0;
+ return (float) gamma;
}
+ /**
+ * Returns the TRC lookup table.
+ * @throws ProfileDataException if the TRC is described by a gamma value
+ * and not a lookup table.
+ */
public short[] getTRC()
{
- return null;
+ short[] data = getCurve(icSigGrayTRCTag);
+ if (data == null)
+ throw new IllegalArgumentException("Couldn't read Gray TRC data.");
+ if (data.length <= 1)
+ throw new ProfileDataException("Gamma value, not a TRC table.");
+ return data;
}
} // class ICC_ProfileGray
diff --git a/libjava/java/awt/color/ICC_ProfileRGB.java b/libjava/java/awt/color/ICC_ProfileRGB.java
index aab7578..cb947f6 100644
--- a/libjava/java/awt/color/ICC_ProfileRGB.java
+++ b/libjava/java/awt/color/ICC_ProfileRGB.java
@@ -1,5 +1,5 @@
/* ICC_ProfileRGB.java -- the ICC profile for a RGB colorspace
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,34 @@ exception statement from your version. */
package java.awt.color;
/**
- * STUBBED
+ * ICC_ProfileRGB - a special case of ICC_Profiles.
+ *
+ * The ICC_Profile.getInstance() method will return an instance of the
+ * ICC_ProfileRGB subclass when all the following conditions are met:
+ * The device color space of the profile is TYPE_RGB.
+ * The profile contains red, green and blue ColorantTags.
+ * The profile contains red, green and blue TRCTags.
+ * The profile contains a mediaWhitePointTag included.
+ *
+ * As per the ICC specification, the color space conversion can then
+ * be done through the following method:
+ * linearR = redTRC[deviceR]
+ * linearG = greenTRC[deviceG]
+ * linearB = blueTRC[deviceB]
+ * TRC curves are either a single gamma value, or a 1-dimensional lookup table.
+ *
+ * Followed by the matrix transform:
+ * PCS = M*linear
+ *
+ * Where PCS is the vector of profile color space (must be XYZ) coordinates,
+ * linear is the vector of linear RGB coordinates, and the matrix M is
+ * constructed from the ColorantTags, where the columns are red, green and
+ * blue respectively, and the rows are X, Y and Z.
+ *
+ * Note that if the profile contains a CLUT for the color space conversion,
+ * it should be used instead, and the TRC information ignored.
+ *
+ * @author Sven de Marothy
* @since 1.2
*/
public class ICC_ProfileRGB extends ICC_Profile
@@ -50,31 +77,151 @@ public class ICC_ProfileRGB extends ICC_Profile
private static final long serialVersionUID = 8505067385152579334L;
public static final int REDCOMPONENT = 0;
+
public static final int GREENCOMPONENT = 1;
+
public static final int BLUECOMPONENT = 2;
- ICC_ProfileRGB()
+ private transient float[][] matrix;
+
+ private transient float[] gamma;
+
+ private transient float[] whitePoint;
+
+
+ /**
+ * Package-private constructor used by ICC_ColorSpace for creating an
+ * ICC_ProfileRGB from a predefined ColorSpace (CS_LINEAR_RGB and CS_sRGB)
+ */
+ ICC_ProfileRGB(int cspace)
{
- super(ColorSpace.CS_sRGB);
+ super(cspace);
+ matrix = createMatrix();
+ whitePoint = getXYZData(icSigMediaWhitePointTag);
}
+ /**
+ * Package-private constructor used by ICC_ColorSpace for creating an
+ * ICC_ProfileRGB from profile data.
+ */
+ ICC_ProfileRGB(byte[] data)
+ {
+ super(data);
+ matrix = createMatrix();
+ whitePoint = getXYZData(icSigMediaWhitePointTag);
+ }
+
+ /**
+ * Returns the media white point of the profile.
+ */
public float[] getMediaWhitePoint()
{
- return null;
+ float[] wp = new float[3];
+ wp[0] = whitePoint[0];
+ wp[1] = whitePoint[1];
+ wp[2] = whitePoint[2];
+ return wp;
}
+ /**
+ * Returns the colorant matrix of the conversion.
+ */
public float[][] getMatrix()
{
- return null;
+ float[][] mat = new float[3][3];
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 3; j++)
+ mat[i][j] = matrix[i][j];
+ return mat;
}
+ /**
+ * Returns the gamma value of a component
+ * @throws ProfileDataException if the TRC is described by a lookup
+ * table and not a gamma value.
+ */
public float getGamma(int component)
{
- return 0;
+ short[] data;
+ switch (component)
+ {
+ case REDCOMPONENT:
+ data = getCurve(icSigRedTRCTag);
+ break;
+ case GREENCOMPONENT:
+ data = getCurve(icSigGreenTRCTag);
+ break;
+ case BLUECOMPONENT:
+ data = getCurve(icSigBlueTRCTag);
+ break;
+ default:
+ throw new IllegalArgumentException("Not a valid component");
+ }
+ if (data == null)
+ throw new IllegalArgumentException("Error reading TRC");
+
+ if (data.length != 1)
+ throw new ProfileDataException("Not a single-gamma TRC");
+
+ // convert the unsigned 7.8 fixed-point gamma to a float.
+ float gamma = (float) (((int) data[0] & 0xFF00) >> 8);
+ double fraction = ((int) data[0] & 0x00FF) / 256.0;
+ gamma += (float) fraction;
+ return gamma;
}
+ /**
+ * Returns the TRC lookup table for a component
+ * @throws ProfileDataException if the TRC is described by a gamma
+ * value and not a lookup table.
+ */
public short[] getTRC(int component)
{
- return null;
+ short[] data;
+ switch (component)
+ {
+ case REDCOMPONENT:
+ data = getCurve(icSigRedTRCTag);
+ break;
+ case GREENCOMPONENT:
+ data = getCurve(icSigGreenTRCTag);
+ break;
+ case BLUECOMPONENT:
+ data = getCurve(icSigBlueTRCTag);
+ break;
+ default:
+ throw new IllegalArgumentException("Not a valid component");
+ }
+ if (data == null)
+ throw new IllegalArgumentException("Error reading TRC");
+
+ if (data.length <= 1)
+ throw new ProfileDataException("Gamma value, not a TRC table.");
+
+ return data;
+ }
+
+ /**
+ * Creates the colorspace conversion matrix from the RGB tristimulus
+ * values.
+ */
+ private float[][] createMatrix() throws IllegalArgumentException
+ {
+ float[][] mat = new float[3][3];
+ float[] r;
+ float[] g;
+ float[] b;
+ r = getXYZData(icSigRedColorantTag);
+ g = getXYZData(icSigGreenColorantTag);
+ b = getXYZData(icSigBlueColorantTag);
+ if (r == null || g == null || b == null)
+ throw new IllegalArgumentException("Error reading colorant tags!");
+ for (int i = 0; i < 3; i++)
+ {
+ mat[i][0] = r[i];
+ mat[i][1] = g[i];
+ mat[i][2] = b[i];
+ }
+ return mat;
}
} // class ICC_ProfileRGB
diff --git a/libjava/java/awt/datatransfer/Clipboard.java b/libjava/java/awt/datatransfer/Clipboard.java
index 93bba7c..ca9b6eb 100644
--- a/libjava/java/awt/datatransfer/Clipboard.java
+++ b/libjava/java/awt/datatransfer/Clipboard.java
@@ -39,102 +39,76 @@ exception statement from your version. */
package java.awt.datatransfer;
/**
- * This class allows data to be transferred using a cut and paste type
- * mechanism.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Clipboard
-{
-
-/*
- * Instance Variables
- */
-
-/**
- * The data being transferred.
- */
-protected Transferable contents;
-
-/**
- * The owner of this clipboard.
- */
-protected ClipboardOwner owner;
-
-// The clipboard name
-private String name;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of <code>Clipboard</code> with the
- * specified name.
- *
- * @param name The clipboard name.
- */
-public
-Clipboard(String name)
-{
- this.name = name;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
+ * This class allows data to be transferred using a cut and paste type
+ * mechanism.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
-
-/**
- * Returns the name of the clipboard.
- */
-public String
-getName()
-{
- return(name);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the contents of the clipboard.
- *
- * @param requestor The object requesting the contents.
- *
- * @exception IllegalStateException If the clipboard is currently unavailable
- */
-public synchronized Transferable
-getContents(Object requestor)
-{
- return(contents);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the content and owner of this clipboard.
- * If the given owner is different from the current owner
- * then lostOwnership is called on the current owner.
- * XXX - is this called with the old or new contents.
- *
- * @param contents The new clipboard contents.
- * @param owner The new clipboard owner
- *
- * @exception IllegalStateException If the clipboard is currently unavailable
- */
-public synchronized void
-setContents(Transferable contents, ClipboardOwner owner)
+public class Clipboard
{
- if (this.owner != owner)
- if (this.owner != null)
- this.owner.lostOwnership(this, contents);
+ /**
+ * The data being transferred.
+ */
+ protected Transferable contents;
+
+ /**
+ * The owner of this clipboard.
+ */
+ protected ClipboardOwner owner;
+
+ // The clipboard name
+ private String name;
+
+ /**
+ * Initializes a new instance of <code>Clipboard</code> with the
+ * specified name.
+ *
+ * @param name The clipboard name.
+ */
+ public Clipboard(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Returns the name of the clipboard.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Returns the contents of the clipboard.
+ *
+ * @param requestor The object requesting the contents.
+ *
+ * @exception IllegalStateException If the clipboard is currently unavailable
+ */
+ public synchronized Transferable getContents(Object requestor)
+ {
+ return contents;
+ }
+
+ /**
+ * Sets the content and owner of this clipboard.
+ * If the given owner is different from the current owner
+ * then lostOwnership is called on the current owner.
+ * XXX - is this called with the old or new contents.
+ *
+ * @param contents The new clipboard contents.
+ * @param owner The new clipboard owner
+ *
+ * @exception IllegalStateException If the clipboard is currently unavailable
+ */
+ public synchronized void setContents(Transferable contents, ClipboardOwner owner)
+ {
+ if (this.owner != owner)
+ if (this.owner != null)
+ this.owner.lostOwnership(this, contents);
- this.owner = owner;
- this.contents = contents;
+ this.owner = owner;
+ this.contents = contents;
+ }
}
-} // class Clipboard
-
diff --git a/libjava/java/awt/datatransfer/ClipboardOwner.java b/libjava/java/awt/datatransfer/ClipboardOwner.java
index 28e58aa..b5ca9e3 100644
--- a/libjava/java/awt/datatransfer/ClipboardOwner.java
+++ b/libjava/java/awt/datatransfer/ClipboardOwner.java
@@ -53,6 +53,5 @@ public interface ClipboardOwner
* @param contents The contents of the clipboard which are no longer owned.
*/
void lostOwnership (Clipboard clipboard, Transferable contents);
-
-} // interface ClipboardOwner
+}
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
index 3ec2191..19f69d5 100644
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/java/awt/datatransfer/DataFlavor.java
@@ -39,11 +39,11 @@ exception statement from your version. */
package java.awt.datatransfer;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.ObjectOutput;
import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
@@ -328,7 +328,6 @@ getRepresentationClassFromMime(String mimeString, ClassLoader classLoader)
*
* @param mimeType The MIME type for this flavor.
* @param humanPresentableName The display name of this flavor.
- * @param classLoader The class loader for finding classes.
*
* @exception IllegalArgumentException If the representation class
* specified cannot be loaded.
@@ -529,7 +528,7 @@ isMimeTypeEqual(String mimeType)
* @return <code>true</code> if the flavor's MIME type is equal to this
* object's MIME type, <code>false</code> otherwise.
*/
-public boolean
+public final boolean
isMimeTypeEqual(DataFlavor flavor)
{
return(isMimeTypeEqual(flavor.getMimeType()));
@@ -555,7 +554,7 @@ isMimeTypeSerializedObject()
* Tests whether or not this flavor has a representation class of
* <code>java.io.InputStream</code>.
*
- * @param <code>true</code> if the representation class of this flavor
+ * @return <code>true</code> if the representation class of this flavor
* is <code>java.io.InputStream</code>, <code>false</code> otherwise.
*/
public boolean
@@ -570,7 +569,7 @@ isRepresentationClassInputStream()
* Tests whether the representation class for this flavor is
* serializable.
*
- * @param <code>true</code> if the representation class is serializable,
+ * @return <code>true</code> if the representation class is serializable,
* <code>false</code> otherwise.
*/
public boolean
diff --git a/libjava/java/awt/datatransfer/FlavorTable.java b/libjava/java/awt/datatransfer/FlavorTable.java
index 23fa9fa..3822cde 100644
--- a/libjava/java/awt/datatransfer/FlavorTable.java
+++ b/libjava/java/awt/datatransfer/FlavorTable.java
@@ -66,8 +66,8 @@ public interface FlavorTable extends FlavorMap
* list should be sorted from best to worst. The list must be modifiable
* without affecting this table.
*
- * @param native the native to look up, or null to return all flavors
+ * @param name the native name to look up, or null to return all flavors
* @return the sorted list of flavors
*/
List getFlavorsForNative(String name);
-} // interface FlavorTable
+}
diff --git a/libjava/java/awt/datatransfer/StringSelection.java b/libjava/java/awt/datatransfer/StringSelection.java
index 51addb7..b41c936 100644
--- a/libjava/java/awt/datatransfer/StringSelection.java
+++ b/libjava/java/awt/datatransfer/StringSelection.java
@@ -1,5 +1,5 @@
/* StringSelection.java -- Clipboard handler for text.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt.datatransfer;
-import java.io.StringReader;
import java.io.IOException;
+import java.io.StringReader;
/**
* This class transfers a string as plain text using the clipboard.
@@ -68,26 +68,15 @@ static final DataFlavor[] supported_flavors
// This is the data to transfer
private String data;
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Transfer the specfied string as text.
- */
-public
-StringSelection(String data)
-{
- this.data = data;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
+ /**
+ * Transfer the specfied string as text.
+ *
+ * @param data the data for the string selection
+ */
+ public StringSelection(String data)
+ {
+ this.data = data;
+ }
/**
* Returns a list of supported data flavors.
diff --git a/libjava/java/awt/datatransfer/SystemFlavorMap.java b/libjava/java/awt/datatransfer/SystemFlavorMap.java
index 7d91412..826992b 100644
--- a/libjava/java/awt/datatransfer/SystemFlavorMap.java
+++ b/libjava/java/awt/datatransfer/SystemFlavorMap.java
@@ -1,5 +1,5 @@
/* SystemFlavorMap.java -- Maps between native flavor names and MIME types.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,8 @@ exception statement from your version. */
package java.awt.datatransfer;
import java.util.HashMap;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
/**
* This class maps between native platform type names and DataFlavors.
diff --git a/libjava/java/awt/dnd/Autoscroll.java b/libjava/java/awt/dnd/Autoscroll.java
index 5c52338..ae868c0 100644
--- a/libjava/java/awt/dnd/Autoscroll.java
+++ b/libjava/java/awt/dnd/Autoscroll.java
@@ -1,5 +1,5 @@
/* Autoscroll.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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 java.awt.dnd;
-import java.awt.Point;
import java.awt.Insets;
+import java.awt.Point;
/**
* During DnD operations it is possible that a user may wish to drop the
diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java
index 4063e20..7379ca7 100644
--- a/libjava/java/awt/dnd/DropTarget.java
+++ b/libjava/java/awt/dnd/DropTarget.java
@@ -1,5 +1,5 @@
/* DropTarget.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,13 @@ 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 java.awt.dnd;
-import java.awt.Point;
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
+import java.awt.Point;
import java.awt.datatransfer.FlavorMap;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
diff --git a/libjava/java/awt/dnd/DropTargetContext.java b/libjava/java/awt/dnd/DropTargetContext.java
index 4301fbc..d617855 100644
--- a/libjava/java/awt/dnd/DropTargetContext.java
+++ b/libjava/java/awt/dnd/DropTargetContext.java
@@ -1,5 +1,5 @@
/* DropTargetContext.java --
- Copyright (C) 2002, 2003 Free Software Foundation
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,13 +37,12 @@ exception statement from your version. */
package java.awt.dnd;
-import java.awt.dnd.peer.DropTargetContextPeer;
-import java.io.Serializable;
-import java.io.IOException;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
diff --git a/libjava/java/awt/dnd/DropTargetDragEvent.java b/libjava/java/awt/dnd/DropTargetDragEvent.java
index e95b2d1..d4a13ea 100644
--- a/libjava/java/awt/dnd/DropTargetDragEvent.java
+++ b/libjava/java/awt/dnd/DropTargetDragEvent.java
@@ -1,5 +1,5 @@
/* DropTargetDragEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,12 @@ 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 java.awt.dnd;
-import java.util.List;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
+import java.util.List;
/**
* @since 1.2
diff --git a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
index 239a437..a2e3ba2 100644
--- a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
+++ b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
@@ -1,5 +1,5 @@
/* DropTargetContextPeer.java -- interface for drag-and-drop peers
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,12 @@ 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 java.awt.dnd.peer;
-import java.awt.dnd.DropTarget;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DropTarget;
import java.awt.dnd.InvalidDnDOperationException;
diff --git a/libjava/java/awt/event/ActionListener.java b/libjava/java/awt/event/ActionListener.java
index 4011208..71fdd2f 100644
--- a/libjava/java/awt/event/ActionListener.java
+++ b/libjava/java/awt/event/ActionListener.java
@@ -43,7 +43,7 @@ import java.util.EventListener;
/**
* This interface is for classes that listen for action events.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
* @see ActionEvent
* @since 1.1
* @status updated to 1.4
@@ -55,5 +55,5 @@ public interface ActionListener extends EventListener
*
* @param event the <code>ActionEvent</code> that occurred
*/
- void actionPerformed(ActionEvent e);
-} // interface ActionListener
+ void actionPerformed(ActionEvent event);
+}
diff --git a/libjava/java/awt/event/AdjustmentEvent.java b/libjava/java/awt/event/AdjustmentEvent.java
index 48b208b..623dab5 100644
--- a/libjava/java/awt/event/AdjustmentEvent.java
+++ b/libjava/java/awt/event/AdjustmentEvent.java
@@ -1,5 +1,5 @@
/* AdjustmentEvent.java -- an adjustable value was changed
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt.event;
-import java.awt.Adjustable;
import java.awt.AWTEvent;
+import java.awt.Adjustable;
/**
* This class represents an event that is generated when an adjustable
diff --git a/libjava/java/awt/event/HierarchyBoundsAdapter.java b/libjava/java/awt/event/HierarchyBoundsAdapter.java
index 5f807b3..2f479fc 100644
--- a/libjava/java/awt/event/HierarchyBoundsAdapter.java
+++ b/libjava/java/awt/event/HierarchyBoundsAdapter.java
@@ -63,7 +63,7 @@ public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
*
* @param event the event, ignored in this implementation
*/
- public void ancestorMoved(HierarchyEvent e)
+ public void ancestorMoved(HierarchyEvent event)
{
}
@@ -72,7 +72,7 @@ public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
*
* @param event the event, ignored in this implementation
*/
- public void ancestorResized(HierarchyEvent e)
+ public void ancestorResized(HierarchyEvent event)
{
}
-} // class HierarchyBoundsAdapter
+}
diff --git a/libjava/java/awt/event/InputEvent.java b/libjava/java/awt/event/InputEvent.java
index 1689e51..b2a1e31 100644
--- a/libjava/java/awt/event/InputEvent.java
+++ b/libjava/java/awt/event/InputEvent.java
@@ -1,5 +1,5 @@
/* InputEvent.java -- common superclass of component input events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,10 @@ exception statement from your version. */
package java.awt.event;
-import java.awt.Component;
import gnu.java.awt.EventModifier;
+import java.awt.Component;
+
/**
* This is the common superclass for all component input classes. These are
* passed to listeners before the component, so that listeners can consume
@@ -349,6 +350,7 @@ public abstract class InputEvent extends ComponentEvent
* XXX Sun claims this can be localized via the awt.properties file - how
* do we implement that?
*
+ * @param modifiers the modifiers
* @return a string representation of the modifiers in this bitmask
* @since 1.4
*/
diff --git a/libjava/java/awt/event/InvocationEvent.java b/libjava/java/awt/event/InvocationEvent.java
index 76d4a55..fb58595 100644
--- a/libjava/java/awt/event/InvocationEvent.java
+++ b/libjava/java/awt/event/InvocationEvent.java
@@ -1,5 +1,5 @@
/* InvocationEvent.java -- call a runnable when dispatched
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt.event;
-import java.awt.ActiveEvent;
import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
import java.awt.EventQueue;
/**
diff --git a/libjava/java/awt/event/KeyEvent.java b/libjava/java/awt/event/KeyEvent.java
index 455d7ee..7212c0c 100644
--- a/libjava/java/awt/event/KeyEvent.java
+++ b/libjava/java/awt/event/KeyEvent.java
@@ -1,5 +1,5 @@
/* KeyEvent.java -- event for key presses
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,11 @@ exception statement from your version. */
package java.awt.event;
+import gnu.java.awt.EventModifier;
+
import java.awt.Component;
import java.io.IOException;
import java.io.ObjectInputStream;
-import gnu.java.awt.EventModifier;
/**
* This event is generated when a key is pressed or released. There are two
diff --git a/libjava/java/awt/event/MouseEvent.java b/libjava/java/awt/event/MouseEvent.java
index ac8804c..7f3e014 100644
--- a/libjava/java/awt/event/MouseEvent.java
+++ b/libjava/java/awt/event/MouseEvent.java
@@ -1,5 +1,5 @@
/* MouseEvent.java -- a mouse event
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,12 @@ exception statement from your version. */
package java.awt.event;
+import gnu.java.awt.EventModifier;
+
import java.awt.Component;
import java.awt.Point;
import java.io.IOException;
import java.io.ObjectInputStream;
-import gnu.java.awt.EventModifier;
/**
* This event is generated for a mouse event. There are three main categories
diff --git a/libjava/java/awt/font/TextAttribute.java b/libjava/java/awt/font/TextAttribute.java
index c30f5fb..7d54446 100644
--- a/libjava/java/awt/font/TextAttribute.java
+++ b/libjava/java/awt/font/TextAttribute.java
@@ -1,5 +1,5 @@
-/* TextAttribute.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* TextAttribute.java --
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -70,19 +70,19 @@ public final class TextAttribute extends AttributedCharacterIterator.Attribute
public static final Float POSTURE_REGULAR = new Float (0.0);
public static final TextAttribute RUN_DIRECTION =
new TextAttribute ("RUN_DIRECTION");
- public static final Boolean RUN_DIRECTION_LTR = new Boolean (true);
- public static final Boolean RUN_DIRECTION_RTL = new Boolean (false);
+ public static final Boolean RUN_DIRECTION_LTR = Boolean.TRUE;
+ public static final Boolean RUN_DIRECTION_RTL = Boolean.FALSE;
public static final TextAttribute SIZE = new TextAttribute ("SIZE");
public static final TextAttribute STRIKETHROUGH =
new TextAttribute ("STRIKETHROUGH");
- public static final Boolean STRIKETHROUGH_ON = new Boolean (true);
+ public static final Boolean STRIKETHROUGH_ON = Boolean.TRUE;
public static final TextAttribute SUPERSCRIPT =
new TextAttribute ("SUPERSCRIPT");
public static final Integer SUPERSCRIPT_SUB = new Integer (-1);
public static final Integer SUPERSCRIPT_SUPER = new Integer (1);
public static final TextAttribute SWAP_COLORS =
new TextAttribute ("SWAP_COLORS");
- public static final Boolean SWAP_COLORS_ON = new Boolean (true);
+ public static final Boolean SWAP_COLORS_ON = Boolean.TRUE;
public static final TextAttribute TRANSFORM = new TextAttribute ("TRANSFORM");
public static final TextAttribute UNDERLINE = new TextAttribute ("UNDERLINE");
public static final Integer UNDERLINE_LOW_DASHED = new Integer (0);
diff --git a/libjava/java/awt/font/TextLayout.java b/libjava/java/awt/font/TextLayout.java
index b58b5a5..7d6c4d8 100644
--- a/libjava/java/awt/font/TextLayout.java
+++ b/libjava/java/awt/font/TextLayout.java
@@ -1,5 +1,5 @@
-/* TextLayout.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* TextLayout.java --
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,17 +38,18 @@ exception statement from your version. */
package java.awt.font;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathTextLayoutPeer;
+
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Shape;
+import java.awt.Toolkit;
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 Michael Koch
@@ -56,6 +57,7 @@ import java.awt.font.TextAttribute;
public final class TextLayout implements Cloneable
{
public static final CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy ();
+ ClasspathTextLayoutPeer peer;
public static class CaretPolicy
{
@@ -67,37 +69,39 @@ public final class TextLayout implements Cloneable
public TextHitInfo getStrongCaret (TextHitInfo hit1, TextHitInfo hit2,
TextLayout layout)
{
- throw new Error ("not implemented");
+ return layout.peer.getStrongCaret(hit1, hit2);
}
}
- private AttributedString attributedString;
- private FontRenderContext fontRenderContext;
-
public TextLayout (AttributedCharacterIterator text, FontRenderContext frc)
{
- attributedString = new AttributedString (text);
- fontRenderContext = frc;
+ AttributedString as = new AttributedString (text);
+ ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
+ peer = tk.getClasspathTextLayoutPeer(as, frc);
}
public TextLayout (String string, Font font, FontRenderContext frc)
{
- attributedString = new AttributedString (string);
- attributedString.addAttribute (TextAttribute.FONT, font);
- fontRenderContext = frc;
+ AttributedString as = new AttributedString (string);
+ as.addAttribute (TextAttribute.FONT, font);
+ ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
+ peer = tk.getClasspathTextLayoutPeer(as, frc);
}
- public TextLayout (String string, Map attributes, FontRenderContext frc)
+ public TextLayout (String string, Map attributes, FontRenderContext frc)
{
- attributedString = new AttributedString (string, attributes);
- fontRenderContext = frc;
+ AttributedString as = new AttributedString (string, attributes);
+ ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
+ peer = tk.getClasspathTextLayoutPeer(as, frc);
}
protected Object clone ()
{
try
{
- return super.clone ();
+ TextLayout tl = (TextLayout) super.clone ();
+ tl.peer = (ClasspathTextLayoutPeer) this.peer.clone();
+ return tl;
}
catch (CloneNotSupportedException e)
{
@@ -107,146 +111,9 @@ public final class TextLayout implements Cloneable
}
- protected class CharacterIteratorProxy
- implements CharacterIterator
- {
- public CharacterIterator target;
- public int begin;
- public int limit;
- public int index;
-
- public CharacterIteratorProxy (CharacterIterator ci)
- {
- target = ci;
- }
-
- public int getBeginIndex ()
- {
- return begin;
- }
-
- public int getEndIndex ()
- {
- return limit;
- }
-
- public int getIndex ()
- {
- return index;
- }
-
- public char setIndex (int idx)
- throws IllegalArgumentException
- {
- if (idx < begin || idx >= limit)
- throw new IllegalArgumentException ();
- char ch = target.setIndex (idx);
- index = idx;
- return ch;
- }
-
- public char first ()
- {
- int save = target.getIndex ();
- char ch = target.setIndex (begin);
- target.setIndex (save);
- return ch;
- }
-
- public char last ()
- {
- if (begin == limit)
- return this.first ();
-
- int save = target.getIndex ();
- char ch = target.setIndex (limit - 1);
- target.setIndex (save);
- return ch;
- }
-
- public char current ()
- {
- return target.current();
- }
-
- public char next ()
- {
- if (index >= limit - 1)
- return CharacterIterator.DONE;
- else
- {
- index++;
- return target.next();
- }
- }
-
- public char previous ()
- {
- if (index <= begin)
- return CharacterIterator.DONE;
- else
- {
- index--;
- return target.previous ();
- }
- }
-
- public Object clone ()
- {
- CharacterIteratorProxy cip = new CharacterIteratorProxy (this.target);
- cip.begin = this.begin;
- cip.limit = this.limit;
- cip.index = this.index;
- return cip;
- }
-
- }
-
-
public void draw (Graphics2D g2, float x, float y)
{
- AttributedCharacterIterator ci = attributedString.getIterator ();
- CharacterIteratorProxy proxy = new CharacterIteratorProxy (ci);
- Font defFont = g2.getFont ();
-
- /* Note: this implementation currently only interprets FONT text
- * attributes. There is a reasonable argument to be made for some
- * attributes being interpreted out here, where we have control of the
- * Graphics2D and can construct or derive new fonts, and some
- * attributes being interpreted by the GlyphVector itself. So far, for
- * all attributes except FONT we do neither.
- */
-
- for (char c = ci.first ();
- c != CharacterIterator.DONE;
- c = ci.next ())
- {
- proxy.begin = ci.getIndex ();
- proxy.limit = ci.getRunLimit(TextAttribute.FONT);
- if (proxy.limit <= proxy.begin)
- continue;
-
- proxy.index = proxy.begin;
-
- Object fnt = ci.getAttribute(TextAttribute.FONT);
- GlyphVector gv;
- if (fnt instanceof Font)
- gv = ((Font)fnt).createGlyphVector (fontRenderContext, proxy);
- else
- gv = defFont.createGlyphVector (fontRenderContext, proxy);
-
- g2.drawGlyphVector (gv, x, y);
-
- int n = gv.getNumGlyphs ();
- for (int i = 0; i < n; ++i)
- {
- GlyphMetrics gm = gv.getGlyphMetrics (i);
- if (gm.getAdvanceX() == gm.getAdvance ())
- x += gm.getAdvanceX ();
- else
- y += gm.getAdvanceY ();
- }
- }
+ peer.draw(g2, x, y);
}
public boolean equals (Object obj)
@@ -259,207 +126,207 @@ public final class TextLayout implements Cloneable
public boolean equals (TextLayout tl)
{
- throw new Error ("not implemented");
+ return this.peer.equals(tl.peer);
}
public float getAdvance ()
{
- throw new Error ("not implemented");
+ return peer.getAdvance();
}
public float getAscent ()
{
- throw new Error ("not implemented");
+ return peer.getAscent();
}
public byte getBaseline ()
{
- throw new Error ("not implemented");
+ return peer.getBaseline();
}
public float[] getBaselineOffsets ()
{
- throw new Error ("not implemented");
+ return peer.getBaselineOffsets();
}
public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
{
- throw new Error ("not implemented");
+ return peer.getBlackBoxBounds(firstEndpoint, secondEndpoint);
}
public Rectangle2D getBounds()
{
- throw new Error ("not implemented");
+ return peer.getBounds();
}
public float[] getCaretInfo (TextHitInfo hit)
{
- throw new Error ("not implemented");
+ return getCaretInfo(hit, getBounds());
}
public float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
{
- throw new Error ("not implemented");
+ return peer.getCaretInfo(hit, bounds);
}
public Shape getCaretShape (TextHitInfo hit)
{
- throw new Error ("not implemented");
+ return getCaretShape(hit, getBounds());
}
public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
{
- throw new Error ("not implemented");
+ return peer.getCaretShape(hit, bounds);
}
public Shape[] getCaretShapes (int offset)
{
- throw new Error ("not implemented");
+ return getCaretShapes(offset, getBounds());
}
public Shape[] getCaretShapes (int offset, Rectangle2D bounds)
{
- throw new Error ("not implemented");
+ return getCaretShapes(offset, getBounds(), DEFAULT_CARET_POLICY);
}
public Shape[] getCaretShapes (int offset, Rectangle2D bounds,
TextLayout.CaretPolicy policy)
{
- throw new Error ("not implemented");
+ return peer.getCaretShapes(offset, bounds, policy);
}
public int getCharacterCount ()
{
- throw new Error ("not implemented");
+ return peer.getCharacterCount();
}
public byte getCharacterLevel (int index)
{
- throw new Error ("not implemented");
+ return peer.getCharacterLevel(index);
}
public float getDescent ()
{
- throw new Error ("not implemented");
+ return peer.getDescent();
}
public TextLayout getJustifiedLayout (float justificationWidth)
{
- throw new Error ("not implemented");
+ return peer.getJustifiedLayout(justificationWidth);
}
public float getLeading ()
{
- throw new Error ("not implemented");
+ return peer.getLeading();
}
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint)
{
- throw new Error ("not implemented");
+ return getLogicalHighlightShape (firstEndpoint, secondEndpoint, getBounds());
}
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
Rectangle2D bounds)
{
- throw new Error ("not implemented");
+ return peer.getLogicalHighlightShape(firstEndpoint, secondEndpoint, bounds);
}
public int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint)
{
- throw new Error ("not implemented");
+ return peer.getLogicalRangesForVisualSelection(firstEndpoint, secondEndpoint);
}
public TextHitInfo getNextLeftHit (int offset)
{
- throw new Error ("not implemented");
+ return getNextLeftHit(offset, DEFAULT_CARET_POLICY);
}
public TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy)
{
- throw new Error ("not implemented");
+ return peer.getNextLeftHit(offset, policy);
}
public TextHitInfo getNextLeftHit (TextHitInfo hit)
{
- throw new Error ("not implemented");
+ return getNextLeftHit(hit.getCharIndex());
}
public TextHitInfo getNextRightHit (int offset)
{
- throw new Error ("not implemented");
+ return getNextRightHit(offset, DEFAULT_CARET_POLICY);
}
public TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy)
{
- throw new Error ("not implemented");
+ return peer.getNextRightHit(offset, policy);
}
public TextHitInfo getNextRightHit (TextHitInfo hit)
{
- throw new Error ("not implemented");
+ return getNextRightHit(hit.getCharIndex());
}
public Shape getOutline (AffineTransform tx)
{
- throw new Error ("not implemented");
+ return peer.getOutline(tx);
}
public float getVisibleAdvance ()
{
- throw new Error ("not implemented");
+ return peer.getVisibleAdvance();
}
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint)
{
- throw new Error ("not implemented");
+ return getVisualHighlightShape(firstEndpoint, secondEndpoint, getBounds());
}
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint,
Rectangle2D bounds)
{
- throw new Error ("not implemented");
+ return peer.getVisualHighlightShape(firstEndpoint, secondEndpoint, bounds);
}
public TextHitInfo getVisualOtherHit (TextHitInfo hit)
{
- throw new Error ("not implemented");
+ return peer.getVisualOtherHit(hit);
}
protected void handleJustify (float justificationWidth)
{
- throw new Error ("not implemented");
+ peer.handleJustify(justificationWidth);
}
public int hashCode ()
{
- throw new Error ("not implemented");
+ return peer.hashCode();
}
public TextHitInfo hitTestChar (float x, float y)
{
- throw new Error ("not implemented");
+ return hitTestChar(x, y, getBounds());
}
public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
{
- throw new Error ("not implemented");
+ return peer.hitTestChar(x, y, bounds);
}
public boolean isLeftToRight ()
{
- throw new Error ("not implemented");
+ return peer.isLeftToRight();
}
public boolean isVertical ()
{
- throw new Error ("not implemented");
+ return peer.isVertical();
}
public String toString ()
{
- throw new Error ("not implemented");
+ return peer.toString();
}
}
diff --git a/libjava/java/awt/geom/AffineTransform.java b/libjava/java/awt/geom/AffineTransform.java
index 1410d90..21eacae 100644
--- a/libjava/java/awt/geom/AffineTransform.java
+++ b/libjava/java/awt/geom/AffineTransform.java
@@ -1,5 +1,5 @@
/* AffineTransform.java -- transform coordinates between two 2-D spaces
- 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,10 +57,11 @@ import java.io.Serializable;
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
* The bottom row of the matrix is constant, so a transform can be uniquely
- * represented (as in toString) by "[[m00, m01, m02], [m10, m11, m12]]".
+ * represented (as in {@link #toString()}) by
+ * "[[m00, m01, m02], [m10, m11, m12]]".
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status partially updated to 1.4, still has some problems
*/
@@ -517,6 +518,8 @@ public class AffineTransform implements Cloneable, Serializable
* or a bit-wise combination of TYPE_TRANSLATION, the mutually exclusive
* TYPE_*_ROTATIONs, and the mutually exclusive TYPE_*_SCALEs.
*
+ * @return The type.
+ *
* @see #TYPE_IDENTITY
* @see #TYPE_TRANSLATION
* @see #TYPE_UNIFORM_SCALE
@@ -1105,9 +1108,9 @@ public class AffineTransform implements Cloneable, Serializable
* transformation, so that no result will overwrite a point that has not yet
* been evaluated.
*
- * @param src the array of source points
+ * @param srcPts the array of source points
* @param srcOff the starting offset into src
- * @param dst the array of destination points
+ * @param dstPts the array of destination points
* @param dstOff the starting offset into dst
* @param num the number of points to transform
* @throws NullPointerException if src or dst is null
@@ -1139,9 +1142,9 @@ public class AffineTransform implements Cloneable, Serializable
* transformation, so that no result will overwrite a point that has not yet
* been evaluated.
*
- * @param src the array of source points
+ * @param srcPts the array of source points
* @param srcOff the starting offset into src
- * @param dst the array of destination points
+ * @param dstPts the array of destination points
* @param dstOff the starting offset into dst
* @param num the number of points to transform
* @throws NullPointerException if src or dst is null
@@ -1171,9 +1174,9 @@ public class AffineTransform implements Cloneable, Serializable
* storing the results in another array. This will not create a destination
* array.
*
- * @param src the array of source points
+ * @param srcPts the array of source points
* @param srcOff the starting offset into src
- * @param dst the array of destination points
+ * @param dstPts the array of destination points
* @param dstOff the starting offset into dst
* @param num the number of points to transform
* @throws NullPointerException if src or dst is null
@@ -1196,9 +1199,9 @@ public class AffineTransform implements Cloneable, Serializable
* storing the results in another array. This will not create a destination
* array.
*
- * @param src the array of source points
+ * @param srcPts the array of source points
* @param srcOff the starting offset into src
- * @param dst the array of destination points
+ * @param dstPts the array of destination points
* @param dstOff the starting offset into dst
* @param num the number of points to transform
* @throws NullPointerException if src or dst is null
@@ -1231,17 +1234,7 @@ public class AffineTransform implements Cloneable, Serializable
public Point2D inverseTransform(Point2D src, Point2D dst)
throws NoninvertibleTransformException
{
- double det = getDeterminant();
- if (det == 0)
- throw new NoninvertibleTransformException("couldn't invert transform");
- if (dst == null)
- dst = new Point2D.Double();
- double x = src.getX();
- double y = src.getY();
- double nx = (m11 * x + -m10 * y) / det - m02;
- double ny = (m01 * x + -m00 * y) / det - m12;
- dst.setLocation(nx, ny);
- return dst;
+ return createInverse().transform(src, dst);
}
/**
@@ -1251,9 +1244,9 @@ public class AffineTransform implements Cloneable, Serializable
* transformation, so that no result will overwrite a point that has not yet
* been evaluated.
*
- * @param src the array of source points
+ * @param srcPts the array of source points
* @param srcOff the starting offset into src
- * @param dst the array of destination points
+ * @param dstPts the array of destination points
* @param dstOff the starting offset into dst
* @param num the number of points to transform
* @throws NullPointerException if src or dst is null
@@ -1265,23 +1258,7 @@ public class AffineTransform implements Cloneable, Serializable
double[] dstPts, int dstOff, int num)
throws NoninvertibleTransformException
{
- double det = getDeterminant();
- if (det == 0)
- throw new NoninvertibleTransformException("couldn't invert transform");
- if (srcPts == dstPts && dstOff > srcOff
- && num > 1 && srcOff + 2 * num > dstOff)
- {
- double[] d = new double[2 * num];
- System.arraycopy(srcPts, srcOff, d, 0, 2 * num);
- srcPts = d;
- }
- while (--num >= 0)
- {
- double x = srcPts[srcOff++];
- double y = srcPts[srcOff++];
- dstPts[dstOff++] = (m11 * x + -m10 * y) / det - m02;
- dstPts[dstOff++] = (m01 * x + -m00 * y) / det - m12;
- }
+ createInverse().transform(srcPts, srcOff, dstPts, dstOff, num);
}
/**
@@ -1322,9 +1299,9 @@ public class AffineTransform implements Cloneable, Serializable
* [ y' ] [ m10 m11 ] [ y ] = [ m10 * x + m11 * y ]
* </pre>
*
- * @param src the array of source points
+ * @param srcPts the array of source points
* @param srcOff the starting offset into src
- * @param dst the array of destination points
+ * @param dstPts the array of destination points
* @param dstOff the starting offset into dst
* @param num the number of points to transform
* @throws NullPointerException if src or dst is null
@@ -1356,12 +1333,14 @@ public class AffineTransform implements Cloneable, Serializable
* which only stores points in float precision.
*
* @param src the shape source to transform
- * @return the shape, transformed by this
- * @throws NullPointerException if src is null
+ * @return the shape, transformed by this, <code>null</code> if src is
+ * <code>null</code>.
* @see GeneralPath#transform(AffineTransform)
*/
public Shape createTransformedShape(Shape src)
{
+ if(src == null)
+ return null;
GeneralPath p = new GeneralPath(src);
p.transform(this);
return p;
@@ -1445,7 +1424,7 @@ public class AffineTransform implements Cloneable, Serializable
* Compares two transforms for equality. This returns true if they have the
* same matrix values.
*
- * @param o the transform to compare
+ * @param obj the transform to compare
* @return true if it is equal
*/
public boolean equals(Object obj)
diff --git a/libjava/java/awt/geom/Arc2D.java b/libjava/java/awt/geom/Arc2D.java
index 64d8165..5ce3b08 100644
--- a/libjava/java/awt/geom/Arc2D.java
+++ b/libjava/java/awt/geom/Arc2D.java
@@ -1,5 +1,5 @@
/* Arc2D.java -- represents an arc in 2-D space
- Copyright (C) 2002, 2003 Free Software Foundation
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -35,11 +35,11 @@ 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 java.awt.geom;
import java.util.NoSuchElementException;
+
/**
* This class represents all arcs (segments of an ellipse in 2-D space). The
* arcs are defined by starting angle and extent (arc length) in degrees, as
@@ -51,8 +51,8 @@ import java.util.NoSuchElementException;
* first 360 degrees. Storage is up to the subclasses.
*
* @author Eric Blake (ebb9@email.byu.edu)
+ * @author Sven de Marothy (sven@physto.se)
* @since 1.2
- * @status updated to 1.4, but still missing functionality
*/
public abstract class Arc2D extends RectangularShape
{
@@ -154,8 +154,8 @@ public abstract class Arc2D extends RectangularShape
* extent sweeps counterclockwise (from the positive x-axis to the negative
* y-axis).
*
- * @param x the new x coordinate of the lower left of the bounding box
- * @param y the new y coordinate of the lower left of the bounding box
+ * @param x the new x coordinate of the upper left of the bounding box
+ * @param y the new y coordinate of the upper left of the bounding box
* @param w the new width of the bounding box
* @param h the new height of the bounding box
* @param start the start angle, in degrees
@@ -171,7 +171,7 @@ public abstract class Arc2D extends RectangularShape
* extent sweeps counterclockwise (from the positive x-axis to the negative
* y-axis).
*
- * @param p the lower left point of the bounding box
+ * @param p the upper left point of the bounding box
* @param d the dimensions of the bounding box
* @param start the start angle, in degrees
* @param extent the arc extent, in degrees
@@ -179,11 +179,10 @@ public abstract class Arc2D extends RectangularShape
* @throws IllegalArgumentException if type is invalid
* @throws NullPointerException if p or d is null
*/
- public void setArc(Point2D p, Dimension2D d,
- double start, double extent, int type)
+ public void setArc(Point2D p, Dimension2D d, double start, double extent,
+ int type)
{
- setArc(p.getX(), p.getY(), d.getWidth(), d.getHeight(),
- start, extent, type);
+ setArc(p.getX(), p.getY(), d.getWidth(), d.getHeight(), start, extent, type);
}
/**
@@ -200,8 +199,7 @@ public abstract class Arc2D extends RectangularShape
*/
public void setArc(Rectangle2D r, double start, double extent, int type)
{
- setArc(r.getX(), r.getY(), r.getWidth(), r.getHeight(),
- start, extent, type);
+ setArc(r.getX(), r.getY(), r.getWidth(), r.getHeight(), start, extent, type);
}
/**
@@ -212,8 +210,8 @@ public abstract class Arc2D extends RectangularShape
*/
public void setArc(Arc2D a)
{
- setArc(a.getX(), a.getY(), a.getWidth(), a.getHeight(),
- a.getAngleStart(), a.getAngleExtent(), a.getArcType());
+ setArc(a.getX(), a.getY(), a.getWidth(), a.getHeight(), a.getAngleStart(),
+ a.getAngleExtent(), a.getArcType());
}
/**
@@ -230,8 +228,8 @@ public abstract class Arc2D extends RectangularShape
* @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
* @throws IllegalArgumentException if type is invalid
*/
- public void setArcByCenter(double x, double y, double r,
- double start, double extent, int type)
+ public void setArcByCenter(double x, double y, double r, double start,
+ double extent, int type)
{
setArc(x - r, y - r, r + r, r + r, start, extent, type);
}
@@ -252,8 +250,50 @@ public abstract class Arc2D extends RectangularShape
*/
public void setArcByTangent(Point2D p1, Point2D p2, Point2D p3, double r)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if ((p2.getX() - p1.getX()) * (p3.getY() - p1.getY())
+ - (p3.getX() - p1.getX()) * (p2.getY() - p1.getY()) > 0)
+ {
+ Point2D p = p3;
+ p3 = p1;
+ p1 = p;
+ }
+
+ // normalized tangent vectors
+ double dx1 = (p1.getX() - p2.getX()) / p1.distance(p2);
+ double dy1 = (p1.getY() - p2.getY()) / p1.distance(p2);
+ double dx2 = (p2.getX() - p3.getX()) / p3.distance(p2);
+ double dy2 = (p2.getY() - p3.getY()) / p3.distance(p2);
+ double theta1 = Math.atan2(dx1, dy1);
+ double theta2 = Math.atan2(dx2, dy2);
+
+ double dx = r * Math.cos(theta2) - r * Math.cos(theta1);
+ double dy = -r * Math.sin(theta2) + r * Math.sin(theta1);
+
+ if (theta1 < 0)
+ theta1 += 2 * Math.PI;
+ if (theta2 < 0)
+ theta2 += 2 * Math.PI;
+ if (theta2 < theta1)
+ theta2 += 2 * Math.PI;
+
+ // Vectors of the lines, not normalized, note we change
+ // the direction of line 2.
+ dx1 = p1.getX() - p2.getX();
+ dy1 = p1.getY() - p2.getY();
+ dx2 = p3.getX() - p2.getX();
+ dy2 = p3.getY() - p2.getY();
+
+ // Calculate the tangent point to the second line
+ double t2 = -(dx1 * dy - dy1 * dx) / (dx2 * dy1 - dx1 * dy2);
+ double x2 = t2 * (p3.getX() - p2.getX()) + p2.getX();
+ double y2 = t2 * (p3.getY() - p2.getY()) + p2.getY();
+
+ // calculate the center point
+ double x = x2 - r * Math.cos(theta2);
+ double y = y2 + r * Math.sin(theta2);
+
+ setArc(x - r, y - r, 2 * r, 2 * r, Math.toDegrees(theta1),
+ Math.toDegrees(theta2 - theta1), getArcType());
}
/**
@@ -287,7 +327,7 @@ public abstract class Arc2D extends RectangularShape
// Normalize.
double x = p.getX() - (getX() + getWidth() / 2);
double y = p.getY() - (getY() + getHeight() / 2);
- setAngleStart(Math.toDegrees(Math.atan2(y, x)));
+ setAngleStart(Math.toDegrees(Math.atan2(-y, x)));
}
/**
@@ -312,8 +352,8 @@ public abstract class Arc2D extends RectangularShape
y1 = y1 - (my + mh / 2);
x2 = x2 - (mx + mw / 2);
y2 = y2 - (my + mh / 2);
- double start = Math.toDegrees(Math.atan2(y1, x1));
- double extent = Math.toDegrees(Math.atan2(y2, x2)) - start;
+ double start = Math.toDegrees(Math.atan2(-y1, x1));
+ double extent = Math.toDegrees(Math.atan2(-y2, x2)) - start;
if (extent < 0)
extent += 360;
setAngleStart(start);
@@ -413,8 +453,8 @@ public abstract class Arc2D extends RectangularShape
* @param h the height
* @return the rectangle for use in getBounds2D
*/
- protected abstract Rectangle2D makeBounds(double x, double y,
- double w, double h);
+ protected abstract Rectangle2D makeBounds(double x, double y, double w,
+ double h);
/**
* Tests if the given angle, in degrees, is included in the arc.
@@ -426,27 +466,44 @@ public abstract class Arc2D extends RectangularShape
public boolean containsAngle(double a)
{
double start = getAngleStart();
- double end = start + getAngleExtent();
+ double extent = getAngleExtent();
+ double end = start + extent;
+
+ if (extent == 0)
+ return false;
+
+ if (extent >= 360 || extent <= -360)
+ return true;
+
+ if (extent < 0)
+ {
+ end = start;
+ start += extent;
+ }
start %= 360;
- if (start < 0)
+ while (start < 0)
start += 360;
end %= 360;
- if (end < 0)
+ while (end < start)
end += 360;
a %= 360;
- if (a < 0)
+ while (a < start)
a += 360;
- return a >= start && a <= end;
+ return a >= start && a < end; // starting angle included, ending angle not
}
/**
* Determines if the arc contains the given point. If the bounding box
* is empty, then this will return false.
*
+ * The area considered 'inside' an arc of type OPEN is the same as the
+ * area inside an equivalent filled CHORD-type arc. The area considered
+ * 'inside' a CHORD-type arc is the same as the filled area.
+ *
* @param x the x coordinate to test
* @param y the y coordinate to test
* @return true if the point is inside the arc
@@ -455,15 +512,50 @@ public abstract class Arc2D extends RectangularShape
{
double w = getWidth();
double h = getHeight();
- if (w <= 0 || h <= 0)
+ double extent = getAngleExtent();
+ if (w <= 0 || h <= 0 || extent == 0)
return false;
- // XXX Finish implementing.
- throw new Error("not implemented");
+
+ double mx = getX() + w / 2;
+ double my = getY() + h / 2;
+ double dx = (x - mx) * 2 / w;
+ double dy = (y - my) * 2 / h;
+ if ((dx * dx + dy * dy) >= 1.0)
+ return false;
+
+ double angle = Math.toDegrees(Math.atan2(-dy, dx));
+ if (getArcType() == PIE)
+ return containsAngle(angle);
+
+ double a1 = Math.toRadians(getAngleStart());
+ double a2 = Math.toRadians(getAngleStart() + extent);
+ double x1 = mx + getWidth() * Math.cos(a1) / 2;
+ double y1 = my - getHeight() * Math.sin(a1) / 2;
+ double x2 = mx + getWidth() * Math.cos(a2) / 2;
+ double y2 = my - getHeight() * Math.sin(a2) / 2;
+ double sgn = ((x2 - x1) * (my - y1) - (mx - x1) * (y2 - y1)) * ((x2 - x1) * (y
+ - y1) - (x - x1) * (y2 - y1));
+
+ if (Math.abs(extent) > 180)
+ {
+ if (containsAngle(angle))
+ return true;
+ return sgn > 0;
+ }
+ else
+ {
+ if (! containsAngle(angle))
+ return false;
+ return sgn < 0;
+ }
}
/**
* Tests if a given rectangle intersects the area of the arc.
*
+ * For a definition of the 'inside' area, see the contains() method.
+ * @see #contains(double, double)
+ *
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
* @param w the width of the rectangle
@@ -472,12 +564,94 @@ public abstract class Arc2D extends RectangularShape
*/
public boolean intersects(double x, double y, double w, double h)
{
- double mw = getWidth();
- double mh = getHeight();
- if (mw <= 0 || mh <= 0 || w <= 0 || h <= 0)
+ double extent = getAngleExtent();
+ if (extent == 0)
return false;
- // XXX Finish implementing.
- throw new Error("not implemented");
+
+ if (contains(x, y) || contains(x, y + h) || contains(x + w, y)
+ || contains(x + w, y + h))
+ return true;
+
+ Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
+
+ double a = getWidth() / 2.0;
+ double b = getHeight() / 2.0;
+
+ double mx = getX() + a;
+ double my = getY() + b;
+ double x1 = mx + a * Math.cos(Math.toRadians(getAngleStart()));
+ double y1 = my - b * Math.sin(Math.toRadians(getAngleStart()));
+ double x2 = mx + a * Math.cos(Math.toRadians(getAngleStart() + extent));
+ double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
+
+ if (getArcType() != CHORD)
+ {
+ // check intersections against the pie radii
+ if (rect.intersectsLine(mx, my, x1, y1))
+ return true;
+ if (rect.intersectsLine(mx, my, x2, y2))
+ return true;
+ }
+ else// check the chord
+ if (rect.intersectsLine(x1, y1, x2, y2))
+ return true;
+
+ // Check the Arc segment against the four edges
+ double dx;
+
+ // Check the Arc segment against the four edges
+ double dy;
+ dy = y - my;
+ dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
+ if (! java.lang.Double.isNaN(dx))
+ {
+ if (mx + dx >= x && mx + dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (mx - dx >= x && mx - dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
+ return true;
+ }
+ dy = (y + h) - my;
+ dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
+ if (! java.lang.Double.isNaN(dx))
+ {
+ if (mx + dx >= x && mx + dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (mx - dx >= x && mx - dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
+ return true;
+ }
+ dx = x - mx;
+ dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
+ if (! java.lang.Double.isNaN(dy))
+ {
+ if (my + dy >= y && my + dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (my - dy >= y && my - dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
+ return true;
+ }
+
+ dx = (x + w) - mx;
+ dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
+ if (! java.lang.Double.isNaN(dy))
+ {
+ if (my + dy >= y && my + dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (my - dy >= y && my - dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
+ return true;
+ }
+
+ // Check whether the arc is contained within the box
+ if (rect.contains(mx, my))
+ return true;
+
+ return false;
}
/**
@@ -491,12 +665,37 @@ public abstract class Arc2D extends RectangularShape
*/
public boolean contains(double x, double y, double w, double h)
{
- double mw = getWidth();
- double mh = getHeight();
- if (mw <= 0 || mh <= 0 || w <= 0 || h <= 0)
+ double extent = getAngleExtent();
+ if (extent == 0)
+ return false;
+
+ if (! (contains(x, y) && contains(x, y + h) && contains(x + w, y)
+ && contains(x + w, y + h)))
+ return false;
+
+ Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
+
+ double a = getWidth() / 2.0;
+ double b = getHeight() / 2.0;
+
+ double mx = getX() + a;
+ double my = getY() + b;
+ double x1 = mx + a * Math.cos(Math.toRadians(getAngleStart()));
+ double y1 = my - b * Math.sin(Math.toRadians(getAngleStart()));
+ double x2 = mx + a * Math.cos(Math.toRadians(getAngleStart() + extent));
+ double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
+ if (getArcType() != CHORD)
+ {
+ // check intersections against the pie radii
+ if (rect.intersectsLine(mx, my, x1, y1))
+ return false;
+
+ if (rect.intersectsLine(mx, my, x2, y2))
+ return false;
+ }
+ else if (rect.intersectsLine(x1, y1, x2, y2))
return false;
- // XXX Finish implementing.
- throw new Error("not implemented");
+ return true;
}
/**
@@ -567,29 +766,37 @@ public abstract class Arc2D extends RectangularShape
* @param a the arc
* @param xform the transform
*/
- ArcIterator(Arc2D a, AffineTransform xform)
+ public ArcIterator(Arc2D a, AffineTransform xform)
{
this.xform = xform;
x = a.getX();
y = a.getY();
w = a.getWidth();
h = a.getHeight();
- start = a.getAngleStart() * (Math.PI / 180);
- extent = a.getAngleExtent() * (Math.PI / 180);
+ double start = a.getAngleStart() * (Math.PI / 180);
+ double extent = a.getAngleExtent() * (Math.PI / 180);
+
+ if (extent < 0)
+ {
+ extent = -extent;
+ start = 2 * Math.PI - extent + start;
+ }
+ this.start = start;
+ this.extent = extent;
+
type = a.type;
- double e = extent < 0 ? -extent : extent;
if (w < 0 || h < 0)
- limit = -1;
- else if (e == 0)
- limit = type;
- else if (e <= Math.PI / 2.0)
- limit = type + 1;
- else if (e <= Math.PI)
- limit = type + 2;
- else if (e <= 3.0 * (Math.PI / 2.0))
- limit = type + 3;
+ limit = -1;
+ else if (extent == 0)
+ limit = type;
+ else if (extent <= Math.PI / 2.0)
+ limit = type + 1;
+ else if (extent <= Math.PI)
+ limit = type + 2;
+ else if (extent <= 3.0 * (Math.PI / 2.0))
+ limit = type + 3;
else
- limit = type + 4;
+ limit = type + 4;
}
/**
@@ -598,7 +805,7 @@ public abstract class Arc2D extends RectangularShape
* @param e the ellipse
* @param xform the transform
*/
- ArcIterator(Ellipse2D e, AffineTransform xform)
+ public ArcIterator(Ellipse2D e, AffineTransform xform)
{
this.xform = xform;
x = e.getX();
@@ -606,7 +813,7 @@ public abstract class Arc2D extends RectangularShape
w = e.getWidth();
h = e.getHeight();
start = 0;
- extent = -2 * Math.PI;
+ extent = 2 * Math.PI;
type = CHORD;
limit = (w < 0 || h < 0) ? -1 : 5;
}
@@ -650,9 +857,9 @@ public abstract class Arc2D extends RectangularShape
public int currentSegment(float[] coords)
{
double[] double_coords = new double[6];
- int code = currentSegment (double_coords);
+ int code = currentSegment(double_coords);
for (int i = 0; i < 6; ++i)
- coords[i] = (float) double_coords[i];
+ coords[i] = (float) double_coords[i];
return code;
}
@@ -666,48 +873,38 @@ public abstract class Arc2D extends RectangularShape
*/
public int currentSegment(double[] coords)
{
- double rx = w/2;
- double ry = h/2;
+ double rx = w / 2;
+ double ry = h / 2;
double xmid = x + rx;
double ymid = y + ry;
-
+
if (current > limit)
- throw new NoSuchElementException("arc iterator out of bounds");
+ throw new NoSuchElementException("arc iterator out of bounds");
if (current == 0)
{
- coords[0] = xmid + rx * Math.cos(start);
- coords[1] = ymid - ry * Math.sin(start);
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 1);
- return SEG_MOVETO;
+ coords[0] = xmid + rx * Math.cos(start);
+ coords[1] = ymid - ry * Math.sin(start);
+ if (xform != null)
+ xform.transform(coords, 0, coords, 0, 1);
+ return SEG_MOVETO;
}
if (type != OPEN && current == limit)
- return SEG_CLOSE;
+ return SEG_CLOSE;
- if ((current == limit - 1) &&
- (type == PIE) || (type == CHORD))
+ if ((current == limit - 1) && (type == PIE))
{
- if (type == PIE)
- {
- coords[0] = xmid;
- coords[1] = ymid;
- }
- else if (type == CHORD)
- {
- coords[0] = xmid + rx * Math.cos(start);
- coords[1] = ymid - ry * Math.sin(start);
- }
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 1);
- return SEG_LINETO;
+ coords[0] = xmid;
+ coords[1] = ymid;
+ if (xform != null)
+ xform.transform(coords, 0, coords, 0, 1);
+ return SEG_LINETO;
}
// note that this produces a cubic approximation of the arc segment,
// not a true ellipsoid. there's no ellipsoid path segment code,
// unfortunately. the cubic approximation looks about right, though.
-
double kappa = (Math.sqrt(2.0) - 1.0) * (4.0 / 3.0);
double quad = (Math.PI / 2.0);
@@ -717,14 +914,14 @@ public abstract class Arc2D extends RectangularShape
double x0 = xmid + rx * Math.cos(curr_begin);
double y0 = ymid - ry * Math.sin(curr_begin);
-
+
double x1 = xmid + rx * Math.cos(curr_begin + curr_extent);
double y1 = ymid - ry * Math.sin(curr_begin + curr_extent);
- AffineTransform trans = new AffineTransform ();
- double [] cvec = new double[2];
- double len = kappa * portion_of_a_quadrant;
- double angle = curr_begin;
+ AffineTransform trans = new AffineTransform();
+ double[] cvec = new double[2];
+ double len = kappa * portion_of_a_quadrant;
+ double angle = curr_begin;
// in a hypothetical "first quadrant" setting, our first control
// vector would be sticking up, from [1,0] to [1,kappa].
@@ -733,31 +930,29 @@ public abstract class Arc2D extends RectangularShape
// from what one would consider "normal" first quadrant rules, so we
// will *subtract* the y value of this control vector from our first
// point.
-
cvec[0] = 0;
cvec[1] = len;
- trans.scale (rx, ry);
- trans.rotate (angle);
+ trans.scale(rx, ry);
+ trans.rotate(angle);
trans.transform(cvec, 0, cvec, 0, 1);
coords[0] = x0 + cvec[0];
coords[1] = y0 - cvec[1];
// control vector #2 would, ideally, be sticking out and to the
// right, in a first quadrant arc segment. again, subtraction of y.
-
cvec[0] = 0;
cvec[1] = -len;
- trans.rotate (curr_extent);
+ trans.rotate(curr_extent);
trans.transform(cvec, 0, cvec, 0, 1);
coords[2] = x1 + cvec[0];
coords[3] = y1 - cvec[1];
-
+
// end point
coords[4] = x1;
coords[5] = y1;
if (xform != null)
- xform.transform(coords, 0, coords, 0, 3);
+ xform.transform(coords, 0, coords, 0, 3);
return SEG_CUBICTO;
}
@@ -820,8 +1015,8 @@ public abstract class Arc2D extends RectangularShape
* @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
* @throws IllegalArgumentException if type is invalid
*/
- public Double(double x, double y, double w, double h,
- double start, double extent, int type)
+ public Double(double x, double y, double w, double h, double start,
+ double extent, int type)
{
super(type);
this.x = x;
@@ -831,7 +1026,7 @@ public abstract class Arc2D extends RectangularShape
this.start = start;
this.extent = extent;
}
-
+
/**
* Create a new arc with the given dimensions.
*
@@ -935,8 +1130,8 @@ public abstract class Arc2D extends RectangularShape
* @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
* @throws IllegalArgumentException if type is invalid
*/
- public void setArc(double x, double y, double w, double h,
- double start, double extent, int type)
+ public void setArc(double x, double y, double w, double h, double start,
+ double extent, int type)
{
this.x = x;
this.y = y;
@@ -960,7 +1155,7 @@ public abstract class Arc2D extends RectangularShape
/**
* Sets the extent angle of the arc.
*
- * @param start the new extent angle
+ * @param extent the new extent angle
*/
public void setAngleExtent(double extent)
{
@@ -1039,8 +1234,8 @@ public abstract class Arc2D extends RectangularShape
* @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
* @throws IllegalArgumentException if type is invalid
*/
- public Float(float x, float y, float w, float h,
- float start, float extent, int type)
+ public Float(float x, float y, float w, float h, float start,
+ float extent, int type)
{
super(type);
this.x = x;
@@ -1050,7 +1245,7 @@ public abstract class Arc2D extends RectangularShape
this.start = start;
this.extent = extent;
}
-
+
/**
* Create a new arc with the given dimensions.
*
@@ -1069,7 +1264,7 @@ public abstract class Arc2D extends RectangularShape
width = (float) r.getWidth();
height = (float) r.getHeight();
this.start = start;
- this.extent = extent;
+ this.extent = (float) extent;
}
/**
@@ -1154,8 +1349,8 @@ public abstract class Arc2D extends RectangularShape
* @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
* @throws IllegalArgumentException if type is invalid
*/
- public void setArc(double x, double y, double w, double h,
- double start, double extent, int type)
+ public void setArc(double x, double y, double w, double h, double start,
+ double extent, int type)
{
this.x = (float) x;
this.y = (float) y;
@@ -1179,7 +1374,7 @@ public abstract class Arc2D extends RectangularShape
/**
* Sets the extent angle of the arc.
*
- * @param start the new extent angle
+ * @param extent the new extent angle
*/
public void setAngleExtent(double extent)
{
diff --git a/libjava/java/awt/geom/Area.java b/libjava/java/awt/geom/Area.java
index 85bc642..9b1b9d3 100644
--- a/libjava/java/awt/geom/Area.java
+++ b/libjava/java/awt/geom/Area.java
@@ -1,5 +1,5 @@
/* Area.java -- represents a shape built by constructive area geometry
- Copyright (C) 2002 Free Software Foundation
+ Copyright (C) 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -35,74 +35,648 @@ 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 java.awt.geom;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.util.Vector;
+
/**
- * STUBS ONLY
- * XXX Implement and document.
+ * The Area class represents any area for the purpose of
+ * Constructive Area Geometry (CAG) manipulations. CAG manipulations
+ * work as an area-wise form of boolean logic, where the basic operations are:
+ * <P><li>Add (in boolean algebra: A <B>or</B> B)<BR>
+ * <li>Subtract (in boolean algebra: A <B>and</B> (<B>not</B> B) )<BR>
+ * <li>Intersect (in boolean algebra: A <B>and</B> B)<BR>
+ * <li>Exclusive Or <BR>
+ * <img src="doc-files/Area-1.png" width="342" height="302"
+ * alt="Illustration of CAG operations" /><BR>
+ * Above is an illustration of the CAG operations on two ring shapes.<P>
+ *
+ * The contains and intersects() methods are also more accurate than the
+ * specification of #Shape requires.<P>
+ *
+ * Please note that constructing an Area can be slow
+ * (Self-intersection resolving is proportional to the square of
+ * the number of segments).<P>
+ * @see #add(Area)
+ * @see #subtract(Area)
+ * @see #intersect(Area)
+ * @see #exclusiveOr(Area)
+ *
+ * @author Sven de Marothy (sven@physto.se)
+ *
+ * @since 1.2
+ * @status Works, but could be faster and more reliable.
*/
public class Area implements Shape, Cloneable
{
+ /**
+ * General numerical precision
+ */
+ private static final double EPSILON = 1E-11;
+
+ /**
+ * recursive subdivision epsilon - (see getRecursionDepth)
+ */
+ private static final double RS_EPSILON = 1E-13;
+
+ /**
+ * Snap distance - points within this distance are considered equal
+ */
+ private static final double PE_EPSILON = 1E-11;
+
+ /**
+ * Segment vectors containing solid areas and holes
+ */
+ private Vector solids;
+
+ /**
+ * Segment vectors containing solid areas and holes
+ */
+ private Vector holes;
+
+ /**
+ * Vector (temporary) storing curve-curve intersections
+ */
+ private Vector cc_intersections;
+
+ /**
+ * Winding rule WIND_NON_ZERO used, after construction,
+ * this is irrelevant.
+ */
+ private int windingRule;
+
+ /**
+ * Constructs an empty Area
+ */
public Area()
{
+ solids = new Vector();
+ holes = new Vector();
}
+
+ /**
+ * Constructs an Area from any given Shape. <P>
+ *
+ * If the Shape is self-intersecting, the created Area will consist
+ * of non-self-intersecting subpaths, and any inner paths which
+ * are found redundant in accordance with the Shape's winding rule
+ * will not be included.
+ *
+ * @param s the shape (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>s</code> is <code>null</code>.
+ */
public Area(Shape s)
{
+ this();
+
+ Vector p = makeSegment(s);
+
+ // empty path
+ if (p == null)
+ return;
+
+ // delete empty paths
+ for (int i = 0; i < p.size(); i++)
+ if (((Segment) p.elementAt(i)).getSignedArea() == 0.0)
+ p.remove(i--);
+
+ /*
+ * Resolve self intersecting paths into non-intersecting
+ * solids and holes.
+ * Algorithm is as follows:
+ * 1: Create nodes at all self intersections
+ * 2: Put all segments into a list
+ * 3: Grab a segment, follow it, change direction at each node,
+ * removing segments from the list in the process
+ * 4: Repeat (3) until no segments remain in the list
+ * 5: Remove redundant paths and sort into solids and holes
+ */
+ Vector paths = new Vector();
+ Segment v;
+
+ for (int i = 0; i < p.size(); i++)
+ {
+ Segment path = (Segment) p.elementAt(i);
+ createNodesSelf(path);
+ }
+
+ if (p.size() > 1)
+ {
+ for (int i = 0; i < p.size() - 1; i++)
+ for (int j = i + 1; j < p.size(); j++)
+ {
+ Segment path1 = (Segment) p.elementAt(i);
+ Segment path2 = (Segment) p.elementAt(j);
+ createNodes(path1, path2);
+ }
+ }
+
+ // we have intersecting points.
+ Vector segments = new Vector();
+
+ for (int i = 0; i < p.size(); i++)
+ {
+ Segment path = v = (Segment) p.elementAt(i);
+ do
+ {
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ paths = weilerAtherton(segments);
+ deleteRedundantPaths(paths);
}
- public void add(Area a)
+
+ /**
+ * Performs an add (union) operation on this area with another Area.<BR>
+ * @param area - the area to be unioned with this one
+ */
+ public void add(Area area)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (equals(area))
+ return;
+ if (area.isEmpty())
+ return;
+
+ Area B = (Area) area.clone();
+
+ Vector pathA = new Vector();
+ Vector pathB = new Vector();
+ pathA.addAll(solids);
+ pathA.addAll(holes);
+ pathB.addAll(B.solids);
+ pathB.addAll(B.holes);
+
+ int nNodes = 0;
+
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
+ }
+
+ Vector paths = new Vector();
+ Segment v;
+
+ // we have intersecting points.
+ Vector segments = new Vector();
+
+ // In a union operation, we keep all
+ // segments of A oustide B and all B outside A
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ do
+ {
+ if (v.isSegmentOutside(area))
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ for (int i = 0; i < pathB.size(); i++)
+ {
+ v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ do
+ {
+ if (v.isSegmentOutside(this))
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ paths = weilerAtherton(segments);
+ deleteRedundantPaths(paths);
}
- public void subtract(Area a)
+
+ /**
+ * Performs a subtraction operation on this Area.<BR>
+ * @param area the area to be subtracted from this area.
+ * @throws NullPointerException if <code>area</code> is <code>null</code>.
+ */
+ public void subtract(Area area)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (isEmpty() || area.isEmpty())
+ return;
+
+ if (equals(area))
+ {
+ reset();
+ return;
+ }
+
+ Vector pathA = new Vector();
+ Area B = (Area) area.clone();
+ pathA.addAll(solids);
+ pathA.addAll(holes);
+
+ // reverse the directions of B paths.
+ setDirection(B.holes, true);
+ setDirection(B.solids, false);
+
+ Vector pathB = new Vector();
+ pathB.addAll(B.solids);
+ pathB.addAll(B.holes);
+
+ int nNodes = 0;
+
+ // create nodes
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
+ }
+
+ Vector paths = new Vector();
+
+ // we have intersecting points.
+ Vector segments = new Vector();
+
+ // In a subtraction operation, we keep all
+ // segments of A oustide B and all B within A
+ // We outsideness-test only one segment in each path
+ // and the segments before and after any node
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ Segment v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ if (v.isSegmentOutside(area) && v.node == null)
+ segments.add(v);
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (v.isSegmentOutside(area))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ for (int i = 0; i < pathB.size(); i++)
+ {
+ Segment v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ if (! v.isSegmentOutside(this) && v.node == null)
+ segments.add(v);
+ v = v.next;
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (! v.isSegmentOutside(this))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ paths = weilerAtherton(segments);
+ deleteRedundantPaths(paths);
}
- public void intersect(Area a)
+
+ /**
+ * Performs an intersection operation on this Area.<BR>
+ * @param area - the area to be intersected with this area.
+ * @throws NullPointerException if <code>area</code> is <code>null</code>.
+ */
+ public void intersect(Area area)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (isEmpty() || area.isEmpty())
+ {
+ reset();
+ return;
+ }
+ if (equals(area))
+ return;
+
+ Vector pathA = new Vector();
+ Area B = (Area) area.clone();
+ pathA.addAll(solids);
+ pathA.addAll(holes);
+
+ Vector pathB = new Vector();
+ pathB.addAll(B.solids);
+ pathB.addAll(B.holes);
+
+ int nNodes = 0;
+
+ // create nodes
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
+ }
+
+ Vector paths = new Vector();
+
+ // we have intersecting points.
+ Vector segments = new Vector();
+
+ // In an intersection operation, we keep all
+ // segments of A within B and all B within A
+ // (The rest must be redundant)
+ // We outsideness-test only one segment in each path
+ // and the segments before and after any node
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ Segment v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ if (! v.isSegmentOutside(area) && v.node == null)
+ segments.add(v);
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (! v.isSegmentOutside(area))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ for (int i = 0; i < pathB.size(); i++)
+ {
+ Segment v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ if (! v.isSegmentOutside(this) && v.node == null)
+ segments.add(v);
+ v = v.next;
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (! v.isSegmentOutside(this))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ paths = weilerAtherton(segments);
+ deleteRedundantPaths(paths);
}
- public void exclusiveOr(Area a)
+
+ /**
+ * Performs an exclusive-or operation on this Area.<BR>
+ * @param area - the area to be XORed with this area.
+ * @throws NullPointerException if <code>area</code> is <code>null</code>.
+ */
+ public void exclusiveOr(Area area)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (area.isEmpty())
+ return;
+
+ if (isEmpty())
+ {
+ Area B = (Area) area.clone();
+ solids = B.solids;
+ holes = B.holes;
+ return;
+ }
+ if (equals(area))
+ {
+ reset();
+ return;
+ }
+
+ Vector pathA = new Vector();
+
+ Area B = (Area) area.clone();
+ Vector pathB = new Vector();
+ pathA.addAll(solids);
+ pathA.addAll(holes);
+
+ // reverse the directions of B paths.
+ setDirection(B.holes, true);
+ setDirection(B.solids, false);
+ pathB.addAll(B.solids);
+ pathB.addAll(B.holes);
+
+ int nNodes = 0;
+
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
+ }
+
+ Vector paths = new Vector();
+ Segment v;
+
+ // we have intersecting points.
+ Vector segments = new Vector();
+
+ // In an XOR operation, we operate on all segments
+ for (int i = 0; i < pathA.size(); i++)
+ {
+ v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ do
+ {
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ for (int i = 0; i < pathB.size(); i++)
+ {
+ v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ do
+ {
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
+ }
+
+ paths = weilerAtherton(segments);
+ deleteRedundantPaths(paths);
}
+
+ /**
+ * Clears the Area object, creating an empty area.
+ */
public void reset()
{
- // XXX Implement.
- throw new Error("not implemented");
+ solids = new Vector();
+ holes = new Vector();
}
+
+ /**
+ * Returns whether this area encloses any area.
+ * @return true if the object encloses any area.
+ */
public boolean isEmpty()
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (solids.size() == 0)
+ return true;
+
+ double totalArea = 0;
+ for (int i = 0; i < solids.size(); i++)
+ totalArea += Math.abs(((Segment) solids.elementAt(i)).getSignedArea());
+ for (int i = 0; i < holes.size(); i++)
+ totalArea -= Math.abs(((Segment) holes.elementAt(i)).getSignedArea());
+ if (totalArea <= EPSILON)
+ return true;
+
+ return false;
}
+
+ /**
+ * Determines whether the Area consists entirely of line segments
+ * @return true if the Area lines-only, false otherwise
+ */
public boolean isPolygonal()
{
- // XXX Implement.
- throw new Error("not implemented");
+ for (int i = 0; i < holes.size(); i++)
+ if (! ((Segment) holes.elementAt(i)).isPolygonal())
+ return false;
+ for (int i = 0; i < solids.size(); i++)
+ if (! ((Segment) solids.elementAt(i)).isPolygonal())
+ return false;
+ return true;
}
+
+ /**
+ * Determines if the Area is rectangular.<P>
+ *
+ * This is strictly qualified. An area is considered rectangular if:<BR>
+ * <li>It consists of a single polygonal path.<BR>
+ * <li>It is oriented parallel/perpendicular to the xy axis<BR>
+ * <li>It must be exactly rectangular, i.e. small errors induced by
+ * transformations may cause a false result, although the area is
+ * visibly rectangular.<P>
+ * @return true if the above criteria are met, false otherwise
+ */
public boolean isRectangular()
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (isEmpty())
+ return true;
+
+ if (holes.size() != 0 || solids.size() != 1)
+ return false;
+
+ Segment path = (Segment) solids.elementAt(0);
+ if (! path.isPolygonal())
+ return false;
+
+ int nCorners = 0;
+ Segment s = path;
+ do
+ {
+ Segment s2 = s.next;
+ double d1 = (s.P2.getX() - s.P1.getX())*(s2.P2.getX() - s2.P1.getX())/
+ ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
+ double d2 = (s.P2.getY() - s.P1.getY())*(s2.P2.getY() - s2.P1.getY())/
+ ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
+ double dotproduct = d1 + d2;
+
+ // For some reason, only rectangles on the XY axis count.
+ if (d1 != 0 && d2 != 0)
+ return false;
+
+ if (Math.abs(dotproduct) == 0) // 90 degree angle
+ nCorners++;
+ else if ((Math.abs(1.0 - dotproduct) > 0)) // 0 degree angle?
+ return false; // if not, return false
+
+ s = s.next;
+ }
+ while (s != path);
+
+ return nCorners == 4;
}
+
+ /**
+ * Returns whether the Area consists of more than one simple
+ * (non self-intersecting) subpath.
+ *
+ * @return true if the Area consists of none or one simple subpath,
+ * false otherwise.
+ */
public boolean isSingular()
{
- // XXX Implement.
- throw new Error("not implemented");
+ return (holes.size() == 0 && solids.size() <= 1);
}
+
+ /**
+ * Returns the bounding box of the Area.<P> Unlike the CubicCurve2D and
+ * QuadraticCurve2D classes, this method will return the tightest possible
+ * bounding box, evaluating the extreme points of each curved segment.<P>
+ * @return the bounding box
+ */
public Rectangle2D getBounds2D()
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (solids.size() == 0)
+ return new Rectangle2D.Double(0.0, 0.0, 0.0, 0.0);
+
+ double xmin;
+ double xmax;
+ double ymin;
+ double ymax;
+ xmin = xmax = ((Segment) solids.elementAt(0)).P1.getX();
+ ymin = ymax = ((Segment) solids.elementAt(0)).P1.getY();
+
+ for (int path = 0; path < solids.size(); path++)
+ {
+ Rectangle2D r = ((Segment) solids.elementAt(path)).getPathBounds();
+ xmin = Math.min(r.getMinX(), xmin);
+ ymin = Math.min(r.getMinY(), ymin);
+ xmax = Math.max(r.getMaxX(), xmax);
+ ymax = Math.max(r.getMaxY(), ymax);
+ }
+
+ return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
}
+
+ /**
+ * Returns the bounds of this object in Rectangle format.
+ * Please note that this may lead to loss of precision.
+ *
+ * @return The bounds.
+ * @see #getBounds2D()
+ */
public Rectangle getBounds()
{
return getBounds2D().getBounds();
@@ -118,66 +692,2618 @@ public class Area implements Shape, Cloneable
{
try
{
- return super.clone();
+ Area clone = new Area();
+ for (int i = 0; i < solids.size(); i++)
+ clone.solids.add(((Segment) solids.elementAt(i)).cloneSegmentList());
+ for (int i = 0; i < holes.size(); i++)
+ clone.holes.add(((Segment) holes.elementAt(i)).cloneSegmentList());
+ return clone;
}
catch (CloneNotSupportedException e)
{
- throw (Error) new InternalError().initCause(e); // Impossible
+ throw (Error) new InternalError().initCause(e); // Impossible
}
}
- public boolean equals(Area a)
+ /**
+ * Compares two Areas.
+ *
+ * @param area the area to compare against this area (<code>null</code>
+ * permitted).
+ * @return <code>true</code> if the areas are equal, and <code>false</code>
+ * otherwise.
+ */
+ public boolean equals(Area area)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (area == null)
+ return false;
+
+ if (! getBounds2D().equals(area.getBounds2D()))
+ return false;
+
+ if (solids.size() != area.solids.size()
+ || holes.size() != area.holes.size())
+ return false;
+
+ Vector pathA = new Vector();
+ pathA.addAll(solids);
+ pathA.addAll(holes);
+ Vector pathB = new Vector();
+ pathB.addAll(area.solids);
+ pathB.addAll(area.holes);
+
+ int nPaths = pathA.size();
+ boolean[][] match = new boolean[2][nPaths];
+
+ for (int i = 0; i < nPaths; i++)
+ {
+ for (int j = 0; j < nPaths; j++)
+ {
+ Segment p1 = (Segment) pathA.elementAt(i);
+ Segment p2 = (Segment) pathB.elementAt(j);
+ if (! match[0][i] && ! match[1][j])
+ if (p1.pathEquals(p2))
+ match[0][i] = match[1][j] = true;
+ }
+ }
+
+ boolean result = true;
+ for (int i = 0; i < nPaths; i++)
+ result = result && match[0][i] && match[1][i];
+ return result;
}
+ /**
+ * Transforms this area by the AffineTransform at.
+ *
+ * @param at the transform.
+ */
public void transform(AffineTransform at)
{
- // XXX Implement.
- throw new Error("not implemented");
+ for (int i = 0; i < solids.size(); i++)
+ ((Segment) solids.elementAt(i)).transformSegmentList(at);
+ for (int i = 0; i < holes.size(); i++)
+ ((Segment) holes.elementAt(i)).transformSegmentList(at);
+
+ // Note that the orientation is not invariant under inversion
+ if ((at.getType() & AffineTransform.TYPE_FLIP) != 0)
+ {
+ setDirection(holes, false);
+ setDirection(solids, true);
+ }
}
+
+ /**
+ * Returns a new Area equal to this one, transformed
+ * by the AffineTransform at.
+ * @param at the transform.
+ * @return the transformed area
+ * @throws NullPointerException if <code>at</code> is <code>null</code>.
+ */
public Area createTransformedArea(AffineTransform at)
{
Area a = (Area) clone();
a.transform(at);
return a;
}
+
+ /**
+ * Determines if the point (x,y) is contained within this Area.
+ *
+ * @param x the x-coordinate of the point.
+ * @param y the y-coordinate of the point.
+ * @return true if the point is contained, false otherwise.
+ */
public boolean contains(double x, double y)
{
- // XXX Implement.
- throw new Error("not implemented");
+ int n = 0;
+ for (int i = 0; i < solids.size(); i++)
+ if (((Segment) solids.elementAt(i)).contains(x, y))
+ n++;
+
+ for (int i = 0; i < holes.size(); i++)
+ if (((Segment) holes.elementAt(i)).contains(x, y))
+ n--;
+
+ return (n != 0);
}
+
+ /**
+ * Determines if the Point2D p is contained within this Area.
+ *
+ * @param p the point.
+ * @return <code>true</code> if the point is contained, <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>p</code> is <code>null</code>.
+ */
public boolean contains(Point2D p)
{
return contains(p.getX(), p.getY());
}
+
+ /**
+ * Determines if the rectangle specified by (x,y) as the upper-left
+ * and with width w and height h is completely contained within this Area,
+ * returns false otherwise.<P>
+ *
+ * This method should always produce the correct results, unlike for other
+ * classes in geom.
+ *
+ * @param x the x-coordinate of the rectangle.
+ * @param y the y-coordinate of the rectangle.
+ * @param w the width of the the rectangle.
+ * @param h the height of the rectangle.
+ * @return <code>true</code> if the rectangle is considered contained
+ */
public boolean contains(double x, double y, double w, double h)
{
- // XXX Implement.
- throw new Error("not implemented");
+ LineSegment[] l = new LineSegment[4];
+ l[0] = new LineSegment(x, y, x + w, y);
+ l[1] = new LineSegment(x, y + h, x + w, y + h);
+ l[2] = new LineSegment(x, y, x, y + h);
+ l[3] = new LineSegment(x + w, y, x + w, y + h);
+
+ // Since every segment in the area must a contour
+ // between inside/outside segments, ANY intersection
+ // will mean the rectangle is not entirely contained.
+ for (int i = 0; i < 4; i++)
+ {
+ for (int path = 0; path < solids.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) solids.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return false;
+ v = v.next;
+ }
+ while (v != start);
+ }
+ for (int path = 0; path < holes.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) holes.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return false;
+ v = v.next;
+ }
+ while (v != start);
+ }
+ }
+
+ // Is any point inside?
+ if (! contains(x, y))
+ return false;
+
+ // Final hoop: Is the rectangle non-intersecting and inside,
+ // but encloses a hole?
+ Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
+ for (int path = 0; path < holes.size(); path++)
+ if (! ((Segment) holes.elementAt(path)).isSegmentOutside(r))
+ return false;
+
+ return true;
}
+
+ /**
+ * Determines if the Rectangle2D specified by r is completely contained
+ * within this Area, returns false otherwise.<P>
+ *
+ * This method should always produce the correct results, unlike for other
+ * classes in geom.
+ *
+ * @param r the rectangle.
+ * @return <code>true</code> if the rectangle is considered contained
+ *
+ * @throws NullPointerException if <code>r</code> is <code>null</code>.
+ */
public boolean contains(Rectangle2D r)
{
return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
}
+ /**
+ * Determines if the rectangle specified by (x,y) as the upper-left
+ * and with width w and height h intersects any part of this Area.
+ *
+ * @param x the x-coordinate for the rectangle.
+ * @param y the y-coordinate for the rectangle.
+ * @param w the width of the rectangle.
+ * @param h the height of the rectangle.
+ * @return <code>true</code> if the rectangle intersects the area,
+ * <code>false</code> otherwise.
+ */
public boolean intersects(double x, double y, double w, double h)
{
- // XXX Implement.
- throw new Error("not implemented");
+ if (solids.size() == 0)
+ return false;
+
+ LineSegment[] l = new LineSegment[4];
+ l[0] = new LineSegment(x, y, x + w, y);
+ l[1] = new LineSegment(x, y + h, x + w, y + h);
+ l[2] = new LineSegment(x, y, x, y + h);
+ l[3] = new LineSegment(x + w, y, x + w, y + h);
+
+ // Return true on any intersection
+ for (int i = 0; i < 4; i++)
+ {
+ for (int path = 0; path < solids.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) solids.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return true;
+ v = v.next;
+ }
+ while (v != start);
+ }
+ for (int path = 0; path < holes.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) holes.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return true;
+ v = v.next;
+ }
+ while (v != start);
+ }
+ }
+
+ // Non-intersecting, Is any point inside?
+ if (contains(x + w * 0.5, y + h * 0.5))
+ return true;
+
+ // What if the rectangle encloses the whole shape?
+ Point2D p = ((Segment) solids.elementAt(0)).getMidPoint();
+ if ((new Rectangle2D.Double(x, y, w, h)).contains(p))
+ return true;
+ return false;
}
+
+ /**
+ * Determines if the Rectangle2D specified by r intersects any
+ * part of this Area.
+ * @param r the rectangle to test intersection with (<code>null</code>
+ * not permitted).
+ * @return <code>true</code> if the rectangle intersects the area,
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>r</code> is <code>null</code>.
+ */
public boolean intersects(Rectangle2D r)
{
return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
}
+
+ /**
+ * Returns a PathIterator object defining the contour of this Area,
+ * transformed by at.
+ *
+ * @param at the transform.
+ * @return A path iterator.
+ */
public PathIterator getPathIterator(AffineTransform at)
{
- // XXX Implement.
- throw new Error("not implemented");
+ return (new AreaIterator(at));
}
+
+ /**
+ * Returns a flattened PathIterator object defining the contour of this
+ * Area, transformed by at and with a defined flatness.
+ *
+ * @param at the transform.
+ * @param flatness the flatness.
+ * @return A path iterator.
+ */
public PathIterator getPathIterator(AffineTransform at, double flatness)
{
return new FlatteningPathIterator(getPathIterator(at), flatness);
}
+
+ //---------------------------------------------------------------------
+ // Non-public methods and classes
+
+ /**
+ * Private pathiterator object.
+ */
+ private class AreaIterator implements PathIterator
+ {
+ private Vector segments;
+ private int index;
+ private AffineTransform at;
+
+ // Simple compound type for segments
+ class IteratorSegment
+ {
+ int type;
+ double[] coords;
+
+ IteratorSegment()
+ {
+ coords = new double[6];
+ }
+ }
+
+ /**
+ * The contructor here does most of the work,
+ * creates a vector of IteratorSegments, which can
+ * readily be returned
+ */
+ public AreaIterator(AffineTransform at)
+ {
+ this.at = at;
+ index = 0;
+ segments = new Vector();
+ Vector allpaths = new Vector();
+ allpaths.addAll(solids);
+ allpaths.addAll(holes);
+
+ for (int i = 0; i < allpaths.size(); i++)
+ {
+ Segment v = (Segment) allpaths.elementAt(i);
+ Segment start = v;
+
+ IteratorSegment is = new IteratorSegment();
+ is.type = SEG_MOVETO;
+ is.coords[0] = start.P1.getX();
+ is.coords[1] = start.P1.getY();
+ segments.add(is);
+
+ do
+ {
+ is = new IteratorSegment();
+ is.type = v.pathIteratorFormat(is.coords);
+ segments.add(is);
+ v = v.next;
+ }
+ while (v != start);
+
+ is = new IteratorSegment();
+ is.type = SEG_CLOSE;
+ segments.add(is);
+ }
+ }
+
+ public int currentSegment(double[] coords)
+ {
+ IteratorSegment s = (IteratorSegment) segments.elementAt(index);
+ if (at != null)
+ at.transform(s.coords, 0, coords, 0, 3);
+ else
+ for (int i = 0; i < 6; i++)
+ coords[i] = s.coords[i];
+ return (s.type);
+ }
+
+ public int currentSegment(float[] coords)
+ {
+ IteratorSegment s = (IteratorSegment) segments.elementAt(index);
+ double[] d = new double[6];
+ if (at != null)
+ {
+ at.transform(s.coords, 0, d, 0, 3);
+ for (int i = 0; i < 6; i++)
+ coords[i] = (float) d[i];
+ }
+ else
+ for (int i = 0; i < 6; i++)
+ coords[i] = (float) s.coords[i];
+ return (s.type);
+ }
+
+ // Note that the winding rule should not matter here,
+ // EVEN_ODD is chosen because it renders faster.
+ public int getWindingRule()
+ {
+ return (PathIterator.WIND_EVEN_ODD);
+ }
+
+ public boolean isDone()
+ {
+ return (index >= segments.size());
+ }
+
+ public void next()
+ {
+ index++;
+ }
+ }
+
+ /**
+ * Performs the fundamental task of the Weiler-Atherton algorithm,
+ * traverse a list of segments, for each segment:
+ * Follow it, removing segments from the list and switching paths
+ * at each node. Do so until the starting segment is reached.
+ *
+ * Returns a Vector of the resulting paths.
+ */
+ private Vector weilerAtherton(Vector segments)
+ {
+ Vector paths = new Vector();
+ while (segments.size() > 0)
+ {
+ // Iterate over the path
+ Segment start = (Segment) segments.elementAt(0);
+ Segment s = start;
+ do
+ {
+ segments.remove(s);
+ if (s.node != null)
+ { // switch over
+ s.next = s.node;
+ s.node = null;
+ }
+ s = s.next; // continue
+ }
+ while (s != start);
+
+ paths.add(start);
+ }
+ return paths;
+ }
+
+ /**
+ * A small wrapper class to store intersection points
+ */
+ private class Intersection
+ {
+ Point2D p; // the 2D point of intersection
+ double ta; // the parametric value on a
+ double tb; // the parametric value on b
+ Segment seg; // segment placeholder for node setting
+
+ public Intersection(Point2D p, double ta, double tb)
+ {
+ this.p = p;
+ this.ta = ta;
+ this.tb = tb;
+ }
+ }
+
+ /**
+ * Returns the recursion depth necessary to approximate the
+ * curve by line segments within the error RS_EPSILON.
+ *
+ * This is done with Wang's formula:
+ * L0 = max{0<=i<=N-2}(|xi - 2xi+1 + xi+2|,|yi - 2yi+1 + yi+2|)
+ * r0 = log4(sqrt(2)*N*(N-1)*L0/8e)
+ * Where e is the maximum distance error (RS_EPSILON)
+ */
+ private int getRecursionDepth(CubicSegment curve)
+ {
+ double x0 = curve.P1.getX();
+ double y0 = curve.P1.getY();
+
+ double x1 = curve.cp1.getX();
+ double y1 = curve.cp1.getY();
+
+ double x2 = curve.cp2.getX();
+ double y2 = curve.cp2.getY();
+
+ double x3 = curve.P2.getX();
+ double y3 = curve.P2.getY();
+
+ double L0 = Math.max(Math.max(Math.abs(x0 - 2 * x1 + x2),
+ Math.abs(x1 - 2 * x2 + x3)),
+ Math.max(Math.abs(y0 - 2 * y1 + y2),
+ Math.abs(y1 - 2 * y2 + y3)));
+
+ double f = Math.sqrt(2) * 6.0 * L0 / (8.0 * RS_EPSILON);
+
+ int r0 = (int) Math.ceil(Math.log(f) / Math.log(4.0));
+ return (r0);
+ }
+
+ /**
+ * Performs recursive subdivision:
+ * @param c1 - curve 1
+ * @param c2 - curve 2
+ * @param depth1 - recursion depth of curve 1
+ * @param depth2 - recursion depth of curve 2
+ * @param t1 - global parametric value of the first curve's starting point
+ * @param t2 - global parametric value of the second curve's starting point
+ * @param w1 - global parametric length of curve 1
+ * @param c1 - global parametric length of curve 2
+ *
+ * The final four parameters are for keeping track of the parametric
+ * value of the curve. For a full curve t = 0, w = 1, w is halved with
+ * each subdivision.
+ */
+ private void recursiveSubdivide(CubicCurve2D c1, CubicCurve2D c2,
+ int depth1, int depth2, double t1,
+ double t2, double w1, double w2)
+ {
+ boolean flat1 = depth1 <= 0;
+ boolean flat2 = depth2 <= 0;
+
+ if (flat1 && flat2)
+ {
+ double xlk = c1.getP2().getX() - c1.getP1().getX();
+ double ylk = c1.getP2().getY() - c1.getP1().getY();
+
+ double xnm = c2.getP2().getX() - c2.getP1().getX();
+ double ynm = c2.getP2().getY() - c2.getP1().getY();
+
+ double xmk = c2.getP1().getX() - c1.getP1().getX();
+ double ymk = c2.getP1().getY() - c1.getP1().getY();
+ double det = xnm * ylk - ynm * xlk;
+
+ if (det + 1.0 == 1.0)
+ return;
+
+ double detinv = 1.0 / det;
+ double s = (xnm * ymk - ynm * xmk) * detinv;
+ double t = (xlk * ymk - ylk * xmk) * detinv;
+ if ((s < 0.0) || (s > 1.0) || (t < 0.0) || (t > 1.0))
+ return;
+
+ double[] temp = new double[2];
+ temp[0] = t1 + s * w1;
+ temp[1] = t2 + t * w1;
+ cc_intersections.add(temp);
+ return;
+ }
+
+ CubicCurve2D.Double c11 = new CubicCurve2D.Double();
+ CubicCurve2D.Double c12 = new CubicCurve2D.Double();
+ CubicCurve2D.Double c21 = new CubicCurve2D.Double();
+ CubicCurve2D.Double c22 = new CubicCurve2D.Double();
+
+ if (! flat1 && ! flat2)
+ {
+ depth1--;
+ depth2--;
+ w1 = w1 * 0.5;
+ w2 = w2 * 0.5;
+ c1.subdivide(c11, c12);
+ c2.subdivide(c21, c22);
+ if (c11.getBounds2D().intersects(c21.getBounds2D()))
+ recursiveSubdivide(c11, c21, depth1, depth2, t1, t2, w1, w2);
+ if (c11.getBounds2D().intersects(c22.getBounds2D()))
+ recursiveSubdivide(c11, c22, depth1, depth2, t1, t2 + w2, w1, w2);
+ if (c12.getBounds2D().intersects(c21.getBounds2D()))
+ recursiveSubdivide(c12, c21, depth1, depth2, t1 + w1, t2, w1, w2);
+ if (c12.getBounds2D().intersects(c22.getBounds2D()))
+ recursiveSubdivide(c12, c22, depth1, depth2, t1 + w1, t2 + w2, w1, w2);
+ return;
+ }
+
+ if (! flat1)
+ {
+ depth1--;
+ c1.subdivide(c11, c12);
+ w1 = w1 * 0.5;
+ if (c11.getBounds2D().intersects(c2.getBounds2D()))
+ recursiveSubdivide(c11, c2, depth1, depth2, t1, t2, w1, w2);
+ if (c12.getBounds2D().intersects(c2.getBounds2D()))
+ recursiveSubdivide(c12, c2, depth1, depth2, t1 + w1, t2, w1, w2);
+ return;
+ }
+
+ depth2--;
+ c2.subdivide(c21, c22);
+ w2 = w2 * 0.5;
+ if (c1.getBounds2D().intersects(c21.getBounds2D()))
+ recursiveSubdivide(c1, c21, depth1, depth2, t1, t2, w1, w2);
+ if (c1.getBounds2D().intersects(c22.getBounds2D()))
+ recursiveSubdivide(c1, c22, depth1, depth2, t1, t2 + w2, w1, w2);
+ }
+
+ /**
+ * Returns a set of interesections between two Cubic segments
+ * Or null if no intersections were found.
+ *
+ * The method used to find the intersection is recursive midpoint
+ * subdivision. Outline description:
+ *
+ * 1) Check if the bounding boxes of the curves intersect,
+ * 2) If so, divide the curves in the middle and test the bounding
+ * boxes again,
+ * 3) Repeat until a maximum recursion depth has been reached, where
+ * the intersecting curves can be approximated by line segments.
+ *
+ * This is a reasonably accurate method, although the recursion depth
+ * is typically around 20, the bounding-box tests allow for significant
+ * pruning of the subdivision tree.
+ */
+ private Intersection[] cubicCubicIntersect(CubicSegment curve1,
+ CubicSegment curve2)
+ {
+ Rectangle2D r1 = curve1.getBounds();
+ Rectangle2D r2 = curve2.getBounds();
+
+ if (! r1.intersects(r2))
+ return null;
+
+ cc_intersections = new Vector();
+ recursiveSubdivide(curve1.getCubicCurve2D(), curve2.getCubicCurve2D(),
+ getRecursionDepth(curve1), getRecursionDepth(curve2),
+ 0.0, 0.0, 1.0, 1.0);
+
+ if (cc_intersections.size() == 0)
+ return null;
+
+ Intersection[] results = new Intersection[cc_intersections.size()];
+ for (int i = 0; i < cc_intersections.size(); i++)
+ {
+ double[] temp = (double[]) cc_intersections.elementAt(i);
+ results[i] = new Intersection(curve1.evaluatePoint(temp[0]), temp[0],
+ temp[1]);
+ }
+ cc_intersections = null;
+ return (results);
+ }
+
+ /**
+ * Returns the intersections between a line and a quadratic bezier
+ * Or null if no intersections are found1
+ * This is done through combining the line's equation with the
+ * parametric form of the Bezier and solving the resulting quadratic.
+ */
+ private Intersection[] lineQuadIntersect(LineSegment l, QuadSegment c)
+ {
+ double[] y = new double[3];
+ double[] x = new double[3];
+ double[] r = new double[3];
+ int nRoots;
+ double x0 = c.P1.getX();
+ double y0 = c.P1.getY();
+ double x1 = c.cp.getX();
+ double y1 = c.cp.getY();
+ double x2 = c.P2.getX();
+ double y2 = c.P2.getY();
+
+ double lx0 = l.P1.getX();
+ double ly0 = l.P1.getY();
+ double lx1 = l.P2.getX();
+ double ly1 = l.P2.getY();
+ double dx = lx1 - lx0;
+ double dy = ly1 - ly0;
+
+ // form r(t) = y(t) - x(t) for the bezier
+ y[0] = y0;
+ y[1] = 2 * (y1 - y0);
+ y[2] = (y2 - 2 * y1 + y0);
+
+ x[0] = x0;
+ x[1] = 2 * (x1 - x0);
+ x[2] = (x2 - 2 * x1 + x0);
+
+ // a point, not a line
+ if (dy == 0 && dx == 0)
+ return null;
+
+ // line on y axis
+ if (dx == 0 || (dy / dx) > 1.0)
+ {
+ double k = dx / dy;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ y[0] *= k;
+ y[1] *= k;
+ y[2] *= k;
+ }
+ else
+ {
+ double k = dy / dx;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ x[0] *= k;
+ x[1] *= k;
+ x[2] *= k;
+ }
+
+ for (int i = 0; i < 3; i++)
+ r[i] = y[i] - x[i];
+
+ if ((nRoots = QuadCurve2D.solveQuadratic(r)) > 0)
+ {
+ Intersection[] temp = new Intersection[nRoots];
+ int intersections = 0;
+ for (int i = 0; i < nRoots; i++)
+ {
+ double t = r[i];
+ if (t >= 0.0 && t <= 1.0)
+ {
+ Point2D p = c.evaluatePoint(t);
+
+ // if the line is on an axis, snap the point to that axis.
+ if (dx == 0)
+ p.setLocation(lx0, p.getY());
+ if (dy == 0)
+ p.setLocation(p.getX(), ly0);
+
+ if (p.getX() <= Math.max(lx0, lx1)
+ && p.getX() >= Math.min(lx0, lx1)
+ && p.getY() <= Math.max(ly0, ly1)
+ && p.getY() >= Math.min(ly0, ly1))
+ {
+ double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
+ temp[i] = new Intersection(p, lineparameter, t);
+ intersections++;
+ }
+ }
+ else
+ temp[i] = null;
+ }
+ if (intersections == 0)
+ return null;
+
+ Intersection[] rValues = new Intersection[intersections];
+
+ for (int i = 0; i < nRoots; i++)
+ if (temp[i] != null)
+ rValues[--intersections] = temp[i];
+ return (rValues);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the intersections between a line and a cubic segment
+ * This is done through combining the line's equation with the
+ * parametric form of the Bezier and solving the resulting quadratic.
+ */
+ private Intersection[] lineCubicIntersect(LineSegment l, CubicSegment c)
+ {
+ double[] y = new double[4];
+ double[] x = new double[4];
+ double[] r = new double[4];
+ int nRoots;
+ double x0 = c.P1.getX();
+ double y0 = c.P1.getY();
+ double x1 = c.cp1.getX();
+ double y1 = c.cp1.getY();
+ double x2 = c.cp2.getX();
+ double y2 = c.cp2.getY();
+ double x3 = c.P2.getX();
+ double y3 = c.P2.getY();
+
+ double lx0 = l.P1.getX();
+ double ly0 = l.P1.getY();
+ double lx1 = l.P2.getX();
+ double ly1 = l.P2.getY();
+ double dx = lx1 - lx0;
+ double dy = ly1 - ly0;
+
+ // form r(t) = y(t) - x(t) for the bezier
+ y[0] = y0;
+ y[1] = 3 * (y1 - y0);
+ y[2] = 3 * (y2 + y0 - 2 * y1);
+ y[3] = y3 - 3 * y2 + 3 * y1 - y0;
+
+ x[0] = x0;
+ x[1] = 3 * (x1 - x0);
+ x[2] = 3 * (x2 + x0 - 2 * x1);
+ x[3] = x3 - 3 * x2 + 3 * x1 - x0;
+
+ // a point, not a line
+ if (dy == 0 && dx == 0)
+ return null;
+
+ // line on y axis
+ if (dx == 0 || (dy / dx) > 1.0)
+ {
+ double k = dx / dy;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ y[0] *= k;
+ y[1] *= k;
+ y[2] *= k;
+ y[3] *= k;
+ }
+ else
+ {
+ double k = dy / dx;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ x[0] *= k;
+ x[1] *= k;
+ x[2] *= k;
+ x[3] *= k;
+ }
+ for (int i = 0; i < 4; i++)
+ r[i] = y[i] - x[i];
+
+ if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
+ {
+ Intersection[] temp = new Intersection[nRoots];
+ int intersections = 0;
+ for (int i = 0; i < nRoots; i++)
+ {
+ double t = r[i];
+ if (t >= 0.0 && t <= 1.0)
+ {
+ // if the line is on an axis, snap the point to that axis.
+ Point2D p = c.evaluatePoint(t);
+ if (dx == 0)
+ p.setLocation(lx0, p.getY());
+ if (dy == 0)
+ p.setLocation(p.getX(), ly0);
+
+ if (p.getX() <= Math.max(lx0, lx1)
+ && p.getX() >= Math.min(lx0, lx1)
+ && p.getY() <= Math.max(ly0, ly1)
+ && p.getY() >= Math.min(ly0, ly1))
+ {
+ double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
+ temp[i] = new Intersection(p, lineparameter, t);
+ intersections++;
+ }
+ }
+ else
+ temp[i] = null;
+ }
+
+ if (intersections == 0)
+ return null;
+
+ Intersection[] rValues = new Intersection[intersections];
+ for (int i = 0; i < nRoots; i++)
+ if (temp[i] != null)
+ rValues[--intersections] = temp[i];
+ return (rValues);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the intersection between two lines, or null if there is no
+ * intersection.
+ */
+ private Intersection linesIntersect(LineSegment a, LineSegment b)
+ {
+ Point2D P1 = a.P1;
+ Point2D P2 = a.P2;
+ Point2D P3 = b.P1;
+ Point2D P4 = b.P2;
+
+ if (! Line2D.linesIntersect(P1.getX(), P1.getY(), P2.getX(), P2.getY(),
+ P3.getX(), P3.getY(), P4.getX(), P4.getY()))
+ return null;
+
+ double x1 = P1.getX();
+ double y1 = P1.getY();
+ double rx = P2.getX() - x1;
+ double ry = P2.getY() - y1;
+
+ double x2 = P3.getX();
+ double y2 = P3.getY();
+ double sx = P4.getX() - x2;
+ double sy = P4.getY() - y2;
+
+ double determinant = sx * ry - sy * rx;
+ double nom = (sx * (y2 - y1) + sy * (x1 - x2));
+
+ // Parallel lines don't intersect. At least we pretend they don't.
+ if (Math.abs(determinant) < EPSILON)
+ return null;
+
+ nom = nom / determinant;
+
+ if (nom == 0.0)
+ return null;
+ if (nom == 1.0)
+ return null;
+
+ Point2D p = new Point2D.Double(x1 + nom * rx, y1 + nom * ry);
+
+ return new Intersection(p, p.distance(P1) / P1.distance(P2),
+ p.distance(P3) / P3.distance(P4));
+ }
+
+ /**
+ * Determines if two points are equal, within an error margin
+ * 'snap distance'
+ */
+ private boolean pointEquals(Point2D a, Point2D b)
+ {
+ return (a.equals(b) || a.distance(b) < PE_EPSILON);
+ }
+
+ /**
+ * Helper method
+ * Turns a shape into a Vector of Segments
+ */
+ private Vector makeSegment(Shape s)
+ {
+ Vector paths = new Vector();
+ PathIterator pi = s.getPathIterator(null);
+ double[] coords = new double[6];
+ Segment subpath = null;
+ Segment current = null;
+ double cx;
+ double cy;
+ double subpathx;
+ double subpathy;
+ cx = cy = subpathx = subpathy = 0.0;
+
+ this.windingRule = pi.getWindingRule();
+
+ while (! pi.isDone())
+ {
+ Segment v;
+ switch (pi.currentSegment(coords))
+ {
+ case PathIterator.SEG_MOVETO:
+ if (subpath != null)
+ { // close existing open path
+ current.next = new LineSegment(cx, cy, subpathx, subpathy);
+ current = current.next;
+ current.next = subpath;
+ }
+ subpath = null;
+ subpathx = cx = coords[0];
+ subpathy = cy = coords[1];
+ break;
+
+ // replace 'close' with a line-to.
+ case PathIterator.SEG_CLOSE:
+ if (subpath != null && (subpathx != cx || subpathy != cy))
+ {
+ current.next = new LineSegment(cx, cy, subpathx, subpathy);
+ current = current.next;
+ current.next = subpath;
+ cx = subpathx;
+ cy = subpathy;
+ subpath = null;
+ }
+ else if (subpath != null)
+ {
+ current.next = subpath;
+ subpath = null;
+ }
+ break;
+ case PathIterator.SEG_LINETO:
+ if (cx != coords[0] || cy != coords[1])
+ {
+ v = new LineSegment(cx, cy, coords[0], coords[1]);
+ if (subpath == null)
+ {
+ subpath = current = v;
+ paths.add(subpath);
+ }
+ else
+ {
+ current.next = v;
+ current = current.next;
+ }
+ cx = coords[0];
+ cy = coords[1];
+ }
+ break;
+ case PathIterator.SEG_QUADTO:
+ v = new QuadSegment(cx, cy, coords[0], coords[1], coords[2],
+ coords[3]);
+ if (subpath == null)
+ {
+ subpath = current = v;
+ paths.add(subpath);
+ }
+ else
+ {
+ current.next = v;
+ current = current.next;
+ }
+ cx = coords[2];
+ cy = coords[3];
+ break;
+ case PathIterator.SEG_CUBICTO:
+ v = new CubicSegment(cx, cy, coords[0], coords[1], coords[2],
+ coords[3], coords[4], coords[5]);
+ if (subpath == null)
+ {
+ subpath = current = v;
+ paths.add(subpath);
+ }
+ else
+ {
+ current.next = v;
+ current = current.next;
+ }
+
+ // check if the cubic is self-intersecting
+ double[] lpts = ((CubicSegment) v).getLoop();
+ if (lpts != null)
+ {
+ // if it is, break off the loop into its own path.
+ v.subdivideInsert(lpts[0]);
+ v.next.subdivideInsert((lpts[1] - lpts[0]) / (1.0 - lpts[0]));
+
+ CubicSegment loop = (CubicSegment) v.next;
+ v.next = loop.next;
+ loop.next = loop;
+
+ v.P2 = v.next.P1 = loop.P2 = loop.P1; // snap points
+ paths.add(loop);
+ current = v.next;
+ }
+
+ cx = coords[4];
+ cy = coords[5];
+ break;
+ }
+ pi.next();
+ }
+
+ if (subpath != null)
+ { // close any open path
+ if (subpathx != cx || subpathy != cy)
+ {
+ current.next = new LineSegment(cx, cy, subpathx, subpathy);
+ current = current.next;
+ current.next = subpath;
+ }
+ else
+ current.next = subpath;
+ }
+
+ if (paths.size() == 0)
+ return (null);
+
+ return (paths);
+ }
+
+ /**
+ * Find the intersections of two separate closed paths,
+ * A and B, split the segments at the intersection points,
+ * and create nodes pointing from one to the other
+ */
+ private int createNodes(Segment A, Segment B)
+ {
+ int nNodes = 0;
+
+ Segment a = A;
+ Segment b = B;
+
+ do
+ {
+ do
+ {
+ nNodes += a.splitIntersections(b);
+ b = b.next;
+ }
+ while (b != B);
+
+ a = a.next; // move to the next segment
+ }
+ while (a != A); // until one wrap.
+
+ return (nNodes);
+ }
+
+ /**
+ * Find the intersections of a path with itself.
+ * Splits the segments at the intersection points,
+ * and create nodes pointing from one to the other.
+ */
+ private int createNodesSelf(Segment A)
+ {
+ int nNodes = 0;
+ Segment a = A;
+
+ if (A.next == A)
+ return 0;
+
+ do
+ {
+ Segment b = a.next;
+ do
+ {
+ if (b != a) // necessary
+ nNodes += a.splitIntersections(b);
+ b = b.next;
+ }
+ while (b != A);
+ a = a.next; // move to the next segment
+ }
+ while (a != A); // until one wrap.
+
+ return (nNodes);
+ }
+
+ /**
+ * Deletes paths which are redundant from a list, (i.e. solid areas within
+ * solid areas) Clears any nodes. Sorts the remaining paths into solids
+ * and holes, sets their orientation and sets the solids and holes lists.
+ */
+ private void deleteRedundantPaths(Vector paths)
+ {
+ int npaths = paths.size();
+
+ int[][] contains = new int[npaths][npaths];
+ int[][] windingNumbers = new int[npaths][2];
+ int neg;
+ Rectangle2D[] bb = new Rectangle2D[npaths]; // path bounding boxes
+
+ neg = ((windingRule == PathIterator.WIND_NON_ZERO) ? -1 : 1);
+
+ for (int i = 0; i < npaths; i++)
+ bb[i] = ((Segment) paths.elementAt(i)).getPathBounds();
+
+ // Find which path contains which, assign winding numbers
+ for (int i = 0; i < npaths; i++)
+ {
+ Segment pathA = (Segment) paths.elementAt(i);
+ pathA.nullNodes(); // remove any now-redundant nodes, in case.
+ int windingA = pathA.hasClockwiseOrientation() ? 1 : neg;
+
+ for (int j = 0; j < npaths; j++)
+ if (i != j)
+ {
+ Segment pathB = (Segment) paths.elementAt(j);
+
+ // A contains B
+ if (bb[i].intersects(bb[j]))
+ {
+ Segment s = pathB.next;
+ while (s.P1.getY() == s.P2.getY() && s != pathB)
+ s = s.next;
+ Point2D p = s.getMidPoint();
+ if (pathA.contains(p.getX(), p.getY()))
+ contains[i][j] = windingA;
+ }
+ else
+ // A does not contain B
+ contains[i][j] = 0;
+ }
+ else
+ contains[i][j] = windingA; // i == j
+ }
+
+ for (int i = 0; i < npaths; i++)
+ {
+ windingNumbers[i][0] = 0;
+ for (int j = 0; j < npaths; j++)
+ windingNumbers[i][0] += contains[j][i];
+ windingNumbers[i][1] = contains[i][i];
+ }
+
+ Vector solids = new Vector();
+ Vector holes = new Vector();
+
+ if (windingRule == PathIterator.WIND_NON_ZERO)
+ {
+ for (int i = 0; i < npaths; i++)
+ {
+ if (windingNumbers[i][0] == 0)
+ holes.add(paths.elementAt(i));
+ else if (windingNumbers[i][0] - windingNumbers[i][1] == 0
+ && Math.abs(windingNumbers[i][0]) == 1)
+ solids.add(paths.elementAt(i));
+ }
+ }
+ else
+ {
+ windingRule = PathIterator.WIND_NON_ZERO;
+ for (int i = 0; i < npaths; i++)
+ {
+ if ((windingNumbers[i][0] & 1) == 0)
+ holes.add(paths.elementAt(i));
+ else if ((windingNumbers[i][0] & 1) == 1)
+ solids.add(paths.elementAt(i));
+ }
+ }
+
+ setDirection(holes, false);
+ setDirection(solids, true);
+ this.holes = holes;
+ this.solids = solids;
+ }
+
+ /**
+ * Sets the winding direction of a Vector of paths
+ * @param clockwise gives the direction,
+ * true = clockwise, false = counter-clockwise
+ */
+ private void setDirection(Vector paths, boolean clockwise)
+ {
+ Segment v;
+ for (int i = 0; i < paths.size(); i++)
+ {
+ v = (Segment) paths.elementAt(i);
+ if (clockwise != v.hasClockwiseOrientation())
+ v.reverseAll();
+ }
+ }
+
+ /**
+ * Class representing a linked-list of vertices forming a closed polygon,
+ * convex or concave, without holes.
+ */
+ private abstract class Segment implements Cloneable
+ {
+ // segment type, PathIterator segment types are used.
+ Point2D P1;
+ Point2D P2;
+ Segment next;
+ Segment node;
+
+ Segment()
+ {
+ P1 = P2 = null;
+ node = next = null;
+ }
+
+ /**
+ * Reverses the direction of a single segment
+ */
+ abstract void reverseCoords();
+
+ /**
+ * Returns the segment's midpoint
+ */
+ abstract Point2D getMidPoint();
+
+ /**
+ * Returns the bounding box of this segment
+ */
+ abstract Rectangle2D getBounds();
+
+ /**
+ * Transforms a single segment
+ */
+ abstract void transform(AffineTransform at);
+
+ /**
+ * Returns the PathIterator type of a segment
+ */
+ abstract int getType();
+
+ /**
+ */
+ abstract int splitIntersections(Segment b);
+
+ /**
+ * Returns the PathIterator coords of a segment
+ */
+ abstract int pathIteratorFormat(double[] coords);
+
+ /**
+ * Returns the number of intersections on the positive X axis,
+ * with the origin at (x,y), used for contains()-testing
+ *
+ * (Although that could be done by the line-intersect methods,
+ * a dedicated method is better to guarantee consitent handling
+ * of endpoint-special-cases)
+ */
+ abstract int rayCrossing(double x, double y);
+
+ /**
+ * Subdivides the segment at parametric value t, inserting
+ * the new segment into the linked list after this,
+ * such that this becomes [0,t] and this.next becomes [t,1]
+ */
+ abstract void subdivideInsert(double t);
+
+ /**
+ * Returns twice the area of a curve, relative the P1-P2 line
+ * Used for area calculations.
+ */
+ abstract double curveArea();
+
+ /**
+ * Compare two segments.
+ */
+ abstract boolean equals(Segment b);
+
+ /**
+ * Determines if this path of segments contains the point (x,y)
+ */
+ boolean contains(double x, double y)
+ {
+ Segment v = this;
+ int crossings = 0;
+ do
+ {
+ int n = v.rayCrossing(x, y);
+ crossings += n;
+ v = v.next;
+ }
+ while (v != this);
+ return ((crossings & 1) == 1);
+ }
+
+ /**
+ * Nulls all nodes of the path. Clean up any 'hairs'.
+ */
+ void nullNodes()
+ {
+ Segment v = this;
+ do
+ {
+ v.node = null;
+ v = v.next;
+ }
+ while (v != this);
+ }
+
+ /**
+ * Transforms each segment in the closed path
+ */
+ void transformSegmentList(AffineTransform at)
+ {
+ Segment v = this;
+ do
+ {
+ v.transform(at);
+ v = v.next;
+ }
+ while (v != this);
+ }
+
+ /**
+ * Determines the winding direction of the path
+ * By the sign of the area.
+ */
+ boolean hasClockwiseOrientation()
+ {
+ return (getSignedArea() > 0.0);
+ }
+
+ /**
+ * Returns the bounds of this path
+ */
+ public Rectangle2D getPathBounds()
+ {
+ double xmin;
+ double xmax;
+ double ymin;
+ double ymax;
+ xmin = xmax = P1.getX();
+ ymin = ymax = P1.getY();
+
+ Segment v = this;
+ do
+ {
+ Rectangle2D r = v.getBounds();
+ xmin = Math.min(r.getMinX(), xmin);
+ ymin = Math.min(r.getMinY(), ymin);
+ xmax = Math.max(r.getMaxX(), xmax);
+ ymax = Math.max(r.getMaxY(), ymax);
+ v = v.next;
+ }
+ while (v != this);
+
+ return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
+ }
+
+ /**
+ * Calculates twice the signed area of the path;
+ */
+ double getSignedArea()
+ {
+ Segment s;
+ double area = 0.0;
+
+ s = this;
+ do
+ {
+ area += s.curveArea();
+
+ area += s.P1.getX() * s.next.P1.getY()
+ - s.P1.getY() * s.next.P1.getX();
+ s = s.next;
+ }
+ while (s != this);
+
+ return area;
+ }
+
+ /**
+ * Reverses the orientation of the whole polygon
+ */
+ void reverseAll()
+ {
+ reverseCoords();
+ Segment v = next;
+ Segment former = this;
+ while (v != this)
+ {
+ v.reverseCoords();
+ Segment vnext = v.next;
+ v.next = former;
+ former = v;
+ v = vnext;
+ }
+ next = former;
+ }
+
+ /**
+ * Inserts a Segment after this one
+ */
+ void insert(Segment v)
+ {
+ Segment n = next;
+ next = v;
+ v.next = n;
+ }
+
+ /**
+ * Returns if this segment path is polygonal
+ */
+ boolean isPolygonal()
+ {
+ Segment v = this;
+ do
+ {
+ if (! (v instanceof LineSegment))
+ return false;
+ v = v.next;
+ }
+ while (v != this);
+ return true;
+ }
+
+ /**
+ * Clones this path
+ */
+ Segment cloneSegmentList() throws CloneNotSupportedException
+ {
+ Vector list = new Vector();
+ Segment v = next;
+
+ while (v != this)
+ {
+ list.add(v);
+ v = v.next;
+ }
+
+ Segment clone = (Segment) this.clone();
+ v = clone;
+ for (int i = 0; i < list.size(); i++)
+ {
+ clone.next = (Segment) ((Segment) list.elementAt(i)).clone();
+ clone = clone.next;
+ }
+ clone.next = v;
+ return v;
+ }
+
+ /**
+ * Creates a node between this segment and segment b
+ * at the given intersection
+ * @return the number of nodes created (0 or 1)
+ */
+ int createNode(Segment b, Intersection i)
+ {
+ Point2D p = i.p;
+ if ((pointEquals(P1, p) || pointEquals(P2, p))
+ && (pointEquals(b.P1, p) || pointEquals(b.P2, p)))
+ return 0;
+
+ subdivideInsert(i.ta);
+ b.subdivideInsert(i.tb);
+
+ // snap points
+ b.P2 = b.next.P1 = P2 = next.P1 = i.p;
+
+ node = b.next;
+ b.node = next;
+ return 1;
+ }
+
+ /**
+ * Creates multiple nodes from a list of intersections,
+ * This must be done in the order of ascending parameters,
+ * and the parameters must be recalculated in accordance
+ * with each split.
+ * @return the number of nodes created
+ */
+ protected int createNodes(Segment b, Intersection[] x)
+ {
+ Vector v = new Vector();
+ for (int i = 0; i < x.length; i++)
+ {
+ Point2D p = x[i].p;
+ if (! ((pointEquals(P1, p) || pointEquals(P2, p))
+ && (pointEquals(b.P1, p) || pointEquals(b.P2, p))))
+ v.add(x[i]);
+ }
+
+ int nNodes = v.size();
+ Intersection[] A = new Intersection[nNodes];
+ Intersection[] B = new Intersection[nNodes];
+ for (int i = 0; i < nNodes; i++)
+ A[i] = B[i] = (Intersection) v.elementAt(i);
+
+ // Create two lists sorted by the parameter
+ // Bubble sort, OK I suppose, since the number of intersections
+ // cannot be larger than 9 (cubic-cubic worst case) anyway
+ for (int i = 0; i < nNodes - 1; i++)
+ {
+ for (int j = i + 1; j < nNodes; j++)
+ {
+ if (A[i].ta > A[j].ta)
+ {
+ Intersection swap = A[i];
+ A[i] = A[j];
+ A[j] = swap;
+ }
+ if (B[i].tb > B[j].tb)
+ {
+ Intersection swap = B[i];
+ B[i] = B[j];
+ B[j] = swap;
+ }
+ }
+ }
+ // subdivide a
+ Segment s = this;
+ for (int i = 0; i < nNodes; i++)
+ {
+ s.subdivideInsert(A[i].ta);
+
+ // renormalize the parameters
+ for (int j = i + 1; j < nNodes; j++)
+ A[j].ta = (A[j].ta - A[i].ta) / (1.0 - A[i].ta);
+
+ A[i].seg = s;
+ s = s.next;
+ }
+
+ // subdivide b, set nodes
+ s = b;
+ for (int i = 0; i < nNodes; i++)
+ {
+ s.subdivideInsert(B[i].tb);
+
+ for (int j = i + 1; j < nNodes; j++)
+ B[j].tb = (B[j].tb - B[i].tb) / (1.0 - B[i].tb);
+
+ // set nodes
+ B[i].seg.node = s.next; // node a -> b
+ s.node = B[i].seg.next; // node b -> a
+
+ // snap points
+ B[i].seg.P2 = B[i].seg.next.P1 = s.P2 = s.next.P1 = B[i].p;
+ s = s.next;
+ }
+ return nNodes;
+ }
+
+ /**
+ * Determines if two paths are equal.
+ * Colinear line segments are ignored in the comparison.
+ */
+ boolean pathEquals(Segment B)
+ {
+ if (! getPathBounds().equals(B.getPathBounds()))
+ return false;
+
+ Segment startA = getTopLeft();
+ Segment startB = B.getTopLeft();
+ Segment a = startA;
+ Segment b = startB;
+ do
+ {
+ if (! a.equals(b))
+ return false;
+
+ if (a instanceof LineSegment)
+ a = ((LineSegment) a).lastCoLinear();
+ if (b instanceof LineSegment)
+ b = ((LineSegment) b).lastCoLinear();
+
+ a = a.next;
+ b = b.next;
+ }
+ while (a != startA && b != startB);
+ return true;
+ }
+
+ /**
+ * Return the segment with the top-leftmost first point
+ */
+ Segment getTopLeft()
+ {
+ Segment v = this;
+ Segment tl = this;
+ do
+ {
+ if (v.P1.getY() < tl.P1.getY())
+ tl = v;
+ else if (v.P1.getY() == tl.P1.getY())
+ {
+ if (v.P1.getX() < tl.P1.getX())
+ tl = v;
+ }
+ v = v.next;
+ }
+ while (v != this);
+ return tl;
+ }
+
+ /**
+ * Returns if the path has a segment outside a shape
+ */
+ boolean isSegmentOutside(Shape shape)
+ {
+ return ! shape.contains(getMidPoint());
+ }
+ } // class Segment
+
+ private class LineSegment extends Segment
+ {
+ public LineSegment(double x1, double y1, double x2, double y2)
+ {
+ super();
+ P1 = new Point2D.Double(x1, y1);
+ P2 = new Point2D.Double(x2, y2);
+ }
+
+ public LineSegment(Point2D p1, Point2D p2)
+ {
+ super();
+ P1 = (Point2D) p1.clone();
+ P2 = (Point2D) p2.clone();
+ }
+
+ /**
+ * Clones this segment
+ */
+ public Object clone()
+ {
+ return new LineSegment(P1, P2);
+ }
+
+ /**
+ * Transforms the segment
+ */
+ void transform(AffineTransform at)
+ {
+ P1 = at.transform(P1, null);
+ P2 = at.transform(P2, null);
+ }
+
+ /**
+ * Swap start and end points
+ */
+ void reverseCoords()
+ {
+ Point2D p = P1;
+ P1 = P2;
+ P2 = p;
+ }
+
+ /**
+ * Returns the segment's midpoint
+ */
+ Point2D getMidPoint()
+ {
+ return (new Point2D.Double(0.5 * (P1.getX() + P2.getX()),
+ 0.5 * (P1.getY() + P2.getY())));
+ }
+
+ /**
+ * Returns twice the area of a curve, relative the P1-P2 line
+ * Obviously, a line does not enclose any area besides the line
+ */
+ double curveArea()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the PathIterator type of a segment
+ */
+ int getType()
+ {
+ return (PathIterator.SEG_LINETO);
+ }
+
+ /**
+ * Subdivides the segment at parametric value t, inserting
+ * the new segment into the linked list after this,
+ * such that this becomes [0,t] and this.next becomes [t,1]
+ */
+ void subdivideInsert(double t)
+ {
+ Point2D p = new Point2D.Double((P2.getX() - P1.getX()) * t + P1.getX(),
+ (P2.getY() - P1.getY()) * t + P1.getY());
+ insert(new LineSegment(p, P2));
+ P2 = p;
+ next.node = node;
+ node = null;
+ }
+
+ /**
+ * Determines if two line segments are strictly colinear
+ */
+ boolean isCoLinear(LineSegment b)
+ {
+ double x1 = P1.getX();
+ double y1 = P1.getY();
+ double x2 = P2.getX();
+ double y2 = P2.getY();
+ double x3 = b.P1.getX();
+ double y3 = b.P1.getY();
+ double x4 = b.P2.getX();
+ double y4 = b.P2.getY();
+
+ if ((y1 - y3) * (x4 - x3) - (x1 - x3) * (y4 - y3) != 0.0)
+ return false;
+
+ return ((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3) == 0.0);
+ }
+
+ /**
+ * Return the last segment colinear with this one.
+ * Used in comparing paths.
+ */
+ Segment lastCoLinear()
+ {
+ Segment prev = this;
+ Segment v = next;
+
+ while (v instanceof LineSegment)
+ {
+ if (isCoLinear((LineSegment) v))
+ {
+ prev = v;
+ v = v.next;
+ }
+ else
+ return prev;
+ }
+ return prev;
+ }
+
+ /**
+ * Compare two segments.
+ * We must take into account that the lines may be broken into colinear
+ * subsegments and ignore them.
+ */
+ boolean equals(Segment b)
+ {
+ if (! (b instanceof LineSegment))
+ return false;
+ Point2D p1 = P1;
+ Point2D p3 = b.P1;
+
+ if (! p1.equals(p3))
+ return false;
+
+ Point2D p2 = lastCoLinear().P2;
+ Point2D p4 = ((LineSegment) b).lastCoLinear().P2;
+ return (p2.equals(p4));
+ }
+
+ /**
+ * Returns a line segment
+ */
+ int pathIteratorFormat(double[] coords)
+ {
+ coords[0] = P2.getX();
+ coords[1] = P2.getY();
+ return (PathIterator.SEG_LINETO);
+ }
+
+ /**
+ * Returns if the line has intersections.
+ */
+ boolean hasIntersections(Segment b)
+ {
+ if (b instanceof LineSegment)
+ return (linesIntersect(this, (LineSegment) b) != null);
+
+ if (b instanceof QuadSegment)
+ return (lineQuadIntersect(this, (QuadSegment) b) != null);
+
+ if (b instanceof CubicSegment)
+ return (lineCubicIntersect(this, (CubicSegment) b) != null);
+
+ return false;
+ }
+
+ /**
+ * Splits intersections into nodes,
+ * This one handles line-line, line-quadratic, line-cubic
+ */
+ int splitIntersections(Segment b)
+ {
+ if (b instanceof LineSegment)
+ {
+ Intersection i = linesIntersect(this, (LineSegment) b);
+
+ if (i == null)
+ return 0;
+
+ return createNode(b, i);
+ }
+
+ Intersection[] x = null;
+
+ if (b instanceof QuadSegment)
+ x = lineQuadIntersect(this, (QuadSegment) b);
+
+ if (b instanceof CubicSegment)
+ x = lineCubicIntersect(this, (CubicSegment) b);
+
+ if (x == null)
+ return 0;
+
+ if (x.length == 1)
+ return createNode(b, (Intersection) x[0]);
+
+ return createNodes(b, x);
+ }
+
+ /**
+ * Returns the bounding box of this segment
+ */
+ Rectangle2D getBounds()
+ {
+ return (new Rectangle2D.Double(Math.min(P1.getX(), P2.getX()),
+ Math.min(P1.getY(), P2.getY()),
+ Math.abs(P1.getX() - P2.getX()),
+ Math.abs(P1.getY() - P2.getY())));
+ }
+
+ /**
+ * Returns the number of intersections on the positive X axis,
+ * with the origin at (x,y), used for contains()-testing
+ */
+ int rayCrossing(double x, double y)
+ {
+ double x0 = P1.getX() - x;
+ double y0 = P1.getY() - y;
+ double x1 = P2.getX() - x;
+ double y1 = P2.getY() - y;
+
+ if (y0 * y1 > 0)
+ return 0;
+
+ if (x0 < 0 && x1 < 0)
+ return 0;
+
+ if (y0 == 0.0)
+ y0 -= EPSILON;
+
+ if (y1 == 0.0)
+ y1 -= EPSILON;
+
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ EPSILON, 0.0, Double.MAX_VALUE, 0.0))
+ return 1;
+ return 0;
+ }
+ } // class LineSegment
+
+ /**
+ * Quadratic Bezier curve segment
+ *
+ * Note: Most peers don't support quadratics directly, so it might make
+ * sense to represent them as cubics internally and just be done with it.
+ * I think we should be peer-agnostic, however, and stay faithful to the
+ * input geometry types as far as possible.
+ */
+ private class QuadSegment extends Segment
+ {
+ Point2D cp; // control point
+
+ /**
+ * Constructor, takes the coordinates of the start, control,
+ * and end point, respectively.
+ */
+ QuadSegment(double x1, double y1, double cx, double cy, double x2,
+ double y2)
+ {
+ super();
+ P1 = new Point2D.Double(x1, y1);
+ P2 = new Point2D.Double(x2, y2);
+ cp = new Point2D.Double(cx, cy);
+ }
+
+ /**
+ * Clones this segment
+ */
+ public Object clone()
+ {
+ return new QuadSegment(P1.getX(), P1.getY(), cp.getX(), cp.getY(),
+ P2.getX(), P2.getY());
+ }
+
+ /**
+ * Returns twice the area of a curve, relative the P1-P2 line
+ *
+ * The area formula can be derived by using Green's formula in the
+ * plane on the parametric form of the bezier.
+ */
+ double curveArea()
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp.getX();
+ double y1 = cp.getY();
+ double x2 = P2.getX();
+ double y2 = P2.getY();
+
+ 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);
+ }
+
+ /**
+ * Compare two segments.
+ */
+ boolean equals(Segment b)
+ {
+ if (! (b instanceof QuadSegment))
+ return false;
+
+ return (P1.equals(b.P1) && cp.equals(((QuadSegment) b).cp)
+ && P2.equals(b.P2));
+ }
+
+ /**
+ * Returns a Point2D corresponding to the parametric value t
+ * of the curve
+ */
+ Point2D evaluatePoint(double t)
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp.getX();
+ double y1 = cp.getY();
+ double x2 = P2.getX();
+ double y2 = P2.getY();
+
+ return new Point2D.Double(t * t * (x2 - 2 * x1 + x0) + 2 * t * (x1 - x0)
+ + x0,
+ t * t * (y2 - 2 * y1 + y0) + 2 * t * (y1 - y0)
+ + y0);
+ }
+
+ /**
+ * Returns the bounding box of this segment
+ */
+ Rectangle2D getBounds()
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp.getX();
+ double y1 = cp.getY();
+ double x2 = P2.getX();
+ double y2 = P2.getY();
+ double r0;
+ double r1;
+
+ double xmax = Math.max(x0, x2);
+ double ymax = Math.max(y0, y2);
+ double xmin = Math.min(x0, x2);
+ double ymin = Math.min(y0, y2);
+
+ r0 = 2 * (y1 - y0);
+ r1 = 2 * (y2 - 2 * y1 + y0);
+ if (r1 != 0.0)
+ {
+ double t = -r0 / r1;
+ if (t > 0.0 && t < 1.0)
+ {
+ double y = evaluatePoint(t).getY();
+ ymax = Math.max(y, ymax);
+ ymin = Math.min(y, ymin);
+ }
+ }
+ r0 = 2 * (x1 - x0);
+ r1 = 2 * (x2 - 2 * x1 + x0);
+ if (r1 != 0.0)
+ {
+ double t = -r0 / r1;
+ if (t > 0.0 && t < 1.0)
+ {
+ double x = evaluatePoint(t).getY();
+ xmax = Math.max(x, xmax);
+ xmin = Math.min(x, xmin);
+ }
+ }
+
+ return (new Rectangle2D.Double(xmin, ymin, xmax - xmin, ymax - ymin));
+ }
+
+ /**
+ * Returns a cubic segment corresponding to this curve
+ */
+ CubicSegment getCubicSegment()
+ {
+ double x1 = P1.getX() + 2.0 * (cp.getX() - P1.getX()) / 3.0;
+ double y1 = P1.getY() + 2.0 * (cp.getY() - P1.getY()) / 3.0;
+ double x2 = cp.getX() + (P2.getX() - cp.getX()) / 3.0;
+ double y2 = cp.getY() + (P2.getY() - cp.getY()) / 3.0;
+
+ return new CubicSegment(P1.getX(), P1.getY(), x1, y1, x2, y2, P2.getX(),
+ P2.getY());
+ }
+
+ /**
+ * Returns the segment's midpoint
+ */
+ Point2D getMidPoint()
+ {
+ return evaluatePoint(0.5);
+ }
+
+ /**
+ * Returns the PathIterator type of a segment
+ */
+ int getType()
+ {
+ return (PathIterator.SEG_QUADTO);
+ }
+
+ /**
+ * Returns the PathIterator coords of a segment
+ */
+ int pathIteratorFormat(double[] coords)
+ {
+ coords[0] = cp.getX();
+ coords[1] = cp.getY();
+ coords[2] = P2.getX();
+ coords[3] = P2.getY();
+ return (PathIterator.SEG_QUADTO);
+ }
+
+ /**
+ * Returns the number of intersections on the positive X axis,
+ * with the origin at (x,y), used for contains()-testing
+ */
+ int rayCrossing(double x, double y)
+ {
+ double x0 = P1.getX() - x;
+ double y0 = P1.getY() - y;
+ double x1 = cp.getX() - x;
+ double y1 = cp.getY() - y;
+ double x2 = P2.getX() - x;
+ double y2 = P2.getY() - y;
+ double[] r = new double[3];
+ int nRoots;
+ int nCrossings = 0;
+
+ /* check if curve may intersect X+ axis. */
+ if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0) && (y0 * y1 <= 0 || y1 * y2 <= 0))
+ {
+ if (y0 == 0.0)
+ y0 -= EPSILON;
+ if (y2 == 0.0)
+ y2 -= EPSILON;
+
+ r[0] = y0;
+ r[1] = 2 * (y1 - y0);
+ r[2] = (y2 - 2 * y1 + y0);
+
+ nRoots = QuadCurve2D.solveQuadratic(r);
+ for (int i = 0; i < nRoots; i++)
+ if (r[i] > 0.0f && r[i] < 1.0f)
+ {
+ double t = r[i];
+ if (t * t * (x2 - 2 * x1 + x0) + 2 * t * (x1 - x0) + x0 > 0.0)
+ nCrossings++;
+ }
+ }
+ return nCrossings;
+ }
+
+ /**
+ * Swap start and end points
+ */
+ void reverseCoords()
+ {
+ Point2D temp = P1;
+ P1 = P2;
+ P2 = temp;
+ }
+
+ /**
+ * Splits intersections into nodes,
+ * This one handles quadratic-quadratic only,
+ * Quadratic-line is passed on to the LineSegment class,
+ * Quadratic-cubic is passed on to the CubicSegment class
+ */
+ int splitIntersections(Segment b)
+ {
+ if (b instanceof LineSegment)
+ return (b.splitIntersections(this));
+
+ if (b instanceof CubicSegment)
+ return (b.splitIntersections(this));
+
+ if (b instanceof QuadSegment)
+ {
+ // Use the cubic-cubic intersection routine for quads as well,
+ // Since a quadratic can be exactly described as a cubic, this
+ // should not be a problem;
+ // The recursion depth will be the same in any case.
+ Intersection[] x = cubicCubicIntersect(getCubicSegment(),
+ ((QuadSegment) b)
+ .getCubicSegment());
+ if (x == null)
+ return 0;
+
+ if (x.length == 1)
+ return createNode(b, (Intersection) x[0]);
+
+ return createNodes(b, x);
+ }
+ return 0;
+ }
+
+ /**
+ * Subdivides the segment at parametric value t, inserting
+ * the new segment into the linked list after this,
+ * such that this becomes [0,t] and this.next becomes [t,1]
+ */
+ void subdivideInsert(double t)
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp.getX();
+ double y1 = cp.getY();
+ double x2 = P2.getX();
+ double y2 = P2.getY();
+
+ double p10x = x0 + t * (x1 - x0);
+ double p10y = y0 + t * (y1 - y0);
+ double p11x = x1 + t * (x2 - x1);
+ double p11y = y1 + t * (y2 - y1);
+ double p20x = p10x + t * (p11x - p10x);
+ double p20y = p10y + t * (p11y - p10y);
+
+ insert(new QuadSegment(p20x, p20y, p11x, p11y, x2, y2));
+ P2 = next.P1;
+ cp.setLocation(p10x, p10y);
+
+ next.node = node;
+ node = null;
+ }
+
+ /**
+ * Transforms the segment
+ */
+ void transform(AffineTransform at)
+ {
+ P1 = at.transform(P1, null);
+ P2 = at.transform(P2, null);
+ cp = at.transform(cp, null);
+ }
+ } // class QuadSegment
+
+ /**
+ * Cubic Bezier curve segment
+ */
+ private class CubicSegment extends Segment
+ {
+ Point2D cp1; // control points
+ Point2D cp2; // control points
+
+ /**
+ * Constructor - takes coordinates of the starting point,
+ * first control point, second control point and end point,
+ * respecively.
+ */
+ public CubicSegment(double x1, double y1, double c1x, double c1y,
+ double c2x, double c2y, double x2, double y2)
+ {
+ super();
+ P1 = new Point2D.Double(x1, y1);
+ P2 = new Point2D.Double(x2, y2);
+ cp1 = new Point2D.Double(c1x, c1y);
+ cp2 = new Point2D.Double(c2x, c2y);
+ }
+
+ /**
+ * Clones this segment
+ */
+ public Object clone()
+ {
+ return new CubicSegment(P1.getX(), P1.getY(), cp1.getX(), cp1.getY(),
+ cp2.getX(), cp2.getY(), P2.getX(), P2.getY());
+ }
+
+ /**
+ * Returns twice the area of a curve, relative the P1-P2 line
+ *
+ * The area formula can be derived by using Green's formula in the
+ * plane on the parametric form of the bezier.
+ */
+ double curveArea()
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp1.getX();
+ double y1 = cp1.getY();
+ double x2 = cp2.getX();
+ double y2 = cp2.getY();
+ double x3 = P2.getX();
+ double y3 = P2.getY();
+
+ 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;
+
+ return (area);
+ }
+
+ /**
+ * Compare two segments.
+ */
+ boolean equals(Segment b)
+ {
+ if (! (b instanceof CubicSegment))
+ return false;
+
+ return (P1.equals(b.P1) && cp1.equals(((CubicSegment) b).cp1)
+ && cp2.equals(((CubicSegment) b).cp2) && P2.equals(b.P2));
+ }
+
+ /**
+ * Returns a Point2D corresponding to the parametric value t
+ * of the curve
+ */
+ Point2D evaluatePoint(double t)
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp1.getX();
+ double y1 = cp1.getY();
+ double x2 = cp2.getX();
+ double y2 = cp2.getY();
+ double x3 = P2.getX();
+ double y3 = P2.getY();
+
+ return new Point2D.Double(-(t * t * t) * (x0 - 3 * x1 + 3 * x2 - x3)
+ + 3 * t * t * (x0 - 2 * x1 + x2)
+ + 3 * t * (x1 - x0) + x0,
+ -(t * t * t) * (y0 - 3 * y1 + 3 * y2 - y3)
+ + 3 * t * t * (y0 - 2 * y1 + y2)
+ + 3 * t * (y1 - y0) + y0);
+ }
+
+ /**
+ * Returns the bounding box of this segment
+ */
+ Rectangle2D getBounds()
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp1.getX();
+ double y1 = cp1.getY();
+ double x2 = cp2.getX();
+ double y2 = cp2.getY();
+ double x3 = P2.getX();
+ double y3 = P2.getY();
+ double[] r = new double[3];
+
+ double xmax = Math.max(x0, x3);
+ double ymax = Math.max(y0, y3);
+ double xmin = Math.min(x0, x3);
+ double ymin = Math.min(y0, y3);
+
+ r[0] = 3 * (y1 - y0);
+ r[1] = 6.0 * (y2 + y0 - 2 * y1);
+ r[2] = 3.0 * (y3 - 3 * y2 + 3 * y1 - y0);
+
+ int n = QuadCurve2D.solveQuadratic(r);
+ for (int i = 0; i < n; i++)
+ {
+ double t = r[i];
+ if (t > 0 && t < 1.0)
+ {
+ double y = evaluatePoint(t).getY();
+ ymax = Math.max(y, ymax);
+ ymin = Math.min(y, ymin);
+ }
+ }
+
+ r[0] = 3 * (x1 - x0);
+ r[1] = 6.0 * (x2 + x0 - 2 * x1);
+ r[2] = 3.0 * (x3 - 3 * x2 + 3 * x1 - x0);
+ n = QuadCurve2D.solveQuadratic(r);
+ for (int i = 0; i < n; i++)
+ {
+ double t = r[i];
+ if (t > 0 && t < 1.0)
+ {
+ double x = evaluatePoint(t).getX();
+ xmax = Math.max(x, xmax);
+ xmin = Math.min(x, xmin);
+ }
+ }
+ return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
+ }
+
+ /**
+ * Returns a CubicCurve2D object corresponding to this segment.
+ */
+ CubicCurve2D getCubicCurve2D()
+ {
+ return new CubicCurve2D.Double(P1.getX(), P1.getY(), cp1.getX(),
+ cp1.getY(), cp2.getX(), cp2.getY(),
+ P2.getX(), P2.getY());
+ }
+
+ /**
+ * Returns the parametric points of self-intersection if the cubic
+ * is self-intersecting, null otherwise.
+ */
+ double[] getLoop()
+ {
+ double x0 = P1.getX();
+ double y0 = P1.getY();
+ double x1 = cp1.getX();
+ double y1 = cp1.getY();
+ double x2 = cp2.getX();
+ double y2 = cp2.getY();
+ double x3 = P2.getX();
+ double y3 = P2.getY();
+ double[] r = new double[4];
+ double k;
+ double R;
+ double T;
+ double A;
+ double B;
+ double[] results = new double[2];
+
+ R = x3 - 3 * x2 + 3 * x1 - x0;
+ T = y3 - 3 * y2 + 3 * y1 - y0;
+
+ // A qudratic
+ if (R == 0.0 && T == 0.0)
+ return null;
+
+ // true cubic
+ if (R != 0.0 && T != 0.0)
+ {
+ A = 3 * (x2 + x0 - 2 * x1) / R;
+ B = 3 * (x1 - x0) / R;
+
+ double P = 3 * (y2 + y0 - 2 * y1) / T;
+ double Q = 3 * (y1 - y0) / T;
+
+ if (A == P || Q == B)
+ return null;
+
+ k = (Q - B) / (A - P);
+ }
+ else
+ {
+ if (R == 0.0)
+ {
+ // quadratic in x
+ k = -(3 * (x1 - x0)) / (3 * (x2 + x0 - 2 * x1));
+ A = 3 * (y2 + y0 - 2 * y1) / T;
+ B = 3 * (y1 - y0) / T;
+ }
+ else
+ {
+ // quadratic in y
+ k = -(3 * (y1 - y0)) / (3 * (y2 + y0 - 2 * y1));
+ A = 3 * (x2 + x0 - 2 * x1) / R;
+ B = 3 * (x1 - x0) / R;
+ }
+ }
+
+ r[0] = -k * k * k - A * k * k - B * k;
+ r[1] = 3 * k * k + 2 * k * A + 2 * B;
+ r[2] = -3 * k;
+ r[3] = 2;
+
+ int n = CubicCurve2D.solveCubic(r);
+ if (n != 3)
+ return null;
+
+ // sort r
+ double t;
+ for (int i = 0; i < 2; i++)
+ for (int j = i + 1; j < 3; j++)
+ if (r[j] < r[i])
+ {
+ t = r[i];
+ r[i] = r[j];
+ r[j] = t;
+ }
+
+ if (Math.abs(r[0] + r[2] - k) < 1E-13)
+ if (r[0] >= 0.0 && r[0] <= 1.0 && r[2] >= 0.0 && r[2] <= 1.0)
+ if (evaluatePoint(r[0]).distance(evaluatePoint(r[2])) < PE_EPSILON * 10)
+ { // we snap the points anyway
+ results[0] = r[0];
+ results[1] = r[2];
+ return (results);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the segment's midpoint
+ */
+ Point2D getMidPoint()
+ {
+ return evaluatePoint(0.5);
+ }
+
+ /**
+ * Returns the PathIterator type of a segment
+ */
+ int getType()
+ {
+ return (PathIterator.SEG_CUBICTO);
+ }
+
+ /**
+ * Returns the PathIterator coords of a segment
+ */
+ int pathIteratorFormat(double[] coords)
+ {
+ coords[0] = cp1.getX();
+ coords[1] = cp1.getY();
+ coords[2] = cp2.getX();
+ coords[3] = cp2.getY();
+ coords[4] = P2.getX();
+ coords[5] = P2.getY();
+ return (PathIterator.SEG_CUBICTO);
+ }
+
+ /**
+ * Returns the number of intersections on the positive X axis,
+ * with the origin at (x,y), used for contains()-testing
+ */
+ int rayCrossing(double x, double y)
+ {
+ double x0 = P1.getX() - x;
+ double y0 = P1.getY() - y;
+ double x1 = cp1.getX() - x;
+ double y1 = cp1.getY() - y;
+ double x2 = cp2.getX() - x;
+ double y2 = cp2.getY() - y;
+ double x3 = P2.getX() - x;
+ double y3 = P2.getY() - y;
+ double[] r = new double[4];
+ int nRoots;
+ int nCrossings = 0;
+
+ /* check if curve may intersect X+ axis. */
+ if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0 || x3 > 0.0)
+ && (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
+ {
+ if (y0 == 0.0)
+ y0 -= EPSILON;
+ if (y3 == 0.0)
+ y3 -= EPSILON;
+
+ r[0] = y0;
+ r[1] = 3 * (y1 - y0);
+ r[2] = 3 * (y2 + y0 - 2 * y1);
+ r[3] = y3 - 3 * y2 + 3 * y1 - y0;
+
+ if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
+ for (int i = 0; i < nRoots; i++)
+ {
+ if (r[i] > 0.0 && r[i] < 1.0)
+ {
+ double t = r[i];
+ if (-(t * t * t) * (x0 - 3 * x1 + 3 * x2 - x3)
+ + 3 * t * t * (x0 - 2 * x1 + x2) + 3 * t * (x1 - x0)
+ + x0 > 0.0)
+ nCrossings++;
+ }
+ }
+ }
+ return nCrossings;
+ }
+
+ /**
+ * Swap start and end points
+ */
+ void reverseCoords()
+ {
+ Point2D p = P1;
+ P1 = P2;
+ P2 = p;
+ p = cp1; // swap control points
+ cp1 = cp2;
+ cp2 = p;
+ }
+
+ /**
+ * Splits intersections into nodes,
+ * This one handles cubic-cubic and cubic-quadratic intersections
+ */
+ int splitIntersections(Segment b)
+ {
+ if (b instanceof LineSegment)
+ return (b.splitIntersections(this));
+
+ Intersection[] x = null;
+
+ if (b instanceof QuadSegment)
+ x = cubicCubicIntersect(this, ((QuadSegment) b).getCubicSegment());
+
+ if (b instanceof CubicSegment)
+ x = cubicCubicIntersect(this, (CubicSegment) b);
+
+ if (x == null)
+ return 0;
+
+ if (x.length == 1)
+ return createNode(b, x[0]);
+
+ return createNodes(b, x);
+ }
+
+ /**
+ * Subdivides the segment at parametric value t, inserting
+ * the new segment into the linked list after this,
+ * such that this becomes [0,t] and this.next becomes [t,1]
+ */
+ void subdivideInsert(double t)
+ {
+ CubicSegment s = (CubicSegment) clone();
+ double p1x = (s.cp1.getX() - s.P1.getX()) * t + s.P1.getX();
+ double p1y = (s.cp1.getY() - s.P1.getY()) * t + s.P1.getY();
+
+ double px = (s.cp2.getX() - s.cp1.getX()) * t + s.cp1.getX();
+ double py = (s.cp2.getY() - s.cp1.getY()) * t + s.cp1.getY();
+
+ s.cp2.setLocation((s.P2.getX() - s.cp2.getX()) * t + s.cp2.getX(),
+ (s.P2.getY() - s.cp2.getY()) * t + s.cp2.getY());
+
+ s.cp1.setLocation((s.cp2.getX() - px) * t + px,
+ (s.cp2.getY() - py) * t + py);
+
+ double p2x = (px - p1x) * t + p1x;
+ double p2y = (py - p1y) * t + p1y;
+
+ double p3x = (s.cp1.getX() - p2x) * t + p2x;
+ double p3y = (s.cp1.getY() - p2y) * t + p2y;
+ s.P1.setLocation(p3x, p3y);
+
+ // insert new curve
+ insert(s);
+
+ // set this curve
+ cp1.setLocation(p1x, p1y);
+ cp2.setLocation(p2x, p2y);
+ P2 = s.P1;
+ next.node = node;
+ node = null;
+ }
+
+ /**
+ * Transforms the segment
+ */
+ void transform(AffineTransform at)
+ {
+ P1 = at.transform(P1, null);
+ P2 = at.transform(P2, null);
+ cp1 = at.transform(cp1, null);
+ cp2 = at.transform(cp2, null);
+ }
+ } // class CubicSegment
} // class Area
diff --git a/libjava/java/awt/geom/CubicCurve2D.java b/libjava/java/awt/geom/CubicCurve2D.java
index 56b90e9..2037306 100644
--- a/libjava/java/awt/geom/CubicCurve2D.java
+++ b/libjava/java/awt/geom/CubicCurve2D.java
@@ -59,6 +59,7 @@ import java.util.NoSuchElementException;
public abstract class CubicCurve2D implements Shape, Cloneable
{
private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
+ private static final double EPSILON = 1E-10;
/**
* Constructs a new CubicCurve2D. Typical users will want to
@@ -1089,21 +1090,21 @@ public abstract class CubicCurve2D implements Shape, Cloneable
If this is not done, bad behaviour may result for points on that axis.*/
if (a0 == 0.0 || a3 == 0.0)
{
- double small = getFlatness() * (1E-10);
+ double small = getFlatness() * EPSILON;
if (a0 == 0.0)
- a0 += small;
+ a0 -= small;
if (a3 == 0.0)
- a3 += small;
+ a3 -= small;
}
if (useYaxis)
{
- if (Line2D.linesIntersect(b0, a0, b3, a3, 0.0, 0.0, distance, 0.0))
+ if (Line2D.linesIntersect(b0, a0, b3, a3, EPSILON, 0.0, distance, 0.0))
nCrossings++;
}
else
{
- if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, 0.0, 0.0, distance))
+ if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, EPSILON, 0.0, distance))
nCrossings++;
}
diff --git a/libjava/java/awt/geom/Ellipse2D.java b/libjava/java/awt/geom/Ellipse2D.java
index 223a193..bd64adf 100644
--- a/libjava/java/awt/geom/Ellipse2D.java
+++ b/libjava/java/awt/geom/Ellipse2D.java
@@ -1,5 +1,5 @@
/* Ellipse2D.java -- represents an ellipse in 2-D space
- Copyright (C) 2000, 2002 Free Software Foundation
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,58 +37,153 @@ exception statement from your version. */
package java.awt.geom;
+
/**
+ * Ellipse2D is the shape of an ellipse.
+ * <BR>
+ * <img src="doc-files/Ellipse-1.png" width="347" height="221"
+ * alt="A drawing of an ellipse" /><BR>
+ * The ellipse is defined by it's bounding box (shown in red),
+ * and is defined by the implicit curve:<BR>
+ * <blockquote>(<i>x</i>/<i>a</i>)<sup>2</sup> +
+ * (<i>y</i>/<i>b</i>)<sup>2</sup> = 1<BR><BR>
+ *
* @author Tom Tromey <tromey@cygnus.com>
* @author Eric Blake <ebb9@email.byu.edu>
+ *
* @since 1.2
- * @status still needs documentation
*/
public abstract class Ellipse2D extends RectangularShape
{
+ /**
+ * Ellipse2D is defined as abstract.
+ * Implementing classes are Ellipse2D.Float and Ellipse2D.Double.
+ */
protected Ellipse2D()
{
}
+ /**
+ * Determines if a point is contained within the ellipse. <P>
+ * @param x - x coordinate of the point.
+ * @param y - y coordinate of the point.
+ * @return true if the point is within the ellipse, false otherwise.
+ */
public boolean contains(double x, double y)
{
double rx = getWidth() / 2;
double ry = getHeight() / 2;
- double tx = (x - getCenterX()) / rx;
- double ty = (y - getCenterY()) / ry;
- return tx * tx + ty * ty <= 1.0;
+ double tx = (x - (getX() + rx)) / rx;
+ double ty = (y - (getY() + ry)) / ry;
+ return tx * tx + ty * ty < 1.0;
}
+ /**
+ * Determines if a rectangle is completely contained within the
+ * ellipse. <P>
+ * @param x - x coordinate of the upper-left corner of the rectangle
+ * @param y - y coordinate of the upper-left corner of the rectangle
+ * @param w - width of the rectangle
+ * @param h - height of the rectangle
+ * @return true if the rectangle is completely contained, false otherwise.
+ */
public boolean contains(double x, double y, double w, double h)
{
double x2 = x + w;
double y2 = y + h;
- return (contains(x, y) && contains(x, y2)
- && contains(x2, y) && contains(x2, y2));
+ return (contains(x, y) && contains(x, y2) && contains(x2, y)
+ && contains(x2, y2));
}
+ /**
+ * Returns a PathIterator object corresponding to the ellipse.<P>
+ *
+ * Note: An ellipse cannot be represented exactly in PathIterator
+ * segments, the outline is thefore approximated with cubic
+ * Bezier segments.
+ *
+ * @param at an optional transform.
+ * @return A path iterator.
+ */
public PathIterator getPathIterator(AffineTransform at)
{
// An ellipse is just a complete arc.
return new Arc2D.ArcIterator(this, at);
}
+ /**
+ * Determines if a rectangle intersects any part of the ellipse.<P>
+ * @param x - x coordinate of the upper-left corner of the rectangle
+ * @param y - y coordinate of the upper-left corner of the rectangle
+ * @param w - width of the rectangle
+ * @param h - height of the rectangle
+ * @return true if the rectangle intersects the ellipse, false otherwise.
+ */
public boolean intersects(double x, double y, double w, double h)
{
- // fixme
+ Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
+ if (! r.intersects(getX(), getY(), getWidth(), getHeight()))
+ return false;
+
+ if (contains(x, y) || contains(x, y + h) || contains(x + w, y)
+ || contains(x + w, y + h))
+ return true;
+
+ Line2D l1 = new Line2D.Double(getX(), getY() + (getHeight() / 2),
+ getX() + getWidth(),
+ getY() + (getHeight() / 2));
+ Line2D l2 = new Line2D.Double(getX() + (getWidth() / 2), getY(),
+ getX() + (getWidth() / 2),
+ getY() + getHeight());
+
+ if (l1.intersects(r) || l2.intersects(r))
+ return true;
+
return false;
}
+ /**
+ * An {@link Ellipse2D} that stores its coordinates using <code>double</code>
+ * primitives.
+ */
public static class Double extends Ellipse2D
{
+ /**
+ * The height of the ellipse.
+ */
public double height;
+
+ /**
+ * The width of the ellipse.
+ */
public double width;
+
+ /**
+ * The upper-left x coordinate of the bounding-box
+ */
public double x;
+
+ /**
+ * The upper-left y coordinate of the bounding-box
+ */
public double y;
+ /**
+ * Creates a new Ellipse2D with an upper-left coordinate of (0,0)
+ * and a zero size.
+ */
public Double()
{
}
+ /**
+ * Creates a new Ellipse2D within a given rectangle
+ * using double-precision coordinates.<P>
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
+ * @param w - width of the ellipse
+ * @param h - height of the ellipse
+ */
public Double(double x, double y, double w, double h)
{
this.x = x;
@@ -97,36 +192,72 @@ public abstract class Ellipse2D extends RectangularShape
width = w;
}
+ /**
+ * Returns the bounding-box of the ellipse.
+ * @return The bounding box.
+ */
public Rectangle2D getBounds2D()
{
return new Rectangle2D.Double(x, y, width, height);
}
+ /**
+ * Returns the height of the ellipse.
+ * @return The height of the ellipse.
+ */
public double getHeight()
{
return height;
}
+ /**
+ * Returns the width of the ellipse.
+ * @return The width of the ellipse.
+ */
public double getWidth()
{
return width;
}
+ /**
+ * Returns x coordinate of the upper-left corner of
+ * the ellipse's bounding-box.
+ * @return The x coordinate.
+ */
public double getX()
{
return x;
}
+ /**
+ * Returns y coordinate of the upper-left corner of
+ * the ellipse's bounding-box.
+ * @return The y coordinate.
+ */
public double getY()
{
return y;
}
+ /**
+ * Returns <code>true</code> if the ellipse encloses no area, and
+ * <code>false</code> otherwise.
+ *
+ * @return A boolean.
+ */
public boolean isEmpty()
{
return height <= 0 || width <= 0;
}
+ /**
+ * Sets the geometry of the ellipse's bounding box.<P>
+ *
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
+ * @param w - width of the ellipse
+ * @param h - height of the ellipse
+ */
public void setFrame(double x, double y, double w, double h)
{
this.x = x;
@@ -136,17 +267,49 @@ public abstract class Ellipse2D extends RectangularShape
}
} // class Double
+ /**
+ * An {@link Ellipse2D} that stores its coordinates using <code>float</code>
+ * primitives.
+ */
public static class Float extends Ellipse2D
{
+ /**
+ * The height of the ellipse.
+ */
public float height;
+
+ /**
+ * The width of the ellipse.
+ */
public float width;
+
+ /**
+ * The upper-left x coordinate of the bounding-box
+ */
public float x;
+
+ /**
+ * The upper-left y coordinate of the bounding-box
+ */
public float y;
+ /**
+ * Creates a new Ellipse2D with an upper-left coordinate of (0,0)
+ * and a zero size.
+ */
public Float()
{
}
+ /**
+ * Creates a new Ellipse2D within a given rectangle
+ * using floating-point precision.<P>
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
+ * @param w - width of the ellipse
+ * @param h - height of the ellipse
+ *
+ */
public Float(float x, float y, float w, float h)
{
this.x = x;
@@ -155,36 +318,72 @@ public abstract class Ellipse2D extends RectangularShape
this.width = w;
}
+ /**
+ * Returns the bounding-box of the ellipse.
+ * @return The bounding box.
+ */
public Rectangle2D getBounds2D()
{
return new Rectangle2D.Float(x, y, width, height);
}
+ /**
+ * Returns the height of the ellipse.
+ * @return The height of the ellipse.
+ */
public double getHeight()
{
return height;
}
+ /**
+ * Returns the width of the ellipse.
+ * @return The width of the ellipse.
+ */
public double getWidth()
{
return width;
}
+ /**
+ * Returns x coordinate of the upper-left corner of
+ * the ellipse's bounding-box.
+ * @return The x coordinate.
+ */
public double getX()
{
return x;
}
+ /**
+ * Returns y coordinate of the upper-left corner of
+ * the ellipse's bounding-box.
+ * @return The y coordinate.
+ */
public double getY()
{
return y;
}
+ /**
+ * Returns <code>true</code> if the ellipse encloses no area, and
+ * <code>false</code> otherwise.
+ *
+ * @return A boolean.
+ */
public boolean isEmpty()
{
return height <= 0 || width <= 0;
}
+ /**
+ * Sets the geometry of the ellipse's bounding box.<P>
+ *
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
+ * @param w - width of the ellipse
+ * @param h - height of the ellipse
+ */
public void setFrame(float x, float y, float w, float h)
{
this.x = x;
@@ -193,6 +392,16 @@ public abstract class Ellipse2D extends RectangularShape
width = w;
}
+ /**
+ * Sets the geometry of the ellipse's bounding box.
+ *
+ * Note: This leads to a loss of precision.<P>
+ *
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
+ * @param w - width of the ellipse
+ * @param h - height of the ellipse
+ */
public void setFrame(double x, double y, double w, double h)
{
this.x = (float) x;
diff --git a/libjava/java/awt/geom/GeneralPath.java b/libjava/java/awt/geom/GeneralPath.java
index 40182ea..0dc9ede 100644
--- a/libjava/java/awt/geom/GeneralPath.java
+++ b/libjava/java/awt/geom/GeneralPath.java
@@ -1,39 +1,40 @@
/* GeneralPath.java -- represents a shape built from subpaths
Copyright (C) 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. */
+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 java.awt.geom;
@@ -641,7 +642,7 @@ public final class GeneralPath implements Shape, Cloneable
if (transform != null)
transform.transform( /* src */
coords, /* srcOffset */
- pos, /* dest */ coords, /* destOffset */
+ 0, /* dest */ coords, /* destOffset */
0, /* numPoints */ numCoords);
}
return seg;
@@ -777,7 +778,10 @@ public final class GeneralPath implements Shape, Cloneable
/* Get a value which is hopefully small but not insignificant relative
the path. */
- epsilon = ypoints[0] * 1E-9;
+ epsilon = ypoints[0] * 1E-7;
+
+ if(epsilon == 0)
+ epsilon = 1E-7;
pos = 0;
while (pos < index)
@@ -793,11 +797,11 @@ public final class GeneralPath implements Shape, Cloneable
y1 = firsty;
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y1 == 0.0)
- y1 += epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, distance,
- 0.0))
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
windingNumber += (y1 < y0) ? 1 : negative;
cx = firstx;
@@ -814,10 +818,11 @@ public final class GeneralPath implements Shape, Cloneable
y1 = firsty;
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y1 == 0.0)
- y1 += epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, distance, 0.0))
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
windingNumber += (y1 < y0) ? 1 : negative;
cx = firstx;
@@ -832,10 +837,11 @@ public final class GeneralPath implements Shape, Cloneable
y1 = ypoints[pos++] - (float) y;
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y1 == 0.0)
- y1 += epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, distance, 0.0))
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
windingNumber += (y1 < y0) ? 1 : negative;
cx = xpoints[pos - 1] - (float) x;
@@ -854,9 +860,9 @@ public final class GeneralPath implements Shape, Cloneable
&& (y0 * y1 <= 0 || y1 * y2 <= 0))
{
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y2 == 0.0)
- y2 += epsilon;
+ y2 -= epsilon;
r[0] = y0;
r[1] = 2 * (y1 - y0);
@@ -897,9 +903,9 @@ public final class GeneralPath implements Shape, Cloneable
&& (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
{
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y3 == 0.0)
- y3 += epsilon;
+ y3 -= epsilon;
r[0] = y0;
r[1] = 3 * (y1 - y0);
@@ -942,3 +948,4 @@ public final class GeneralPath implements Shape, Cloneable
return (windingNumber);
}
} // class GeneralPath
+
diff --git a/libjava/java/awt/geom/Line2D.java b/libjava/java/awt/geom/Line2D.java
index 15b2eca..05eedcd 100644
--- a/libjava/java/awt/geom/Line2D.java
+++ b/libjava/java/awt/geom/Line2D.java
@@ -48,6 +48,7 @@ import java.util.NoSuchElementException;
*
* @author Tom Tromey <tromey@cygnus.com>
* @author Eric Blake <ebb9@email.byu.edu>
+ * @author David Gilbert
* @since 1.2
* @status updated to 1.4
*/
@@ -235,11 +236,57 @@ public abstract class Line2D implements Shape, Cloneable
}
/**
- * Test if the line segment (x1,y1)-&gt;(x2,y2) intersects the line segment
+ * Computes twice the (signed) area of the triangle defined by the three
+ * points. This method is used for intersection testing.
+ *
+ * @param x1 the x-coordinate of the first point.
+ * @param y1 the y-coordinate of the first point.
+ * @param x2 the x-coordinate of the second point.
+ * @param y2 the y-coordinate of the second point.
+ * @param x3 the x-coordinate of the third point.
+ * @param y3 the y-coordinate of the third point.
+ *
+ * @return Twice the area.
+ */
+ private static double area2(double x1, double y1,
+ double x2, double y2,
+ double x3, double y3)
+ {
+ return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
+ }
+
+ /**
+ * Returns <code>true</code> if (x3, y3) lies between (x1, y1) and (x2, y2),
+ * and false otherwise, This test assumes that the three points are
+ * collinear, and is used for intersection testing.
+ *
+ * @param x1 the x-coordinate of the first point.
+ * @param y1 the y-coordinate of the first point.
+ * @param x2 the x-coordinate of the second point.
+ * @param y2 the y-coordinate of the second point.
+ * @param x3 the x-coordinate of the third point.
+ * @param y3 the y-coordinate of the third point.
+ *
+ * @return A boolean.
+ */
+ private static boolean between(double x1, double y1,
+ double x2, double y2,
+ double x3, double y3)
+ {
+ if (x1 != x2) {
+ return (x1 <= x3 && x3 <= x2) || (x1 >= x3 && x3 >= x2);
+ }
+ else {
+ return (y1 <= y3 && y3 <= y2) || (y1 >= y3 && y3 >= y2);
+ }
+ }
+
+ /**
+ * Test if the line segment (x1,y1)-&gt;(x2,y2) intersects the line segment
* (x3,y3)-&gt;(x4,y4).
*
* @param x1 the first x coordinate of the first segment
- * @param y1 the first y coordinate of the first segment
+ * @param y1 the first y coordinate of the first segment
* @param x2 the second x coordinate of the first segment
* @param y2 the second y coordinate of the first segment
* @param x3 the first x coordinate of the second segment
@@ -249,16 +296,64 @@ public abstract class Line2D implements Shape, Cloneable
* @return true if the segments intersect
*/
public static boolean linesIntersect(double x1, double y1,
- double x2, double y2,
- double x3, double y3,
- double x4, double y4)
+ double x2, double y2,
+ double x3, double y3,
+ double x4, double y4)
{
- double beta = (((y1 - y3) * (x4 - x3) + (x1 - x3) * (y4 - y3))
- / ((y2 - y1) * (x4 - x3) + (x2 - x1) * (y4 - y3)));
- if (beta < 0.0 || beta > 1.0)
- return false;
- double alpha = (x1 + beta * (x2 - x1) - x3) / (x4 - x3);
- return alpha >= 0.0 && alpha <= 1.0;
+ double a1, a2, a3, a4;
+
+ // deal with special cases
+ if ((a1 = area2(x1, y1, x2, y2, x3, y3)) == 0.0)
+ {
+ // check if p3 is between p1 and p2 OR
+ // p4 is collinear also AND either between p1 and p2 OR at opposite ends
+ if (between(x1, y1, x2, y2, x3, y3))
+ {
+ return true;
+ }
+ else
+ {
+ if (area2(x1, y1, x2, y2, x4, y4) == 0.0)
+ {
+ return between(x3, y3, x4, y4, x1, y1)
+ || between (x3, y3, x4, y4, x2, y2);
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ else if ((a2 = area2(x1, y1, x2, y2, x4, y4)) == 0.0)
+ {
+ // check if p4 is between p1 and p2 (we already know p3 is not
+ // collinear)
+ return between(x1, y1, x2, y2, x4, y4);
+ }
+
+ if ((a3 = area2(x3, y3, x4, y4, x1, y1)) == 0.0) {
+ // check if p1 is between p3 and p4 OR
+ // p2 is collinear also AND either between p1 and p2 OR at opposite ends
+ if (between(x3, y3, x4, y4, x1, y1)) {
+ return true;
+ }
+ else {
+ if (area2(x3, y3, x4, y4, x2, y2) == 0.0) {
+ return between(x1, y1, x2, y2, x3, y3)
+ || between (x1, y1, x2, y2, x4, y4);
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ else if ((a4 = area2(x3, y3, x4, y4, x2, y2)) == 0.0) {
+ // check if p2 is between p3 and p4 (we already know p1 is not
+ // collinear)
+ return between(x3, y3, x4, y4, x2, y2);
+ }
+ else { // test for regular intersection
+ return ((a1 > 0.0) ^ (a2 > 0.0)) && ((a3 > 0.0) ^ (a4 > 0.0));
+ }
}
/**
diff --git a/libjava/java/awt/geom/PathIterator.java b/libjava/java/awt/geom/PathIterator.java
index 1fb0a46..8076b5c 100644
--- a/libjava/java/awt/geom/PathIterator.java
+++ b/libjava/java/awt/geom/PathIterator.java
@@ -46,8 +46,8 @@ package java.awt.geom;
*
* @author Tom Tromey <tromey@cygnus.com>
* @author Eric Blake <ebb9@email.byu.edu>
- * @see Shape
- * @see Stroke
+ * @see java.awt.Shape
+ * @see java.awt.Stroke
* @see FlatteningPathIterator
* @since 1.2
* @status updated to 1.4
diff --git a/libjava/java/awt/geom/Point2D.java b/libjava/java/awt/geom/Point2D.java
index 48b12f6..d27505f 100644
--- a/libjava/java/awt/geom/Point2D.java
+++ b/libjava/java/awt/geom/Point2D.java
@@ -1,5 +1,5 @@
/* Point2D.java -- generic point in 2-D space
- Copyright (C) 1999, 2000, 2002 Free Software Foundation
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
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 java.awt.geom;
/**
@@ -42,8 +43,8 @@ package java.awt.geom;
* representation is left up to the subclass. Point includes two useful
* nested classes, for float and double storage respectively.
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -52,7 +53,7 @@ public abstract class Point2D implements Cloneable
/**
* The default constructor.
*
- * @see Point
+ * @see java.awt.Point
* @see Point2D.Float
* @see Point2D.Double
*/
@@ -120,7 +121,7 @@ public abstract class Point2D implements Cloneable
* @param y2 the y coordinate of point 2
* @return the distance from (x1,y1) to (x2,y2)
*/
- static public double distance(double x1, double y1, double x2, double y2)
+ public static double distance(double x1, double y1, double x2, double y2)
{
return Math.sqrt(distanceSq(x1, y1, x2, y2));
}
diff --git a/libjava/java/awt/geom/QuadCurve2D.java b/libjava/java/awt/geom/QuadCurve2D.java
index 0cc9eb4..0376d5a 100644
--- a/libjava/java/awt/geom/QuadCurve2D.java
+++ b/libjava/java/awt/geom/QuadCurve2D.java
@@ -59,6 +59,7 @@ import java.util.NoSuchElementException;
public abstract class QuadCurve2D implements Shape, Cloneable
{
private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
+ private static final double EPSILON = 1E-10;
/**
* Constructs a new QuadCurve2D. Typical users will want to
@@ -962,12 +963,12 @@ public abstract class QuadCurve2D implements Shape, Cloneable
If this is not done,bad behaviour may result for points on that axis. */
if (a0 == 0.0 || a2 == 0.0)
{
- double small = getFlatness() * (1E-10);
+ double small = getFlatness() * EPSILON;
if (a0 == 0.0)
- a0 += small;
+ a0 -= small;
if (a2 == 0.0)
- a2 += small;
+ a2 -= small;
}
r[0] = a0;
@@ -990,12 +991,12 @@ public abstract class QuadCurve2D implements Shape, Cloneable
if (useYaxis)
{
- if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0))
+ if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0))
nCrossings++;
}
else
{
- if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance))
+ if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance))
nCrossings++;
}
diff --git a/libjava/java/awt/geom/Rectangle2D.java b/libjava/java/awt/geom/Rectangle2D.java
index 8203ca3..bd1a37c 100644
--- a/libjava/java/awt/geom/Rectangle2D.java
+++ b/libjava/java/awt/geom/Rectangle2D.java
@@ -49,8 +49,8 @@ import java.util.NoSuchElementException;
* in methods like <code>contains</code> or <code>intersects</code> is
* undefined unless the rectangle has positive width and height.
*
- * @author Tom Tromey <tromey@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -71,14 +71,14 @@ public abstract class Rectangle2D extends RectangularShape
public static final int OUT_TOP = 2;
/**
- * The point lies right of the rectangle (p.x > r.maxX).
+ * The point lies right of the rectangle (p.x &gt; r.maxX).
*
* @see #outcode()
*/
public static final int OUT_RIGHT = 4;
/**
- * The point lies below of the rectangle (p.y > r.maxY).
+ * The point lies below of the rectangle (p.y &gt; r.maxY).
*
* @see #outcode()
*/
@@ -335,8 +335,8 @@ public abstract class Rectangle2D extends RectangularShape
* inside the rectangle, a subsequent call to <code>contains</code> may
* return false.
*
- * @param x the X coordinate of the point to add to this rectangle
- * @param y the Y coordinate of the point to add to this rectangle
+ * @param newx the X coordinate of the point to add to this rectangle
+ * @param newy the Y coordinate of the point to add to this rectangle
*/
public void add(double newx, double newy)
{
@@ -368,7 +368,7 @@ public abstract class Rectangle2D extends RectangularShape
*
* @param r the rectangle to add to this rectangle
* @throws NullPointerException if r is null
- * @see #union(Rectangle2D)
+ * @see #union(Rectangle2D, Rectangle2D, Rectangle2D)
*/
public void add(Rectangle2D r)
{
@@ -382,7 +382,7 @@ public abstract class Rectangle2D extends RectangularShape
* safe; modifications to the rectangle do not affect the results of this
* path instance.
*
- * @param transform an optional transform to apply to the iterator
+ * @param at an optional transform to apply to the iterator
* @return a new iterator over the boundary
* @since 1.2
*/
@@ -490,8 +490,8 @@ public abstract class Rectangle2D extends RectangularShape
* path instance. As the rectangle is already flat, the flatness parameter
* is ignored.
*
- * @param transform an optional transform to apply to the iterator
- * @param double the maximum distance for deviation from the real boundary
+ * @param at an optional transform to apply to the iterator
+ * @param flatness the maximum distance for deviation from the real boundary
* @return a new iterator over the boundary
* @since 1.2
*/
@@ -508,7 +508,7 @@ public abstract class Rectangle2D extends RectangularShape
* + 37 * Double.doubleToLongBits(getY())
* + 43 * Double.doubleToLongBits(getWidth())
* + 47 * Double.doubleToLongBits(getHeight());
- * return (int) ((l >> 32) ^ l);
+ * return (int) ((l &gt;&gt; 32) ^ l);
* </pre>
*
* @return the hashcode
@@ -543,7 +543,7 @@ public abstract class Rectangle2D extends RectangularShape
/**
* This class defines a rectangle in <code>double</code> precision.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -747,12 +747,12 @@ public abstract class Rectangle2D extends RectangularShape
return getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
+ ",h=" + height + ']';
}
- } // class Double
+ }
/**
* This class defines a rectangle in <code>float</code> precision.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -988,5 +988,5 @@ public abstract class Rectangle2D extends RectangularShape
return getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
+ ",h=" + height + ']';
}
- } // class Float
-} // class Rectangle2D
+ }
+}
diff --git a/libjava/java/awt/geom/RectangularShape.java b/libjava/java/awt/geom/RectangularShape.java
index 1801e80..78e393e 100644
--- a/libjava/java/awt/geom/RectangularShape.java
+++ b/libjava/java/awt/geom/RectangularShape.java
@@ -354,7 +354,7 @@ public abstract class RectangularShape implements Shape, Cloneable
* threadsafe if and only if the iterator returned by
* {@link #getPathIterator(AffineTransform)} is as well.
*
- * @param transform an optional transform to apply to the iterator
+ * @param at an optional transform to apply to the iterator
* @param flatness the desired flatness
* @return a new iterator over the boundary
* @throws IllegalArgumentException if flatness is invalid
diff --git a/libjava/java/awt/im/InputContext.java b/libjava/java/awt/im/InputContext.java
index 2c3c6aa..04e70e3 100644
--- a/libjava/java/awt/im/InputContext.java
+++ b/libjava/java/awt/im/InputContext.java
@@ -1,5 +1,5 @@
/* InputContext.java -- provides the context for text input
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,22 +35,24 @@ 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 java.awt.im;
+import gnu.java.util.EmptyEnumeration;
+
import java.awt.AWTEvent;
import java.awt.AWTException;
import java.awt.Component;
import java.awt.im.spi.InputMethod;
import java.awt.im.spi.InputMethodDescriptor;
import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
-import gnu.java.util.EmptyEnumeration;
/**
* Provides a context for controlling input methods and keyboard layouts.
diff --git a/libjava/java/awt/im/spi/InputMethod.java b/libjava/java/awt/im/spi/InputMethod.java
index 8e7e0bc..0e981ef 100644
--- a/libjava/java/awt/im/spi/InputMethod.java
+++ b/libjava/java/awt/im/spi/InputMethod.java
@@ -162,7 +162,7 @@ public interface InputMethod
* called on a previous client.</li>
* </ul>
*
- * @param the client window's current bounds, or null
+ * @param bounds the client window's current bounds, or null
*/
void notifyClientWindowChange(Rectangle bounds);
diff --git a/libjava/java/awt/im/spi/InputMethodContext.java b/libjava/java/awt/im/spi/InputMethodContext.java
index 6243ffa..a2ea475 100644
--- a/libjava/java/awt/im/spi/InputMethodContext.java
+++ b/libjava/java/awt/im/spi/InputMethodContext.java
@@ -1,5 +1,5 @@
/* InputMethodContext.java -- communication between an input method and client
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,13 +35,14 @@ 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 java.awt.im.spi;
-import java.awt.HeadlessException;
import java.awt.Window;
import java.awt.font.TextHitInfo;
import java.awt.im.InputMethodRequests;
import java.text.AttributedCharacterIterator;
+
import javax.swing.JFrame;
/**
@@ -49,7 +50,7 @@ import javax.swing.JFrame;
* and the client component. This should be passed to
* {@link InputMethod#setInputMethodContext(InputMethodContext)}.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.3
* @status updated to 1.4
*/
diff --git a/libjava/java/awt/image/AffineTransformOp.java b/libjava/java/awt/image/AffineTransformOp.java
index 6219635..1326a61 100644
--- a/libjava/java/awt/image/AffineTransformOp.java
+++ b/libjava/java/awt/image/AffineTransformOp.java
@@ -1,6 +1,6 @@
/* AffineTransformOp.java -- This class performs affine
- * transformation between two images or rasters in 2
- * dimensions. Copyright (C) 2004 Free Software Foundation
+ transformation between two images or rasters in 2 dimensions.
+ Copyright (C) 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -38,30 +38,39 @@ exception statement from your version. */
package java.awt.image;
-import java.awt.*;
-import java.awt.Graphics;
import java.awt.Graphics2D;
-import java.awt.geom.*;
-
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.Arrays;
/**
* This class performs affine transformation between two images or
* rasters in 2 dimensions.
*
- * @author Olga Rodimina <rodimina@redhat.com>
+ * @author Olga Rodimina (rodimina@redhat.com)
*/
-
public class AffineTransformOp implements BufferedImageOp, RasterOp
{
- public static final int TYPE_BILINEAR = 0;
public static final int TYPE_NEAREST_NEIGHBOR = 1;
+
+ public static final int TYPE_BILINEAR = 2;
+
+ /**
+ * @since 1.5.0
+ */
+ public static final int TYPE_BICUBIC = 3;
private AffineTransform transform;
private RenderingHints hints;
/**
* Construct AffineTransformOp with the given xform and interpolationType.
- * Interpolation type can be either TYPE_BILINEAR or TYPE_NEAREST_NEIGHBOR.
+ * Interpolation type can be TYPE_BILINEAR, TYPE_BICUBIC or
+ * TYPE_NEAREST_NEIGHBOR.
*
* @param xform AffineTransform that will applied to the source image
* @param interpolationType type of interpolation used
@@ -69,15 +78,23 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
public AffineTransformOp (AffineTransform xform, int interpolationType)
{
this.transform = xform;
+ if (xform.getDeterminant() == 0)
+ throw new ImagingOpException(null);
- if (interpolationType == 0)
+ switch (interpolationType)
+ {
+ case TYPE_BILINEAR:
hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
-
- else
+ break;
+ case TYPE_BICUBIC:
+ hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ break;
+ default:
hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
-
+ }
}
/**
@@ -90,6 +107,8 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
{
this.transform = xform;
this.hints = hints;
+ if (xform.getDeterminant() == 0)
+ throw new ImagingOpException(null);
}
/**
@@ -149,7 +168,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
* @param dst destination image
* @return transformed source image
*/
- public BufferedImage filter (BufferedImage src, BufferedImage dst)
+ public final BufferedImage filter (BufferedImage src, BufferedImage dst)
{
if (dst == src)
@@ -180,9 +199,99 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
* @param dst destination raster
* @return transformed raster
*/
- public WritableRaster filter (Raster src, WritableRaster dst)
+ public final WritableRaster filter (Raster src, WritableRaster dst)
{
- throw new UnsupportedOperationException ("not implemented yet");
+ if (dst == src)
+ throw new IllegalArgumentException("src image cannot be the same as"
+ + " the dst image");
+
+ if (dst == null)
+ dst = createCompatibleDestRaster(src);
+
+ if (src.getNumBands() != dst.getNumBands())
+ throw new IllegalArgumentException("src and dst must have same number"
+ + " of bands");
+
+ double[] dpts = new double[dst.getWidth() * 2];
+ double[] pts = new double[dst.getWidth() * 2];
+ for (int x = 0; x < dst.getWidth(); x++)
+ {
+ dpts[2 * x] = x + dst.getMinX();
+ dpts[2 * x + 1] = x;
+ }
+ Rectangle srcbounds = src.getBounds();
+ if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
+ {
+ for (int y = dst.getMinY(); y < dst.getMinY() + dst.getHeight(); y++)
+ {
+ try {
+ transform.inverseTransform(dpts, 0, pts, 0, dst.getWidth() * 2);
+ } catch (NoninvertibleTransformException e) {
+ // Can't happen since the constructor traps this
+ e.printStackTrace();
+ }
+
+ for (int x = 0; x < dst.getWidth(); x++)
+ {
+ if (!srcbounds.contains(pts[2 * x], pts[2 * x + 1]))
+ continue;
+ dst.setDataElements(x + dst.getMinX(), y,
+ src.getDataElements((int)pts[2 * x],
+ (int)pts[2 * x + 1],
+ null));
+ }
+ }
+ }
+ else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
+ {
+ double[] tmp = new double[4 * src.getNumBands()];
+ for (int y = dst.getMinY(); y < dst.getMinY() + dst.getHeight(); y++)
+ {
+ try {
+ transform.inverseTransform(dpts, 0, pts, 0, dst.getWidth() * 2);
+ } catch (NoninvertibleTransformException e) {
+ // Can't happen since the constructor traps this
+ e.printStackTrace();
+ }
+
+ for (int x = 0; x < dst.getWidth(); x++)
+ {
+ if (!srcbounds.contains(pts[2 * x], pts[2 * x + 1]))
+ continue;
+ int xx = (int)pts[2 * x];
+ int yy = (int)pts[2 * x + 1];
+ double dx = (pts[2 * x] - xx);
+ double dy = (pts[2 * x + 1] - yy);
+
+ // TODO write this more intelligently
+ if (xx == src.getMinX() + src.getWidth() - 1 ||
+ yy == src.getMinY() + src.getHeight() - 1)
+ {
+ // bottom or right edge
+ Arrays.fill(tmp, 0);
+ src.getPixel(xx, yy, tmp);
+ }
+ else
+ {
+ // Normal case
+ src.getPixels(xx, yy, 2, 2, tmp);
+ for (int b = 0; b < src.getNumBands(); b++)
+ tmp[b] = dx * dy * tmp[b]
+ + (1 - dx) * dy * tmp[b + src.getNumBands()]
+ + dx * (1 - dy) * tmp[b + 2 * src.getNumBands()]
+ + (1 - dx) * (1 - dy) * tmp[b + 3 * src.getNumBands()];
+ }
+ dst.setPixel(x, y, tmp);
+ }
+ }
+ }
+ else
+ {
+ // Bicubic
+ throw new UnsupportedOperationException("not implemented yet");
+ }
+
+ return dst;
}
/**
@@ -192,7 +301,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
* @param src image to be transformed
* @return bounds of the transformed image.
*/
- public Rectangle2D getBounds2D (BufferedImage src)
+ public final Rectangle2D getBounds2D (BufferedImage src)
{
return getBounds2D (src.getRaster());
}
@@ -203,7 +312,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
* @param src raster to be transformed
* @return bounds of the transformed raster.
*/
- public Rectangle2D getBounds2D (Raster src)
+ public final Rectangle2D getBounds2D (Raster src)
{
// determine new size for the transformed raster.
// Need to calculate transformed coordinates of the lower right
@@ -222,7 +331,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
*
* @return interpolation type
*/
- public int getInterpolationType ()
+ public final int getInterpolationType ()
{
if(hints.containsValue (RenderingHints.VALUE_INTERPOLATION_BILINEAR))
return TYPE_BILINEAR;
@@ -243,21 +352,23 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
return transform.transform (srcPt, dstPt);
}
- /** Returns rendering hints that are used during transformation.
+ /**
+ * Returns rendering hints that are used during transformation.
*
* @return rendering hints
*/
- public RenderingHints getRenderingHints ()
+ public final RenderingHints getRenderingHints ()
{
return hints;
}
- /** Returns transform used in transformation between source and destination
+ /**
+ * Returns transform used in transformation between source and destination
* image.
*
* @return transform
*/
- public AffineTransform getTransform ()
+ public final AffineTransform getTransform ()
{
return transform;
}
diff --git a/libjava/java/awt/image/BandCombineOp.java b/libjava/java/awt/image/BandCombineOp.java
new file mode 100644
index 0000000..48c61c5
--- /dev/null
+++ b/libjava/java/awt/image/BandCombineOp.java
@@ -0,0 +1,168 @@
+/* Copyright (C) 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 java.awt.image;
+
+import java.awt.Point;
+import java.awt.RenderingHints;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * Filter Raster pixels by applying a matrix.
+ *
+ * BandCombineOp applies a matrix to each pixel to produce new pixel values.
+ * The width of the matrix must be the same or one more than the number of
+ * bands in the source Raster. If one more, the pixels in the source are
+ * assumed to contain an implicit 1.0 at the end.
+ *
+ * The rows of the matrix are multiplied by the pixel to produce the values
+ * for the destination. Therefore the destination Raster must contain the
+ * same number of bands as the number of rows in the filter matrix.
+ *
+ * @author Jerry Quinn <jlquinn@optonline.net>
+ */
+public class BandCombineOp implements RasterOp
+{
+ private RenderingHints hints;
+ private float[][] matrix;
+
+ /**
+ * Construct a BandCombineOp.
+ *
+ * @param matrix The matrix to filter pixels with.
+ * @param hints Rendering hints to apply. Ignored.
+ */
+ public BandCombineOp(float[][] matrix, RenderingHints hints)
+ {
+ this.matrix = matrix;
+ this.hints = hints;
+ }
+
+ /**
+ * Filter Raster pixels through a matrix.
+ *
+ * Applies the Op matrix to source pixes to produce dest pixels. Each row
+ * of the matrix is multiplied by the src pixel components to produce the
+ * dest pixel. If matrix is one more than the number of bands in the src,
+ * the last element is implicitly multiplied by 1, i.e. added to the sum
+ * for that dest component.
+ *
+ * If dest is null, a suitable Raster is created. This implementation uses
+ * createCompatibleDestRaster.
+ *
+ * @param src The source Raster.
+ * @param dest The destination Raster, or null.
+ * @returns The destination Raster or an allocated Raster.
+ * @see java.awt.image.RasterOp#filter(java.awt.image.Raster,
+ *java.awt.image.WritableRaster)
+ */
+ public WritableRaster filter(Raster src, WritableRaster dest) {
+ if (dest == null)
+ dest = createCompatibleDestRaster(src);
+
+ // Filter the pixels
+ float[] spix = new float[matrix[0].length];
+ float[] dpix = new float[matrix.length];
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ {
+ // In case matrix rows have implicit translation
+ spix[spix.length - 1] = 1.0f;
+ src.getPixel(x, y, spix);
+ for (int i = 0; i < matrix.length; i++)
+ {
+ dpix[i] = 0;
+ for (int j = 0; j < matrix[0].length; j++)
+ dpix[i] += spix[j] * matrix[i][j];
+ }
+ dest.setPixel(x, y, dpix);
+ }
+
+ return dest;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
+ */
+ public Rectangle2D getBounds2D(Raster src)
+ {
+ return src.getBounds();
+ }
+
+ /**
+ * Creates a new WritableRaster that can be used as the destination for this
+ * Op. This implementation creates a Banded Raster with data type FLOAT.
+ * @see
+ *java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
+ */
+ public WritableRaster createCompatibleDestRaster(Raster src)
+ {
+ return Raster.createBandedRaster(DataBuffer.TYPE_FLOAT, src.getWidth(),
+ src.getHeight(), matrix.length,
+ new Point(src.getMinX(), src.getMinY()));
+ }
+
+ /** Return corresponding destination point for source point.
+ *
+ * LookupOp will return the value of src unchanged.
+ * @param src The source point.
+ * @param dst The destination point.
+ * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D,
+ *java.awt.geom.Point2D)
+ */
+ public Point2D getPoint2D(Point2D src, Point2D dst)
+ {
+ if (dst == null) return (Point2D)src.clone();
+ dst.setLocation(src);
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getRenderingHints()
+ */
+ public RenderingHints getRenderingHints()
+ {
+ return hints;
+ }
+
+ /** Return the matrix for this Op. */
+ public float[][] getMatrix()
+ {
+ return matrix;
+ }
+
+}
diff --git a/libjava/java/awt/image/BandedSampleModel.java b/libjava/java/awt/image/BandedSampleModel.java
new file mode 100644
index 0000000..93252d9
--- /dev/null
+++ b/libjava/java/awt/image/BandedSampleModel.java
@@ -0,0 +1,537 @@
+/* Copyright (C) 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 java.awt.image;
+
+/**
+ * MultiPixelPackedSampleModel provides a single band model that supports
+ * multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
+ * per data element.
+ *
+ * @author Jerry Quinn <jlquinn@optonline.net>
+ */
+public final class BandedSampleModel extends ComponentSampleModel
+{
+ private int[] bitMasks;
+ private int[] bitOffsets;
+ private int[] sampleSize;
+ private int dataBitOffset;
+ private int elemBits;
+ private int numberOfBits;
+ private int numElems;
+
+ public BandedSampleModel(int dataType, int w, int h, int numBands)
+ {
+ super(dataType, w, h, 1, w, new int[numBands]);
+ }
+
+ public BandedSampleModel(int dataType, int w, int h, int scanlineStride,
+ int[] bankIndices, int[] bandOffsets)
+ {
+ super(dataType, w, h, 1, scanlineStride, bankIndices, bandOffsets);
+ }
+
+ public SampleModel createCompatibleSampleModel(int w, int h)
+ {
+ // NOTE: blackdown 1.4.1 sets all offsets to 0. Sun's 1.4.2 docs
+ // disagree.
+
+ // Compress offsets so minimum is 0, others w*scanlineStride
+ int[] newoffsets = new int[bandOffsets.length];
+ int[] order = new int[bandOffsets.length];
+ for (int i=0; i < bandOffsets.length; i++)
+ order[i] = i;
+ // FIXME: This is N^2, but not a big issue, unless there's a lot of
+ // bands...
+ for (int i=0; i < bandOffsets.length; i++)
+ for (int j=i+1; j < bandOffsets.length; i++)
+ if (bankIndices[order[i]] > bankIndices[order[j]]
+ || (bankIndices[order[i]] == bankIndices[order[j]]
+ && bandOffsets[order[i]] > bandOffsets[order[j]]))
+ {
+ int t = order[i]; order[i] = order[j]; order[j] = t;
+ }
+ int bank = 0;
+ int offset = 0;
+ for (int i=0; i < bandOffsets.length; i++)
+ {
+ if (bankIndices[order[i]] != bank)
+ {
+ bank = bankIndices[order[i]];
+ offset = 0;
+ }
+ newoffsets[order[i]] = offset;
+ offset += w * scanlineStride;
+ }
+
+ return new BandedSampleModel(dataType, w, h, scanlineStride, bankIndices, newoffsets);
+ }
+
+
+ public SampleModel createSubsetSampleModel(int[] bands)
+ {
+ int[] newoff = new int[bands.length];
+ int[] newbanks = new int[bands.length];
+ for (int i=0; i < bands.length; i++)
+ {
+ int b = bands[i];
+ newoff[i] = bandOffsets[b];
+ newbanks[i] = bankIndices[b];
+ }
+
+ if (bands.length > bankIndices.length)
+ throw new
+ RasterFormatException("BandedSampleModel createSubsetSampleModel too"
+ +" many bands");
+
+ return new BandedSampleModel(dataType, width, height, scanlineStride,
+ newbanks, newoff);
+ }
+
+ /**
+ * Extract all samples of one pixel and return in an array of transfer type.
+ *
+ * Extracts the pixel at x, y from data and stores samples into the array
+ * obj. If obj is null, a new array of getTransferType() is created.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param obj The primitive array to store the pixels into or null to force creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ * @see java.awt.image.SampleModel#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public Object getDataElements(int x, int y, Object obj,
+ DataBuffer data)
+ {
+ int pixel = getSample(x, y, 0, data);
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ byte[] b = (byte[])obj;
+ if (b == null) b = new byte[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = (byte)getSample(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_SHORT:
+ case DataBuffer.TYPE_USHORT:
+ {
+ short[] b = (short[])obj;
+ if (b == null) b = new short[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = (short)getSample(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ int[] b = (int[])obj;
+ if (b == null) b = new int[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = getSample(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ {
+ float[] b = (float[])obj;
+ if (b == null) b = new float[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = getSampleFloat(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_DOUBLE:
+ {
+ double[] b = (double[])obj;
+ if (b == null) b = new double[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = getSample(x, y, i, data);
+ return b;
+ }
+
+ default:
+ // Seems like the only sensible thing to do.
+ throw new ClassCastException();
+ }
+ }
+
+ public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[numBands];
+ for (int i=0; i < numBands; i++)
+ iArray[i] = getSample(x, y, 0, data);
+
+ return iArray;
+ }
+
+ /**
+ * Copy pixels from a region into an array.
+ *
+ * Copies the samples of the pixels in the rectangle starting at x, y that
+ * is w pixels wide and h scanlines high. When there is more than one band,
+ * the samples stored in order before the next pixel. This ordering isn't
+ * well specified in Sun's docs as of 1.4.2.
+ *
+ * If iArray is null, a new array is allocated, filled, and returned.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param w The width in pixels of the rectangle.
+ * @param h The height in pixels of the rectangle.
+ * @param iArray The int array to store the pixels into or null to force
+ * creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ */
+ public int[] getPixels(int x, int y, int w, int h, int[] iArray,
+ DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[w*h*numBands];
+ int outOffset = 0;
+ for (y=0; y<h; y++)
+ {
+ for (x=0; x<w;)
+ {
+ for (int b=0; b < numBands; b++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ iArray[outOffset++] =
+ data.getElem(bankIndices[b], offset);
+ }
+ }
+ }
+ return iArray;
+ }
+
+ public int getSample(int x, int y, int b, DataBuffer data)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ return data.getElem(bankIndices[b], offset);
+ }
+
+ public float getSampleFloat(int x, int y, int b, DataBuffer data)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ return data.getElemFloat(bankIndices[b], offset);
+ }
+
+ public double getSampleDouble(int x, int y, int b, DataBuffer data)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ return data.getElemDouble(bankIndices[b], offset);
+ }
+
+ /**
+ * Copy one band's samples from a region into an array.
+ *
+ * Copies from one band the samples of the pixels in the rectangle starting
+ * at x, y that is w pixels wide and h scanlines high.
+ *
+ * If iArray is null, a new array is allocated, filled, and returned.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param w The width in pixels of the rectangle.
+ * @param h The height in pixels of the rectangle.
+ * @param b The band to retrieve.
+ * @param iArray The int array to store the pixels into or null to force
+ * creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ */
+ public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray,
+ DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[w*h];
+ int outOffset = 0;
+ for (y=0; y<h; y++)
+ {
+ for (x=0; x<w;)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ iArray[outOffset++] =
+ data.getElem(bankIndices[b], offset);
+ }
+ }
+ return iArray;
+ }
+
+
+ /**
+ * Set the pixel at x, y to the value in the first element of the primitive
+ * array obj.
+ *
+ * @param x The x-coordinate of the data elements in <code>obj</code>.
+ * @param y The y-coordinate of the data elements in <code>obj</code>.
+ * @param obj The primitive array containing the data elements to set.
+ * @param data The DataBuffer to store the data elements into.
+ * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public void setDataElements(int x, int y, Object obj, DataBuffer data)
+ {
+ int transferType = getTransferType();
+ if (getTransferType() != data.getDataType())
+ {
+ throw new IllegalArgumentException("transfer type ("+
+ getTransferType()+"), "+
+ "does not match data "+
+ "buffer type (" +
+ data.getDataType() +
+ ").");
+ }
+
+ int offset = y * scanlineStride + x;
+
+ try
+ {
+ switch (transferType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] in = (byte[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_SHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] in = (short[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferUShort out = (DataBufferUShort) data;
+ short[] in = (short[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] in = (int[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ {
+ DataBufferFloat out = (DataBufferFloat) data;
+ float[] in = (float[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_DOUBLE:
+ {
+ DataBufferDouble out = (DataBufferDouble) data;
+ double[] in = (double[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ String msg = "While writing data elements" +
+ ", x="+x+", y="+y+
+ ", width="+width+", height="+height+
+ ", scanlineStride="+scanlineStride+
+ ", offset="+offset+
+ ", data.getSize()="+data.getSize()+
+ ", data.getOffset()="+data.getOffset()+
+ ": " +
+ aioobe;
+ throw new ArrayIndexOutOfBoundsException(msg);
+ }
+ }
+
+ public void setPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ for (int b=0; b < numBands; b++)
+ data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
+ iArray[b]);
+ }
+
+ public void setPixels(int x, int y, int w, int h, int[] iArray,
+ DataBuffer data)
+ {
+ int inOffset = 0;
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = y * scanlineStride + (x + ww);
+ for (int b=0; b < numBands; b++)
+ data.setElem(bankIndices[b], bandOffsets[b] + offset,
+ iArray[inOffset++]);
+ }
+ y++;
+ }
+ }
+
+ public void setSample(int x, int y, int b, int s, DataBuffer data)
+ {
+ data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
+ }
+
+ public void setSample(int x, int y, int b, float s, DataBuffer data)
+ {
+ data.setElemFloat(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
+ }
+
+ public void setSample(int x, int y, int b, double s, DataBuffer data)
+ {
+ data.setElemDouble(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
+ }
+
+ public void setSamples(int x, int y, int w, int h, int b, int[] iArray,
+ DataBuffer data)
+ {
+ int inOffset = 0;
+
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (byte)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_SHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (short)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (short)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ case DataBuffer.TYPE_DOUBLE:
+ break;
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
+
+ // Default implementation probably slower for float and double
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ data.setElem(bankIndices[b], offset, iArray[inOffset++]);
+ }
+ y++;
+ }
+ }
+
+ /**
+ * Creates a String with some information about this SampleModel.
+ * @return A String describing this SampleModel.
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(getClass().getName());
+ result.append("[");
+ result.append("scanlineStride=").append(scanlineStride);
+ for(int i=0; i < bitMasks.length; i+=1)
+ {
+ result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
+ }
+
+ result.append("]");
+ return result.toString();
+ }
+}
diff --git a/libjava/java/awt/image/BufferedImage.java b/libjava/java/awt/image/BufferedImage.java
index b18779a..723eeeb 100644
--- a/libjava/java/awt/image/BufferedImage.java
+++ b/libjava/java/awt/image/BufferedImage.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
+/* BufferedImage.java --
+ Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,6 +38,8 @@ exception statement from your version. */
package java.awt.image;
+import gnu.java.awt.ComponentDataBlitOp;
+
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
@@ -45,11 +48,10 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import java.util.Hashtable;
-import java.util.Vector;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
-import gnu.java.awt.ComponentDataBlitOp;
+import java.util.Vector;
/**
* A buffered image always starts at coordinates (0, 0).
@@ -59,7 +61,7 @@ import gnu.java.awt.ComponentDataBlitOp;
* height of the image. This tile is always considered to be checked
* out.
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class BufferedImage extends Image
implements WritableRenderedImage
@@ -79,20 +81,20 @@ public class BufferedImage extends Image
TYPE_BYTE_BINARY = 12,
TYPE_BYTE_INDEXED = 13;
- final static int[] bits3 = { 8, 8, 8 };
- final static int[] bits4 = { 8, 8, 8 };
- final static int[] bits1byte = { 8 };
- final static int[] bits1ushort = { 16 };
+ static final int[] bits3 = { 8, 8, 8 };
+ static final int[] bits4 = { 8, 8, 8 };
+ static final int[] bits1byte = { 8 };
+ static final int[] bits1ushort = { 16 };
- final static int[] masks_int = { 0x00ff0000,
+ static final int[] masks_int = { 0x00ff0000,
0x0000ff00,
0x000000ff,
DataBuffer.TYPE_INT };
- final static int[] masks_565 = { 0xf800,
+ static final int[] masks_565 = { 0xf800,
0x07e0,
0x001f,
DataBuffer.TYPE_USHORT};
- final static int[] masks_555 = { 0x7c00,
+ static final int[] masks_555 = { 0x7c00,
0x03e0,
0x001f,
DataBuffer.TYPE_USHORT};
diff --git a/libjava/java/awt/image/BufferedImageFilter.java b/libjava/java/awt/image/BufferedImageFilter.java
new file mode 100644
index 0000000..8fa7d47
--- /dev/null
+++ b/libjava/java/awt/image/BufferedImageFilter.java
@@ -0,0 +1,110 @@
+/* Copyright (C) 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 java.awt.image;
+
+import java.awt.Point;
+
+/**
+ * The BufferedImageFilter class wraps BufferedImageOp objects in a Filter.
+ *
+ * When pixels are pushed through the filter, we create a BufferedImage,
+ * apply the BufferedImageOp, and pass the filtered pixels to the base class.
+ *
+ * @author jlquinn@optonline.net
+ */
+public class BufferedImageFilter extends ImageFilter implements Cloneable
+{
+ private BufferedImageOp op;
+
+ /**
+ *
+ */
+ public BufferedImageFilter(BufferedImageOp op)
+ {
+ super();
+ if (op == null)
+ throw new NullPointerException("BufferedImageFilter null"
+ + " op in constructor");
+ this.op = op;
+ }
+
+ /**
+ * @return Returns the contained BufferedImageOp.
+ */
+ public BufferedImageOp getBufferedImageOp()
+ {
+ return op;
+ }
+
+ // FIXME: Definitely not sure this is the right thing. I'm not sure how to
+ // create a compatible sample model that incorporates scansize != w. I
+ // asume off is handled by the db itself.
+ public void setPixels(int x, int y, int w, int h, ColorModel model,
+ byte[] pixels, int off, int scansize)
+ {
+ // Create an input BufferedImage
+ DataBufferByte db = new DataBufferByte(pixels, scansize * h + off, off);
+ SampleModel sm = model.createCompatibleSampleModel(scansize, h);
+ WritableRaster wr = new WritableRaster(sm, db, new Point(0, 0));
+ BufferedImage in =
+ new BufferedImage(model, wr, model.isAlphaPremultiplied(), null);
+ BufferedImage out = op.createCompatibleDestImage(in, model);
+ op.filter(in, out);
+ DataBuffer dbout = out.getRaster().getDataBuffer();
+ super.setPixels(0, 0, w, h, model, ((DataBufferByte)dbout).getData(), 0,
+ scansize);
+ }
+
+ // FIXME: Definitely not sure this is the right thing. I'm not sure how
+ // to create a compatible sample model that incorporates
+ // scansize != w. I asume off is handled by the db itself.
+ public void setPixels(int x, int y, int w, int h, ColorModel model,
+ int[] pixels, int off, int scansize)
+ {
+ // Create an input BufferedImage
+ DataBufferInt db = new DataBufferInt(pixels, scansize * h + off, off);
+ SampleModel sm = model.createCompatibleSampleModel(scansize, h);
+ WritableRaster wr = new WritableRaster(sm, db, new Point(0, 0));
+ BufferedImage in =
+ new BufferedImage(model, wr, model.isAlphaPremultiplied(), null);
+ BufferedImage out = op.createCompatibleDestImage(in, model);
+ op.filter(in, out);
+ DataBuffer dbout = out.getRaster().getDataBuffer();
+ super.setPixels(0, 0, w, h, model, ((DataBufferInt)dbout).getData(), 0,
+ scansize);
+ }
+}
diff --git a/libjava/java/awt/image/ByteLookupTable.java b/libjava/java/awt/image/ByteLookupTable.java
index 572f6e9..f022191 100644
--- a/libjava/java/awt/image/ByteLookupTable.java
+++ b/libjava/java/awt/image/ByteLookupTable.java
@@ -61,7 +61,7 @@ public class ByteLookupTable extends LookupTable
*
* @param offset Offset to be subtracted.
* @param data Array of lookup tables.
- * @exception IllegalArgumentException if offset < 0 or data.length < 1.
+ * @exception IllegalArgumentException if offset &lt; 0 or data.length &lt; 1.
*/
public ByteLookupTable(int offset, byte[][] data)
throws IllegalArgumentException
@@ -78,7 +78,7 @@ public class ByteLookupTable extends LookupTable
*
* @param offset Offset to be subtracted.
* @param data Lookup table for all components.
- * @exception IllegalArgumentException if offset < 0.
+ * @exception IllegalArgumentException if offset &lt; 0.
*/
public ByteLookupTable(int offset, byte[] data)
throws IllegalArgumentException
@@ -87,7 +87,11 @@ public class ByteLookupTable extends LookupTable
this.data = new byte[][] {data};
}
- /** Return the lookup tables. */
+ /**
+ * Return the lookup tables.
+ *
+ * @return the tables
+ */
public final byte[][] getTable()
{
return data;
@@ -107,14 +111,14 @@ public class ByteLookupTable extends LookupTable
* translation arrays.
*
* @param src Component values of a pixel.
- * @param dest Destination array for values, or null.
+ * @param dst Destination array for values, or null.
* @return Translated values for the pixel.
*/
public int[] lookupPixel(int[] src, int[] dst)
throws ArrayIndexOutOfBoundsException
{
if (dst == null)
- dst = new int[numComponents];
+ dst = new int[src.length];
if (data.length == 1)
for (int i=0; i < src.length; i++)
@@ -140,14 +144,14 @@ public class ByteLookupTable extends LookupTable
* translation arrays.
*
* @param src Component values of a pixel.
- * @param dest Destination array for values, or null.
+ * @param dst Destination array for values, or null.
* @return Translated values for the pixel.
*/
public byte[] lookupPixel(byte[] src, byte[] dst)
throws ArrayIndexOutOfBoundsException
{
if (dst == null)
- dst = new byte[numComponents];
+ dst = new byte[src.length];
if (data.length == 1)
for (int i=0; i < src.length; i++)
diff --git a/libjava/java/awt/image/ColorConvertOp.java b/libjava/java/awt/image/ColorConvertOp.java
new file mode 100644
index 0000000..5fcb37c
--- /dev/null
+++ b/libjava/java/awt/image/ColorConvertOp.java
@@ -0,0 +1,319 @@
+/* ColorModel.java --
+ Copyright (C) 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 java.awt.image;
+
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.color.ColorSpace;
+import java.awt.color.ICC_ColorSpace;
+import java.awt.color.ICC_Profile;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * ColorConvertOp is a filter for converting an image from one colorspace to
+ * another colorspace. The filter can convert the image through a sequence
+ * of colorspaces or just from source to destination.
+ *
+ * Color conversion is done on the color components without alpha. Thus
+ * if a BufferedImage has alpha premultiplied, this is divided out before
+ * color conversion, and premultiplication applied if the destination
+ * requires it.
+ *
+ * Color rendering and dithering hints may be applied if specified. This is
+ * likely platform-dependent.
+ *
+ * @author jlquinn@optonline.net
+ */
+public class ColorConvertOp implements BufferedImageOp, RasterOp
+{
+ private ColorSpace srccs;
+ private ColorSpace dstcs;
+ private RenderingHints hints;
+ private ICC_Profile[] profiles;
+ private ColorSpace[] spaces;
+ private boolean rasterValid;
+
+
+ /**
+ * Convert BufferedImage through a ColorSpace.
+ *
+ * This filter version is only valid for BufferedImages. The source image
+ * is converted to cspace. If the destination is not null, it is then
+ * converted to the destination colorspace. Normally this filter will only
+ * be used with a null destination.
+ *
+ * @param cspace The target color space.
+ * @param hints Rendering hints to use in conversion, or null.
+ */
+ public ColorConvertOp(ColorSpace cspace, RenderingHints hints)
+ {
+ if (cspace == null)
+ throw new NullPointerException();
+ spaces = new ColorSpace[]{cspace};
+ this.hints = hints;
+ rasterValid = false;
+ }
+
+ public ColorConvertOp(ColorSpace srcCspace, ColorSpace dstCspace,
+ RenderingHints hints)
+ {
+ if (srcCspace == null || dstCspace == null)
+ throw new NullPointerException();
+ spaces = new ColorSpace[]{srcCspace, dstCspace};
+ this.hints = hints;
+ }
+
+ /**
+ * Convert from a source image destination image color space.
+ *
+ * This constructor builds a ColorConvertOp from an array of ICC_Profiles.
+ * The source image will be converted through the sequence of color spaces
+ * defined by the profiles. If the sequence of profiles doesn't give a
+ * well-defined conversion, throws IllegalArgumentException.
+ *
+ * NOTE: Sun's docs don't clearly define what a well-defined conversion is
+ * - or perhaps someone smarter can come along and sort it out.
+ *
+ * For BufferedImages, when the first and last profiles match the
+ * requirements of the source and destination color space respectively, the
+ * corresponding conversion is unnecessary. TODO: code this up. I don't
+ * yet understand how you determine this.
+ *
+ * For Rasters, the first and last profiles must have the same number of
+ * bands as the source and destination Rasters, respectively. If this is
+ * not the case, or there fewer than 2 profiles, an IllegalArgumentException
+ * will be thrown.
+ *
+ * @param profiles
+ * @param hints
+ */
+ public ColorConvertOp(ICC_Profile[] profiles, RenderingHints hints)
+ {
+ if (profiles == null)
+ throw new NullPointerException();
+ this.hints = hints;
+ this.profiles = profiles;
+ // TODO: Determine if this is well-defined.
+ // Create colorspace array with space for src and dest colorspace
+ spaces = new ColorSpace[profiles.length];
+ for (int i = 0; i < profiles.length; i++)
+ spaces[i] = new ICC_ColorSpace(profiles[i]);
+ }
+
+ /** Convert from source image color space to destination image color space.
+ *
+ * Only valid for BufferedImage objects, this Op converts from the source
+ * color space to the destination color space. The destination can't be
+ * null for this operation.
+ *
+ * @param hints Rendering hints to use during conversion, or null.
+ */
+ public ColorConvertOp(RenderingHints hints)
+ {
+ this.hints = hints;
+ srccs = null;
+ dstcs = null;
+ rasterValid = false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage,
+ java.awt.image.BufferedImage)
+ */
+ public final BufferedImage filter(BufferedImage src, BufferedImage dst)
+ {
+ // TODO: The plan is to create a scanline buffer for intermediate buffers.
+ // For now we just suck it up and create intermediate buffers.
+
+ if (dst == null && spaces.length == 0)
+ throw new IllegalArgumentException();
+
+ // Make sure input isn't premultiplied by alpha
+ if (src.isAlphaPremultiplied())
+ {
+ BufferedImage tmp = createCompatibleDestImage(src, src.getColorModel());
+ copyimage(src, tmp);
+ tmp.coerceData(false);
+ src = tmp;
+ }
+
+ ColorModel scm = src.getColorModel();
+ for (int i = 0; i < spaces.length; i++)
+ {
+ ColorModel cm = scm.cloneColorModel(spaces[i]);
+ BufferedImage tmp = createCompatibleDestImage(src, cm);
+ copyimage(src, tmp);
+ src = tmp;
+ }
+
+ // Intermediate conversions leave result in src
+ if (dst == null)
+ return src;
+
+ // Apply final conversion
+ copyimage(src, dst);
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
+ */
+ public BufferedImage createCompatibleDestImage(BufferedImage src,
+ ColorModel dstCM)
+ {
+ // FIXME: set properties to those in src
+ return new BufferedImage(dstCM,
+ src.getRaster().createCompatibleWritableRaster(),
+ src.isPremultiplied,
+ null);
+ }
+
+ public final ICC_Profile[] getICC_Profiles()
+ {
+ return profiles;
+ }
+
+ /** Return the rendering hints for this op. */
+ public final RenderingHints getRenderingHints()
+ {
+ return hints;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
+ */
+ public final WritableRaster filter(Raster src, WritableRaster dest)
+ {
+ if (!rasterValid)
+ throw new IllegalArgumentException();
+
+ // Need to iterate through each color space - there must be at least 2
+ for (int i = 1; i < spaces.length - 1; i++)
+ {
+ // FIXME: this is wrong. tmp needs to have the same number of bands as
+ // spaces[i] has.
+ WritableRaster tmp = createCompatibleDestRaster(src);
+ copyraster(src, spaces[i - 1], tmp, spaces[i]);
+ src = tmp;
+ }
+
+ // FIXME: this is wrong. dst needs to have the same number of bands as
+ // spaces[i] has.
+ if (dest == null)
+ dest = createCompatibleDestRaster(src);
+ copyraster(src, spaces[spaces.length - 2],
+ dest, spaces[spaces.length - 1]);
+
+ return dest;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
+ */
+ public WritableRaster createCompatibleDestRaster(Raster src)
+ {
+ return src.createCompatibleWritableRaster();
+ }
+
+ /** Return corresponding destination point for source point.
+ *
+ * LookupOp will return the value of src unchanged.
+ * @param src The source point.
+ * @param dst The destination point.
+ * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
+ */
+ public final Point2D getPoint2D(Point2D src, Point2D dst)
+ {
+ if (dst == null) return (Point2D)src.clone();
+ dst.setLocation(src);
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
+ */
+ public final Rectangle2D getBounds2D(BufferedImage src)
+ {
+ return src.getRaster().getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
+ */
+ public final Rectangle2D getBounds2D(Raster src)
+ {
+ return src.getBounds();
+ }
+
+ // According to Sven de Marothy, we need to copy the src into the dest
+ // using Graphics2D, in order to use the rendering hints.
+ private void copyimage(BufferedImage src, BufferedImage dst)
+ {
+ Graphics2D gg = dst.createGraphics();
+ gg.setRenderingHints(hints);
+ gg.drawImage(src, 0, 0, null);
+ gg.dispose();
+ }
+
+ private void copyraster(Raster src, ColorSpace scs, WritableRaster dst,
+ ColorSpace dcs)
+ {
+ float[] sbuf = new float[src.getNumBands()];
+
+ if (hints.get(RenderingHints.KEY_COLOR_RENDERING) ==
+ RenderingHints.VALUE_COLOR_RENDER_QUALITY)
+ {
+ // use cie for accuracy
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ dst.setPixel(x, y,
+ dcs.fromCIEXYZ(scs.toCIEXYZ(src.getPixel(x, y, sbuf))));
+ }
+ else
+ {
+ // use rgb - it's probably faster
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ dst.setPixel(x, y,
+ dcs.fromRGB(scs.toRGB(src.getPixel(x, y, sbuf))));
+ }
+ }
+
+}
diff --git a/libjava/java/awt/image/ColorModel.java b/libjava/java/awt/image/ColorModel.java
index 87ab942..11615fd 100644
--- a/libjava/java/awt/image/ColorModel.java
+++ b/libjava/java/awt/image/ColorModel.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
+/* ColorModel.java --
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,11 +38,13 @@ exception statement from your version. */
package java.awt.image;
-import java.util.Arrays;
+import gnu.java.awt.Buffers;
+
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import gnu.java.awt.Buffers;
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
/**
* A color model operates with colors in several formats:
@@ -76,8 +79,8 @@ import gnu.java.awt.Buffers;
*
* </ul>
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
- * @author C. Brian Jones <cbj@gnu.org>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public abstract class ColorModel implements Transparency
{
@@ -108,7 +111,7 @@ public abstract class ColorModel implements Transparency
* Constructs the default color model. The default color model
* can be obtained by calling <code>getRGBdefault</code> of this
* class.
- * @param b the number of bits wide used for bit size of pixel values
+ * @param bits the number of bits wide used for bit size of pixel values
*/
public ColorModel(int bits)
{
@@ -156,6 +159,32 @@ public abstract class ColorModel implements Transparency
this.transferType = transferType;
}
+ // This is a hook for ColorConvertOp to create a colormodel with
+ // a new colorspace
+ ColorModel cloneColorModel(ColorSpace cspace)
+ {
+ Class cls = this.getClass();
+ ColorModel cm;
+ try {
+ // This constructor will exist.
+ Constructor ctor =
+ cls.getConstructor(new Class[]{int.class, int[].class,
+ ColorSpace.class, boolean.class,
+ boolean.class, int.class, int.class});
+ cm = (ColorModel)ctor.
+ newInstance(new Object[]{new Integer(pixel_bits),
+ bits, cspace, Boolean.valueOf(hasAlpha),
+ Boolean.valueOf(isAlphaPremultiplied),
+ new Integer(transparency),
+ new Integer(transferType)});
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException();
+ }
+ return cm;
+ }
+
public void finalize()
{
// Do nothing here.
@@ -294,7 +323,7 @@ public abstract class ColorModel implements Transparency
* This method is typically overriden in subclasses to provide a
* more efficient implementation.
*
- * @param array of transferType containing a single pixel. The
+ * @param inData array of transferType containing a single pixel. The
* pixel should be encoded in the natural way of the color model.
*/
public int getRed(Object inData)
@@ -508,40 +537,89 @@ public abstract class ColorModel implements Transparency
* <code>(pixel == cm.getDataElement(cm.getComponents(pixel, null,
* 0), 0))</code>.
*
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation.
+ * This method is overriden in subclasses since this abstract class throws
+ * UnsupportedOperationException().
*
- * @param arrays of unnormalized component samples of single
- * pixel. The scale and multiplication state of the samples are
- * according to the color model. Each component sample is stored
- * as a separate element in the array.
+ * @param components Array of unnormalized component samples of single
+ * pixel. The scale and multiplication state of the samples are according
+ * to the color model. Each component sample is stored as a separate element
+ * in the array.
+ * @param offset Position of the first value of the pixel in components.
*
* @return pixel value encoded according to the color model.
*/
public int getDataElement(int[] components, int offset)
{
- // subclasses has to implement this method.
+ // subclasses have to implement this method.
throw new UnsupportedOperationException();
}
+ /**
+ * Converts the normalized component samples from an array to a pixel
+ * value. I.e. composes the pixel from component samples, but does not
+ * perform any color conversion or scaling of the samples.
+ *
+ * This method is typically overriden in subclasses to provide a
+ * more efficient implementation. The method provided by this abstract
+ * class converts the components to unnormalized form and returns
+ * getDataElement(int[], int).
+ *
+ * @param components Array of normalized component samples of single pixel.
+ * The scale and multiplication state of the samples are according to the
+ * color model. Each component sample is stored as a separate element in the
+ * array.
+ * @param offset Position of the first value of the pixel in components.
+ *
+ * @return pixel value encoded according to the color model.
+ * @since 1.4
+ */
public int getDataElement (float[] components, int offset)
{
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
+ return
+ getDataElement(getUnnormalizedComponents(components, offset, null, 0),
+ 0);
}
public Object getDataElements(int[] components, int offset, Object obj)
{
- // subclasses has to implement this method.
+ // subclasses have to implement this method.
throw new UnsupportedOperationException();
}
- public int getDataElements (float[] components, Object obj)
+ /**
+ * Converts the normalized component samples from an array to an array of
+ * TransferType values. I.e. composes the pixel from component samples, but
+ * does not perform any color conversion or scaling of the samples.
+ *
+ * If obj is null, a new array of TransferType is allocated and returned.
+ * Otherwise the results are stored in obj and obj is returned. If obj is
+ * not long enough, ArrayIndexOutOfBounds is thrown. If obj is not an array
+ * of primitives, ClassCastException is thrown.
+ *
+ * This method is typically overriden in subclasses to provide a
+ * more efficient implementation. The method provided by this abstract
+ * class converts the components to unnormalized form and returns
+ * getDataElement(int[], int, Object).
+ *
+ * @param components Array of normalized component samples of single pixel.
+ * The scale and multiplication state of the samples are according to the
+ * color model. Each component sample is stored as a separate element in the
+ * array.
+ * @param offset Position of the first value of the pixel in components.
+ * @param obj Array of TransferType or null.
+ *
+ * @return pixel value encoded according to the color model.
+ * @throws ArrayIndexOutOfBounds
+ * @throws ClassCastException
+ * @since 1.4
+ */
+ public Object getDataElements(float[] components, int offset, Object obj)
{
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
+ return
+ getDataElements(getUnnormalizedComponents(components, offset, null, 0),
+ 0, obj);
}
-
+
public boolean equals(Object obj)
{
if (!(obj instanceof ColorModel)) return false;
diff --git a/libjava/java/awt/image/ComponentColorModel.java b/libjava/java/awt/image/ComponentColorModel.java
index 24d8b8e..2b06532 100644
--- a/libjava/java/awt/image/ComponentColorModel.java
+++ b/libjava/java/awt/image/ComponentColorModel.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
+/* ComponentColorModel.java --
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,9 +38,10 @@ exception statement from your version. */
package java.awt.image;
+import gnu.java.awt.Buffers;
+
import java.awt.Point;
import java.awt.color.ColorSpace;
-import gnu.java.awt.Buffers;
public class ComponentColorModel extends ColorModel
{
@@ -60,6 +62,32 @@ public class ComponentColorModel extends ColorModel
transparency, transferType);
}
+ /**
+ * Construct a new ComponentColorModel.
+ *
+ * This constructor makes all bits of each sample significant, so for a
+ * transferType of DataBuffer.BYTE, the bits per sample is 8, etc. If
+ * both hasAlpha and isAlphaPremultiplied are true, color samples are
+ * assumed to be premultiplied by the alpha component. Transparency may be
+ * one of OPAQUE, BITMASK, or TRANSLUCENT.
+ *
+ * @param colorSpace The colorspace for this color model.
+ * @param hasAlpha True if there is an alpha component.
+ * @param isAlphaPremultiplied True if colors are already multiplied by
+ * alpha.
+ * @param transparency The type of alpha values.
+ * @param transferType Data type of pixel sample values.
+ * @since 1.4
+ */
+ public ComponentColorModel(ColorSpace colorSpace,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied,
+ int transparency, int transferType)
+ {
+ this(colorSpace, null, hasAlpha, isAlphaPremultiplied,
+ transparency, transferType);
+ }
+
public int getRed(int pixel)
{
if (getNumComponents()>1) throw new IllegalArgumentException();
@@ -95,12 +123,6 @@ public class ComponentColorModel extends ColorModel
}
- /* FIXME: Is the values returned from toRGB() in the [0.0, 1.0] or the
- [0.0, 256) range?
-
- we assume it is in the [0.0, 1.0] range along with the
- other color spaces. */
-
/* Note, it's OK to pass a to large array to toRGB(). Extra
elements are ignored. */
diff --git a/libjava/java/awt/image/ComponentSampleModel.java b/libjava/java/awt/image/ComponentSampleModel.java
index c7b08b9..0665f40 100644
--- a/libjava/java/awt/image/ComponentSampleModel.java
+++ b/libjava/java/awt/image/ComponentSampleModel.java
@@ -41,6 +41,21 @@ import gnu.java.awt.Buffers;
/* FIXME: This class does not yet support data type TYPE_SHORT */
/**
+ * ComponentSampleModel supports a flexible organization of pixel samples in
+ * memory, permitting pixel samples to be interleaved by band, by scanline,
+ * and by pixel.
+ *
+ * A DataBuffer for this sample model has K banks of data. Pixels have N
+ * samples, so there are N bands in the DataBuffer. Each band is completely
+ * contained in one bank of data, but a bank may contain more than one band.
+ * Each pixel sample is stored in a single data element.
+ *
+ * Within a bank, each band begins at an offset stored in bandOffsets. The
+ * banks containing the band is given by bankIndices. Within the bank, there
+ * are three dimensions - band, pixel, and scanline. The dimension ordering
+ * is controlled by bandOffset, pixelStride, and scanlineStride, which means
+ * that any combination of interleavings is supported.
+ *
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
public class ComponentSampleModel extends SampleModel
@@ -86,6 +101,7 @@ public class ComponentSampleModel extends SampleModel
this.bandOffsets = bandOffsets;
this.bankIndices = bankIndices;
+ this.numBanks = 0;
for (int b=0; b<bankIndices.length; b++)
this.numBanks = Math.max(this.numBanks, bankIndices[b]+1);
@@ -249,6 +265,18 @@ public class ComponentSampleModel extends SampleModel
}
return outUShort;
+ case DataBuffer.TYPE_SHORT:
+ DataBufferShort inShort = (DataBufferShort) data;
+ short[] outShort = (short[]) obj;
+ if (outShort == null) outShort = new short[numBands];
+
+ for (int b=0; b<numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outShort[b] = inShort.getData(bankIndices[b])[dOffset];
+ }
+ return outShort;
+
case DataBuffer.TYPE_INT:
DataBufferInt inInt = (DataBufferInt) data;
int[] outInt = (int[]) obj;
@@ -260,8 +288,31 @@ public class ComponentSampleModel extends SampleModel
outInt[b] = inInt.getData(bankIndices[b])[dOffset];
}
return outInt;
-
- // FIXME: Fill in the other possible types.
+
+ case DataBuffer.TYPE_FLOAT:
+ DataBufferFloat inFloat = (DataBufferFloat) data;
+ float[] outFloat = (float[]) obj;
+ if (outFloat == null) outFloat = new float[numBands];
+
+ for (int b=0; b<numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outFloat[b] = inFloat.getData(bankIndices[b])[dOffset];
+ }
+ return outFloat;
+
+ case DataBuffer.TYPE_DOUBLE:
+ DataBufferDouble inDouble = (DataBufferDouble) data;
+ double[] outDouble = (double[]) obj;
+ if (outDouble == null) outDouble = new double[numBands];
+
+ for (int b=0; b<numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outDouble[b] = inDouble.getData(bankIndices[b])[dOffset];
+ }
+ return outDouble;
+
default:
throw new IllegalStateException("unknown transfer type " +
getTransferType());
@@ -433,6 +484,16 @@ public class ComponentSampleModel extends SampleModel
return;
}
+ case DataBuffer.TYPE_SHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] in = (short[]) obj;
+
+ for (int b=0; b<numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
case DataBuffer.TYPE_INT:
{
DataBufferInt out = (DataBufferInt) data;
@@ -443,6 +504,26 @@ public class ComponentSampleModel extends SampleModel
return;
}
+ case DataBuffer.TYPE_FLOAT:
+ {
+ DataBufferFloat out = (DataBufferFloat) data;
+ float[] in = (float[]) obj;
+
+ for (int b=0; b<numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
+ case DataBuffer.TYPE_DOUBLE:
+ {
+ DataBufferDouble out = (DataBufferDouble) data;
+ double[] in = (double[]) obj;
+
+ for (int b=0; b<numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
default:
throw new UnsupportedOperationException("transfer type not " +
"implemented");
diff --git a/libjava/java/awt/image/ConvolveOp.java b/libjava/java/awt/image/ConvolveOp.java
new file mode 100644
index 0000000..c793eee
--- /dev/null
+++ b/libjava/java/awt/image/ConvolveOp.java
@@ -0,0 +1,341 @@
+/* Copyright (C) 2004 Free Software Foundation -- ConvolveOp
+
+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. */
+
+/*
+ * Created on Nov 1, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package java.awt.image;
+
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.Arrays;
+
+/**
+ * Convolution filter.
+ *
+ * ConvolveOp convolves the source image with a Kernel to generate a
+ * destination image. This involves multiplying each pixel and its neighbors
+ * with elements in the kernel to compute a new pixel.
+ *
+ * Each band in a Raster is convolved and copied to the destination Raster.
+ *
+ * For BufferedImages, convolution is applied to all components. If the
+ * source is not premultiplied, the data will be premultiplied before
+ * convolving. Premultiplication will be undone if the destination is not
+ * premultiplied. Color conversion will be applied if needed.
+ *
+ * @author jlquinn@optonline.net
+ */
+public class ConvolveOp implements BufferedImageOp, RasterOp
+{
+ /** Edge pixels are set to 0. */
+ public static final int EDGE_ZERO_FILL = 0;
+
+ /** Edge pixels are copied from the source. */
+ public static final int EDGE_NO_OP = 1;
+
+ private Kernel kernel;
+ private int edge;
+ private RenderingHints hints;
+
+ /**
+ * Construct a ConvolveOp.
+ *
+ * The edge condition specifies that pixels outside the area that can be
+ * filtered are either set to 0 or copied from the source image.
+ *
+ * @param kernel The kernel to convolve with.
+ * @param edgeCondition Either EDGE_ZERO_FILL or EDGE_NO_OP.
+ * @param hints Rendering hints for color conversion, or null.
+ */
+ public ConvolveOp(Kernel kernel,
+ int edgeCondition,
+ RenderingHints hints)
+ {
+ this.kernel = kernel;
+ edge = edgeCondition;
+ this.hints = hints;
+ }
+
+ /**
+ * Construct a ConvolveOp.
+ *
+ * The edge condition defaults to EDGE_ZERO_FILL.
+ *
+ * @param kernel The kernel to convolve with.
+ */
+ public ConvolveOp(Kernel kernel)
+ {
+ this.kernel = kernel;
+ edge = EDGE_ZERO_FILL;
+ hints = null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage,
+ * java.awt.image.BufferedImage)
+ */
+ public BufferedImage filter(BufferedImage src, BufferedImage dst)
+ {
+ if (src == dst)
+ throw new IllegalArgumentException();
+
+ if (dst == null)
+ dst = createCompatibleDestImage(src, src.getColorModel());
+
+ // Make sure source image is premultiplied
+ BufferedImage src1 = src;
+ if (!src.isPremultiplied)
+ {
+ src1 = createCompatibleDestImage(src, src.getColorModel());
+ src.copyData(src1.getRaster());
+ src1.coerceData(true);
+ }
+
+ BufferedImage dst1 = dst;
+ if (!src.getColorModel().equals(dst.getColorModel()))
+ dst1 = createCompatibleDestImage(src, src.getColorModel());
+
+ filter(src1.getRaster(), dst1.getRaster());
+
+ if (dst1 != dst)
+ {
+ // Convert between color models.
+ // TODO Check that premultiplied alpha is handled correctly here.
+ Graphics2D gg = dst.createGraphics();
+ gg.setRenderingHints(hints);
+ gg.drawImage(dst1, 0, 0, null);
+ gg.dispose();
+ }
+
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see
+ * java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage,
+ * java.awt.image.ColorModel)
+ */
+ public BufferedImage createCompatibleDestImage(BufferedImage src,
+ ColorModel dstCM)
+ {
+ // FIXME: set properties to those in src
+ return new BufferedImage(dstCM,
+ src.getRaster().createCompatibleWritableRaster(),
+ src.isPremultiplied, null);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getRenderingHints()
+ */
+ public RenderingHints getRenderingHints()
+ {
+ return hints;
+ }
+
+ /**
+ * @return The edge condition.
+ */
+ public int getEdgeCondition()
+ {
+ return edge;
+ }
+
+ /**
+ * @return The convolution kernel.
+ */
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#filter(java.awt.image.Raster,
+ * java.awt.image.WritableRaster)
+ */
+ public WritableRaster filter(Raster src, WritableRaster dest) {
+ if (src.numBands != dest.numBands)
+ throw new ImagingOpException(null);
+ if (src == dest)
+ throw new IllegalArgumentException();
+ if (src.getWidth() < kernel.getWidth() ||
+ src.getHeight() < kernel.getHeight())
+ throw new ImagingOpException(null);
+
+ if (dest == null)
+ dest = createCompatibleDestRaster(src);
+
+ // Deal with bottom edge
+ if (edge == EDGE_ZERO_FILL)
+ {
+ float[] zeros = new float[src.getNumBands() * src.getWidth()
+ * (kernel.getYOrigin() - 1)];
+ Arrays.fill(zeros, 0);
+ dest.setPixels(src.getMinX(), src.getMinY(), src.getWidth(),
+ kernel.getYOrigin() - 1, zeros);
+ }
+ else
+ {
+ float[] vals = new float[src.getNumBands() * src.getWidth()
+ * (kernel.getYOrigin() - 1)];
+ src.getPixels(src.getMinX(), src.getMinY(), src.getWidth(),
+ kernel.getYOrigin() - 1, vals);
+ dest.setPixels(src.getMinX(), src.getMinY(), src.getWidth(),
+ kernel.getYOrigin() - 1, vals);
+ }
+
+ // Handle main section
+ float[] kvals = kernel.getKernelData(null);
+
+ float[] tmp = new float[kernel.getWidth() * kernel.getHeight()];
+ for (int y = src.getMinY() + kernel.getYOrigin();
+ y < src.getMinY() + src.getHeight() - kernel.getYOrigin() / 2; y++)
+ {
+ // Handle unfiltered edge pixels at start of line
+ float[] t1 = new float[(kernel.getXOrigin() - 1) * src.getNumBands()];
+ if (edge == EDGE_ZERO_FILL)
+ Arrays.fill(t1, 0);
+ else
+ src.getPixels(src.getMinX(), y, kernel.getXOrigin() - 1, 1, t1);
+ dest.setPixels(src.getMinX(), y, kernel.getXOrigin() - 1, 1, t1);
+
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ {
+ // FIXME: This needs a much more efficient implementation
+ for (int b = 0; b < src.getNumBands(); b++)
+ {
+ float v = 0;
+ src.getSamples(x, y, kernel.getWidth(), kernel.getHeight(), b, tmp);
+ for (int i=0; i < tmp.length; i++)
+ v += tmp[i] * kvals[i];
+ dest.setSample(x, y, b, v);
+ }
+ }
+
+ // Handle unfiltered edge pixels at end of line
+ float[] t2 = new float[(kernel.getWidth() / 2) * src.getNumBands()];
+ if (edge == EDGE_ZERO_FILL)
+ Arrays.fill(t2, 0);
+ else
+ src.getPixels(src.getMinX() + src.getWidth()
+ - (kernel.getWidth() / 2),
+ y, kernel.getWidth() / 2, 1, t2);
+ dest.setPixels(src.getMinX() + src.getWidth() - (kernel.getWidth() / 2),
+ y, kernel.getWidth() / 2, 1, t2);
+ }
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x< src.getWidth() + src.getMinX(); x++)
+ {
+
+ }
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x< src.getWidth() + src.getMinX(); x++)
+ {
+
+ }
+
+ // Handle top edge
+ if (edge == EDGE_ZERO_FILL)
+ {
+ float[] zeros = new float[src.getNumBands() * src.getWidth() *
+ (kernel.getHeight() / 2)];
+ Arrays.fill(zeros, 0);
+ dest.setPixels(src.getMinX(),
+ src.getHeight() + src.getMinY() - (kernel.getHeight() / 2),
+ src.getWidth(), kernel.getHeight() / 2, zeros);
+ }
+ else
+ {
+ float[] vals = new float[src.getNumBands() * src.getWidth() *
+ (kernel.getHeight() / 2)];
+ src.getPixels(src.getMinX(),
+ src.getHeight() + src.getMinY()
+ - (kernel.getHeight() / 2),
+ src.getWidth(), kernel.getHeight() / 2, vals);
+ dest.setPixels(src.getMinX(),
+ src.getHeight() + src.getMinY()
+ - (kernel.getHeight() / 2),
+ src.getWidth(), kernel.getHeight() / 2, vals);
+ }
+
+ return dest;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
+ */
+ public WritableRaster createCompatibleDestRaster(Raster src)
+ {
+ return src.createCompatibleWritableRaster();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
+ */
+ public Rectangle2D getBounds2D(BufferedImage src)
+ {
+ return src.getRaster().getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
+ */
+ public Rectangle2D getBounds2D(Raster src)
+ {
+ return src.getBounds();
+ }
+
+ /** Return corresponding destination point for source point.
+ *
+ * ConvolveOp will return the value of src unchanged.
+ * @param src The source point.
+ * @param dst The destination point.
+ * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D,
+ * java.awt.geom.Point2D)
+ */
+ public Point2D getPoint2D(Point2D src, Point2D dst)
+ {
+ if (dst == null) return (Point2D)src.clone();
+ dst.setLocation(src);
+ return dst;
+ }
+}
diff --git a/libjava/java/awt/image/CropImageFilter.java b/libjava/java/awt/image/CropImageFilter.java
index c9a170b..a006d26 100644
--- a/libjava/java/awt/image/CropImageFilter.java
+++ b/libjava/java/awt/image/CropImageFilter.java
@@ -1,5 +1,5 @@
/* CropImageFilter.java -- Java class for cropping image filter
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,10 @@ exception statement from your version. */
package java.awt.image;
-import java.util.Hashtable;
import java.awt.Rectangle;
+import java.util.Hashtable;
/**
- * <br>
* Currently this filter does almost nothing and needs to be implemented.
*
* @author C. Brian Jones (cbj@gnu.org)
diff --git a/libjava/java/awt/image/DataBuffer.java b/libjava/java/awt/image/DataBuffer.java
index 967e1a2..b921953 100644
--- a/libjava/java/awt/image/DataBuffer.java
+++ b/libjava/java/awt/image/DataBuffer.java
@@ -45,12 +45,45 @@ package java.awt.image;
*/
public abstract class DataBuffer
{
+ /**
+ * A constant representng a data type that uses <code>byte</code> primitives
+ * as the storage unit.
+ */
public static final int TYPE_BYTE = 0;
+
+ /**
+ * A constant representng a data type that uses <code>short</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_USHORT = 1;
+
+ /**
+ * A constant representng a data type that uses <code>short</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_SHORT = 2;
+
+ /**
+ * A constant representng a data type that uses <code>int</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_INT = 3;
+
+ /**
+ * A constant representng a data type that uses <code>float</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_FLOAT = 4;
+
+ /**
+ * A constant representng a data type that uses <code>double</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_DOUBLE = 5;
+
+ /**
+ * A constant representng an undefined data type.
+ */
public static final int TYPE_UNDEFINED = 32;
/** The type of the data elements stored in the data buffer. */
@@ -68,18 +101,57 @@ public abstract class DataBuffer
/** Offset into each bank. */
protected int[] offsets;
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type and
+ * size. The <code>dataType</code> should be one of the constants
+ * {@link #TYPE_BYTE}, {@link #TYPE_SHORT}, {@link #TYPE_USHORT},
+ * {@link #TYPE_INT}, {@link #TYPE_FLOAT} and {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ */
protected DataBuffer(int dataType, int size)
{
this.dataType = dataType;
this.size = size;
}
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type,
+ * size and number of banks. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ * @param numBanks the number of data banks.
+ */
protected DataBuffer(int dataType, int size, int numBanks) {
this(dataType, size);
banks = numBanks;
offsets = new int[numBanks];
}
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type,
+ * size and number of banks. An offset (which applies to all banks) is
+ * also specified. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ * @param numBanks the number of data banks.
+ * @param offset the offset to the first element for all banks.
+ */
protected DataBuffer(int dataType, int size, int numBanks, int offset) {
this(dataType, size, numBanks);
@@ -88,6 +160,24 @@ public abstract class DataBuffer
this.offset = offset;
}
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type,
+ * size and number of banks. An offset (which applies to all banks) is
+ * also specified. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ * @param numBanks the number of data banks.
+ * @param offsets the offsets to the first element for all banks.
+ *
+ * @throws ArrayIndexOutOfBoundsException if
+ * <code>numBanks != offsets.length</code>.
+ */
protected DataBuffer(int dataType, int size, int numBanks, int[] offsets) {
this(dataType, size);
if (numBanks != offsets.length)
@@ -99,6 +189,17 @@ public abstract class DataBuffer
offset = offsets[0];
}
+ /**
+ * Returns the size (number of bits) of the specified data type. Valid types
+ * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ *
+ * @param dataType the data type.
+ * @return The number of bits for the specified data type.
+ * @throws IllegalArgumentException if <code>dataType < 0</code> or
+ * <code>dataType > TYPE_DOUBLE</code>.
+ */
public static int getDataTypeSize(int dataType) {
// Maybe this should be a lookup table instead.
switch (dataType)
@@ -118,21 +219,45 @@ public abstract class DataBuffer
}
}
+ /**
+ * Returns the type of the data elements in the data buffer. Valid types
+ * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ *
+ * @return The type.
+ */
public int getDataType()
{
return dataType;
}
+ /**
+ * Returns the size of the data buffer.
+ *
+ * @return The size.
+ */
public int getSize()
{
return size;
}
+ /**
+ * Returns the element offset for the first data bank.
+ *
+ * @return The element offset.
+ */
public int getOffset()
{
return offset;
}
+ /**
+ * Returns the offsets for all the data banks used by this
+ * <code>DataBuffer</code>.
+ *
+ * @return The offsets.
+ */
public int[] getOffsets()
{
if (offsets == null)
@@ -144,60 +269,166 @@ public abstract class DataBuffer
return offsets;
}
+ /**
+ * Returns the number of data banks for this <code>DataBuffer</code>.
+ * @return The number of data banks.
+ */
public int getNumBanks()
{
return banks;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return getElem(0, i);
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public abstract int getElem(int bank, int i);
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
setElem(0, i, val);
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public abstract void setElem(int bank, int i, int val);
+ /**
+ * Returns an element from the first data bank, converted to a
+ * <code>float</code>. The offset (specified in the constructor) is added
+ * to <code>i</code> before accessing the underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public float getElemFloat(int i)
{
return getElem(i);
}
+ /**
+ * Returns an element from a particular data bank, converted to a
+ * <code>float</code>. The offset (specified in the constructor) is
+ * added to <code>i</code> before accessing the underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public float getElemFloat(int bank, int i)
{
return getElem(bank, i);
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemFloat(int i, float val)
{
setElem(i, (int) val);
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemFloat(int bank, int i, float val)
{
setElem(bank, i, (int) val);
}
+ /**
+ * Returns an element from the first data bank, converted to a
+ * <code>double</code>. The offset (specified in the constructor) is added
+ * to <code>i</code> before accessing the underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public double getElemDouble(int i)
{
return getElem(i);
}
+ /**
+ * Returns an element from a particular data bank, converted to a
+ * <code>double</code>. The offset (specified in the constructor) is
+ * added to <code>i</code> before accessing the underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public double getElemDouble(int bank, int i)
{
return getElem(bank, i);
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemDouble(int i, double val)
{
setElem(i, (int) val);
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemDouble(int bank, int i, double val)
{
setElem(bank, i, (int) val);
diff --git a/libjava/java/awt/image/DataBufferByte.java b/libjava/java/awt/image/DataBufferByte.java
index 84df551..c56be6b 100644
--- a/libjava/java/awt/image/DataBufferByte.java
+++ b/libjava/java/awt/image/DataBufferByte.java
@@ -54,12 +54,27 @@ public final class DataBufferByte extends DataBuffer
private byte[] data;
private byte[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>byte</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferByte(int size)
{
- super(TYPE_BYTE, size);
+ super(TYPE_BYTE, size, 1, 0);
+ bankData = new byte[1][];
data = new byte[size];
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>byte</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferByte(int size, int numBanks)
{
super(TYPE_BYTE, size, numBanks);
@@ -67,18 +82,53 @@ public final class DataBufferByte extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferByte(byte[] dataArray, int size)
{
- super(TYPE_BYTE, size);
+ super(TYPE_BYTE, size, 1, 0);
+ bankData = new byte[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferByte(byte[] dataArray, int size, int offset)
{
super(TYPE_BYTE, size, 1, offset);
+ bankData = new byte[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferByte(byte[][] dataArray, int size)
{
super(TYPE_BYTE, size, dataArray.length);
@@ -86,6 +136,17 @@ public final class DataBufferByte extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferByte(byte[][] dataArray, int size, int[] offsets)
{
super(TYPE_BYTE, size, dataArray.length, offsets);
@@ -93,37 +154,87 @@ public final class DataBufferByte extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public byte[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public byte[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public byte[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset] & 0xff; // get unsigned byte as int
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
// get unsigned byte as int
return bankData[bank][i+offsets[bank]] & 0xff;
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (byte) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (byte) val;
diff --git a/libjava/java/awt/image/DataBufferDouble.java b/libjava/java/awt/image/DataBufferDouble.java
index b1291f4..305cb00 100644
--- a/libjava/java/awt/image/DataBufferDouble.java
+++ b/libjava/java/awt/image/DataBufferDouble.java
@@ -58,12 +58,27 @@ public final class DataBufferDouble
private double[] data;
private double[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>double</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferDouble(int size)
{
- super(TYPE_DOUBLE, size);
+ super(TYPE_DOUBLE, size, 1, 0);
+ bankData = new double[1][];
data = new double[size];
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>double</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferDouble(int size, int numBanks)
{
super(TYPE_DOUBLE, size, numBanks);
@@ -71,18 +86,53 @@ public final class DataBufferDouble
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferDouble(double[] dataArray, int size)
{
- super(TYPE_DOUBLE, size);
+ super(TYPE_DOUBLE, size, 1, 0);
+ bankData = new double[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferDouble(double[] dataArray, int size, int offset)
{
super(TYPE_DOUBLE, size, 1, offset);
+ bankData = new double[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferDouble(double[][] dataArray, int size)
{
super(TYPE_DOUBLE, size, dataArray.length);
@@ -90,6 +140,17 @@ public final class DataBufferDouble
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferDouble(double[][] dataArray, int size, int[] offsets)
{
super(TYPE_DOUBLE, size, dataArray.length, offsets);
@@ -97,36 +158,86 @@ public final class DataBufferDouble
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public double[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public double[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public double[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return (int) data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
return (int) bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (double) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (double) val;
diff --git a/libjava/java/awt/image/DataBufferFloat.java b/libjava/java/awt/image/DataBufferFloat.java
index b2d88c1..9673edd 100644
--- a/libjava/java/awt/image/DataBufferFloat.java
+++ b/libjava/java/awt/image/DataBufferFloat.java
@@ -56,12 +56,27 @@ public final class DataBufferFloat
private float[] data;
private float[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>float</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferFloat(int size)
{
- super(TYPE_FLOAT, size);
+ super(TYPE_FLOAT, size, 1, 0);
+ bankData = new float[1][];
data = new float[size];
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>float</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferFloat(int size, int numBanks)
{
super(TYPE_FLOAT, size, numBanks);
@@ -69,18 +84,53 @@ public final class DataBufferFloat
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferFloat(float[] dataArray, int size)
{
- super(TYPE_FLOAT, size);
+ super(TYPE_FLOAT, size, 1, 0);
+ bankData = new float[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferFloat(float[] dataArray, int size, int offset)
{
super(TYPE_FLOAT, size, 1, offset);
+ bankData = new float[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferFloat(float[][] dataArray, int size)
{
super(TYPE_FLOAT, size, dataArray.length);
@@ -88,6 +138,17 @@ public final class DataBufferFloat
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferFloat(float[][] dataArray, int size, int[] offsets)
{
super(TYPE_FLOAT, size, dataArray.length, offsets);
@@ -95,36 +156,86 @@ public final class DataBufferFloat
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public float[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public float[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public float[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return (int) data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
return (int) bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (float) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (float) val;
diff --git a/libjava/java/awt/image/DataBufferInt.java b/libjava/java/awt/image/DataBufferInt.java
index 54308fe..c5f0853 100644
--- a/libjava/java/awt/image/DataBufferInt.java
+++ b/libjava/java/awt/image/DataBufferInt.java
@@ -54,12 +54,27 @@ public final class DataBufferInt extends DataBuffer
private int[] data;
private int[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>int</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferInt(int size)
{
- super(TYPE_INT, size);
+ super(TYPE_INT, size, 1, 0);
+ bankData = new int[1][];
data = new int[size];
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>int</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferInt(int size, int numBanks)
{
super(TYPE_INT, size, numBanks);
@@ -67,18 +82,53 @@ public final class DataBufferInt extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferInt(int[] dataArray, int size)
{
- super(TYPE_INT, size);
+ super(TYPE_INT, size, 1, 0);
+ bankData = new int[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferInt(int[] dataArray, int size, int offset)
{
super(TYPE_INT, size, 1, offset);
+ bankData = new int[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferInt(int[][] dataArray, int size)
{
super(TYPE_INT, size, dataArray.length);
@@ -86,6 +136,17 @@ public final class DataBufferInt extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferInt(int[][] dataArray, int size, int[] offsets)
{
super(TYPE_INT, size, dataArray.length, offsets);
@@ -93,39 +154,88 @@ public final class DataBufferInt extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public int[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public int[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public int[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The <code>offset</code> is
+ * added to the specified index before accessing the underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The <code>offset</code>
+ * is added to the specified index before accessing the underlying data
+ * array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
// get unsigned int as int
return bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
- data[i+offset] = (int) val;
+ data[i+offset] = val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
- bankData[bank][i+offsets[bank]] = (int) val;
+ bankData[bank][i+offsets[bank]] = val;
}
}
diff --git a/libjava/java/awt/image/DataBufferShort.java b/libjava/java/awt/image/DataBufferShort.java
index 7a5c394..7a095c4 100644
--- a/libjava/java/awt/image/DataBufferShort.java
+++ b/libjava/java/awt/image/DataBufferShort.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2004 Free Software Foundation
+/* DataBufferShort.java --
+ Copyright (C) 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -54,12 +55,27 @@ public final class DataBufferShort extends DataBuffer
private short[] data;
private short[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferShort(int size)
{
- super(TYPE_SHORT, size);
+ super(TYPE_SHORT, size, 1, 0);
+ bankData = new short[1][];
data = new short[size];
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferShort(int size, int numBanks)
{
super(TYPE_SHORT, size, numBanks);
@@ -67,18 +83,53 @@ public final class DataBufferShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferShort(short[] dataArray, int size)
{
- super(TYPE_SHORT, size);
+ super(TYPE_SHORT, size, 1, 0);
+ bankData = new short[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferShort(short[] dataArray, int size, int offset)
{
super(TYPE_SHORT, size, 1, offset);
+ bankData = new short[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferShort(short[][] dataArray, int size)
{
super(TYPE_SHORT, size, dataArray.length);
@@ -86,6 +137,17 @@ public final class DataBufferShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferShort(short[][] dataArray, int size, int[] offsets)
{
super(TYPE_SHORT, size, dataArray.length, offsets);
@@ -93,36 +155,86 @@ public final class DataBufferShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public short[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public short[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public short[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
return bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (short) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (short) val;
diff --git a/libjava/java/awt/image/DataBufferUShort.java b/libjava/java/awt/image/DataBufferUShort.java
index e11b4ab..6efe73d 100644
--- a/libjava/java/awt/image/DataBufferUShort.java
+++ b/libjava/java/awt/image/DataBufferUShort.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* DataBufferUShort.java --
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -54,12 +55,27 @@ public final class DataBufferUShort extends DataBuffer
private short[] data;
private short[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferUShort(int size)
{
- super(TYPE_USHORT, size);
+ super(TYPE_USHORT, size, 1, 0);
+ bankData = new short[1][];
data = new short[size];
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferUShort(int size, int numBanks)
{
super(TYPE_USHORT, size, numBanks);
@@ -67,18 +83,53 @@ public final class DataBufferUShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if dataArray is null
+ */
public DataBufferUShort(short[] dataArray, int size)
{
- super(TYPE_USHORT, size);
+ super(TYPE_USHORT, size, 1, 0);
+ if (dataArray == null)
+ throw new NullPointerException();
+ bankData = new short[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ *
+ * @throws NullPointerException if dataArray is null
+ */
public DataBufferUShort(short[] dataArray, int size, int offset)
{
super(TYPE_USHORT, size, 1, offset);
+ if (dataArray == null)
+ throw new NullPointerException();
+ bankData = new short[1][];
data = dataArray;
+ bankData[0] = data;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferUShort(short[][] dataArray, int size)
{
super(TYPE_USHORT, size, dataArray.length);
@@ -86,6 +137,17 @@ public final class DataBufferUShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferUShort(short[][] dataArray, int size, int[] offsets)
{
super(TYPE_USHORT, size, dataArray.length, offsets);
@@ -93,37 +155,87 @@ public final class DataBufferUShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public short[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public short[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public short[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset] & 0xffff; // get unsigned short as int
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
// get unsigned short as int
return bankData[bank][i+offsets[bank]] & 0xffff;
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (short) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (short) val;
diff --git a/libjava/java/awt/image/DirectColorModel.java b/libjava/java/awt/image/DirectColorModel.java
index 3ac43cf..b1aa6c0 100644
--- a/libjava/java/awt/image/DirectColorModel.java
+++ b/libjava/java/awt/image/DirectColorModel.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* DirectColorModel.java --
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,13 +38,14 @@ exception statement from your version. */
package java.awt.image;
+import gnu.java.awt.Buffers;
+
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import gnu.java.awt.Buffers;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
* @author C. Brian Jones (cbj@gnu.org)
* @author Mark Benvenuto (mcb54@columbia.edu)
*/
@@ -56,7 +58,7 @@ public class DirectColorModel extends PackedColorModel
* most likely order of alpha, red, green, blue from the most significant
* byte to the least significant byte.
*
- * @param bits the number of bits wide used for bit size of pixel values
+ * @param pixelBits the number of bits wide used for bit size of pixel values
* @param rmask the bits describing the red component of a pixel
* @param gmask the bits describing the green component of a pixel
* @param bmask the bits describing the blue component of a pixel
@@ -77,7 +79,7 @@ public class DirectColorModel extends PackedColorModel
* most likely order of red, green, blue from the most significant
* byte to the least significant byte.
*
- * @param bits the number of bits wide used for bit size of pixel values
+ * @param pixelBits the number of bits wide used for bit size of pixel values
* @param rmask the bits describing the red component of a pixel
* @param gmask the bits describing the green component of a pixel
* @param bmask the bits describing the blue component of a pixel
@@ -162,7 +164,7 @@ public class DirectColorModel extends PackedColorModel
return extractAndScaleSample(pixel, 3);
}
- private final int extractAndNormalizeSample(int pixel, int component)
+ private int extractAndNormalizeSample(int pixel, int component)
{
int value = extractAndScaleSample(pixel, component);
if (hasAlpha() && isAlphaPremultiplied())
@@ -170,7 +172,7 @@ public class DirectColorModel extends PackedColorModel
return value;
}
- private final int extractAndScaleSample(int pixel, int component)
+ private int extractAndScaleSample(int pixel, int component)
{
int field = pixel & getMask(component);
int to8BitShift =
@@ -303,7 +305,7 @@ public class DirectColorModel extends PackedColorModel
* @param highBit the position of the most significant bit in the
* val parameter.
*/
- private final int valueToField(int val, int component, int highBit)
+ private int valueToField(int val, int component, int highBit)
{
int toFieldShift =
getComponentSize(component) + shifts[component] - highBit;
@@ -317,7 +319,7 @@ public class DirectColorModel extends PackedColorModel
* Converts a 16 bit value to the correct field bits based on the
* information derived from the field masks.
*/
- private final int value16ToField(int val, int component)
+ private int value16ToField(int val, int component)
{
int toFieldShift = getComponentSize(component) + shifts[component] - 16;
return (toFieldShift>0) ?
diff --git a/libjava/java/awt/image/IndexColorModel.java b/libjava/java/awt/image/IndexColorModel.java
index 9ceb0bf..6791589 100644
--- a/libjava/java/awt/image/IndexColorModel.java
+++ b/libjava/java/awt/image/IndexColorModel.java
@@ -38,7 +38,29 @@ exception statement from your version. */
package java.awt.image;
+import java.awt.color.ColorSpace;
+import java.math.BigInteger;
+
/**
+ * Color model similar to pseudo visual in X11.
+ *
+ * This color model maps linear pixel values to actual RGB and alpha colors.
+ * Thus, pixel values are indexes into the color map. Each color component is
+ * an 8-bit unsigned value.
+ *
+ * The IndexColorModel supports a map of valid pixels, allowing the
+ * representation of holes in the the color map. The valid map is represented
+ * as a BigInteger where each bit indicates the validity of the map entry with
+ * the same index.
+ *
+ * Colors can have alpha components for transparency support. If alpha
+ * component values aren't given, color values are opaque. The model also
+ * supports a reserved pixel value to represent completely transparent colors,
+ * no matter what the actual color component values are.
+ *
+ * IndexColorModel supports anywhere from 1 to 16 bit index values. The
+ * allowed transfer types are DataBuffer.TYPE_BYTE and DataBuffer.TYPE_USHORT.
+ *
* @author C. Brian Jones (cbj@gnu.org)
*/
public class IndexColorModel extends ColorModel
@@ -47,6 +69,7 @@ public class IndexColorModel extends ColorModel
private boolean opaque;
private int trans = -1;
private int[] rgb;
+ private BigInteger validBits = BigInteger.ZERO;
/**
* Each array much contain <code>size</code> elements. For each
@@ -127,6 +150,9 @@ public class IndexColorModel extends ColorModel
| (blues[i] & 0xff));
}
}
+
+ // Generate a bigint with 1's for every pixel
+ validBits = validBits.setBit(size).subtract(BigInteger.ONE);
}
/**
@@ -140,6 +166,7 @@ public class IndexColorModel extends ColorModel
* @param cmap packed color components
* @param start the offset of the first color component in <code>cmap</code>
* @param hasAlpha <code>cmap</code> has alpha values
+ * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
*/
public IndexColorModel (int bits, int size, byte[] cmap, int start,
boolean hasAlpha)
@@ -148,25 +175,155 @@ public class IndexColorModel extends ColorModel
}
/**
- * Each array much contain <code>size</code> elements. For each
- * array, the i-th color is described by reds[i], greens[i],
- * blues[i], alphas[i], unless alphas is not specified, then all the
- * colors are opaque except for the transparent color.
- *
+ * Construct an IndexColorModel from an array of red, green, blue, and
+ * optional alpha components. The component values are interleaved as RGB(A).
+ *
* @param bits the number of bits needed to represent <code>size</code> colors
* @param size the number of colors in the color map
- * @param cmap packed color components
+ * @param cmap interleaved color components
* @param start the offset of the first color component in <code>cmap</code>
* @param hasAlpha <code>cmap</code> has alpha values
* @param trans the index of the transparent color
+ * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
*/
public IndexColorModel (int bits, int size, byte[] cmap, int start,
boolean hasAlpha, int trans)
{
super (bits);
+ if (bits > 16)
+ throw new IllegalArgumentException("bits > 16");
+ if (size < 1)
+ throw new IllegalArgumentException("size < 1");
+ map_size = size;
+ opaque = !hasAlpha;
+ this.trans = trans;
+
+ rgb = new int[size];
+ if (hasAlpha)
+ {
+ for (int i = 0; i < size; i++)
+ rgb[i] =
+ // alpha
+ ((cmap[4 * i + 3 + start] & 0xff) << 24
+ // red
+ | ((cmap[4 * i + start] & 0xff) << 16)
+ // green
+ | ((cmap[4 * i + 1 + start] & 0xff) << 8)
+ // blue
+ | (cmap[4 * i + 2 + start] & 0xff));
+ }
+ else
+ {
+ for (int i = 0; i < size; i++)
+ rgb[i] = (0xff000000
+ // red
+ | ((cmap[3 * i + start] & 0xff) << 16)
+ // green
+ | ((cmap[3 * i + 1 + start] & 0xff) << 8)
+ // blue
+ | (cmap[3 * i + 2 + start] & 0xff));
+ }
+
+ // Generate a bigint with 1's for every pixel
+ validBits = validBits.setBit(size).subtract(BigInteger.ONE);
+ }
+
+ /**
+ * Construct an IndexColorModel from an array of <code>size</code> packed
+ * colors. Each int element contains 8-bit red, green, blue, and optional
+ * alpha values packed in order. If hasAlpha is false, then all the colors
+ * are opaque except for the transparent color.
+ *
+ * @param bits the number of bits needed to represent <code>size</code> colors
+ * @param size the number of colors in the color map
+ * @param cmap packed color components
+ * @param start the offset of the first color component in <code>cmap</code>
+ * @param hasAlpha <code>cmap</code> has alpha values
+ * @param trans the index of the transparent color
+ * @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
+ * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
+ * @throws IllegalArgumentException if transferType is something other than
+ * TYPE_BYTE or TYPE_USHORT.
+ */
+ public IndexColorModel (int bits, int size, int[] cmap, int start,
+ boolean hasAlpha, int trans, int transferType)
+ {
+ super(bits * 4, // total bits, sRGB, four channels
+ nArray(bits, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT, transferType);
+ if (transferType != DataBuffer.TYPE_BYTE
+ && transferType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException();
+ if (bits > 16)
+ throw new IllegalArgumentException("bits > 16");
+ if (size < 1)
+ throw new IllegalArgumentException("size < 1");
map_size = size;
opaque = !hasAlpha;
this.trans = trans;
+
+ rgb = new int[size];
+ if (!hasAlpha)
+ for (int i = 0; i < size; i++)
+ rgb[i] = cmap[i + start] | 0xff000000;
+ else
+ System.arraycopy(cmap, start, rgb, 0, size);
+
+ // Generate a bigint with 1's for every pixel
+ validBits = validBits.setBit(size).subtract(BigInteger.ONE);
+ }
+
+ /**
+ * Construct an IndexColorModel using a colormap with holes.
+ *
+ * The IndexColorModel is built from the array of ints defining the
+ * colormap. Each element contains red, green, blue, and alpha
+ * components. The ColorSpace is sRGB. The transparency value is
+ * automatically determined.
+ *
+ * This constructor permits indicating which colormap entries are valid,
+ * using the validBits argument. Each entry in cmap is valid if the
+ * corresponding bit in validBits is set.
+ *
+ * @param bits the number of bits needed to represent <code>size</code> colors
+ * @param size the number of colors in the color map
+ * @param cmap packed color components
+ * @param start the offset of the first color component in <code>cmap</code>
+ * @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
+ * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
+ * @throws IllegalArgumentException if transferType is something other than
+ * TYPE_BYTE or TYPE_USHORT.
+ */
+ public IndexColorModel (int bits, int size, int[] cmap, int start,
+ int transferType, BigInteger validBits)
+ {
+ super(bits * 4, // total bits, sRGB, four channels
+ nArray(bits, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT, transferType);
+ if (transferType != DataBuffer.TYPE_BYTE
+ && transferType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException();
+ if (bits > 16)
+ throw new IllegalArgumentException("bits > 16");
+ if (size < 1)
+ throw new IllegalArgumentException("size < 1");
+ map_size = size;
+ opaque = false;
+ this.trans = -1;
+ this.validBits = validBits;
+
+ rgb = new int[size];
+ if (!hasAlpha)
+ for (int i = 0; i < size; i++)
+ rgb[i] = cmap[i + start] | 0xff000000;
+ else
+ System.arraycopy(cmap, start, rgb, 0, size);
}
public final int getMapSize ()
@@ -279,11 +436,79 @@ public class IndexColorModel extends ColorModel
return 0;
}
- //pixel_bits is number of bits to be in generated mask
+ /**
+ * Get the RGB color values of all pixels in the map using the default
+ * RGB color model.
+ *
+ * @param rgb The destination array.
+ */
+ public final void getRGBs (int[] rgb)
+ {
+ System.arraycopy(this.rgb, 0, rgb, 0, map_size);
+ }
+
+ //pixel_bits is number of bits to be in generated mask
private int generateMask (int offset)
{
return (((2 << pixel_bits ) - 1) << (pixel_bits * offset));
}
+ /** Return true if pixel is valid, false otherwise. */
+ public boolean isValid(int pixel)
+ {
+ return validBits.testBit(pixel);
+ }
+
+ /** Return true if all pixels are valid, false otherwise. */
+ public boolean isValid()
+ {
+ // Generate a bigint with 1's for every pixel
+ BigInteger allbits = new BigInteger("0");
+ allbits.setBit(map_size);
+ allbits.subtract(new BigInteger("1"));
+ return allbits.equals(validBits);
+ }
+
+ /**
+ * Returns a BigInteger where each bit represents an entry in the color
+ * model. If the bit is on, the entry is valid.
+ */
+ public BigInteger getValidPixels()
+ {
+ return validBits;
+ }
+
+ /**
+ * Construct a BufferedImage with rgb pixel values from a Raster.
+ *
+ * Constructs a new BufferedImage in which each pixel is an RGBA int from
+ * a Raster with index-valued pixels. If this model has no alpha component
+ * or transparent pixel, the type of the new BufferedImage is TYPE_INT_RGB.
+ * Otherwise the type is TYPE_INT_ARGB. If forceARGB is true, the type is
+ * forced to be TYPE_INT_ARGB no matter what.
+ *
+ * @param raster The source of pixel values.
+ * @param forceARGB True if type must be TYPE_INT_ARGB.
+ * @return New BufferedImage with RBGA int pixel values.
+ */
+ public BufferedImage convertToIntDiscrete(Raster raster, boolean forceARGB)
+ {
+ int type = forceARGB ? BufferedImage.TYPE_INT_ARGB
+ : ((opaque && trans == -1) ? BufferedImage.TYPE_INT_RGB :
+ BufferedImage.TYPE_INT_ARGB);
+
+ // FIXME: assuming that raster has only 1 band since pixels are supposed
+ // to be int indexes.
+ // FIXME: it would likely be more efficient to fetch a complete array,
+ // but it would take much more memory.
+ // FIXME: I'm not sure if transparent pixels or alpha values need special
+ // handling here.
+ BufferedImage im = new BufferedImage(raster.width, raster.height, type);
+ for (int x = raster.minX; x < raster.width + raster.minX; x++)
+ for (int y = raster.minY; y < raster.height + raster.minY; y++)
+ im.setRGB(x, y, rgb[raster.getSample(x, y, 0)]);
+
+ return im;
+ }
}
diff --git a/libjava/java/awt/image/LookupOp.java b/libjava/java/awt/image/LookupOp.java
new file mode 100644
index 0000000..523aba4
--- /dev/null
+++ b/libjava/java/awt/image/LookupOp.java
@@ -0,0 +1,252 @@
+/* LookupOp.java -- Filter that converts each pixel using a lookup table.
+ Copyright (C) 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 java.awt.image;
+
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * LookupOp is a filter that converts each pixel using a lookup table.
+ *
+ * For filtering Rasters, the lookup table must have either one component
+ * that is applied to all bands, or one component for every band in the
+ * Rasters.
+ *
+ * For BufferedImages, the lookup table may apply to both color and alpha
+ * components. If the lookup table contains one component, or if there are
+ * the same number of components as color components in the source, the table
+ * applies to all color components. Otherwise the table applies to all
+ * components including alpha. Alpha premultiplication is ignored during the
+ * lookup filtering.
+ *
+ * After filtering, if color conversion is necessary, the conversion happens,
+ * taking alpha premultiplication into account.
+ *
+ * @author jlquinn
+ */
+public class LookupOp implements BufferedImageOp, RasterOp
+{
+ private LookupTable lut;
+ private RenderingHints hints;
+
+ /** Construct a new LookupOp.
+ *
+ * @param lookup LookupTable to use.
+ * @param hints Rendering hints (can be null).
+ */
+ public LookupOp(LookupTable lookup, RenderingHints hints)
+ {
+ lut = lookup;
+ this.hints = hints;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
+ */
+ public BufferedImage filter(BufferedImage src, BufferedImage dst)
+ {
+ if (src.getColorModel() instanceof IndexColorModel)
+ throw new IllegalArgumentException("LookupOp.filter: IndexColorModel "
+ + "not allowed");
+ if (dst == null)
+ dst = createCompatibleDestImage(src, src.getColorModel());
+
+ // Set up for potential colormodel mismatch
+ BufferedImage tgt;
+ if (dst.getColorModel().equals(src.getColorModel()))
+ tgt = dst;
+ else
+ tgt = createCompatibleDestImage(src, src.getColorModel());
+
+ Raster sr = src.getRaster();
+ WritableRaster dr = tgt.getRaster();
+
+ if (src.getColorModel().hasAlpha() &&
+ (lut.getNumComponents() == 1 ||
+ lut.getNumComponents() == src.getColorModel().getNumColorComponents()))
+ {
+ // Need to ignore alpha for lookup
+ int[] dbuf = new int[src.getColorModel().getNumComponents()];
+ int tmpBands = src.getColorModel().getNumColorComponents();
+ int[] tmp = new int[tmpBands];
+
+ // Filter the pixels
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ {
+ // Filter only color components, but also copy alpha
+ sr.getPixel(x, y, dbuf);
+ System.arraycopy(dbuf, 0, tmp, 0, tmpBands);
+ dr.setPixel(x, y, lut.lookupPixel(tmp, dbuf));
+ }
+ }
+ else if (lut.getNumComponents() != 1
+ &&
+ lut.getNumComponents() != src.getColorModel().getNumComponents())
+ throw new IllegalArgumentException("LookupOp.filter: "
+ + "Incompatible lookup "
+ + "table and source image");
+
+ // No alpha to ignore
+ int[] dbuf = new int[src.getColorModel().getNumComponents()];
+
+ // Filter the pixels
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ dr.setPixel(x, y, lut.lookupPixel(sr.getPixel(x, y, dbuf), dbuf));
+
+ if (tgt != dst)
+ {
+ // Convert between color models.
+ // TODO Check that premultiplied alpha is handled correctly here.
+ Graphics2D gg = dst.createGraphics();
+ gg.setRenderingHints(hints);
+ gg.drawImage(tgt, 0, 0, null);
+ gg.dispose();
+ }
+
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
+ */
+ public Rectangle2D getBounds2D(BufferedImage src)
+ {
+ return src.getRaster().getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
+ */
+ public BufferedImage createCompatibleDestImage(BufferedImage src,
+ ColorModel dstCM)
+ {
+ // FIXME: set properties to those in src
+ return new BufferedImage(dstCM,
+ src.getRaster().createCompatibleWritableRaster(),
+ src.isPremultiplied, null);
+ }
+
+ /** Return corresponding destination point for source point.
+ *
+ * LookupOp will return the value of src unchanged.
+ * @param src The source point.
+ * @param dst The destination point.
+ * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
+ */
+ public Point2D getPoint2D(Point2D src, Point2D dst)
+ {
+ if (dst == null)
+ return (Point2D) src.clone();
+
+ dst.setLocation(src);
+ return dst;
+ }
+
+ /** Return the LookupTable for this op. */
+ public LookupTable getTable()
+ {
+ return lut;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getRenderingHints()
+ */
+ public RenderingHints getRenderingHints()
+ {
+ return hints;
+ }
+
+ /** Filter a raster through a lookup table.
+ *
+ * Applies the lookup table for this Rasterop to each pixel of src and
+ * puts the results in dest. If dest is null, a new Raster is created and
+ * returned.
+ *
+ * @param src The source raster.
+ * @param dest The destination raster.
+ * @return The WritableRaster with the filtered pixels.
+ * @throws IllegalArgumentException if lookup table has more than one
+ * component but not the same as src and dest.
+ * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
+ */
+ public WritableRaster filter(Raster src, WritableRaster dest)
+ {
+ if (dest == null)
+ // Allocate a raster if needed
+ dest = createCompatibleDestRaster(src);
+ else
+ if (src.getNumBands() != dest.getNumBands())
+ throw new IllegalArgumentException();
+
+ if (lut.getNumComponents() != 1
+ && lut.getNumComponents() != src.getNumBands())
+ throw new IllegalArgumentException();
+
+
+ // Allocate pixel storage.
+ int[] tmp = new int[src.getNumBands()];
+
+ // Filter the pixels
+ for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
+ for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
+ dest.setPixel(x, y, lut.lookupPixel(src.getPixel(x, y, tmp), tmp));
+ return dest;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
+ */
+ public Rectangle2D getBounds2D(Raster src)
+ {
+ return src.getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
+ */
+ public WritableRaster createCompatibleDestRaster(Raster src)
+ {
+ return src.createCompatibleWritableRaster();
+ }
+
+}
diff --git a/libjava/java/awt/image/MemoryImageSource.java b/libjava/java/awt/image/MemoryImageSource.java
index ddd5800..07e42cf 100644
--- a/libjava/java/awt/image/MemoryImageSource.java
+++ b/libjava/java/awt/image/MemoryImageSource.java
@@ -1,5 +1,5 @@
/* MemoryImageSource.java -- Java class for providing image data
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.awt.image;
-import java.awt.Image;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
@@ -54,8 +52,16 @@ public class MemoryImageSource implements ImageProducer
private Vector consumers = new Vector();
/**
- Constructs an ImageProducer from memory
- */
+ * 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)
{
@@ -75,12 +81,19 @@ public class MemoryImageSource implements ImageProducer
scansize = scan;
this.props = props;
int max = (( scansize > width ) ? scansize : width );
- pixelb = new byte[ max * height ];
- System.arraycopy( pix, 0, pixelb, 0, max * height );
+ pixelb = pix;
}
/**
- Constructs an ImageProducer from memory
- */
+ * 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)
{
@@ -101,8 +114,7 @@ public class MemoryImageSource implements ImageProducer
scansize = scan;
this.props = props;
int max = (( scansize > width ) ? scansize : width );
- pixeli = new int[ max * height ];
- System.arraycopy( pix, 0, pixeli, 0, max * height );
+ pixeli = pix;
}
/**
Constructs an ImageProducer from memory using the default RGB ColorModel
@@ -166,9 +178,12 @@ public class MemoryImageSource implements ImageProducer
Vector list = (Vector) consumers.clone();
for(int i = 0; i < list.size(); i++) {
ic = (ImageConsumer) list.elementAt(i);
- sendPicture( ic );
- ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
- }
+ sendPicture( ic );
+ if (animated)
+ ic.imageComplete( ImageConsumer.SINGLEFRAME );
+ else
+ ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
+ }
}
/**
@@ -261,13 +276,14 @@ public class MemoryImageSource implements ImageProducer
}
if( pixeli != null ) {
int[] pixelbuf = new int[w * h];
- for (int row = y; row < h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, row * w, w);
+ 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 < h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, row * w, w);
+ 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 );
@@ -306,13 +322,13 @@ public class MemoryImageSource implements ImageProducer
}
if( pixeli != null ) {
int[] pixelbuf = new int[w * h];
- for (int row = y; row < h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset, pixelbuf, row * w, w);
+ 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 < h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset, pixelbuf, row * w, w);
+ 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 )
diff --git a/libjava/java/awt/image/MultiPixelPackedSampleModel.java b/libjava/java/awt/image/MultiPixelPackedSampleModel.java
new file mode 100644
index 0000000..0525d37
--- /dev/null
+++ b/libjava/java/awt/image/MultiPixelPackedSampleModel.java
@@ -0,0 +1,387 @@
+/* Copyright (C) 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 java.awt.image;
+
+import gnu.java.awt.Buffers;
+
+/**
+ * MultiPixelPackedSampleModel provides a single band model that supports
+ * multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
+ * per data element.
+ *
+ * @author Jerry Quinn <jlquinn@optonline.net>
+ */
+public class MultiPixelPackedSampleModel extends SampleModel
+{
+ private int scanlineStride;
+ private int[] bitMasks;
+ private int[] bitOffsets;
+ private int[] sampleSize;
+ private int dataBitOffset;
+ private int elemBits;
+ private int numberOfBits;
+ private int numElems;
+
+ public MultiPixelPackedSampleModel(int dataType, int w, int h,
+ int numberOfBits)
+ {
+ this(dataType, w, h, 0, numberOfBits, 0);
+ }
+
+ public MultiPixelPackedSampleModel(int dataType, int w, int h,
+ int numberOfBits, int scanlineStride,
+ int dataBitOffset)
+ {
+ super(dataType, w, h, 1);
+
+ switch (dataType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ elemBits = 8;
+ break;
+ case DataBuffer.TYPE_USHORT:
+ elemBits = 16;
+ break;
+ case DataBuffer.TYPE_INT:
+ elemBits = 32;
+ break;
+ default:
+ throw new IllegalArgumentException("MultiPixelPackedSampleModel"
+ + " unsupported dataType");
+ }
+
+ this.dataBitOffset = dataBitOffset;
+
+ this.numberOfBits = numberOfBits;
+ if (numberOfBits > elemBits)
+ throw new RasterFormatException("MultiPixelPackedSampleModel pixel size"
+ + " larger than dataType");
+ switch (numberOfBits)
+ {
+ case 1: case 2: case 4: case 8: case 16: case 32: break;
+ default:
+ throw new RasterFormatException("MultiPixelPackedSampleModel pixel"
+ + " size not 2^n bits");
+ }
+ numElems = elemBits / numberOfBits;
+
+ // Compute scan line large enough for w pixels.
+ if (scanlineStride == 0)
+ scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits) + 1;
+ this.scanlineStride = scanlineStride;
+
+
+ sampleSize = new int[1];
+ sampleSize[0] = numberOfBits;
+
+ bitMasks = new int[numElems];
+ bitOffsets = new int[numElems];
+ for (int i=0; i < numElems; i++)
+ {
+ bitOffsets[i] = numberOfBits * i;
+ bitMasks[i] = ((1 << numberOfBits) - 1) << bitOffsets[i];
+ }
+ }
+
+ public SampleModel createCompatibleSampleModel(int w, int h)
+ {
+ /* FIXME: We can avoid recalculation of bit offsets and sample
+ sizes here by passing these from the current instance to a
+ special private constructor. */
+ return new MultiPixelPackedSampleModel(dataType, w, h, numberOfBits);
+ }
+
+
+ /**
+ * Creates a DataBuffer for holding pixel data in the format and
+ * layout described by this SampleModel. The returned buffer will
+ * consist of one single bank.
+ */
+ public DataBuffer createDataBuffer()
+ {
+ int size;
+
+ // FIXME: The comment refers to SinglePixelPackedSampleModel. See if the
+ // same can be done for MultiPixelPackedSampleModel.
+ // We can save (scanlineStride - width) pixels at the very end of
+ // the buffer. The Sun reference implementation (J2SE 1.3.1 and
+ // 1.4.1_01) seems to do this; tested with Mauve test code.
+ size = scanlineStride * height;
+
+ return Buffers.createBuffer(getDataType(), size);
+ }
+
+
+ public int getNumDataElements()
+ {
+ return 1;
+ }
+
+ public int[] getSampleSize()
+ {
+ return sampleSize;
+ }
+
+ public int getSampleSize(int band)
+ {
+ return sampleSize[0];
+ }
+
+ public int getOffset(int x, int y)
+ {
+ return scanlineStride * y + ((dataBitOffset + x*numberOfBits) / elemBits);
+ }
+
+ public int getBitOffset(int x)
+ {
+ return (dataBitOffset + x*numberOfBits) % elemBits;
+ }
+
+ public int getDataBitOffset()
+ {
+ return dataBitOffset;
+ }
+
+ public int getScanlineStride()
+ {
+ return scanlineStride;
+ }
+
+ public int getPixelBitStride()
+ {
+ return numberOfBits;
+ }
+
+
+ public SampleModel createSubsetSampleModel(int[] bands)
+ {
+ int numBands = bands.length;
+ if (numBands != 1)
+ throw new RasterFormatException("MultiPixelPackedSampleModel only"
+ + " supports one band");
+
+ return new MultiPixelPackedSampleModel(dataType, width, height,
+ numberOfBits, scanlineStride,
+ dataBitOffset);
+ }
+
+ /**
+ * Extract one pixel and return in an array of transfer type.
+ *
+ * Extracts the pixel at x, y from data and stores into the 0th index of the
+ * array obj, since there is only one band. If obj is null, a new array of
+ * getTransferType() is created.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param obj The primitive array to store the pixels into or null to force creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ * @see java.awt.image.SampleModel#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public Object getDataElements(int x, int y, Object obj,
+ DataBuffer data)
+ {
+ int pixel = getSample(x, y, 0, data);
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ if (obj == null) obj = new byte[1];
+ ((byte[])obj)[0] = (byte)pixel;
+ return obj;
+ case DataBuffer.TYPE_USHORT:
+ if (obj == null) obj = new short[1];
+ ((short[])obj)[0] = (short)pixel;
+ return obj;
+ case DataBuffer.TYPE_INT:
+ if (obj == null) obj = new int[1];
+ ((int[])obj)[0] = pixel;
+ return obj;
+ default:
+ // Seems like the only sensible thing to do.
+ throw new ClassCastException();
+ }
+ }
+
+ public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[1];
+ iArray[0] = getSample(x, y, 0, data);
+
+ return iArray;
+ }
+
+ public int[] getPixels(int x, int y, int w, int h, int[] iArray,
+ DataBuffer data)
+ {
+ int offset = getOffset(x, y);
+ if (iArray == null) iArray = new int[w*h];
+ int outOffset = 0;
+ for (y=0; y<h; y++)
+ {
+ int lineOffset = offset;
+ for (x=0; x<w;)
+ {
+ int samples = data.getElem(lineOffset++);
+ for (int b=0; b<numElems && x<w; b++)
+ {
+ iArray[outOffset++] = (samples & bitMasks[b]) >>> bitOffsets[b];
+ x++;
+ }
+ }
+ offset += scanlineStride;
+ }
+ return iArray;
+ }
+
+ public int getSample(int x, int y, int b, DataBuffer data)
+ {
+ int pos =
+ ((dataBitOffset + x * numberOfBits) % elemBits) / numberOfBits;
+ int offset = getOffset(x, y);
+ int samples = data.getElem(offset);
+ return (samples & bitMasks[pos]) >>> bitOffsets[pos];
+ }
+
+ /**
+ * Set the pixel at x, y to the value in the first element of the primitive
+ * array obj.
+ *
+ * @param x The x-coordinate of the data elements in <code>obj</code>.
+ * @param y The y-coordinate of the data elements in <code>obj</code>.
+ * @param obj The primitive array containing the data elements to set.
+ * @param data The DataBuffer to store the data elements into.
+ * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public void setDataElements(int x, int y, Object obj, DataBuffer data)
+ {
+ int transferType = getTransferType();
+ if (getTransferType() != data.getDataType())
+ {
+ throw new IllegalArgumentException("transfer type ("+
+ getTransferType()+"), "+
+ "does not match data "+
+ "buffer type (" +
+ data.getDataType() +
+ ").");
+ }
+
+ int offset = getOffset(x, y);
+
+ try
+ {
+ switch (transferType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] in = (byte[]) obj;
+ out.getData()[offset] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferUShort out = (DataBufferUShort) data;
+ short[] in = (short[]) obj;
+ out.getData()[offset] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] in = (int[]) obj;
+ out.getData()[offset] = in[0];
+ return;
+ }
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ String msg = "While writing data elements" +
+ ", x="+x+", y="+y+
+ ", width="+width+", height="+height+
+ ", scanlineStride="+scanlineStride+
+ ", offset="+offset+
+ ", data.getSize()="+data.getSize()+
+ ", data.getOffset()="+data.getOffset()+
+ ": " +
+ aioobe;
+ throw new ArrayIndexOutOfBoundsException(msg);
+ }
+ }
+
+ public void setPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ setSample(x, y, 0, iArray[0], data);
+ }
+
+ public void setSample(int x, int y, int b, int s, DataBuffer data)
+ {
+ int bitpos =
+ ((dataBitOffset + x * numberOfBits) % elemBits) / numberOfBits;
+ int offset = getOffset(x, y);
+
+ s = s << bitOffsets[bitpos];
+ s = s & bitMasks[bitpos];
+
+ int sample = data.getElem(offset);
+ sample |= s;
+ data.setElem(offset, sample);
+ }
+
+ /**
+ * Creates a String with some information about this SampleModel.
+ * @return A String describing this SampleModel.
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(getClass().getName());
+ result.append("[");
+ result.append("scanlineStride=").append(scanlineStride);
+ for(int i=0; i < bitMasks.length; i+=1)
+ {
+ result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
+ }
+
+ result.append("]");
+ return result.toString();
+ }
+}
diff --git a/libjava/java/awt/image/PackedColorModel.java b/libjava/java/awt/image/PackedColorModel.java
index 2d8b0e1..1f18cf6 100644
--- a/libjava/java/awt/image/PackedColorModel.java
+++ b/libjava/java/awt/image/PackedColorModel.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,11 +34,13 @@ 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 java.awt.image;
+import gnu.java.awt.BitMaskExtent;
+
import java.awt.Point;
import java.awt.color.ColorSpace;
-import gnu.java.awt.BitMaskExtent;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
diff --git a/libjava/java/awt/image/PixelGrabber.java b/libjava/java/awt/image/PixelGrabber.java
index d6d2403..bcfa050 100644
--- a/libjava/java/awt/image/PixelGrabber.java
+++ b/libjava/java/awt/image/PixelGrabber.java
@@ -1,39 +1,39 @@
/* PixelGrabber.java -- retrieve a subset of an image's data
- Copyright (C) 1999, 2003 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. */
+ 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. */
package java.awt.image;
diff --git a/libjava/java/awt/image/RGBImageFilter.java b/libjava/java/awt/image/RGBImageFilter.java
index 819580e..0fd977e 100644
--- a/libjava/java/awt/image/RGBImageFilter.java
+++ b/libjava/java/awt/image/RGBImageFilter.java
@@ -140,28 +140,19 @@ public abstract class RGBImageFilter extends ImageFilter
@param y the y coordinate of the rectangle
@param w the width of the rectangle
@param h the height of the rectangle
- @param model the <code>ColorModel</code> used to translate the pixels
@param pixels the array of pixel values
@param offset the index of the first pixels in the <code>pixels</code> array
@param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void filterRGBPixels(int x,
- int y,
- int w,
- int h,
- int[] pixels,
- int off,
- int scansize)
+ public void filterRGBPixels(int x, int y, int w, int h, int[] pixels,
+ int offset, int scansize)
{
- int xp, yp, i;
-
- i = 0;
- for( xp = x; xp < ( x + w); xp++ )
- for( yp = y; yp < (y + h); yp++ )
- {
- pixels[i] = filterRGB( xp, yp, pixels[i] );
- i++;
- }
+ for (int xp = x; xp < (x + w); xp++)
+ for (int yp = y; yp < (y + h); yp++)
+ {
+ pixels[offset] = filterRGB(xp, yp, pixels[offset]);
+ offset++;
+ }
}
diff --git a/libjava/java/awt/image/Raster.java b/libjava/java/awt/image/Raster.java
index 4fd194e..0fad4ba 100644
--- a/libjava/java/awt/image/Raster.java
+++ b/libjava/java/awt/image/Raster.java
@@ -128,8 +128,8 @@ public class Raster
int w, int h, int bands,
Point location)
{
- // FIXME: Implement;
- throw new UnsupportedOperationException("not implemented yet");
+ SampleModel sm = new BandedSampleModel(dataType, w, h, bands);
+ return createWritableRaster(sm, location);
}
public static WritableRaster createBandedRaster(int dataType,
@@ -139,8 +139,9 @@ public class Raster
int[] bandOffsets,
Point location)
{
- // FIXME: Implement;
- throw new UnsupportedOperationException("not implemented yet");
+ SampleModel sm = new BandedSampleModel(dataType, w, h, scanlineStride,
+ bankIndices, bandOffsets);
+ return createWritableRaster(sm, location);
}
public static WritableRaster createPackedRaster(int dataType,
@@ -154,6 +155,35 @@ public class Raster
return createWritableRaster(sm, location);
}
+ public static WritableRaster createPackedRaster(int dataType,
+ int w, int h,
+ int bands, int bitsPerBand,
+ Point location)
+ {
+ if (bands <= 0 || (bands * bitsPerBand > getTypeBits(dataType)))
+ throw new IllegalArgumentException();
+
+ SampleModel sm;
+
+ if (bands == 1)
+ sm = new MultiPixelPackedSampleModel(dataType, w, h, bitsPerBand);
+ else
+ {
+ int[] bandMasks = new int[bands];
+ int mask = 0x1;
+ for (int bits = bitsPerBand; --bits != 0;)
+ mask = (mask << 1) | 0x1;
+ for (int i = 0; i < bands; i++)
+ {
+ bandMasks[i] = mask;
+ mask <<= bitsPerBand;
+ }
+
+ sm = new SinglePixelPackedSampleModel(dataType, w, h, bandMasks);
+ }
+ return createWritableRaster(sm, location);
+ }
+
public static WritableRaster
createInterleavedRaster(DataBuffer dataBuffer, int w, int h,
int scanlineStride, int pixelStride,
@@ -175,8 +205,10 @@ public class Raster
int[] bandOffsets,
Point location)
{
- // FIXME: Implement;
- throw new UnsupportedOperationException("not implemented yet");
+ SampleModel sm = new BandedSampleModel(dataBuffer.getDataType(),
+ w, h, scanlineStride,
+ bankIndices, bandOffsets);
+ return createWritableRaster(sm, dataBuffer, location);
}
public static WritableRaster
@@ -184,7 +216,8 @@ public class Raster
int w, int h,
int scanlineStride,
int[] bandMasks,
- Point location) {
+ Point location)
+ {
SampleModel sm =
new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
w, h,
@@ -192,6 +225,19 @@ public class Raster
bandMasks);
return createWritableRaster(sm, dataBuffer, location);
}
+
+ public static WritableRaster
+ createPackedRaster(DataBuffer dataBuffer,
+ int w, int h,
+ int bitsPerPixel,
+ Point location)
+ {
+ SampleModel sm =
+ new MultiPixelPackedSampleModel(dataBuffer.getDataType(),
+ w, h,
+ bitsPerPixel);
+ return createWritableRaster(sm, dataBuffer, location);
+ }
public static Raster createRaster(SampleModel sm, DataBuffer db,
Point location)
@@ -329,6 +375,11 @@ public class Raster
return height;
}
+ public final int getNumBands()
+ {
+ return numBands;
+ }
+
public final int getNumDataElements()
{
return numDataElements;
@@ -472,5 +523,24 @@ public class Raster
return result.toString();
}
-
+
+ // Map from datatype to bits
+ private static int getTypeBits(int dataType)
+ {
+ switch (dataType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ return 8;
+ case DataBuffer.TYPE_USHORT:
+ case DataBuffer.TYPE_SHORT:
+ return 16;
+ case DataBuffer.TYPE_INT:
+ case DataBuffer.TYPE_FLOAT:
+ return 32;
+ case DataBuffer.TYPE_DOUBLE:
+ return 64;
+ default:
+ return 0;
+ }
+ }
}
diff --git a/libjava/java/awt/image/RasterOp.java b/libjava/java/awt/image/RasterOp.java
index 5796180..84d47c1 100644
--- a/libjava/java/awt/image/RasterOp.java
+++ b/libjava/java/awt/image/RasterOp.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,11 +34,12 @@ 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 java.awt.image;
+import java.awt.RenderingHints;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.awt.RenderingHints;
public interface RasterOp {
diff --git a/libjava/java/awt/image/RescaleOp.java b/libjava/java/awt/image/RescaleOp.java
new file mode 100644
index 0000000..cc892b6
--- /dev/null
+++ b/libjava/java/awt/image/RescaleOp.java
@@ -0,0 +1,218 @@
+/* Copyright (C) 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 java.awt.image;
+
+import java.awt.RenderingHints;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.Arrays;
+
+/**
+ * @author Jerry Quinn (jlquinn@optonline.net)
+ */
+public class RescaleOp implements BufferedImageOp, RasterOp
+{
+ private float[] scale;
+ private float[] offsets;
+ private RenderingHints hints = null;
+
+ public RescaleOp(float[] scaleFactors,
+ float[] offsets,
+ RenderingHints hints)
+ {
+ this.scale = scaleFactors;
+ this.offsets = offsets;
+ this.hints = hints;
+ }
+
+ public RescaleOp(float scaleFactor,
+ float offset,
+ RenderingHints hints)
+ {
+ scale = new float[]{ scaleFactor };
+ offsets = new float[]{offset};
+ this.hints = hints;
+ }
+
+ public final float[] getScaleFactors(float[] scaleFactors)
+ {
+ if (scaleFactors == null)
+ scaleFactors = new float[scale.length];
+ System.arraycopy(scale, 0, scaleFactors, 0, scale.length);
+ return scaleFactors;
+ }
+
+ public final float[] getOffsets(float[] offsets)
+ {
+ if (offsets == null)
+ offsets = new float[this.offsets.length];
+ System.arraycopy(this.offsets, 0, offsets, 0, this.offsets.length);
+ return offsets;
+ }
+
+ public final int getNumFactors()
+ {
+ return scale.length;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getRenderingHints()
+ */
+ public RenderingHints getRenderingHints()
+ {
+ return hints;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
+ */
+ public final BufferedImage filter(BufferedImage src, BufferedImage dst)
+ {
+ // TODO Make sure premultiplied alpha is handled correctly.
+ // TODO See that color conversion is handled.
+ // TODO figure out how to use rendering hints.
+ if (scale.length != offsets.length)
+ throw new IllegalArgumentException();
+
+ ColorModel scm = src.getColorModel();
+ if (dst == null) dst = createCompatibleDestImage(src, null);
+
+ WritableRaster wsrc = src.getRaster();
+ WritableRaster wdst = dst.getRaster();
+
+ // Share constant across colors except alpha
+ if (scale.length == 1 || scale.length == scm.getNumColorComponents())
+ {
+ // Construct a raster that doesn't include an alpha band.
+ int[] subbands = new int[scm.getNumColorComponents()];
+ for (int i=0; i < subbands.length; i++) subbands[i] = i;
+ wsrc =
+ wsrc.createWritableChild(wsrc.minX, wsrc.minY, wsrc.width, wsrc.height,
+ wsrc.minX, wsrc.minY, subbands);
+ }
+ // else all color bands
+
+ filter(wsrc, wdst);
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
+ */
+ public final WritableRaster filter(Raster src, WritableRaster dest)
+ {
+ if (dest == null) dest = src.createCompatibleWritableRaster();
+
+ // Required sanity checks
+ if (src.numBands != dest.numBands || scale.length != offsets.length)
+ throw new IllegalArgumentException();
+ if (scale.length != 1 && scale.length != src.numBands)
+ throw new IllegalArgumentException();
+
+ // Create scaling arrays if needed
+ float[] lscale = scale;
+ float[] loff = offsets;
+ if (scale.length == 1)
+ {
+ lscale = new float[src.numBands];
+ Arrays.fill(lscale, scale[0]);
+ loff = new float[src.numBands];
+ Arrays.fill(loff, offsets[0]);
+ }
+
+ // TODO The efficiency here can be improved for various data storage
+ // patterns, aka SampleModels.
+ float[] pixel = new float[src.numBands];
+ for (int y = src.minY; y < src.height + src.minY; y++)
+ for (int x = src.minX; x < src.width + src.minX; x++)
+ {
+ src.getPixel(x, y, pixel);
+ for (int b = 0; b < src.numBands; b++)
+ pixel[b] = pixel[b] * lscale[b] + loff[b];
+ dest.setPixel(x, y, pixel);
+ }
+ return dest;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
+ */
+ public BufferedImage createCompatibleDestImage(BufferedImage src,
+ ColorModel dstCM)
+ {
+ if (dstCM == null) dstCM = src.getColorModel();
+ WritableRaster wr = src.getRaster().createCompatibleWritableRaster();
+ BufferedImage image
+ = new BufferedImage(dstCM, wr, src.isPremultiplied, null);
+ return image;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
+ */
+ public WritableRaster createCompatibleDestRaster(Raster src)
+ {
+ return src.createCompatibleWritableRaster();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
+ */
+ public final Rectangle2D getBounds2D(BufferedImage src)
+ {
+ return src.getRaster().getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
+ */
+ public final Rectangle2D getBounds2D(Raster src)
+ {
+ return src.getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
+ */
+ public final Point2D getPoint2D(Point2D src, Point2D dst) {
+ if (dst == null) dst = (Point2D) src.clone();
+ else dst.setLocation(src);
+ return dst;
+ }
+
+}
diff --git a/libjava/java/awt/image/SampleModel.java b/libjava/java/awt/image/SampleModel.java
index a5d65ff..4e3b38b 100644
--- a/libjava/java/awt/image/SampleModel.java
+++ b/libjava/java/awt/image/SampleModel.java
@@ -456,6 +456,17 @@ public abstract class SampleModel
public abstract SampleModel createCompatibleSampleModel(int w, int h);
+ /**
+ * Return a SampleModel with a subset of the bands in this model.
+ *
+ * Selects bands.length bands from this sample model. The bands chosen
+ * are specified in the indices of bands[]. This also permits permuting
+ * the bands as well as taking a subset. Thus, giving an array with
+ * 1, 2, 3, ..., numbands, will give an identical sample model.
+ *
+ * @param bands Array with band indices to include.
+ * @return A new sample model
+ */
public abstract SampleModel createSubsetSampleModel(int[] bands);
public abstract DataBuffer createDataBuffer();
diff --git a/libjava/java/awt/image/ShortLookupTable.java b/libjava/java/awt/image/ShortLookupTable.java
index 223d03b..36beb1d 100644
--- a/libjava/java/awt/image/ShortLookupTable.java
+++ b/libjava/java/awt/image/ShortLookupTable.java
@@ -61,7 +61,7 @@ public class ShortLookupTable extends LookupTable
*
* @param offset Offset to be subtracted.
* @param data Array of lookup tables.
- * @exception IllegalArgumentException if offset < 0 or data.length < 1.
+ * @exception IllegalArgumentException if offset &lt; 0 or data.length &lt; 1.
*/
public ShortLookupTable(int offset, short[][] data)
throws IllegalArgumentException
@@ -78,7 +78,7 @@ public class ShortLookupTable extends LookupTable
*
* @param offset Offset to be subtracted.
* @param data Lookup table for all components.
- * @exception IllegalArgumentException if offset < 0.
+ * @exception IllegalArgumentException if offset &lt; 0.
*/
public ShortLookupTable(int offset, short[] data)
throws IllegalArgumentException
@@ -107,14 +107,14 @@ public class ShortLookupTable extends LookupTable
* translation arrays.
*
* @param src Component values of a pixel.
- * @param dest Destination array for values, or null.
+ * @param dst Destination array for values, or null.
* @return Translated values for the pixel.
*/
public int[] lookupPixel(int[] src, int[] dst)
throws ArrayIndexOutOfBoundsException
{
if (dst == null)
- dst = new int[numComponents];
+ dst = new int[src.length];
if (data.length == 1)
for (int i=0; i < src.length; i++)
@@ -140,14 +140,14 @@ public class ShortLookupTable extends LookupTable
* translation arrays.
*
* @param src Component values of a pixel.
- * @param dest Destination array for values, or null.
+ * @param dst Destination array for values, or null.
* @return Translated values for the pixel.
*/
public short[] lookupPixel(short[] src, short[] dst)
throws ArrayIndexOutOfBoundsException
{
if (dst == null)
- dst = new short[numComponents];
+ dst = new short[src.length];
if (data.length == 1)
for (int i=0; i < src.length; i++)
diff --git a/libjava/java/awt/image/SinglePixelPackedSampleModel.java b/libjava/java/awt/image/SinglePixelPackedSampleModel.java
index 578500d..94a9537 100644
--- a/libjava/java/awt/image/SinglePixelPackedSampleModel.java
+++ b/libjava/java/awt/image/SinglePixelPackedSampleModel.java
@@ -59,6 +59,16 @@ public class SinglePixelPackedSampleModel extends SampleModel
int scanlineStride, int[] bitMasks)
{
super(dataType, w, h, bitMasks.length);
+
+ switch (dataType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ case DataBuffer.TYPE_USHORT:
+ case DataBuffer.TYPE_INT:
+ break;
+ default:
+ throw new IllegalArgumentException("SinglePixelPackedSampleModel unsupported dataType");
+ }
this.scanlineStride = scanlineStride;
this.bitMasks = bitMasks;
@@ -382,7 +392,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
* @param y The y-coordinate of the pixel rectangle in <code>obj</code>.
* @param w The width of the pixel rectangle in <code>obj</code>.
* @param h The height of the pixel rectangle in <code>obj</code>.
- * @param obj The primitive array containing the pixels to set.
+ * @param iArray The primitive array containing the pixels to set.
* @param data The DataBuffer to store the pixels into.
* @see java.awt.image.SampleModel#setPixels(int, int, int, int, int[], java.awt.image.DataBuffer)
*/
diff --git a/libjava/java/awt/print/Book.java b/libjava/java/awt/print/Book.java
index 19014ba..9bdd7d6 100644
--- a/libjava/java/awt/print/Book.java
+++ b/libjava/java/awt/print/Book.java
@@ -93,7 +93,7 @@ getNumberOfPages()
* This method returns the <code>PageFormat</code> object for the
* specified page.
*
- * @param page_numbers The number of the page to get information for, where
+ * @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.
@@ -112,7 +112,7 @@ getPageFormat(int page_number)
* This method returns the <code>Printable</code> object for the
* specified page.
*
- * @param page_numbers The number of the page to get information for, where
+ * @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.
@@ -155,11 +155,11 @@ append(Printable printable, PageFormat page_format)
* @exception NullPointerException If any argument is <code>null</code>.
*/
public void
-append(Printable painter, PageFormat page_format, int num_pages)
+append(Printable printable, PageFormat page_format, int num_pages)
{
for (int i = 0; i < num_pages; i++)
{
- printables.addElement(painter);
+ printables.addElement(printable);
page_formats.addElement(page_format);
}
}
@@ -175,7 +175,7 @@ append(Printable painter, PageFormat page_format, int num_pages)
* @param printable The new <code>Printable</code> for the page.
* @param page_format The new <code>PageFormat</code> for the page.
*
- * @param IndexOutOfBoundsException If the specified page does not exist.
+ * @throws IndexOutOfBoundsException If the specified page does not exist.
*/
public void
setPage(int page_num, Printable printable, PageFormat page_format)
@@ -183,6 +183,4 @@ setPage(int page_num, Printable printable, PageFormat page_format)
printables.setElementAt(printable, page_num);
page_formats.setElementAt(page_format, page_num);
}
-
-} // class Book
-
+}
diff --git a/libjava/java/awt/print/Printable.java b/libjava/java/awt/print/Printable.java
index fecc01a..3e63211 100644
--- a/libjava/java/awt/print/Printable.java
+++ b/libjava/java/awt/print/Printable.java
@@ -1,5 +1,5 @@
/* Printable.java -- Renders a page to the print device
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,56 +35,46 @@ 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 java.awt.print;
import java.awt.Graphics;
+
/**
- * This interface provides a mechanism for the actual printing of pages to the
- * printer. The object implementing this interface performs the page
- * rendering.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
+ * This interface provides a mechanism for the actual printing of pages to the
+ * printer. The object implementing this interface performs the page
+ * rendering.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public interface Printable
{
-
-/*
- * Static Variables
- */
-
-/**
- * This value is returned by the <code>print()</code> method to indicate
- * that the requested page number does not exist.
- */
-int NO_SUCH_PAGE = 0;
-
-/**
- * This value is returned by the <code>print()</code> method to indicate
- * that the requested page exists and has been printed.
- */
-int PAGE_EXISTS = 1;
-
-/*************************************************************************/
-
-/**
- * This method prints the specified page to the specified graphics
- * context in the specified format. The pages are numbered starting
- * from zero.
- *
- * @param graphics The graphics context to render the pages on.
- * @param format The format in which to print the page.
- * @param page_number The page number to print, where numbers start at zero.
- *
- * @return <code>PAGE_EXISTS</code> if the requested page exists and was
- * successfully printed, <code>NO_SUCH_PAGE</code> otherwise.
- *
- * @exception PrinterException If an error occurs during printing.
- */
-int
-print(Graphics graphics, PageFormat format, int page_number)
- throws PrinterException;
-
-} // interface Printable
-
+ /**
+ * This value is returned by the <code>print()</code> method to indicate
+ * that the requested page exists and has been printed.
+ */
+ int PAGE_EXISTS = 0;
+
+ /**
+ * This value is returned by the <code>print()</code> method to indicate
+ * that the requested page number does not exist.
+ */
+ int NO_SUCH_PAGE = 1;
+
+ /**
+ * This method prints the specified page to the specified graphics
+ * context in the specified format. The pages are numbered starting
+ * from zero.
+ *
+ * @param graphics The graphics context to render the pages on.
+ * @param format The format in which to print the page.
+ * @param page_number The page number to print, where numbers start at zero.
+ *
+ * @return <code>PAGE_EXISTS</code> if the requested page exists and was
+ * successfully printed, <code>NO_SUCH_PAGE</code> otherwise.
+ *
+ * @exception PrinterException If an error occurs during printing.
+ */
+ int print(Graphics graphics, PageFormat format, int page_number)
+ throws PrinterException;
+}
diff --git a/libjava/java/awt/print/PrinterJob.java b/libjava/java/awt/print/PrinterJob.java
index 3ad4567..8998aa0 100644
--- a/libjava/java/awt/print/PrinterJob.java
+++ b/libjava/java/awt/print/PrinterJob.java
@@ -1,5 +1,5 @@
/* PrinterJob.java -- This job is the printer control class
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,219 +38,246 @@ exception statement from your version. */
package java.awt.print;
-/**
- * This class controls printing.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public abstract class PrinterJob
-{
-
-/*
- * Class Methods
- */
-
-/**
- * Creates a new print job.
- *
- * @return A <code>PrinterJob</code> object for the newly created print job.
- */
-public static PrinterJob
-getPrinterJob()
-{
- // FIXME: Need to fix this to load a default implementation instance.
- return(null);
-}
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
+import javax.print.DocFlavor;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+//import javax.print.StreamPrintServiceFactory;
+import javax.print.attribute.PrintRequestAttributeSet;
/**
- * Initializes a new instance of <code>PrinterJob</code>.
- */
-public
-PrinterJob()
-{
- ;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
+ * This class controls printing.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
-
-/**
- * Returns the number of copies to be printed.
- *
- * @return The number of copies to be printed.
- */
-public abstract int
-getCopies();
-
-/*************************************************************************/
-
-/**
- * Sets the number of copies to be printed.
- *
- * @param copies The number of copies to be printed.
- */
-public abstract void setCopies (int copies);
-
-/*************************************************************************/
-
-/**
- * Returns the name of the print job.
- *
- * @return The name of the print job.
- */
-public abstract String
-getJobName();
-
-/*************************************************************************/
-
-/**
- * Sets the name of the print job.
- *
- * @param job_name The name of the print job.
- */
-public abstract void setJobName (String job_name);
-
-/*************************************************************************/
-
-/**
- * Returns the printing user name.
- *
- * @return The printing username.
- */
-public abstract String
-getUserName();
-
-/*************************************************************************/
-
-/**
- * Cancels an in progress print job.
- */
-public abstract void
-cancel();
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this job has been cancelled.
- *
- * @param <code>true</code> if this job has been cancelled, <code>false</code>
- * otherwise.
- */
-public abstract boolean
-isCancelled();
-
-/*************************************************************************/
-
-/**
- * Returns an instance of the default page which will have the default
- * paper and orientation.
- *
- * @return A default instance of <code>PageFormat</code>.
- */
-public PageFormat
-defaultPage()
+public abstract class PrinterJob
{
- return(new PageFormat());
+ // The print service associated with this job
+ private PrintService printer = null;
+
+ /**
+ * Creates a new print job.
+ *
+ * @return A <code>PrinterJob</code> object for the newly created print job.
+ */
+ public static PrinterJob getPrinterJob()
+ {
+ // FIXME: Need to fix this to load a default implementation instance.
+ return null;
+ }
+
+ /**
+ * Initializes a new instance of <code>PrinterJob</code>.
+ */
+ public PrinterJob()
+ {
+ }
+
+ /**
+ * Returns the number of copies to be printed.
+ *
+ * @return The number of copies to be printed.
+ */
+ public abstract int getCopies();
+
+ /**
+ * Sets the number of copies to be printed.
+ *
+ * @param copies The number of copies to be printed.
+ */
+ public abstract void setCopies(int copies);
+
+ /**
+ * Returns the name of the print job.
+ *
+ * @return The name of the print job.
+ */
+ public abstract String getJobName();
+
+ /**
+ * Sets the name of the print job.
+ *
+ * @param job_name The name of the print job.
+ */
+ public abstract void setJobName(String job_name);
+
+ /**
+ * Returns the printing user name.
+ *
+ * @return The printing username.
+ */
+ public abstract String getUserName();
+
+ /**
+ * Cancels an in progress print job.
+ */
+ public abstract void cancel();
+
+ /**
+ * Tests whether or not this job has been cancelled.
+ *
+ * @return <code>true</code> if this job has been cancelled, <code>false</code>
+ * otherwise.
+ */
+ public abstract boolean isCancelled();
+
+ /**
+ * Returns an instance of the default page which will have the default
+ * paper and orientation.
+ *
+ * @return A default instance of <code>PageFormat</code>.
+ */
+ public PageFormat defaultPage()
+ {
+ return new PageFormat();
+ }
+
+ /**
+ * Clones the specified <code>PageFormat</code> object then alters the
+ * clone so that it represents the default page format.
+ *
+ * @param page_format The <code>PageFormat</code> to clone.
+ *
+ * @return A new default page format.
+ */
+ public abstract PageFormat defaultPage(PageFormat page_format);
+
+ /**
+ * Displays a dialog box to the user which allows the page format
+ * attributes to be modified.
+ *
+ * @param page_format The <code>PageFormat</code> object to modify.
+ *
+ * @return The modified <code>PageFormat</code>.
+ */
+ public abstract PageFormat pageDialog(PageFormat page_format);
+
+ /**
+ * Prints the pages.
+ */
+ public abstract void print () throws PrinterException;
+
+ /**
+ * Prints the page with given attributes.
+ */
+ public abstract void print (PrintRequestAttributeSet attributes)
+ throws PrinterException;
+
+ /**
+ * Displays a dialog box to the user which allows the print job
+ * attributes to be modified.
+ *
+ * @return <code>false</code> if the user cancels the dialog box,
+ * <code>true</code> otherwise.
+ */
+ public abstract boolean printDialog();
+
+ /**
+ * Displays a dialog box to the user which allows the print job
+ * attributes to be modified.
+ *
+ * @return <code>false</code> if the user cancels the dialog box,
+ * <code>true</code> otherwise.
+ */
+ public abstract boolean printDialog(PrintRequestAttributeSet attributes);
+
+ /**
+ * This sets the pages that are to be printed.
+ *
+ * @param pageable The pages to be printed, which may not be <code>null</code>.
+ */
+ public abstract void setPageable(Pageable pageable);
+
+ /**
+ * Sets this specified <code>Printable</code> as the one to use for
+ * rendering the pages on the print device.
+ *
+ * @param printable The <code>Printable</code> for the print job.
+ */
+ public abstract void setPrintable(Printable printable);
+
+ /**
+ * Sets the <code>Printable</code> and the page format for the pages
+ * to be printed.
+ *
+ * @param printable The <code>Printable</code> for the print job.
+ * @param page_format The <code>PageFormat</code> for the print job.
+ */
+ public abstract void setPrintable(Printable printable, PageFormat page_format);
+
+ /**
+ * Makes any alterations to the specified <code>PageFormat</code>
+ * necessary to make it work with the current printer. The alterations
+ * are made to a clone of the input object, which is then returned.
+ *
+ * @param page_format The <code>PageFormat</code> to validate.
+ *
+ * @return The validated <code>PageFormat</code>.
+ */
+ public abstract PageFormat validatePage(PageFormat page_format);
+
+ /**
+ * Find and return 2D image print services.
+ *
+ * This is the same as calling PrintServiceLookup.lookupPrintServices()
+ * with Pageable service-specified DocFlavor.
+ * @return Array of PrintService objects, could be empty.
+ * @since 1.4
+ */
+ public static PrintService[] lookupPrintServices()
+ {
+ return new PrintService[0];
+ // FIXME:
+ // Enable this when javax.print has this implemented.
+// return PrintServiceLookup.lookupPrintServices(
+// new DocFlavor("application/x-java-jvm-local-objectref",
+// "java.awt.print.Pageable"),
+// null);
+ }
+
+ /**
+ * Find and return 2D image stream print services.
+ *
+ * This is the same as calling
+ * StreamPrintServiceFactory.lookupStreamPrintServices()
+ * with Pageable service-specified DocFlavor.
+ * @param mimeType The output format mime type, or null for any type.
+ * @return Array of stream print services, could be empty.
+ * @since 1.4
+ */
+ // FIXME:
+ // Enable when javax.print has StreamPrintServiceFactory
+// public static StreamPrintServiceFactory[] lookupStreamPrintServices(String mimeType)
+// {
+// return StreamPrintServiceFactory.lookupStreamServiceFactories(
+// new DocFlavor("application/x-java-jvm-local-objectref",
+// "java.awt.print.Pageable"),
+// mimeType);
+// }
+
+ /**
+ * Return the printer for this job. If print services aren't supported by
+ * the subclass, returns null.
+ *
+ * @return The associated PrintService.
+ * @since 1.4
+ */
+ public PrintService getPrintService()
+ {
+ return null;
+ }
+
+ /**
+ * Change the printer for this print job to service. Subclasses that
+ * support setting the print service override this method. Throws
+ * PrinterException when the class doesn't support setting the printer,
+ * the service doesn't support Pageable or Printable interfaces for 2D
+ * print output.
+ * @param service The new printer to use.
+ * @throws PrinterException if service is not valid.
+ */
+ public void setPrintService(PrintService service)
+ throws PrinterException
+ {
+ throw new PrinterException();
+ }
}
-
-/*************************************************************************/
-
-/**
- * Clones the specified <code>PageFormat</code> object then alters the
- * clone so that it represents the default page format.
- *
- * @param page_format The <code>PageFormat</code> to clone.
- *
- * @return A new default page format.
- */
-public abstract PageFormat
-defaultPage(PageFormat page_format);
-
-/*************************************************************************/
-
-/**
- * Displays a dialog box to the user which allows the page format
- * attributes to be modified.
- *
- * @param page_format The <code>PageFormat</code> object to modify.
- *
- * @return The modified <code>PageFormat</code>.
- */
-public abstract PageFormat
-pageDialog(PageFormat page_format);
-
-/*************************************************************************/
-
-/**
- * Prints the pages.
- */
-public abstract void print () throws PrinterException;
-
-/**
- * Displays a dialog box to the user which allows the print job
- * attributes to be modified.
- *
- * @return <code>false</code> if the user cancels the dialog box,
- * <code>true</code> otherwise.
- */
-public abstract boolean
-printDialog();
-
-/*************************************************************************/
-
-/**
- * This sets the pages that are to be printed.
- *
- * @param pageable The pages to be printed, which may not be <code>null</code>.
- */
-public abstract void
-setPageable(Pageable pageable);
-
-/*************************************************************************/
-
-/**
- * Sets this specified <code>Printable</code> as the one to use for
- * rendering the pages on the print device.
- *
- * @param printable The <code>Printable</code> for the print job.
- */
-public abstract void
-setPrintable(Printable printable);
-
-/*************************************************************************/
-
-/**
- * Sets the <code>Printable</code> and the page format for the pages
- * to be printed.
- *
- * @param printable The <code>Printable</code> for the print job.
- * @param page_format The <code>PageFormat</code> for the print job.
- */
-public abstract void
-setPrintable(Printable printable, PageFormat page_format);
-
-/*************************************************************************/
-
-/**
- * Makes any alterations to the specified <code>PageFormat</code>
- * necessary to make it work with the current printer. The alterations
- * are made to a clone of the input object, which is then returned.
- *
- * @param page_format The <code>PageFormat</code> to validate.
- *
- * @return The validated <code>PageFormat</code>.
- */
-public abstract PageFormat
-validatePage(PageFormat page);
-
-} // class PrinterJob
-
diff --git a/libjava/javax/swing/AbstractAction.java b/libjava/javax/swing/AbstractAction.java
index d751899..4f0af1c 100644
--- a/libjava/javax/swing/AbstractAction.java
+++ b/libjava/javax/swing/AbstractAction.java
@@ -44,6 +44,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.HashMap;
+
import javax.swing.event.SwingPropertyChangeSupport;
/**
diff --git a/libjava/javax/swing/AbstractButton.java b/libjava/javax/swing/AbstractButton.java
index 11ab198..adb3af408 100644
--- a/libjava/javax/swing/AbstractButton.java
+++ b/libjava/javax/swing/AbstractButton.java
@@ -45,8 +45,6 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
@@ -240,7 +238,7 @@ public abstract class AbstractButton extends JComponent
PropertyChangeListener actionPropertyChangeListener;
/** ChangeEvent that is fired to button's ChangeEventListeners */
- private ChangeEvent changeEvent = new ChangeEvent(this);
+ protected ChangeEvent changeEvent = new ChangeEvent(this);
/** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
@@ -441,8 +439,7 @@ public abstract class AbstractButton extends JComponent
{
return null; // TODO
}
- }
-
+ }
/**
* Creates a new AbstractButton object.
@@ -691,11 +688,8 @@ public abstract class AbstractButton extends JComponent
/**
* Calls {@link ChangeEvent.stateChanged} on each {@link ChangeListener}
* in the button's listener list.
- *
- * @param e The event signifying a change in one of the (non-bound)
- * properties of the button's model.
*/
- public void fireStateChanged(ChangeEvent e)
+ public void fireStateChanged()
{
ChangeListener[] listeners = getChangeListeners();
@@ -785,8 +779,8 @@ public abstract class AbstractButton extends JComponent
{
if (index < -1 || (text != null && index >= text.length()))
throw new IllegalArgumentException();
- else
- mnemonicIndex = index;
+
+ mnemonicIndex = index;
}
/**
@@ -892,14 +886,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setHorizontalAlignment(int a)
{
+ if (horizontalAlignment == a)
+ return;
+
int old = horizontalAlignment;
horizontalAlignment = a;
- if (old != a)
- {
- firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
- revalidate();
- repaint();
- }
+ firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
+ revalidate();
+ repaint();
}
/**
@@ -929,14 +923,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setHorizontalTextPosition(int t)
{
+ if (horizontalTextPosition == t)
+ return;
+
int old = horizontalTextPosition;
horizontalTextPosition = t;
- if (old != t)
- {
- firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
- revalidate();
- repaint();
- }
+ firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
+ revalidate();
+ repaint();
}
/**
@@ -964,14 +958,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setVerticalAlignment(int a)
{
+ if (verticalAlignment == a)
+ return;
+
int old = verticalAlignment;
verticalAlignment = a;
- if (old != a)
- {
- firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
- revalidate();
- repaint();
- }
+ firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
+ revalidate();
+ repaint();
}
/**
@@ -1001,14 +995,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setVerticalTextPosition(int t)
{
+ if (verticalTextPosition == t)
+ return;
+
int old = verticalTextPosition;
verticalTextPosition = t;
- if (old != t)
- {
- firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
- revalidate();
- repaint();
- }
+ firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
+ revalidate();
+ repaint();
}
/**
@@ -1032,14 +1026,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setBorderPainted(boolean b)
{
+ if (borderPainted == b)
+ return;
+
boolean old = borderPainted;
- borderPainted = b;
- if (b != old)
- {
- firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
- revalidate();
- repaint();
- }
+ borderPainted = b;
+ firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
+ revalidate();
+ repaint();
}
/**
@@ -1078,10 +1072,7 @@ public abstract class AbstractButton extends JComponent
action.removePropertyChangeListener(actionPropertyChangeListener);
actionPropertyChangeListener = null;
}
-
-
- }
-
+ }
Action old = action;
action = a;
@@ -1112,14 +1103,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setIcon(Icon i)
{
- if (default_icon != i)
- {
+ if (default_icon == i)
+ return;
+
Icon old = default_icon;
default_icon = i;
firePropertyChange(ICON_CHANGED_PROPERTY, old, i);
revalidate();
repaint();
- }
}
/**
@@ -1138,6 +1129,8 @@ public abstract class AbstractButton extends JComponent
* "text" property.
*
* @param label The new "label" property
+ *
+ * @deprecated use <code>setText(text)</code>
*/
public void setLabel(String label)
{
@@ -1149,6 +1142,8 @@ public abstract class AbstractButton extends JComponent
* the "text" property.
*
* @return The current "label" property
+ *
+ * @deprecated use <code>getText()</code>
*/
public String getLabel()
{
@@ -1163,15 +1158,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setText(String t)
{
+ if (text == t)
+ return;
+
String old = text;
text = t;
- if (t != old)
- {
- firePropertyChange(TEXT_CHANGED_PROPERTY, old, t);
+ firePropertyChange(TEXT_CHANGED_PROPERTY, old, t);
revalidate();
repaint();
}
- }
/**
* Set the value of the {@link #iconTextGap} property.
@@ -1180,14 +1175,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setIconTextGap(int i)
{
+ if (iconTextGap == i)
+ return;
+
int old = iconTextGap;
iconTextGap = i;
- if (old != i)
- {
- fireStateChanged(new ChangeEvent(this));
- revalidate();
- repaint();
- }
+ fireStateChanged();
+ revalidate();
+ repaint();
}
/**
@@ -1207,7 +1202,7 @@ public abstract class AbstractButton extends JComponent
*
* @return The current "margin" property
*/
- public Insets getMargin()
+ public Insets getMargin()
{
return margin;
}
@@ -1221,15 +1216,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setMargin(Insets m)
{
+ if (margin == m)
+ return;
+
Insets old = margin;
margin = m;
- if (m != old)
- {
- firePropertyChange(MARGIN_CHANGED_PROPERTY, old, m);
- revalidate();
+ firePropertyChange(MARGIN_CHANGED_PROPERTY, old, m);
+ revalidate();
repaint();
}
- }
/**
* Return the button's "pressedIcon" property. The look and feel class
@@ -1254,15 +1249,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setPressedIcon(Icon pressedIcon)
{
+ if (pressed_icon == pressedIcon)
+ return;
+
Icon old = pressed_icon;
pressed_icon = pressedIcon;
- if (pressed_icon != old)
- {
- firePropertyChange(PRESSED_ICON_CHANGED_PROPERTY, old, pressed_icon);
+ firePropertyChange(PRESSED_ICON_CHANGED_PROPERTY, old, pressed_icon);
revalidate();
repaint();
}
- }
/**
* Return the button's "disabledIcon" property. The look and feel class
@@ -1323,15 +1318,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setFocusPainted(boolean p)
{
+ if (focusPainted == p)
+ return;
+
boolean old = focusPainted;
focusPainted = p;
-
- if (old != focusPainted)
- {
- firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, p);
- revalidate();
- repaint();
- }
+ firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, p);
+ revalidate();
+ repaint();
}
/**
@@ -1554,7 +1548,7 @@ public abstract class AbstractButton extends JComponent
{
public void stateChanged(ChangeEvent e)
{
- AbstractButton.this.fireStateChanged(e);
+ AbstractButton.this.fireStateChanged();
AbstractButton.this.repaint();
}
};
@@ -1612,13 +1606,13 @@ public abstract class AbstractButton extends JComponent
getModel().setArmed(true);
getModel().setPressed(true);
try
- {
+ {
java.lang.Thread.sleep(pressTime);
- }
+ }
catch (java.lang.InterruptedException e)
- {
+ {
// probably harmless
- }
+ }
getModel().setPressed(false);
getModel().setArmed(false);
}
@@ -1644,22 +1638,20 @@ public abstract class AbstractButton extends JComponent
* <code>true</code>. This icon can be <code>null</code>, in which case
* it is synthesized from the button's selected icon.
*
- * @param disabledSelectedIcon The new disabled selected icon
+ * @param icon The new disabled selected icon
*/
- public void setDisabledSelectedIcon(Icon disabledSelectedIcon)
+ public void setDisabledSelectedIcon(Icon icon)
{
+ if (disabledSelectedIcon == icon)
+ return;
+
Icon old = disabledSelectedIcon;
- disabledSelectedIcon = disabledSelectedIcon;
- if (old != disabledSelectedIcon)
- {
- firePropertyChange(DISABLED_SELECTED_ICON_CHANGED_PROPERTY, old,
- disabledSelectedIcon);
- revalidate();
- repaint();
- }
+ disabledSelectedIcon = icon;
+ firePropertyChange(DISABLED_SELECTED_ICON_CHANGED_PROPERTY, old, icon);
+ revalidate();
+ repaint();
}
-
/**
* Return the button's rollover icon. The look and feel class should
* paint this icon when the "rolloverEnabled" property of the button is
@@ -1681,15 +1673,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setRolloverIcon(Icon r)
{
+ if (rolloverIcon == r)
+ return;
+
Icon old = rolloverIcon;
rolloverIcon = r;
- if (old != rolloverIcon)
- {
- firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old,
- rolloverIcon);
- revalidate();
- repaint();
- }
+ firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old, rolloverIcon);
+ revalidate();
+ repaint();
}
/**
@@ -1715,18 +1706,16 @@ public abstract class AbstractButton extends JComponent
*/
public void setRolloverSelectedIcon(Icon r)
{
+ if (rolloverSelectedIcon == r)
+ return;
+
Icon old = rolloverSelectedIcon;
rolloverSelectedIcon = r;
- if (old != rolloverSelectedIcon)
- {
- firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old,
- rolloverSelectedIcon);
- revalidate();
- repaint();
- }
+ firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old, r);
+ revalidate();
+ repaint();
}
-
/**
* Return the button's selected icon. The look and feel class should
* paint this icon when the "selected" property of the button's model is
@@ -1752,15 +1741,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setSelectedIcon(Icon s)
{
+ if (selectedIcon == s)
+ return;
+
Icon old = selectedIcon;
selectedIcon = s;
- if (old != selectedIcon)
- {
- firePropertyChange(SELECTED_ICON_CHANGED_PROPERTY, old,
- selectedIcon);
- revalidate();
- repaint();
- }
+ firePropertyChange(SELECTED_ICON_CHANGED_PROPERTY, old, s);
+ revalidate();
+ repaint();
}
/**
@@ -1777,9 +1765,9 @@ public abstract class AbstractButton extends JComponent
Object[] objs = new Object[1];
objs[0] = getText();
return objs;
- }
+ }
else
- {
+ {
return null;
}
}
@@ -1800,9 +1788,9 @@ public abstract class AbstractButton extends JComponent
*/
public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
int h)
- {
+ {
return current_icon == img;
- }
+ }
/**
* Returns the value of the button's "contentAreaFilled" property. This
@@ -1814,9 +1802,9 @@ public abstract class AbstractButton extends JComponent
* @return The current value of the "contentAreaFilled" property
*/
public boolean isContentAreaFilled()
- {
+ {
return contentAreaFilled;
- }
+ }
/**
* Sets the value of the button's "contentAreaFilled" property. This
@@ -1828,16 +1816,16 @@ public abstract class AbstractButton extends JComponent
* @param b The new value of the "contentAreaFilled" property
*/
public void setContentAreaFilled(boolean b)
- {
+ {
+ if (contentAreaFilled == b)
+ return;
+
boolean old = contentAreaFilled;
contentAreaFilled = b;
- if (b != old)
- {
- firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
- revalidate();
- repaint();
- }
- }
+ firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
+ revalidate();
+ repaint();
+ }
/**
* Paints the button's border, if the button's "borderPainted" property is
@@ -1846,10 +1834,10 @@ public abstract class AbstractButton extends JComponent
* @param g The graphics context used to paint the border
*/
protected void paintBorder(Graphics g)
- {
+ {
if (isBorderPainted())
super.paintBorder(g);
- }
+ }
/**
* Returns a string, used only for debugging, which identifies or somehow
@@ -1862,7 +1850,6 @@ public abstract class AbstractButton extends JComponent
return "AbstractButton";
}
-
/**
* Set the "UI" property of the button, which is a look and feel class
* responsible for handling the button's input events and painting it.
@@ -1870,9 +1857,9 @@ public abstract class AbstractButton extends JComponent
* @param ui The new "UI" property
*/
public void setUI(ButtonUI ui)
- {
+ {
super.setUI(ui);
- }
+ }
/**
* Set the "UI" property of the button, which is a look and feel class
@@ -1883,7 +1870,7 @@ public abstract class AbstractButton extends JComponent
public ButtonUI getUI()
{
return (ButtonUI) ui;
- }
+ }
/**
* Set the "UI" property to a class constructed, via the {@link
diff --git a/libjava/javax/swing/AbstractCellEditor.java b/libjava/javax/swing/AbstractCellEditor.java
index 3463c97..196e2e2 100644
--- a/libjava/javax/swing/AbstractCellEditor.java
+++ b/libjava/javax/swing/AbstractCellEditor.java
@@ -40,6 +40,7 @@ package javax.swing;
import java.io.Serializable;
import java.util.EventObject;
+
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.EventListenerList;
diff --git a/libjava/javax/swing/AbstractListModel.java b/libjava/javax/swing/AbstractListModel.java
index 4a5c14b..9fe1bcb 100644
--- a/libjava/javax/swing/AbstractListModel.java
+++ b/libjava/javax/swing/AbstractListModel.java
@@ -1,5 +1,5 @@
/* AbstractListModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,15 +35,16 @@ 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.util.EventListener;
+
import javax.swing.event.EventListenerList;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
-
/**
* AbstractListModel
*
diff --git a/libjava/javax/swing/AbstractSpinnerModel.java b/libjava/javax/swing/AbstractSpinnerModel.java
index d2d345b..1d3a621 100644
--- a/libjava/javax/swing/AbstractSpinnerModel.java
+++ b/libjava/javax/swing/AbstractSpinnerModel.java
@@ -35,9 +35,11 @@ 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.EventListener;
+
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
diff --git a/libjava/javax/swing/ActionMap.java b/libjava/javax/swing/ActionMap.java
index 9861591..645252f 100644
--- a/libjava/javax/swing/ActionMap.java
+++ b/libjava/javax/swing/ActionMap.java
@@ -44,7 +44,6 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
diff --git a/libjava/javax/swing/BorderFactory.java b/libjava/javax/swing/BorderFactory.java
index 1cc6cbf..4f0a1ee 100644
--- a/libjava/javax/swing/BorderFactory.java
+++ b/libjava/javax/swing/BorderFactory.java
@@ -1,5 +1,5 @@
-/* BorderFactory.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* BorderFactory.java --
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package javax.swing;
import java.awt.Color;
import java.awt.Font;
+
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
@@ -51,6 +52,11 @@ import javax.swing.border.TitledBorder;
public class BorderFactory
{
+ private BorderFactory()
+ {
+ // Do nothing.
+ }
+
/**
* Creates a line border withe the specified color.
*
diff --git a/libjava/javax/swing/Box.java b/libjava/javax/swing/Box.java
index 26588a5..7532d30 100644
--- a/libjava/javax/swing/Box.java
+++ b/libjava/javax/swing/Box.java
@@ -38,13 +38,14 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTError;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.LayoutManager;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
-import java.awt.LayoutManager;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.AWTError;
/**
* A component that uses a {@link BoxLayout} as Layout Manager.
diff --git a/libjava/javax/swing/ButtonModel.java b/libjava/javax/swing/ButtonModel.java
index 2876c75..0c704be 100644
--- a/libjava/javax/swing/ButtonModel.java
+++ b/libjava/javax/swing/ButtonModel.java
@@ -35,11 +35,13 @@ 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.ItemSelectable;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
+
import javax.swing.event.ChangeListener;
public interface ButtonModel extends ItemSelectable
diff --git a/libjava/javax/swing/CellEditor.java b/libjava/javax/swing/CellEditor.java
index 831cde0..5c298db 100644
--- a/libjava/javax/swing/CellEditor.java
+++ b/libjava/javax/swing/CellEditor.java
@@ -35,9 +35,11 @@ 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.EventObject;
+
import javax.swing.event.CellEditorListener;
/**
diff --git a/libjava/javax/swing/CellRendererPane.java b/libjava/javax/swing/CellRendererPane.java
index 246916d..6e6c2ca 100644
--- a/libjava/javax/swing/CellRendererPane.java
+++ b/libjava/javax/swing/CellRendererPane.java
@@ -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;
@@ -43,6 +44,7 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.io.IOException;
import java.io.ObjectOutputStream;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
diff --git a/libjava/javax/swing/DebugGraphics.java b/libjava/javax/swing/DebugGraphics.java
index a3c3d39..6aa80ad 100644
--- a/libjava/javax/swing/DebugGraphics.java
+++ b/libjava/javax/swing/DebugGraphics.java
@@ -48,678 +48,740 @@ import java.awt.image.ImageObserver;
import java.io.PrintStream;
import java.text.AttributedCharacterIterator;
+
/**
* DebugGraphics
* @author Andrew Selkirk
* @version 1.0
*/
-public class DebugGraphics extends Graphics {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * graphics
- */
- Graphics graphics;
-
- /**
- * buffer
- */
- Image buffer;
-
- /**
- * debugOptions
- */
- int debugOptions;
-
- /**
- * graphicsID
- */
- int graphicsID;
-
- /**
- * xOffset
- */
- int xOffset;
-
- /**
- * yOffset
- */
- 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;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DebugGraphics
- */
- public DebugGraphics() {
- // TODO
- } // DebugGraphics()
-
- /**
- * Constructor DebugGraphics
- * @param graphics TODO
- * @param component TODO
- */
- public DebugGraphics(Graphics graphics, JComponent component) {
- // TODO
- } // DebugGraphics()
-
- /**
- * Constructor DebugGraphics
- * @param graphics TODO
- */
- public DebugGraphics(Graphics graphics) {
- // TODO
- } // DebugGraphics()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * setColor
- * @param value0 TODO
- */
- public void setColor(Color color) {
- // TODO
- } // setColor()
-
- /**
- * create
- * @returns Graphics
- */
- public Graphics create() {
- return null; // TODO
- } // create()
-
- /**
- * create
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @returns Graphics
- */
- public Graphics create(int valx, int y, int w, int h) {
- return null; // TODO
- } // create()
-
- /**
- * flashColor
- * @returns Color
- */
- public static Color flashColor() {
- return null; // TODO
- } // flashColor()
-
- /**
- * setFlashColor
- * @param color TODO
- */
- public static void setFlashColor(Color color) {
- // TODO
- } // setFlashColor()
-
- /**
- * flashTime
- * @returns int
- */
- public static int flashTime() {
- return 0; // TODO
- } // flashTime()
-
- /**
- * setFlashTime
- * @param time TODO
- */
- public static void setFlashTime(int time) {
- // TODO
- } // setFlashTime()
-
- /**
- * flashCount
- * @returns int
- */
- public static int flashCount() {
- return 0; // TODO
- } // flashCount()
-
- /**
- * setFlashCount
- * @param count TODO
- */
- public static void setFlashCount(int count) {
- // TODO
- } // setFlashCount()
-
- /**
- * logStream
- * @returns PrintStream
- */
- public static PrintStream logStream() {
- return null; // TODO
- } // logStream()
-
- /**
- * setLogStream
- * @param stream TODO
- */
- public static void setLogStream(PrintStream stream) {
- // TODO
- } // setLogStream()
-
- /**
- * getFont
- * @returns Font
- */
- public Font getFont() {
- return null; // TODO
- } // getFont()
-
- /**
- * setFont
- * @param font TODO
- */
- public void setFont(Font font) {
- // TODO
- } // setFont()
-
- /**
- * getColor
- * @returns Color
- */
- public Color getColor() {
- return null; // TODO
- } // getColor()
-
- /**
- * getFontMetrics
- * @returns FontMetrics
- */
- public FontMetrics getFontMetrics() {
- return null; // TODO
- } // getFontMetrics()
-
- /**
- * getFontMetrics
- * @param font TODO
- * @returns FontMetrics
- */
- public FontMetrics getFontMetrics(Font font) {
- return null; // TODO
- } // getFontMetrics()
-
- /**
- * translate
- * @param x TODO
- * @param y TODO
- */
- public void translate(int x, int y) {
- // TODO
- } // translate()
-
- /**
- * setPaintMode
- */
- public void setPaintMode() {
- // TODO
- } // setPaintMode()
-
- /**
- * setXORMode
- * @param color TODO
- */
- public void setXORMode(Color color) {
- // TODO
- } // setXORMode()
-
- /**
- * getClipBounds
- * @returns Rectangle
- */
- public Rectangle getClipBounds() {
- return null; // TODO
- } // getClipBounds()
-
- /**
- * clipRect
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- */
- public void clipRect(int value0, int value1, int value2, int value3) {
- // TODO
- } // clipRect()
-
- /**
- * setClip
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void setClip(int x, int y, int w, int h) {
- // TODO
- } // setClip()
-
- /**
- * getClip
- * @returns Shape
- */
- public Shape getClip() {
- return null; // TODO
- } // getClip()
-
- /**
- * setClip
- * @param shape TODO
- */
- public void setClip(Shape shape) {
- // TODO
- } // setClip()
-
- /**
- * drawRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param valh TODO
- */
- public void drawRect(int x, int y, int w, int h) {
- // TODO
- } // drawRect()
-
- /**
- * fillRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void fillRect(int x, int y, int w, int h) {
- // TODO
- } // fillRect()
-
- /**
- * clearRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void clearRect(int x, int y, int w, int h) {
- // TODO
- } // clearRect()
-
- /**
- * drawRoundRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param arcWidth TODO
- * @param arcHeight TODO
- */
- public void drawRoundRect(int x, int y, int w, int h,
- int arcWidth, int arcHeight) {
- // TODO
- } // drawRoundRect()
-
- /**
- * fillRoundRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param arcWidth TODO
- * @param arcHeight TODO
- */
- public void fillRoundRect(int x, int y, int w, int h,
- int arcWidth, int arcHeight) {
- // TODO
- } // fillRoundRect()
-
- /**
- * drawLine
- * @param x1 TODO
- * @param y1 TODO
- * @param x2 TODO
- * @param y2 TODO
- */
- public void drawLine(int x1, int y1, int x2, int y2) {
- // TODO
- } // drawLine()
-
- /**
- * draw3DRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param raised TODO
- */
- public void draw3DRect(int x, int y, int w, int h, boolean raised) {
- // TODO
- } // draw3DRect()
-
- /**
- * fill3DRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param raised TODO
- */
- public void fill3DRect(int x, int y, int w, int h, boolean raised) {
- // TODO
- } // fill3DRect()
-
- /**
- * drawOval
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void drawOval(int x, int y, int w, int h) {
- // TODO
- } // drawOval()
-
- /**
- * fillOval
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void fillOval(int x, int y, int w, int h) {
- // TODO
- } // fillOval()
-
- /**
- * drawArc
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param startAngle TODO
- * @param arcAngle TODO
- */
- public void drawArc(int x, int y, int w, int h,
- int startAngle, int arcAngle) {
- // TODO
- } // drawArc()
-
- /**
- * fillArc
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param startAngle TODO
- * @param arcAngle TODO
- */
- public void fillArc(int x, int y, int w, int h,
- int startAngle, int arcAngle) {
- // TODO
- } // fillArc()
-
- /**
- * drawPolyline
- * @param xpoints TODO
- * @param ypoints TODO
- * @param npoints TODO
- */
- public void drawPolyline(int[] xpoints, int[] ypoints, int npoints) {
- // TODO
- } // drawPolyline()
-
- /**
- * drawPolygon
- * @param xpoints TODO
- * @param ypoints TODO
- * @param npoints TODO
- */
- public void drawPolygon(int[] xpoints, int[] ypoints, int npoints) {
- // TODO
- } // drawPolygon()
-
- /**
- * fillPolygon
- * @param xpoints TODO
- * @param ypoints TODO
- * @param npoints TODO
- */
- public void fillPolygon(int[] xpoints, int[] ypoints, int npoints) {
- // TODO
- } // fillPolygon()
-
- /**
- * drawString
- * @param string TODO
- * @param x TODO
- * @param y TODO
- */
- public void drawString(String string, int s, int y) {
- // TODO
- } // drawString()
-
- /**
- * drawString
- * @param iterator TODO
- * @param x TODO
- * @param y TODO
- */
- public void drawString(AttributedCharacterIterator iterator,
- int x, int y) {
- // TODO
- } // drawString()
-
- /**
- * drawBytes
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @param x TODO
- * @param y TODO
- */
- public void drawBytes(byte[] data, int offset, int length,
- int x, int y) {
- // TODO
- } // drawBytes()
-
- /**
- * drawChars
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @param value3 TODO
- * @param value4 TODO
- */
- public void drawChars(char[] data, int offset, int value2,
- int x, int y) {
- // TODO
- } // drawChars()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y,
- ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y, int w,
- int h, ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param background TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y,
- Color background, ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * 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) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param dx1 TODO
- * @param dy1 TODO
- * @param dx2 TODO
- * @param dy2 TODO
- * @param sx1 TODO
- * @param sy1 TODO
- * @param sx2 TODO
- * @param sy2 TODO
- * @param observer TODO
- * @returns boolean
- */
- 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
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param dx1 TODO
- * @param dy1 TODO
- * @param dx2 TODO
- * @param dy2 TODO
- * @param sx1 TODO
- * @param sy1 TODO
- * @param sx2 TODO
- * @param sy2 TODO
- * @param background TODO
- * @param observer TODO
- * @returns 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) {
- return false; // TODO
- } // drawImage()
-
- /**
- * copyArea
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param destx TODO
- * @param desty TODO
- */
- public void copyArea(int x, int y, int w, int h,
- int destx, int desty) {
- // TODO
- } // copyArea()
-
- /**
- * dispose
- */
- public void dispose() {
- // TODO
- } // dispose()
-
- /**
- * isDrawingBuffer
- * @returns boolean
- */
- public boolean isDrawingBuffer() {
- return false; // TODO
- } // isDrawingBuffer()
-
- /**
- * toShortString
- * @returns String
- */
- String toShortString() {
- return null; // TODO
- } // toShortString()
-
- /**
- * setDebugOptions
- * @param options TODO
- */
- public void setDebugOptions(int options) {
- // TODO
- } // setDebugOptions()
-
- /**
- * getDebugOptions
- * @returns int
- */
- public int getDebugOptions() {
- return 0; // TODO
- } // getDebugOptions()
-
-
-} // DebugGraphics
+public class DebugGraphics extends Graphics
+{
+
+ /**
+ * graphics
+ */
+ Graphics graphics;
+
+ /**
+ * buffer
+ */
+ Image buffer;
+
+ /**
+ * debugOptions
+ */
+ int debugOptions;
+
+ /**
+ * graphicsID
+ */
+ int graphicsID;
+
+ /**
+ * xOffset
+ */
+ int xOffset;
+
+ /**
+ * yOffset
+ */
+ 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()
+ {
+ // TODO
+ }
+
+ /**
+ * Constructor DebugGraphics
+ * @param graphics TODO
+ * @param component TODO
+ */
+ public DebugGraphics(Graphics graphics, JComponent component)
+ {
+ // TODO
+ }
+
+ /**
+ * Constructor DebugGraphics
+ * @param graphics TODO
+ */
+ public DebugGraphics(Graphics graphics)
+ {
+ // TODO
+ }
+
+ /**
+ * setColor
+ * @param value0 TODO
+ */
+ public void setColor(Color color)
+ {
+ // TODO
+ }
+
+ /**
+ * create
+ *
+ * @return Graphics
+ */
+ public Graphics create()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * create
+ *
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @returns Graphics
+ */
+ public Graphics create(int valx, int y, int w, int h)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * flashColor
+ *
+ * @return Color
+ */
+ public static Color flashColor()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setFlashColor
+ *
+ * @param color the color to use for flashing
+ */
+ public static void setFlashColor(Color color)
+ {
+ // TODO
+ }
+
+ /**
+ * flashTime
+ *
+ * @return The time in milliseconds
+ */
+ public static int flashTime()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * setFlashTime
+ *
+ * @param time The time in milliseconds
+ */
+ public static void setFlashTime(int time)
+ {
+ // TODO
+ }
+
+ /**
+ * flashCount
+ * @returns int
+ */
+ public static int flashCount()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * setFlashCount
+ *
+ * @param count The number of flashes
+ */
+ public static void setFlashCount(int count)
+ {
+ // TODO
+ }
+
+ /**
+ * logStream
+ *
+ * @return The <code>PrintStream</code> to write logging messages to
+ */
+ public static PrintStream logStream()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setLogStream
+ *
+ * @param stream The currently set <code>PrintStream</code>.
+ */
+ public static void setLogStream(PrintStream stream)
+ {
+ // TODO
+ }
+
+ /**
+ * getFont
+ * @returns Font
+ */
+ public Font getFont()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setFont
+ *
+ * @param font The font to use for drawing text
+ */
+ public void setFont(Font font)
+ {
+ // TODO
+ }
+
+ /**
+ * getColor
+ * @returns Color
+ */
+ public Color getColor()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getFontMetrics
+ * @returns FontMetrics
+ */
+ public FontMetrics getFontMetrics()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getFontMetrics
+ * @param font TODO
+ * @returns FontMetrics
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * translate
+ *
+ * @param x TODO
+ * @param y TODO
+ */
+ public void translate(int x, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * setPaintMode
+ */
+ public void setPaintMode()
+ {
+ // TODO
+ }
+
+ /**
+ * setXORMode
+ *
+ * @param color TODO
+ */
+ public void setXORMode(Color color)
+ {
+ // TODO
+ }
+
+ /**
+ * getClipBounds
+ * @returns Rectangle
+ */
+ public Rectangle getClipBounds()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * clipRect
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ * @param value3 TODO
+ */
+ public void clipRect(int value0, int value1, int value2, int value3)
+ {
+ // TODO
+ }
+
+ /**
+ * setClip
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void setClip(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * getClip
+ * @returns Shape
+ */
+ public Shape getClip()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setClip
+ * @param shape TODO
+ */
+ public void setClip(Shape shape)
+ {
+ // TODO
+ }
+
+ /**
+ * drawRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param valh TODO
+ */
+ public void drawRect(int x, int y, int w, int h)
+ {
+ // TODO
+ } // drawRect()
+
+ /**
+ * fillRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void fillRect(int x, int y, int w, int h)
+ {
+ // TODO
+ } // fillRect()
+
+ /**
+ * clearRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void clearRect(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * drawRoundRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param arcWidth TODO
+ * @param arcHeight TODO
+ */
+ public void drawRoundRect(int x, int y, int w, int h, int arcWidth,
+ int arcHeight)
+ {
+ // TODO
+ }
+
+ /**
+ * fillRoundRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param arcWidth TODO
+ * @param arcHeight TODO
+ */
+ public void fillRoundRect(int x, int y, int w, int h, int arcWidth,
+ int arcHeight)
+ {
+ // TODO
+ }
+
+ /**
+ * drawLine
+ * @param x1 TODO
+ * @param y1 TODO
+ * @param x2 TODO
+ * @param y2 TODO
+ */
+ public void drawLine(int x1, int y1, int x2, int y2)
+ {
+ // TODO
+ }
+
+ /**
+ * draw3DRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param raised TODO
+ */
+ public void draw3DRect(int x, int y, int w, int h, boolean raised)
+ {
+ // TODO
+ }
+
+ /**
+ * fill3DRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param raised TODO
+ */
+ public void fill3DRect(int x, int y, int w, int h, boolean raised)
+ {
+ // TODO
+ }
+
+ /**
+ * drawOval
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void drawOval(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * fillOval
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void fillOval(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * drawArc
+ *
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param startAngle TODO
+ * @param arcAngle TODO
+ */
+ public void drawArc(int x, int y, int w, int h, int startAngle, int arcAngle)
+ {
+ // TODO
+ }
+
+ /**
+ * fillArc
+ *
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param startAngle TODO
+ * @param arcAngle TODO
+ */
+ public void fillArc(int x, int y, int w, int h, int startAngle, int arcAngle)
+ {
+ // TODO
+ }
+
+ /**
+ * drawPolyline
+ * @param xpoints TODO
+ * @param ypoints TODO
+ * @param npoints TODO
+ */
+ public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
+ {
+ // TODO
+ }
+
+ /**
+ * drawPolygon
+ *
+ * @param xpoints TODO
+ * @param ypoints TODO
+ * @param npoints TODO
+ */
+ public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
+ {
+ // TODO
+ }
+
+ /**
+ * fillPolygon
+ *
+ * @param xpoints TODO
+ * @param ypoints TODO
+ * @param npoints TODO
+ */
+ public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
+ {
+ // TODO
+ }
+
+ /**
+ * drawString
+ *
+ * @param string TODO
+ * @param x TODO
+ * @param y TODO
+ */
+ public void drawString(String string, int s, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * drawString
+ *
+ * @param iterator TODO
+ * @param x TODO
+ * @param y TODO
+ */
+ public void drawString(AttributedCharacterIterator iterator, int x, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * drawBytes
+ *
+ * @param data TODO
+ * @param offset TODO
+ * @param length TODO
+ * @param x TODO
+ * @param y TODO
+ */
+ public void drawBytes(byte[] data, int offset, int length, int x, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * drawChars
+ * @param data TODO
+ * @param offset TODO
+ * @param length TODO
+ * @param value3 TODO
+ * @param value4 TODO
+ */
+ public void drawChars(char[] data, int offset, int value2, int x, int y)
+ {
+ // TODO
+ } // drawChars()
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, int w, int h,
+ ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param background TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, Color background,
+ ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * 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)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ *
+ * @param image The image to draw
+ * @param dx1 TODO
+ * @param dy1 TODO
+ * @param dx2 TODO
+ * @param dy2 TODO
+ * @param sx1 TODO
+ * @param sy1 TODO
+ * @param sx2 TODO
+ * @param sy2 TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ 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
+ }
+
+ /**
+ * drawImage
+ *
+ * @param image The image to draw
+ * @param dx1 TODO
+ * @param dy1 TODO
+ * @param dx2 TODO
+ * @param dy2 TODO
+ * @param sx1 TODO
+ * @param sy1 TODO
+ * @param sx2 TODO
+ * @param sy2 TODO
+ * @param background TODO
+ * @param observer TODO
+ * @returns 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)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * copyArea
+ *
+ * @param x The x position of the source area
+ * @param y The y position of the source area
+ * @param width The width of the area
+ * @param height The height of the area
+ * @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)
+ {
+ // TODO
+ }
+
+ /**
+ * Releases all system resources that this <code>Graphics</code> is using.
+ */
+ public void dispose()
+ {
+ // TODO
+ }
+
+ /**
+ * isDrawingBuffer
+ *
+ * @return boolean
+ */
+ public boolean isDrawingBuffer()
+ {
+ return false; // TODO
+ }
+
+ /**
+ * toShortString
+ * @returns String
+ */
+ String toShortString()
+ {
+ return null; // TODO
+ } // toShortString()
+
+ /**
+ * setDebugOptions
+ *
+ * @param options the debug options
+ */
+ public void setDebugOptions(int options)
+ {
+ // TODO
+ }
+
+ /**
+ * getDebugOptions
+ *
+ * @return the debug options
+ */
+ public int getDebugOptions()
+ {
+ return 0; // TODO
+ }
+}
diff --git a/libjava/javax/swing/DefaultBoundedRangeModel.java b/libjava/javax/swing/DefaultBoundedRangeModel.java
index 3294c1d..9a2d974 100644
--- a/libjava/javax/swing/DefaultBoundedRangeModel.java
+++ b/libjava/javax/swing/DefaultBoundedRangeModel.java
@@ -36,15 +36,16 @@ 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.util.EventListener;
+
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
-
/**
* A default implementation of BoundedRangeModel.
*
diff --git a/libjava/javax/swing/DefaultButtonModel.java b/libjava/javax/swing/DefaultButtonModel.java
index 4c7c247..543428a 100644
--- a/libjava/javax/swing/DefaultButtonModel.java
+++ b/libjava/javax/swing/DefaultButtonModel.java
@@ -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.event.ActionEvent;
@@ -44,11 +45,11 @@ import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.io.Serializable;
import java.util.EventListener;
+
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
-
/**
* The purpose of this class is to model the dynamic state of an abstract
* button. The concrete button type holding this state may be a a "toggle"
diff --git a/libjava/javax/swing/DefaultCellEditor.java b/libjava/javax/swing/DefaultCellEditor.java
index 39da1fb..1dd17b4 100644
--- a/libjava/javax/swing/DefaultCellEditor.java
+++ b/libjava/javax/swing/DefaultCellEditor.java
@@ -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;
@@ -44,6 +45,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.Serializable;
import java.util.EventObject;
+
import javax.swing.table.TableCellEditor;
import javax.swing.tree.TreeCellEditor;
diff --git a/libjava/javax/swing/DefaultDesktopManager.java b/libjava/javax/swing/DefaultDesktopManager.java
index 6678c93..4928c5d 100644
--- a/libjava/javax/swing/DefaultDesktopManager.java
+++ b/libjava/javax/swing/DefaultDesktopManager.java
@@ -37,19 +37,15 @@ exception statement from your version. */
package javax.swing;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.beans.PropertyVetoException;
import java.io.Serializable;
-import javax.swing.JDesktopPane;
-import javax.swing.JInternalFrame;
-import javax.swing.JInternalFrame.JDesktopIcon;
+import javax.swing.JInternalFrame.JDesktopIcon;
/**
* DefaultDesktopManager is the default implementation of DesktopManager for
diff --git a/libjava/javax/swing/DefaultListCellRenderer.java b/libjava/javax/swing/DefaultListCellRenderer.java
index fe4b3d0..4c4cee3 100644
--- a/libjava/javax/swing/DefaultListCellRenderer.java
+++ b/libjava/javax/swing/DefaultListCellRenderer.java
@@ -35,15 +35,16 @@ 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.Rectangle;
import java.io.Serializable;
+
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
-
/**
* DefaultListCellRenderer. This class is responsible for rendering list
* cells.
diff --git a/libjava/javax/swing/DefaultListSelectionModel.java b/libjava/javax/swing/DefaultListSelectionModel.java
index 4b8ddc3..d5801c7 100644
--- a/libjava/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/javax/swing/DefaultListSelectionModel.java
@@ -35,16 +35,17 @@ 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.util.EventListener;
import java.util.BitSet;
+import java.util.EventListener;
+
import javax.swing.event.EventListenerList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
-
/**
* <p>This class provides a default implementation of {@link
* ListSelectioModel}, which is used by {@link javax.swing.JList} and
diff --git a/libjava/javax/swing/DefaultSingleSelectionModel.java b/libjava/javax/swing/DefaultSingleSelectionModel.java
index e3f990d..0b1371e 100644
--- a/libjava/javax/swing/DefaultSingleSelectionModel.java
+++ b/libjava/javax/swing/DefaultSingleSelectionModel.java
@@ -1,5 +1,5 @@
/* DefaultSingleSelectionModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,12 @@ 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.util.EventListener;
+
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
@@ -77,7 +79,7 @@ public class DefaultSingleSelectionModel
/**
* getSelectedIndex
- * @returns int
+ * @return int
*/
public int getSelectedIndex ()
{
@@ -111,7 +113,7 @@ public class DefaultSingleSelectionModel
/**
* isSelected
- * @returns boolean
+ * @return boolean
*/
public boolean isSelected ()
{
@@ -120,7 +122,8 @@ public class DefaultSingleSelectionModel
/**
* addChangeListener
- * @param listener TODO
+ *
+ * @param listener the listener to add
*/
public void addChangeListener (ChangeListener listener)
{
@@ -129,7 +132,8 @@ public class DefaultSingleSelectionModel
/**
* removeChangeListener
- * @param listener TODO
+ *
+ * @param listener the listener to remove
*/
public void removeChangeListener (ChangeListener listener)
{
@@ -159,8 +163,12 @@ public class DefaultSingleSelectionModel
/**
* getListeners
- * @param listenerClass TODO
- * @returns EventListener[]
+ *
+ * @param listenerClass the type fo listener
+ *
+ * @return an array of listeners
+ *
+ * @since 1.3
*/
public EventListener[] getListeners (Class listenerClass)
{
@@ -169,6 +177,8 @@ public class DefaultSingleSelectionModel
/**
* getChangeListeners
+ *
+ * @since 1.4
*/
public ChangeListener[] getChangeListeners ()
{
diff --git a/libjava/javax/swing/FocusManager.java b/libjava/javax/swing/FocusManager.java
index 6cbfa10f..8e404e9 100644
--- a/libjava/javax/swing/FocusManager.java
+++ b/libjava/javax/swing/FocusManager.java
@@ -1,5 +1,5 @@
/* FocusManager.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -148,6 +148,7 @@ public abstract class FocusManager extends DefaultKeyboardFocusManager
/**
* disableSwingFocusManager
+ * @deprecated 1.4
*/
public static void disableSwingFocusManager() {
// TODO
@@ -155,7 +156,8 @@ public abstract class FocusManager extends DefaultKeyboardFocusManager
/**
* isFocusManagerEnabled
- * @returns boolean
+ * @return boolean
+ * @deprecated 1.4
*/
public static boolean isFocusManagerEnabled() {
return false; // TODO
diff --git a/libjava/javax/swing/GrayFilter.java b/libjava/javax/swing/GrayFilter.java
index 39ad4d3..73302ad 100644
--- a/libjava/javax/swing/GrayFilter.java
+++ b/libjava/javax/swing/GrayFilter.java
@@ -1,5 +1,5 @@
/* GrayFilter.java -- Java class for filtering Pixels to produce Gray Pictures
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,9 +39,9 @@ exception statement from your version. */
package javax.swing;
import java.awt.Image;
+import java.awt.Toolkit;
import java.awt.image.FilteredImageSource;
import java.awt.image.RGBImageFilter;
-import java.awt.Toolkit;
public class GrayFilter extends RGBImageFilter
{
diff --git a/libjava/javax/swing/InputMap.java b/libjava/javax/swing/InputMap.java
index c737ae4..3f0bc3f 100644
--- a/libjava/javax/swing/InputMap.java
+++ b/libjava/javax/swing/InputMap.java
@@ -44,7 +44,6 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
diff --git a/libjava/javax/swing/InputVerifier.java b/libjava/javax/swing/InputVerifier.java
index a125fe4..ccd13d2 100644
--- a/libjava/javax/swing/InputVerifier.java
+++ b/libjava/javax/swing/InputVerifier.java
@@ -1,5 +1,5 @@
/* InputVerifier.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,43 +37,39 @@ exception statement from your version. */
package javax.swing;
+
/**
* InputVerifier
- * @author Andrew Selkirk
- * @version 1.0
+ * @author Andrew Selkirk
+ * @version 1.0
*/
-public abstract class InputVerifier {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor InputVerifier
- */
- public InputVerifier() {
- } // InputVerifier()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * verify
- * @param component TODO
- * @returns boolean
- */
- public abstract boolean verify(JComponent component);
-
- /**
- * shouldYieldFocus
- * @param component TODO
- * @returns boolean
- */
- public boolean shouldYieldFocus(JComponent component) {
- return verify(component);
- } // shouldYieldFocus()
-
-
-} // InputVerifier
+public abstract class InputVerifier
+{
+ /**
+ * Creates a <code>InputVerifier</code>
+ */
+ public InputVerifier()
+ {
+ }
+
+ /**
+ * verify
+ *
+ * @param component the component to verify
+ *
+ * @return <code>true</code> if valid, <code>false</code> otherwise.
+ */
+ public abstract boolean verify(JComponent component);
+
+ /**
+ * shouldYieldFocus
+ *
+ * @param component the component to verify
+ *
+ * @return <code>true</code> if valid, <code>false</code> otherwise.
+ */
+ public boolean shouldYieldFocus(JComponent component)
+ {
+ return verify(component);
+ }
+}
diff --git a/libjava/javax/swing/JApplet.java b/libjava/javax/swing/JApplet.java
index f1c3e35..42d7426 100644
--- a/libjava/javax/swing/JApplet.java
+++ b/libjava/javax/swing/JApplet.java
@@ -1,4 +1,4 @@
-/* JApplet.java --
+/* JApplet.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,169 +47,200 @@ import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
+
import javax.accessibility.AccessibleContext;
-public class JApplet extends Applet implements RootPaneContainer
+public class JApplet extends Applet
+ implements RootPaneContainer
{
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;
- public final static int HIDE_ON_CLOSE = 0;
- public final static int EXIT_ON_CLOSE = 1;
- public final static int DISPOSE_ON_CLOSE = 2;
- public final static int DO_NOTHING_ON_CLOSE = 3;
+ protected JRootPane rootPane;
+ protected boolean rootPaneCheckingEnabled;
- private int close_action = EXIT_ON_CLOSE;
- private boolean checking;
- protected JRootPane rootPane;
+ public JApplet()
+ {
+ frameInit();
+ }
- public JApplet()
- {
- frameInit();
- }
-
- public JApplet(String title)
- {
- frameInit();
- }
+ public JApplet(String title)
+ {
+ frameInit();
+ }
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- getRootPane(); // will do set/create
- }
+ 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());
+ System.out.println("JFrame.getPrefSize(): " + d + " , comp="
+ + getComponentCount() + ", layout=" + getLayout());
return d;
}
- 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);
+ }
+
+ public JLayeredPane getLayeredPane()
+ {
+ return getRootPane().getLayeredPane();
+ }
+ public JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
- /////////////////////////////////////////////////////////////////////////////////
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
-
- public AccessibleContext getAccessibleContext()
- { return null; }
-
- int getDefaultCloseOperation()
- { return close_action; }
-
-
- public JMenuBar getJMenuBar()
- { return getRootPane().getJMenuBar(); }
-
- public void setJMenuBar(JMenuBar menubar)
- { getRootPane().setJMenuBar(menubar); }
-
-
- protected String paramString()
- { return "JFrame"; }
-
- protected void processKeyEvent(KeyEvent e)
- { 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); }
-
+ 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);
+ }
- void setDefaultCloseOperation(int operation)
- { close_action = operation; }
+ public Component getGlassPane()
+ {
+ return getRootPane().getGlassPane();
+ }
+
+ public void setGlassPane(Component glassPane)
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ int getDefaultCloseOperation()
+ {
+ return close_action;
+ }
+
+ public JMenuBar getJMenuBar()
+ {
+ return getRootPane().getJMenuBar();
+ }
+
+ public void setJMenuBar(JMenuBar menubar)
+ {
+ getRootPane().setJMenuBar(menubar);
+ }
+ protected String paramString()
+ {
+ return "JFrame";
+ }
+ protected void processKeyEvent(KeyEvent e)
+ {
+ super.processKeyEvent(e);
+ }
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ 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);
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ void setDefaultCloseOperation(int operation)
+ {
+ close_action = operation;
+ }
- public void update(Graphics g)
- { paint(g); }
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return rootPaneCheckingEnabled;
+ }
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ rootPaneCheckingEnabled = enabled;
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
}
diff --git a/libjava/javax/swing/JCheckBox.java b/libjava/javax/swing/JCheckBox.java
index 8490c0b..36cd071 100644
--- a/libjava/javax/swing/JCheckBox.java
+++ b/libjava/javax/swing/JCheckBox.java
@@ -48,6 +48,9 @@ import javax.accessibility.AccessibleContext;
public class JCheckBox extends JToggleButton
{
private static final long serialVersionUID = -5246739313864538930L;
+
+ public static final String BORDER_PAINTED_FLAT_CHANGED_PROPERTY =
+ "borderPaintedFlat";
private boolean borderPaintedFlat;
diff --git a/libjava/javax/swing/JCheckBoxMenuItem.java b/libjava/javax/swing/JCheckBoxMenuItem.java
index e0ebb7f..76377b6 100644
--- a/libjava/javax/swing/JCheckBoxMenuItem.java
+++ b/libjava/javax/swing/JCheckBoxMenuItem.java
@@ -35,15 +35,16 @@ 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.IOException;
import java.io.ObjectOutputStream;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
-
/**
* This class represents JCheckBoxMenuItem. Its behaviour is very similar
* to JCheckBoxButton. Just like the JCheckBoxButton, user can check and
diff --git a/libjava/javax/swing/JColorChooser.java b/libjava/javax/swing/JColorChooser.java
index 6ba70ce..27809ce 100644
--- a/libjava/javax/swing/JColorChooser.java
+++ b/libjava/javax/swing/JColorChooser.java
@@ -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.AWTError;
@@ -46,13 +47,11 @@ import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.colorchooser.AbstractColorChooserPanel;
-import javax.swing.colorchooser.ColorChooserComponentFactory;
import javax.swing.colorchooser.ColorSelectionModel;
import javax.swing.colorchooser.DefaultColorSelectionModel;
import javax.swing.plaf.ColorChooserUI;
diff --git a/libjava/javax/swing/JComboBox.java b/libjava/javax/swing/JComboBox.java
index 9d480dc..86f20b0 100644
--- a/libjava/javax/swing/JComboBox.java
+++ b/libjava/javax/swing/JComboBox.java
@@ -35,10 +35,9 @@ 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.Dimension;
import java.awt.ItemSelectable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -50,12 +49,12 @@ import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleSelection;
-import javax.swing.JComponent;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.PopupMenuListener;
diff --git a/libjava/javax/swing/JComponent.java b/libjava/javax/swing/JComponent.java
index eadf855..c22c2b2 100644
--- a/libjava/javax/swing/JComponent.java
+++ b/libjava/javax/swing/JComponent.java
@@ -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.AWTEvent;
@@ -68,7 +69,7 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Hashtable;
import java.util.Locale;
-import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -79,7 +80,6 @@ import javax.swing.event.EventListenerList;
import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.plaf.ComponentUI;
-
/**
* Every component in swing inherits from this class (JLabel, JButton, etc).
* It contains generic methods to manage events, properties and sizes. Actual
@@ -323,6 +323,9 @@ public abstract class JComponent extends Container implements Serializable
private InputMap inputMap_whenAncestorOfFocused;
private InputMap inputMap_whenInFocusedWindow;
private ActionMap actionMap;
+ private InputVerifier inputVerifier;
+
+ private TransferHandler transferHandler;
/**
* A lock held during recursive painting; this is used to serialize
@@ -379,6 +382,9 @@ public abstract class JComponent extends Container implements Serializable
public static final int WHEN_IN_FOCUSED_WINDOW = 2;
+ /**
+ * Creates a new <code>JComponent</code> instance.
+ */
public JComponent()
{
super();
@@ -611,8 +617,8 @@ public abstract class JComponent extends Container implements Serializable
boolean newValue)
{
if (changeSupport != null)
- changeSupport.firePropertyChange(propertyName, new Boolean(oldValue),
- new Boolean(newValue));
+ changeSupport.firePropertyChange(propertyName, Boolean.valueOf(oldValue),
+ Boolean.valueOf(newValue));
}
/**
@@ -796,13 +802,15 @@ public abstract class JComponent extends Container implements Serializable
* Set the value of the {@link #border} property, revalidate
* and repaint this component.
*
- * @param border The new value of the property
+ * @param newBorder The new value of the property
*
* @see #getBorder
*/
- public void setBorder(Border border)
+ public void setBorder(Border newBorder)
{
- this.border = border;
+ Border oldBorder = border;
+ border = newBorder;
+ firePropertyChange("border", oldBorder, newBorder);
revalidate();
repaint();
}
@@ -856,9 +864,10 @@ public abstract class JComponent extends Container implements Serializable
*/
protected Graphics getComponentGraphics(Graphics g)
{
- g.setFont(this.getFont());
- g.setColor(this.getForeground());
- return g;
+ Graphics g2 = g.create();
+ g2.setFont(this.getFont());
+ g2.setColor(this.getForeground());
+ return g2;
}
@@ -1017,12 +1026,51 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return the value of the {@link #nextFocusableComponent} property.
+ * Checks if a maximum size was explicitely set on the component.
+ *
+ * @return <code>true</code> if a maximum size was set,
+ * <code>false</code> otherwise
*
- * @deprecated See {@link java.awt.FocusTraversalPolicy}
+ * @since 1.3
+ */
+ public boolean isMaximumSizeSet()
+ {
+ return maximumSize != null;
+ }
+
+ /**
+ * Checks if a minimum size was explicitely set on the component.
+ *
+ * @return <code>true</code> if a minimum size was set,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ public boolean isMinimumSizeSet()
+ {
+ return minimumSize != null;
+ }
+
+ /**
+ * Checks if a preferred size was explicitely set on the component.
+ *
+ * @return <code>true</code> if a preferred size was set,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ public boolean isPreferredSizeSet()
+ {
+ return preferredSize != null;
+ }
+
+ /**
+ * Return the value of the {@link #nextFocusableComponent} property.
*
* @return The current value of the property, or <code>null</code>
* if none has been set.
+ *
+ * @deprecated See {@link java.awt.FocusTraversalPolicy}
*/
public Component getNextFocusableComponent()
{
@@ -1257,7 +1305,7 @@ public abstract class JComponent extends Container implements Serializable
* @return <code>true</code> if you want this component to manage its own
* focus, otherwise (by default) <code>false</code>
*
- * @deprecated Use {@link Component.setFocusTraversalKeys(int,Set)} and
+ * @deprecated 1.4 Use {@link Component.setFocusTraversalKeys(int,Set)} and
* {@link Container.setFocusCycleRoot(boolean)} instead
*/
public boolean isManagingFocus()
@@ -1641,9 +1689,6 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * @deprecated As of 1.3 KeyStrokes can be registered with multiple
- * simultaneous conditions.
- *
* Return the condition that determines whether a registered action
* occurs in response to the specified keystroke.
*
@@ -1653,6 +1698,9 @@ public abstract class JComponent extends Container implements Serializable
* #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or {@link
* #WHEN_IN_FOCUSED_WINDOW}
*
+ * @deprecated As of 1.3 KeyStrokes can be registered with multiple
+ * simultaneous conditions.
+ *
* @see #registerKeyboardAction
* @see #unregisterKeyboardAction
* @see #resetKeyboardActiond
@@ -1673,14 +1721,14 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * @deprecated Use {@link #getActionMap()}
- *
* Get the ActionListener (typically an {@link Action} object) which is
* associated with a particular keystroke.
*
* @param aKeyStroke The keystroke to retrieve the action of
*
* @return The action associated with the specified keystroke
+ *
+ * @deprecated Use {@link #getActionMap()}
*/
public ActionListener getActionForKeyStroke(KeyStroke ks)
{
@@ -1907,11 +1955,13 @@ public abstract class JComponent extends Container implements Serializable
* Set the value of the {@link #enabled} property, revalidate
* and repaint this component.
*
- * @param e The new value of the property
+ * @param enable The new value of the property
*/
- public void setEnabled(boolean e)
+ public void setEnabled(boolean enable)
{
- super.setEnabled(e);
+ boolean oldEnabled = isEnabled();
+ super.setEnabled(enable);
+ firePropertyChange("enabeld", oldEnabled, enable);
revalidate();
repaint();
}
@@ -1963,7 +2013,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setMaximumSize(Dimension max)
{
+ Dimension oldMaximumSize = maximumSize;
maximumSize = max;
+ firePropertyChange("maximumSize", oldMaximumSize, maximumSize);
revalidate();
repaint();
}
@@ -1976,7 +2028,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setMinimumSize(Dimension min)
{
+ Dimension oldMinimumSize = minimumSize;
minimumSize = min;
+ firePropertyChange("minimumSize", oldMinimumSize, minimumSize);
revalidate();
repaint();
}
@@ -1989,7 +2043,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setPreferredSize(Dimension pref)
{
+ Dimension oldPreferredSize = preferredSize;
preferredSize = pref;
+ firePropertyChange("preferredSize", oldPreferredSize, preferredSize);
}
/**
@@ -2016,6 +2072,32 @@ public abstract class JComponent extends Container implements Serializable
}
/**
+ * Get the value of the {@link #transferHandler} property.
+ *
+ * @return The current value of the property
+ *
+ * @see ComponentUI#setTransferHandler
+ */
+
+ public TransferHandler getTransferHandler()
+ {
+ return transferHandler;
+ }
+
+ /**
+ * Set the value of the {@link #transferHandler} property.
+ *
+ * @param newHandler The new value of the property
+ *
+ * @see ComponentUI#getTransferHandler
+ */
+
+ void setTransferHandler (TransferHandler newHandler)
+ {
+ transferHandler = newHandler;
+ }
+
+ /**
* Set the value of the {@link #opaque} property, revalidate and repaint
* this component.
*
@@ -2025,7 +2107,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setOpaque(boolean isOpaque)
{
+ boolean oldOpaque = opaque;
opaque = isOpaque;
+ firePropertyChange("opaque", oldOpaque, opaque);
revalidate();
repaint();
}
@@ -2119,4 +2203,26 @@ public abstract class JComponent extends Container implements Serializable
{
defaultLocale = l;
}
+
+ /**
+ * Returns the currently set input verifier for this component.
+ *
+ * @return the input verifier, or <code>null</code> if none
+ */
+ public InputVerifier getInputVerifier()
+ {
+ return inputVerifier;
+ }
+
+ /**
+ * Sets the input verifier to use by this component.
+ *
+ * @param verifier the input verifier, or <code>null</code>
+ */
+ public void setInputVerifier(InputVerifier verifier)
+ {
+ InputVerifier oldVerifier = inputVerifier;
+ inputVerifier = verifier;
+ firePropertyChange("inputVerifier", oldVerifier, verifier);
+ }
}
diff --git a/libjava/javax/swing/JDesktopPane.java b/libjava/javax/swing/JDesktopPane.java
index ce8085a..996aaf1 100644
--- a/libjava/javax/swing/JDesktopPane.java
+++ b/libjava/javax/swing/JDesktopPane.java
@@ -35,18 +35,17 @@ 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.beans.PropertyVetoException;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.plaf.DesktopPaneUI;
-
/**
* JDesktopPane is a container (usually for JInternalFrames) that simulates a
* desktop. Typically, the user will create JInternalFrames and place thme in
@@ -63,14 +62,18 @@ public class JDesktopPane extends JLayeredPane implements Accessible
/**
* This specifies that when dragged, a JInternalFrame should be completely
* visible.
+ *
+ * @specnote final since 1.5.0.
*/
- public static int LIVE_DRAG_MODE = 0;
+ public static final int LIVE_DRAG_MODE = 0;
/**
* This specifies that when dragged, a JInternalFrame should only be visible
* as an outline.
+ *
+ * @specnote final since 1.5.0.
*/
- public static int OUTLINE_DRAG_MODE = 1;
+ public static final int OUTLINE_DRAG_MODE = 1;
/** The selected frame in the JDesktopPane. */
private transient JInternalFrame selectedFrame;
@@ -151,7 +154,10 @@ public class JDesktopPane extends JLayeredPane implements Accessible
// FIXME: Unsupported mode.
if (mode == OUTLINE_DRAG_MODE)
- throw new IllegalArgumentException("Outline drag modes are unsupported.");
+ {
+ // throw new IllegalArgumentException("Outline drag modes are unsupported.");
+ mode = LIVE_DRAG_MODE;
+ }
dragMode = mode;
}
diff --git a/libjava/javax/swing/JDialog.java b/libjava/javax/swing/JDialog.java
index d331580..ace284b 100644
--- a/libjava/javax/swing/JDialog.java
+++ b/libjava/javax/swing/JDialog.java
@@ -35,9 +35,9 @@ 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.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
@@ -45,14 +45,13 @@ import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
+import java.awt.IllegalComponentStateException;
import java.awt.LayoutManager;
-import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
-import java.awt.IllegalComponentStateException;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-
/**
* Unlike JComponent derivatives, JDialog inherits from java.awt.Dialog. But
* also lets a look-and-feel component to its work.
@@ -77,7 +76,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
private int close_action = HIDE_ON_CLOSE;
/** Whether JDialogs are decorated by the Look and Feel. */
- private static boolean decorated = false;
+ private static boolean decorated;
/**
* Creates a new non-modal JDialog with no title
diff --git a/libjava/javax/swing/JEditorPane.java b/libjava/javax/swing/JEditorPane.java
index a36eba7..3b66c2b 100644
--- a/libjava/javax/swing/JEditorPane.java
+++ b/libjava/javax/swing/JEditorPane.java
@@ -35,12 +35,13 @@ 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;
import java.awt.event.KeyEvent;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import javax.accessibility.AccessibleContext;
@@ -153,16 +154,9 @@ public class JEditorPane extends JTextComponent
}
protected InputStream getStream(URL page)
+ throws IOException
{
- try
- {
- return page.openStream();
- }
- catch (Exception e)
- {
- System.out.println("Hhmmm, failed to open stream: " + e);
- }
- return null;
+ return page.openStream();
}
public String getText()
@@ -209,6 +203,7 @@ public class JEditorPane extends JTextComponent
* This method initializes from a stream.
*/
public void read(InputStream in, Object desc)
+ throws IOException
{
}
diff --git a/libjava/javax/swing/JFileChooser.java b/libjava/javax/swing/JFileChooser.java
index 2a23eff..f653c70 100644
--- a/libjava/javax/swing/JFileChooser.java
+++ b/libjava/javax/swing/JFileChooser.java
@@ -1,5 +1,5 @@
/* JFileChooser.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,7 @@ import java.io.File;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
diff --git a/libjava/javax/swing/JFormattedTextField.java b/libjava/javax/swing/JFormattedTextField.java
index 8074799..eaf5355 100644
--- a/libjava/javax/swing/JFormattedTextField.java
+++ b/libjava/javax/swing/JFormattedTextField.java
@@ -42,6 +42,7 @@ import java.awt.event.FocusEvent;
import java.io.Serializable;
import java.text.Format;
import java.text.ParseException;
+
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;
import javax.swing.text.NavigationFilter;
diff --git a/libjava/javax/swing/JFrame.java b/libjava/javax/swing/JFrame.java
index 3c254ab..aa641ca 100644
--- a/libjava/javax/swing/JFrame.java
+++ b/libjava/javax/swing/JFrame.java
@@ -57,222 +57,223 @@ import javax.accessibility.AccessibleContext;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JFrame extends Frame implements WindowConstants, RootPaneContainer
+public class JFrame extends Frame
+ implements WindowConstants, RootPaneContainer
{
private static final long serialVersionUID = -3362141868504252139L;
-
- protected AccessibleContext accessibleContext;
-
- private int close_action = HIDE_ON_CLOSE;
-
- private static boolean defaultLookAndFeelDecorated = false;
-
- public static void setDefaultLookAndFeelDecorated(boolean d)
+ private static boolean defaultLookAndFeelDecorated;
+ private int close_action = HIDE_ON_CLOSE;
+ protected AccessibleContext accessibleContext;
+ protected JRootPane rootPane;
+ protected boolean rootPaneCheckingEnabled;
+
+ public JFrame()
{
- defaultLookAndFeelDecorated = d;
+ super("JFrame");
+ frameInit();
}
- public static boolean isDefaultLookAndFeelDecorated()
+ public JFrame(String title)
{
- return defaultLookAndFeelDecorated;
+ super(title);
+ frameInit();
+ }
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ enableEvents(AWTEvent.WINDOW_EVENT_MASK);
+ getRootPane(); // will do set/create
}
- /***************************************************
- *
- * initia
- *
- *
- *************/
-
-
- public JFrame()
- {
- super("JFrame");
- frameInit();
- }
-
- public JFrame(String title)
- {
- super(title);
- frameInit();
- }
-
-
- /***************************************************
- *
- *
- * methods, this part is shared with JDialog, JFrame
- *
- *
- *************/
-
-
- private boolean checking;
- protected JRootPane rootPane;
-
-
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- enableEvents(AWTEvent.WINDOW_EVENT_MASK);
- getRootPane(); // will do set/create
- }
-
public Dimension getPreferredSize()
{
- Dimension d = super.getPreferredSize();
- return d;
+ return super.getPreferredSize();
}
public JMenuBar getJMenuBar()
- { return getRootPane().getJMenuBar(); }
-
+ {
+ return getRootPane().getJMenuBar();
+ }
+
public void setJMenuBar(JMenuBar menubar)
- { getRootPane().setJMenuBar(menubar); }
-
+ {
+ getRootPane().setJMenuBar(menubar);
+ }
+
+ 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 void setLayeredPane(JLayeredPane layeredPane)
- { getRootPane().setLayeredPane(layeredPane); }
-
public JLayeredPane getLayeredPane()
- { return getRootPane().getLayeredPane(); }
-
+ {
+ return getRootPane().getLayeredPane();
+ }
+
public JRootPane getRootPane()
- {
- if (rootPane == null)
- setRootPane(createRootPane());
- return rootPane;
- }
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
public void setRootPane(JRootPane root)
- {
- if (rootPane != null)
- remove(rootPane);
-
- rootPane = root;
- add(rootPane, BorderLayout.CENTER);
- }
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
public JRootPane createRootPane()
- { return new JRootPane(); }
+ {
+ return new JRootPane();
+ }
public Container getContentPane()
- { return getRootPane().getContentPane(); }
+ {
+ return getRootPane().getContentPane();
+ }
public void setContentPane(Container contentPane)
- { getRootPane().setContentPane(contentPane); }
-
+ {
+ getRootPane().setContentPane(contentPane);
+ }
+
public Component getGlassPane()
- { return getRootPane().getGlassPane(); }
-
+ {
+ return getRootPane().getGlassPane();
+ }
+
public void setGlassPane(Component glassPane)
- { getRootPane().setGlassPane(glassPane); }
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
-
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+ public void remove(Component comp)
+ {
+ getContentPane().remove(comp);
+ }
- public void remove(Component comp)
- { getContentPane().remove(comp); }
-
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return rootPaneCheckingEnabled;
+ }
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ rootPaneCheckingEnabled = enabled;
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+ protected void processKeyEvent(KeyEvent e)
+ {
+ super.processKeyEvent(e);
+ }
- public void update(Graphics g)
- { paint(g); }
+ public static void setDefaultLookAndFeelDecorated(boolean decorated)
+ {
+ defaultLookAndFeelDecorated = decorated;
+ }
- protected void processKeyEvent(KeyEvent e)
- { super.processKeyEvent(e); }
+ public static boolean isDefaultLookAndFeelDecorated()
+ {
+ return defaultLookAndFeelDecorated;
+ }
- /////////////////////////////////////////////////////////////////////////////////
-
public AccessibleContext getAccessibleContext()
{
return accessibleContext;
}
-
- public int getDefaultCloseOperation()
- { return close_action; }
-
-
- protected String paramString()
- { return "JFrame"; }
+ public int getDefaultCloseOperation()
+ {
+ return close_action;
+ }
+ protected String paramString()
+ {
+ return "JFrame";
+ }
- protected void processWindowEvent(WindowEvent e)
- {
- super.processWindowEvent(e);
- switch (e.getID())
+ protected void processWindowEvent(WindowEvent e)
+ {
+ super.processWindowEvent(e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch (close_action)
{
- case WindowEvent.WINDOW_CLOSING:
- {
- switch(close_action)
- {
- case EXIT_ON_CLOSE:
- {
- System.exit(0);
- break;
- }
- case 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:
+ case EXIT_ON_CLOSE:
+ {
+ System.exit(0);
+ break;
+ }
+ case DISPOSE_ON_CLOSE:
+ {
+ dispose();
break;
+ }
+ case HIDE_ON_CLOSE:
+ {
+ setVisible(false);
+ break;
+ }
+ case DO_NOTHING_ON_CLOSE:
+ break;
}
- }
-
- /**
- * Defines what happens when this frame is closed. Can be one off
- * <code>EXIT_ON_CLOSE</code>,
- * <code>DISPOSE_ON_CLOSE</code>,
- * <code>HIDE_ON_CLOSE</code> or
- * <code>DO_NOTHING_ON_CLOSE</code>.
- * The default is <code>HIDE_ON_CLOSE</code>.
- * When <code>EXIT_ON_CLOSE</code> is specified this method calls
- * <code>SecurityManager.checkExit(0)</code> which might throw a
- * <code>SecurityException</code>. When the specified operation is
- * not one of the above a <code>IllegalArgumentException</code> is
- * thrown.
- */
- public void setDefaultCloseOperation(int operation)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null && operation == EXIT_ON_CLOSE)
- sm.checkExit(0);
-
- if (operation != EXIT_ON_CLOSE && operation != DISPOSE_ON_CLOSE
- && operation != HIDE_ON_CLOSE && operation != DO_NOTHING_ON_CLOSE)
- throw new IllegalArgumentException("operation = " + operation);
-
- close_action = operation;
- }
+ 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;
+ }
+ }
+ /**
+ * Defines what happens when this frame is closed. Can be one off
+ * <code>EXIT_ON_CLOSE</code>,
+ * <code>DISPOSE_ON_CLOSE</code>,
+ * <code>HIDE_ON_CLOSE</code> or
+ * <code>DO_NOTHING_ON_CLOSE</code>.
+ * The default is <code>HIDE_ON_CLOSE</code>.
+ * When <code>EXIT_ON_CLOSE</code> is specified this method calls
+ * <code>SecurityManager.checkExit(0)</code> which might throw a
+ * <code>SecurityException</code>. When the specified operation is
+ * not one of the above a <code>IllegalArgumentException</code> is
+ * thrown.
+ */
+ public void setDefaultCloseOperation(int operation)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null && operation == EXIT_ON_CLOSE)
+ sm.checkExit(0);
+
+ if (operation != EXIT_ON_CLOSE && operation != DISPOSE_ON_CLOSE
+ && operation != HIDE_ON_CLOSE && operation != DO_NOTHING_ON_CLOSE)
+ throw new IllegalArgumentException("operation = " + operation);
+
+ close_action = operation;
+ }
}
diff --git a/libjava/javax/swing/JInternalFrame.java b/libjava/javax/swing/JInternalFrame.java
index 12c9d13..ead61f2 100644
--- a/libjava/javax/swing/JInternalFrame.java
+++ b/libjava/javax/swing/JInternalFrame.java
@@ -35,9 +35,9 @@ 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.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
@@ -45,6 +45,7 @@ import java.awt.KeyboardFocusManager;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.beans.PropertyVetoException;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -54,7 +55,6 @@ import javax.swing.event.InternalFrameListener;
import javax.swing.plaf.DesktopIconUI;
import javax.swing.plaf.InternalFrameUI;
-
/**
* This class implements a Swing widget that looks and acts like a native
* frame. The frame can be dragged, resized, closed, etc. Typically,
@@ -341,67 +341,67 @@ public class JInternalFrame extends JComponent implements Accessible,
* The property fired in a PropertyChangeEvent when the contentPane property
* changes.
*/
- public static String CONTENT_PANE_PROPERTY = "contentPane";
+ public static final String CONTENT_PANE_PROPERTY = "contentPane";
/**
* The property fired in a PropertyChangeEvent when the frameIcon property
* changes.
*/
- public static String FRAME_ICON_PROPERTY = "frameIcon";
+ public static final String FRAME_ICON_PROPERTY = "frameIcon";
/**
* The property fired in a PropertyChangeEvent when the glassPane property
* changes.
*/
- public static String GLASS_PANE_PROPERTY = "glassPane";
+ public static final String GLASS_PANE_PROPERTY = "glassPane";
/**
* The property fired in a PropertyChangeEvent when the closed property
* changes.
*/
- public static String IS_CLOSED_PROPERTY = "closed";
+ public static final String IS_CLOSED_PROPERTY = "closed";
/**
* The property fired in a PropertyChangeEvent when the icon property
* changes.
*/
- public static String IS_ICON_PROPERTY = "icon";
+ public static final String IS_ICON_PROPERTY = "icon";
/**
* The property fired in a PropertyChangeEvent when the maximum property
* changes.
*/
- public static String IS_MAXIMUM_PROPERTY = "maximum";
+ public static final String IS_MAXIMUM_PROPERTY = "maximum";
/**
* The property fired in a PropertyChangeEvent when the selected property
* changes.
*/
- public static String IS_SELECTED_PROPERTY = "selected";
+ public static final String IS_SELECTED_PROPERTY = "selected";
/**
* The property fired in a PropertyChangeEvent when the layeredPane property
* changes.
*/
- public static String LAYERED_PANE_PROPERTY = "layeredPane";
+ public static final String LAYERED_PANE_PROPERTY = "layeredPane";
/**
* The property fired in a PropertyChangeEvent when the jMenuBar property
* changes.
*/
- public static String MENU_BAR_PROPERTY = "jMenuBar";
+ public static final String MENU_BAR_PROPERTY = "JMenuBar";
/**
* The property fired in a PropertyChangeEvent when the rootPane property
* changes.
*/
- public static String ROOT_PANE_PROPERTY = "rootPane";
+ public static final String ROOT_PANE_PROPERTY = "rootPane";
/**
* The property fired in a PropertyChangeEvent when the title property
* changes.
*/
- public static String TITLE_PROPERTY = "title";
+ public static final String TITLE_PROPERTY = "title";
/** Whether the JInternalFrame is closable. */
protected boolean closable;
@@ -879,6 +879,8 @@ public class JInternalFrame extends JComponent implements Accessible,
* JInternalFrame.
*
* @return The JMenuBar for this JInternalFrame.
+ *
+ * @deprecated 1.0.3
*/
public JMenuBar getMenuBar()
{
@@ -1482,6 +1484,8 @@ public class JInternalFrame extends JComponent implements Accessible,
* JInternalFrame.
*
* @param m The JMenuBar to use with this JInternalFrame.
+ *
+ * @deprecated 1.0.3
*/
public void setMenuBar(JMenuBar m)
{
@@ -1702,6 +1706,6 @@ public class JInternalFrame extends JComponent implements Accessible,
boolean newValue)
throws PropertyVetoException
{
- super.fireVetoableChange(name, new Boolean(oldValue), new Boolean(newValue));
+ super.fireVetoableChange(name, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
-} // class JInternalFrame
+}
diff --git a/libjava/javax/swing/JLabel.java b/libjava/javax/swing/JLabel.java
index 652c965..b3d7225 100644
--- a/libjava/javax/swing/JLabel.java
+++ b/libjava/javax/swing/JLabel.java
@@ -35,22 +35,20 @@ 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.Font;
import java.awt.Image;
import java.awt.event.KeyEvent;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.swing.Icon;
import javax.swing.plaf.LabelUI;
-
/**
- * <p>
* A swing widget that displays a text message and/or an icon.
- * </p>
*/
public class JLabel extends JComponent implements Accessible, SwingConstants
{
diff --git a/libjava/javax/swing/JLayeredPane.java b/libjava/javax/swing/JLayeredPane.java
index a184e21..a200f28 100644
--- a/libjava/javax/swing/JLayeredPane.java
+++ b/libjava/javax/swing/JLayeredPane.java
@@ -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;
@@ -42,6 +43,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
+
import javax.accessibility.Accessible;
/**
diff --git a/libjava/javax/swing/JList.java b/libjava/javax/swing/JList.java
index b763881..d88a4db 100644
--- a/libjava/javax/swing/JList.java
+++ b/libjava/javax/swing/JList.java
@@ -1,5 +1,5 @@
/* JList.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 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;
import java.awt.Color;
@@ -44,6 +45,7 @@ import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.event.ListDataEvent;
@@ -52,7 +54,6 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.plaf.ListUI;
-
/**
* <p>This class is a facade over three separate objects: {@link
* javax.swing.ListModel}, {@link javax.swing.ListSelectionModel} and
diff --git a/libjava/javax/swing/JMenu.java b/libjava/javax/swing/JMenu.java
index 60e9441..812c26b 100644
--- a/libjava/javax/swing/JMenu.java
+++ b/libjava/javax/swing/JMenu.java
@@ -35,11 +35,11 @@ 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.Point;
-import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
@@ -49,18 +49,15 @@ import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventListener;
-import java.util.Hashtable;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleSelection;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
import javax.swing.event.MenuEvent;
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
@@ -140,7 +137,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
public JMenu(String text, boolean tearoff)
{
- throw new Error("not implemented");
+ // FIXME: tearoff not implemented
+ this(text);
}
private void writeObject(ObjectOutputStream stream) throws IOException
@@ -644,16 +642,28 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
}
/**
+ * Returns all registered <code>MenuListener</code> objects.
+ *
+ * @return an array of listeners
+ *
+ * @since 1.4
+ */
+ public MenuListener[] getMenuListeners()
+ {
+ return (MenuListener[]) listenerList.getListeners(MenuListener.class);
+ }
+
+ /**
* This method fires MenuEvents to all menu's MenuListeners. In this case
* menuSelected() method of MenuListeners is called to indicated that the menu
* was selected.
*/
protected void fireMenuSelected()
{
- EventListener[] ll = listenerList.getListeners(MenuListener.class);
+ MenuListener[] listeners = getMenuListeners();
- for (int i = 0; i < ll.length; i++)
- ((MenuListener) ll[i]).menuSelected(menuEvent);
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].menuSelected(menuEvent);
}
/**
diff --git a/libjava/javax/swing/JMenuBar.java b/libjava/javax/swing/JMenuBar.java
index f63b363..904ba3b 100644
--- a/libjava/javax/swing/JMenuBar.java
+++ b/libjava/javax/swing/JMenuBar.java
@@ -35,35 +35,18 @@ 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.Color;
import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
import java.awt.Graphics;
-import java.awt.Graphics2D;
import java.awt.Insets;
-import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleSelection;
-import javax.accessibility.AccessibleStateSet;
-import javax.accessibility.AccessibleValue;
-import javax.swing.UIManager;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.MenuDragMouseEvent;
-import javax.swing.event.MenuDragMouseListener;
-import javax.swing.event.MenuKeyEvent;
-import javax.swing.event.MenuKeyListener;
import javax.swing.plaf.MenuBarUI;
-import javax.swing.plaf.MenuItemUI;
-
/**
* <p>
@@ -480,8 +463,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
*/
public void updateUI()
{
- MenuBarUI ui = ((MenuBarUI) UIManager.getUI(this));
- setUI(ui);
+ setUI((MenuBarUI) UIManager.getUI(this));
invalidate();
}
}
diff --git a/libjava/javax/swing/JMenuItem.java b/libjava/javax/swing/JMenuItem.java
index 6bf2abc..0aaf0c7 100644
--- a/libjava/javax/swing/JMenuItem.java
+++ b/libjava/javax/swing/JMenuItem.java
@@ -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;
@@ -47,10 +48,10 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.EventListener;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
-import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.MenuDragMouseEvent;
@@ -528,19 +529,20 @@ public class JMenuItem extends AbstractButton implements Accessible,
*/
public void menuSelectionChanged(boolean changed)
{
+ Component parent = this.getParent();
if (changed)
{
model.setArmed(true);
- if (this.getParent() instanceof JPopupMenu)
- ((JPopupMenu) this.getParent()).setSelected(this);
+ if (parent != null && parent instanceof JPopupMenu)
+ ((JPopupMenu) parent).setSelected(this);
}
else
{
model.setArmed(false);
- if (this.getParent() instanceof JPopupMenu)
- ((JPopupMenu) this.getParent()).getSelectionModel().clearSelection();
+ if (parent != null && parent instanceof JPopupMenu)
+ ((JPopupMenu) parent).getSelectionModel().clearSelection();
}
}
diff --git a/libjava/javax/swing/JOptionPane.java b/libjava/javax/swing/JOptionPane.java
index 0704270..2623682 100644
--- a/libjava/javax/swing/JOptionPane.java
+++ b/libjava/javax/swing/JOptionPane.java
@@ -35,22 +35,20 @@ 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.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
-import javax.swing.Icon;
-import javax.swing.JInternalFrame;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import javax.swing.plaf.OptionPaneUI;
-
/**
* This class creates different types of JDialogs and JInternalFrames that can
* ask users for input or pass on information. JOptionPane can be used by
diff --git a/libjava/javax/swing/JPanel.java b/libjava/javax/swing/JPanel.java
index 29abffc..34a7c9f 100644
--- a/libjava/javax/swing/JPanel.java
+++ b/libjava/javax/swing/JPanel.java
@@ -35,15 +35,16 @@ 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.FlowLayout;
import java.awt.LayoutManager;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.plaf.PanelUI;
-
/**
* An instance of JPanel can be added to a panel, frame etc
*
diff --git a/libjava/javax/swing/JPasswordField.java b/libjava/javax/swing/JPasswordField.java
index b8c8805..133c99a 100644
--- a/libjava/javax/swing/JPasswordField.java
+++ b/libjava/javax/swing/JPasswordField.java
@@ -35,10 +35,12 @@ 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.IOException;
import java.io.ObjectOutputStream;
+
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.text.BadLocationException;
@@ -75,164 +77,186 @@ public class JPasswordField extends JTextField
}
}
- /**
- * uiClassID
- */
- private static final String uiClassID = "PasswordFieldUI";
-
- /**
- * echoChar. Default is 0
- */
- private char echoChar = 0;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor JPasswordField
- */
- public JPasswordField() {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param text TODO
- */
- public JPasswordField(String text) {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param columns TODO
- */
- public JPasswordField(int columns) {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param text TODO
- * @param columns TODO
- */
- public JPasswordField(String text, int columns) {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param document TODO
- * @param text TODO
- * @param columns TODO
- */
- public JPasswordField(Document document, String text, int columns) {
- // TODO
- } // JPasswordField()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * writeObject
- * @param stream TODO
- * @exception IOException TODO
- */
- private void writeObject(ObjectOutputStream stream) throws IOException {
- // TODO
- } // writeObject()
-
- /**
- * copy
- */
- public void copy() {
- // TODO
- } // copy()
-
- /**
- * getUIClassID
- * @returns String
- */
- public String getUIClassID() {
- return uiClassID;
- } // getUIClassID()
-
- /**
- * getEchoChar
- * @returns char
- */
- public char getEchoChar() {
- return echoChar;
- } // getEchoChar()
-
- /**
- * setEchoChar
- * @param echo TODO
- */
- public void setEchoChar(char echo) {
- this.echoChar = echo;
- // TODO
- } // setEchoChar()
-
- /**
- * echoCharIsSet
- * @returns boolean
- */
- public boolean echoCharIsSet() {
- return (echoChar == 0);
- } // echoCharIsSet()
-
- /**
- * cut
- */
- public void cut() {
- // TODO
- } // cut()
-
- /**
- * getText
- * @returns String
- * @deprecated
- */
- public String getText() {
- return null; // TODO
- } // getText()
-
- /**
- * getText
- * @param offset TODO
- * @param length TODO
- * @exception BadLocationException TODO
- * @returns String
- * @deprecated
- */
- public String getText(int offset, int length) throws BadLocationException {
- return null; // TODO
- } // getText()
-
- /**
- * getPassword
- * @returns char[]
- */
- public char[] getPassword() {
- return null; // TODO
- } // getPassword()
-
- /**
- * paramString
- * @returns String
- */
- protected String paramString() {
- return null; // TODO
- } // paramString()
+ /**
+ * echoChar. Default is 0.
+ */
+ private char echoChar = 0;
+
+ /**
+ * Constructor JPasswordField
+ */
+ public JPasswordField()
+ {
+ this(null, null, 0);
+ }
+
+ /**
+ * Creates a <code>JPasswordField</code> object.
+ *
+ * @param text the initial text
+ */
+ public JPasswordField(String text)
+ {
+ this(null, text, 0);
+ }
+
+ /**
+ * Creates a <code>JPasswordField</code> object.
+ *
+ * @param columns the number of columns
+ */
+ public JPasswordField(int columns)
+ {
+ this(null, null, columns);
+ }
+
+ /**
+ * Creates a <code>JPasswordField</code> object.
+ *
+ * @param text the initial text
+ * @param columns the number of columns
+ */
+ public JPasswordField(String text, int columns)
+ {
+ this(null, text, columns);
+ }
+
+ /**
+ * Creates a <code>JPasswordField</code> object.
+ *
+ * @param document the document to use
+ * @param text the initial text
+ * @param columns the number of columns
+ */
+ public JPasswordField(Document document, String text, int columns)
+ {
+ super(document, text, columns);
+ }
+
+ /**
+ * writeObject
+ *
+ * @param stream the stream to write to
+ *
+ * @exception IOException if an error occurs
+ */
+ private void writeObject(ObjectOutputStream stream) throws IOException
+ {
+ // TODO: Implement me.
+ }
+
+ /**
+ * Returns the <code>UIClassID</code>
+ *
+ * @return the string "PasswordFieldUI"
+ */
+ public String getUIClassID()
+ {
+ return "PasswordFieldUI";
+ }
+
+ /**
+ * getEchoChar
+ *
+ * @return the echo char
+ */
+ public char getEchoChar()
+ {
+ return echoChar;
+ }
+
+ /**
+ * setEchoChar
+ *
+ * @param echo the echo char
+ */
+ public void setEchoChar(char echo)
+ {
+ this.echoChar = echo;
+ }
+
+ /**
+ * echoCharIsSet
+ *
+ * @return <code>true</code> if the echo char is set,
+ * <code>false</code> otherwise.
+ */
+ public boolean echoCharIsSet()
+ {
+ return echoChar == 0;
+ }
+
+ /**
+ * Copies the selected text into the clipboard. This operation is not
+ * allowed in a password input field.
+ */
+ public void copy()
+ {
+ UIManager.getLookAndFeel().provideErrorFeedback(this);
+ }
+
+ /**
+ * Cuts the selected text and puts it into the clipboard. This operation
+ * is not allowed in a password input field.
+ */
+ public void cut()
+ {
+ UIManager.getLookAndFeel().provideErrorFeedback(this);
+ }
+
+ /**
+ * getText
+ *
+ * @return String
+ *
+ * @deprecated
+ */
+ public String getText()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getText
+ *
+ * @param offset TODO
+ * @param length TODO
+ *
+ * @return String
+ *
+ * @exception BadLocationException TODO
+ *
+ * @deprecated
+ */
+ public String getText(int offset, int length) throws BadLocationException
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getPassword
+ *
+ * @return char[]
+ */
+ public char[] getPassword()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * paramString
+ *
+ * @return String
+ */
+ protected String paramString()
+ {
+ return null; // TODO
+ }
/**
* getAccessibleContext
- * @return AccessibleContext
+ *
+ * @return the <code>AccessibleContext</code> object
*/
public AccessibleContext getAccessibleContext()
{
diff --git a/libjava/javax/swing/JPopupMenu.java b/libjava/javax/swing/JPopupMenu.java
index d7d3e43..76f6362 100644
--- a/libjava/javax/swing/JPopupMenu.java
+++ b/libjava/javax/swing/JPopupMenu.java
@@ -35,21 +35,17 @@ 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.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
import java.awt.Insets;
-import java.awt.LayoutManager;
import java.awt.Panel;
import java.awt.Point;
-import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
@@ -58,7 +54,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.EventListener;
-import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -66,7 +62,6 @@ import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.PopupMenuUI;
-
/**
* JPopupMenu is a container that is used to display popup menu's menu
* items. By default JPopupMenu is a lightweight container, however if it
diff --git a/libjava/javax/swing/JRadioButton.java b/libjava/javax/swing/JRadioButton.java
index b1f733a..fc06d15 100644
--- a/libjava/javax/swing/JRadioButton.java
+++ b/libjava/javax/swing/JRadioButton.java
@@ -39,70 +39,219 @@ exception statement from your version. */
package javax.swing;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.plaf.ButtonUI;
+/**
+ * The <code>JRadioButton</code> component provides a visually selectable
+ * button with mutually exclusive behaviour within a <code>ButtonGroup</code>.
+ * A series of radio buttons can be used to provide options to the user,
+ * where the user can only select one of the available options. The state
+ * of the button is provided by the superclass, <code>JToggleButton</code>.
+ * <code>JRadioButton</code> adds the additional behaviour, that if two
+ * or more radio buttons are grouped together, the selection of one implies
+ * the deselection of the other buttons within the group.
+ * <p>
+ *
+ * Buttons are grouped by adding each instance to a <code>ButtonGroup</code>.
+ * The existence of such a grouping is not reflected visually, so other means
+ * should be used to denote this. For instance, the grouped buttons can be placed
+ * within the same panel, possibly with an appropriate border to denote
+ * the connection between the components.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @author Graydon Hoare <graydon@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see JToggleButton
+ * @see ButtonGroup
+ * @since 1.2
+ */
public class JRadioButton extends JToggleButton
{
+ /**
+ * Compatible with Sun's JDK.
+ */
private static final long serialVersionUID = 7751949583255506856L;
+ /**
+ * This class provides accessibility support for the toggle button.
+ */
+ protected class AccessibleJRadioButton
+ extends AccessibleJToggleButton
+ {
+
+ /**
+ * Constructor for the accessible toggle button.
+ */
+ protected AccessibleJRadioButton()
+ {
+ /* Call the superclass to register for events */
+ super();
+ }
+
+ /**
+ * Returns the accessible role for the toggle button.
+ *
+ * @return An instance of <code>AccessibleRole</code>, describing
+ * the role of the toggle button.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.RADIO_BUTTON;
+ }
+
+ }
+
+ /**
+ * Constructs an unselected radio button with no text or icon.
+ */
public JRadioButton()
{
- this(null, null);
+ this(null, null, false);
}
+ /**
+ * Constructs a radio button using the labelling, state
+ * and icon specified by the supplied action.
+ *
+ * @param a the action to use to define the properties of the button.
+ */
public JRadioButton(Action a)
{
this();
setAction(a);
}
+ /**
+ * Constructs an unselected radio button with the supplied icon
+ * and no text.
+ *
+ * @param icon the icon to use.
+ */
public JRadioButton(Icon icon)
{
- this(null, icon);
+ this(null, icon, false);
}
+ /**
+ * Constructs a radio button with the supplied icon and state.
+ *
+ * @param icon the icon to use.
+ * @param selected if true, the radio button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
public JRadioButton(Icon icon, boolean selected)
{
this(null, icon, selected);
}
+ /**
+ * Constructs an unselected radio button using the supplied text
+ * and no icon.
+ *
+ * @param text the text to use.
+ */
public JRadioButton(String text)
{
- this(text, null);
+ this(text, null, false);
}
+ /**
+ * Constructs a radio button with the supplied text and state.
+ *
+ * @param text the text to use.
+ * @param selected if true, the radio button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
public JRadioButton(String text, boolean selected)
{
this(text, null, selected);
}
+ /**
+ * Constructs an unselected radio button with the supplied text
+ * and icon.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ */
public JRadioButton(String text, Icon icon)
{
- super(text, icon);
+ this(text, icon, false);
+ }
+
+ /**
+ * Constructs a radio button with the supplied text, icon and state.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ * @param selected if true, the radio button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
+ public JRadioButton(String text, Icon icon, boolean selected)
+ {
+ super(text, icon, selected);
borderPainted = false;
contentAreaFilled = false;
}
- public JRadioButton(String text, Icon icon, boolean selected)
+ /**
+ * Returns the accessible context for this <code>JRadioButton</code>,
+ * in the form of an instance of <code>AccessibleJRadioButton</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)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleJRadioButton();
+ }
+ return accessibleContext;
}
-
- public AccessibleContext getAccessibleContext()
- {
- //Gets the AccessibleContext associated with this JRadioButton.
- return null;
- }
- public String getUIClassID()
- {
- //Returns a string that specifies the name of the Look and Feel
- //class that renders this component.
- return "RadioButtonUI";
- }
+ /**
+ * Returns a string specifying the name of the Look and Feel UI class
+ * that renders this component.
+ *
+ * @return the Look and Feel UI class for <code>JRadioButton</code>s
+ * as a <code>String</code>.
+ */
+ public String getUIClassID()
+ {
+ return "RadioButtonUI";
+ }
- protected String paramString()
- {
- return "JRadioButton";
- }
+ /**
+ * Returns a string representation of this component for debugging use.
+ * Users should not depend on anything as regards the content or formatting
+ * of this string, except for the fact that the returned string may never be
+ * null (only empty).
+ *
+ * @return the component in <code>String</code> form for debugging.
+ */
+ protected String paramString()
+ {
+ return "JRadioButton";
+ }
+
+ /**
+ * This method resets the radio button's UI delegate to the default UI for
+ * the current look and feel.
+ */
+ public void updateUI()
+ {
+ /*
+ I can't see any difference between this and the superclass one,
+ but Sun reimplements it... there is no RadioButtonUI class for it
+ to be cast to.
+ */
+ setUI((ButtonUI) UIManager.getUI(this));
+ }
+
}
diff --git a/libjava/javax/swing/JRadioButtonMenuItem.java b/libjava/javax/swing/JRadioButtonMenuItem.java
index 4ced1a5..2aefb33 100644
--- a/libjava/javax/swing/JRadioButtonMenuItem.java
+++ b/libjava/javax/swing/JRadioButtonMenuItem.java
@@ -35,16 +35,15 @@ 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.IOException;
import java.io.ObjectOutputStream;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
/**
* This class represents JRadioButtonMenuItem. Its behaviour is very similar
diff --git a/libjava/javax/swing/JRootPane.java b/libjava/javax/swing/JRootPane.java
index 34cd800..4f067c9 100644
--- a/libjava/javax/swing/JRootPane.java
+++ b/libjava/javax/swing/JRootPane.java
@@ -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.BorderLayout;
@@ -44,6 +45,7 @@ import java.awt.Dimension;
import java.awt.LayoutManager;
import java.awt.LayoutManager2;
import java.io.Serializable;
+
import javax.accessibility.AccessibleRole;
import javax.swing.plaf.RootPaneUI;
@@ -62,7 +64,9 @@ public class JRootPane extends JComponent
// The class used to obtain the accessible role for this object.
protected static class AccessibleJRootPane
{
- /** DOCUMENT ME! */
+ /**
+ * For compatability with Sun's JDK
+ */
private static final long serialVersionUID = 1082432482784468088L;
/**
@@ -306,6 +310,16 @@ public class JRootPane extends JComponent
/** DOCUMENT ME! */
private static final long serialVersionUID = 8690748000348575668L;
+ public static final int NONE = 0;
+ public static final int FRAME = 1;
+ public static final int PLAIN_DIALOG = 2;
+ public static final int INFORMATION_DIALOG = 3;
+ public static final int ERROR_DIALOG = 4;
+ public static final int COLOR_CHOOSER_DIALOG = 5;
+ public static final int FILE_CHOOSER_DIALOG = 6;
+ public static final int QUESTION_DIALOG = 7;
+ public static final int WARNING_DIALOG = 8;
+
/** DOCUMENT ME! */
protected Component glassPane;
@@ -318,6 +332,8 @@ public class JRootPane extends JComponent
/** DOCUMENT ME! */
protected Container contentPane;
+ protected JButton defaultButton;
+
/**
* DOCUMENT ME!
*
@@ -466,7 +482,7 @@ public class JRootPane extends JComponent
*
* @return DOCUMENT ME!
*/
- protected JComponent createContentPane()
+ protected Container createContentPane()
{
JPanel p = new JPanel();
p.setName(this.getName() + ".contentPane");
@@ -538,4 +554,19 @@ public class JRootPane extends JComponent
{
return "RootPaneUI";
}
+
+ public JButton getDefaultButton()
+ {
+ return defaultButton;
+ }
+
+ public void setDefaultButton(JButton newButton)
+ {
+ if (defaultButton == newButton)
+ return;
+
+ JButton oldButton = defaultButton;
+ defaultButton = newButton;
+ firePropertyChange("defaultButton", oldButton, newButton);
+ }
}
diff --git a/libjava/javax/swing/JScrollBar.java b/libjava/javax/swing/JScrollBar.java
index 07fe5cc..b755c6f 100644
--- a/libjava/javax/swing/JScrollBar.java
+++ b/libjava/javax/swing/JScrollBar.java
@@ -542,7 +542,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
* @param newMin The new minimum.
* @param newMax The new maximum.
*/
- public void setValue(int newValue, int newExtent, int newMin, int newMax)
+ public void setValues(int newValue, int newExtent, int newMin, int newMax)
{
if (!isEnabled())
newValue = model.getValue();
diff --git a/libjava/javax/swing/JScrollPane.java b/libjava/javax/swing/JScrollPane.java
index 798c48b..01131b7 100644
--- a/libjava/javax/swing/JScrollPane.java
+++ b/libjava/javax/swing/JScrollPane.java
@@ -497,14 +497,14 @@ public class JScrollPane
|| vsb.getMaximum() != vs.height
|| vsb.getValue() != vr.y
|| vsb.getVisibleAmount() != vr.height))
- vsb.setValue(vr.y, vr.height, 0, vs.height);
+ vsb.setValues(vr.y, vr.height, 0, vs.height);
if (hsb != null
&& (hsb.getMinimum() != 0
|| hsb.getMaximum() != vs.width
|| hsb.getValue() != vr.width
|| hsb.getVisibleAmount() != vr.height))
- hsb.setValue(vr.x, vr.width, 0, vs.width);
+ hsb.setValues(vr.x, vr.width, 0, vs.width);
}
else
{
@@ -593,7 +593,6 @@ public class JScrollPane
return new JViewport();
}
-
public String getUIClassID()
{
return "ScrollPaneUI";
@@ -605,6 +604,25 @@ public class JScrollPane
setUI(b);
}
+ /**
+ * This method returns the scrollpane's UI delegate.
+ *
+ * @return The scrollpane's UI delegate.
+ */
+ public ScrollPaneUI getUI()
+ {
+ return (ScrollPaneUI) ui;
+ }
+
+ /**
+ * This method sets the scrollpane's UI delegate.
+ *
+ * @param ui The scrollpane's UI delegate.
+ */
+ public void setUI(ScrollPaneUI ui)
+ {
+ super.setUI(ui);
+ }
class ScrollBar
extends JScrollBar
diff --git a/libjava/javax/swing/JSpinner.java b/libjava/javax/swing/JSpinner.java
index 00b22d5..271c511 100644
--- a/libjava/javax/swing/JSpinner.java
+++ b/libjava/javax/swing/JSpinner.java
@@ -35,20 +35,18 @@ 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.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.DecimalFormat;
import java.text.ParseException;
-import java.util.EventListener;
+
import javax.swing.border.EtchedBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -113,21 +111,41 @@ public class JSpinner extends JComponent
PropertyChangeListener,
LayoutManager
{
+ private JSpinner spinner;
+
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -5317788736173368172L;
+
/**
- * Creates a new DefaultEditor object.
+ * Creates a new <code>DefaultEditor</code> object.
*
- * @param spinner DOCUMENT ME!
+ * @param spinner the <code>JSpinner</code> associated with this editor
*/
public DefaultEditor(JSpinner spinner)
{
+ this.spinner = spinner;
+
spinner.addChangeListener(this);
- } /* TODO */
+ }
+
+ /**
+ * Returns the <code>JSpinner</code> object for this editor.
+ */
+ public JSpinner getSpinner()
+ {
+ return spinner;
+ }
+
/**
* DOCUMENT ME!
*/
public void commitEdit()
+ throws ParseException
{
} /* TODO */
+
/**
* DOCUMENT ME!
*
@@ -147,6 +165,7 @@ public class JSpinner extends JComponent
{
return null;
} /* TODO */
+
/**
* DOCUMENT ME!
*
@@ -155,6 +174,7 @@ public class JSpinner extends JComponent
public void layoutContainer(Container parent)
{
} /* TODO */
+
/**
* DOCUMENT ME!
*
@@ -166,6 +186,7 @@ public class JSpinner extends JComponent
{
return null;
} /* TODO */
+
/**
* DOCUMENT ME!
*
@@ -177,22 +198,25 @@ public class JSpinner extends JComponent
{
return null;
} /* TODO */
+
/**
* DOCUMENT ME!
*
- * @param evt DOCUMENT ME!
+ * @param event DOCUMENT ME!
*/
- public void propertyChange(PropertyChangeEvent evt)
+ public void propertyChange(PropertyChangeEvent event)
{
} /* TODO */
+
/**
* DOCUMENT ME!
*
- * @param evt DOCUMENT ME!
+ * @param event DOCUMENT ME!
*/
- public void stateChanged(ChangeEvent evt)
+ public void stateChanged(ChangeEvent event)
{
} /* TODO */
+
/* no-ops */
public void removeLayoutComponent(Component child)
{
@@ -215,6 +239,11 @@ public class JSpinner extends JComponent
public static class NumberEditor extends DefaultEditor
{
/**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 3791956183098282942L;
+
+ /**
* Creates a new NumberEditor object.
*
* @param spinner DOCUMENT ME!
@@ -225,6 +254,16 @@ public class JSpinner extends JComponent
}
/**
+ * Creates a new NumberEditor object.
+ *
+ * @param spinner DOCUMENT ME!
+ */
+ public NumberEditor(JSpinner spinner, String decimalFormatPattern)
+ {
+ super(spinner);
+ }
+
+ /**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
@@ -233,6 +272,11 @@ public class JSpinner extends JComponent
{
return null;
}
+
+ public SpinnerNumberModel getModel()
+ {
+ return (SpinnerNumberModel) getSpinner().getModel();
+ }
}
/** DOCUMENT ME! */
@@ -337,6 +381,29 @@ public class JSpinner extends JComponent
}
/**
+ * Sets a new underlying model.
+ *
+ * @param newModel the new model to set
+ *
+ * @exception IllegalArgumentException if newModel is <code>null</code>
+ */
+ public void setModel(SpinnerModel newModel)
+ {
+ if (newModel == null)
+ throw new IllegalArgumentException();
+
+ if (model == newModel)
+ return;
+
+ SpinnerModel oldModel = model;
+ model = newModel;
+ firePropertyChange("model", oldModel, newModel);
+
+ if (editor == null)
+ setEditor(createEditor(model));
+ }
+
+ /**
* Gets the next value without changing the current value.
*
* @return the next value
diff --git a/libjava/javax/swing/JSplitPane.java b/libjava/javax/swing/JSplitPane.java
index 32b85e1..9cdad16 100644
--- a/libjava/javax/swing/JSplitPane.java
+++ b/libjava/javax/swing/JSplitPane.java
@@ -40,15 +40,14 @@ package javax.swing;
import java.awt.Component;
import java.awt.Graphics;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleValue;
-import javax.swing.UIManager;
import javax.swing.plaf.SplitPaneUI;
-
/**
* This class implements JSplitPane. It is used to divide two components. By
* dragging the SplitPane's divider, the user can resize the two components.
diff --git a/libjava/javax/swing/JTabbedPane.java b/libjava/javax/swing/JTabbedPane.java
index 0f3fbce..25733df 100644
--- a/libjava/javax/swing/JTabbedPane.java
+++ b/libjava/javax/swing/JTabbedPane.java
@@ -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.Color;
@@ -44,6 +45,7 @@ import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.io.Serializable;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -53,7 +55,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.TabbedPaneUI;
import javax.swing.plaf.UIResource;
-
/**
* <p>
* This is a container for components. One component is displayed at a time.
diff --git a/libjava/javax/swing/JTable.java b/libjava/javax/swing/JTable.java
index 4a81e04..ae2c4af 100644
--- a/libjava/javax/swing/JTable.java
+++ b/libjava/javax/swing/JTable.java
@@ -56,8 +56,8 @@ import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.plaf.TableUI;
-import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;
@@ -675,6 +675,11 @@ public class JTable extends JComponent
return renderer;
}
+ public void setDefaultRenderer(Class columnClass, TableCellRenderer rend)
+ {
+ defaultRenderersByColumnClass.put(columnClass, rend);
+ }
+
public TableCellRenderer getDefaultRenderer(Class columnClass)
{
if (defaultRenderersByColumnClass.containsKey(columnClass))
@@ -1148,16 +1153,32 @@ public class JTable extends JComponent
*/
public void setModel(TableModel m)
{
+ // Throw exception is m is null.
if (m == null)
throw new IllegalArgumentException();
- TableModel tmp = dataModel;
- if (autoCreateColumnsFromModel)
- createColumnsFromModel();
- if (tmp != null)
- tmp.removeTableModelListener(this);
+
+ // Don't do anything if setting the current model again.
+ if (dataModel == m)
+ return;
+
+ // Remove table as TableModelListener from old model.
+ if (dataModel != null)
+ dataModel.removeTableModelListener(this);
+
if (m != null)
- m.addTableModelListener(this);
- dataModel = m;
+ {
+ // Set property.
+ dataModel = m;
+
+ // Add table as TableModelListener to new model.
+ dataModel.addTableModelListener(this);
+
+ // Automatically create columns.
+ if (autoCreateColumnsFromModel)
+ createColumnsFromModel();
+ }
+
+ // Repaint table.
revalidate();
repaint();
}
@@ -1540,17 +1561,31 @@ public class JTable extends JComponent
doLayout();
}
-
public String getUIClassID()
{
return "TableUI";
}
+ /**
+ * This method returns the table's UI delegate.
+ *
+ * @return The table's UI delegate.
+ */
public TableUI getUI()
{
return (TableUI) ui;
}
+ /**
+ * This method sets the table's UI delegate.
+ *
+ * @param ui The table's UI delegate.
+ */
+ public void setUI(TableUI ui)
+ {
+ super.setUI(ui);
+ }
+
public void updateUI()
{
setUI((TableUI) UIManager.getUI(this));
diff --git a/libjava/javax/swing/JTextArea.java b/libjava/javax/swing/JTextArea.java
index 5cbc87d..2561775 100644
--- a/libjava/javax/swing/JTextArea.java
+++ b/libjava/javax/swing/JTextArea.java
@@ -35,22 +35,86 @@ 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;
+import java.awt.FontMetrics;
+
+import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
+import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;
+/**
+ * The <code>JTextArea</code> component provides a multi-line area for displaying
+ * and editing plain text. The component is designed to act as a lightweight
+ * replacement for the heavyweight <code>java.awt.TextArea</code> component,
+ * which provides similar functionality using native widgets.
+ * <p>
+ *
+ * This component has additional functionality to the AWT class. It follows
+ * the same design pattern as seen in other text components, such as
+ * <code>JTextField</code>, <code>JTextPane</code> and <code>JEditorPane</code>,
+ * and embodied in <code>JTextComponent</code>. These classes separate the text
+ * (the model) from its appearance within the onscreen component (the view). The
+ * text is held within a <code>javax.swing.text.Document</code> object, which can
+ * also maintain relevant style information where necessary. As a result, it is the
+ * document that should be monitored for textual changes, via
+ * <code>DocumentEvent</code>s delivered to registered
+ * <code>DocumentListener</code>s, rather than this component.
+ * <p>
+ *
+ * Unlike <code>java.awt.TextArea</code>, <code>JTextArea</code> does not
+ * handle scrolling. Instead, this functionality is delegated to a
+ * <code>JScrollPane</code>, which can contain the text area and handle
+ * scrolling when required. Likewise, the word wrapping functionality
+ * of the AWT component is converted to a property of this component
+ * and the <code>rows</code> and <code>columns</code> properties
+ * are used in calculating the preferred size of the scroll pane's
+ * view port.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see java.awt.TextArea
+ * @see javax.swing.JTextComponent
+ * @see javax.swing.JTextField
+ * @see javax.swing.JTextPane
+ * @see javax.swing.JEditorPane
+ * @see javax.swing.text.Document
+ * @see javax.swing.text.DocumentEvent
+ * @see javax.swing.text.DocumentListener
+ */
+
public class JTextArea extends JTextComponent
{
+ /**
+ * Compatible with Sun's JDK
+ */
private static final long serialVersionUID = -6141680179310439825L;
+ /**
+ * The number of rows used by the component.
+ */
private int rows;
+
+ /**
+ * The number of columns used by the component.
+ */
private int columns;
- private boolean wrapping;
+
+ /**
+ * Whether line wrapping is enabled or not.
+ */
+ private boolean lineWrap;
+
+ /**
+ * The number of characters equal to a tab within the text.
+ */
private int tabSize = 8;
+ private boolean wrapStyleWord;
+
/**
* Creates a new <code>JTextArea</code> object.
*/
@@ -125,13 +189,22 @@ public class JTextArea extends JTextComponent
}
/**
- * Appends some text.
+ * Appends the supplied text to the current contents
+ * of the document model.
*
* @param toAppend the text to append
*/
public void append(String toAppend)
{
- setText(getText() + toAppend);
+ try
+ {
+ getDocument().insertString(getText().length(), toAppend, null);
+ }
+ catch (BadLocationException exception)
+ {
+ /* This shouldn't happen in theory -- but, if it does... */
+ throw new RuntimeException("Unexpected exception occurred.", exception);
+ }
}
/**
@@ -144,10 +217,16 @@ public class JTextArea extends JTextComponent
return new PlainDocument();
}
-
+ /**
+ * Returns true if the width of this component should be forced
+ * to match the width of a surrounding view port. When line wrapping
+ * is turned on, this method returns true.
+ *
+ * @return true if lines are wrapped.
+ */
public boolean getScrollableTracksViewportWidth()
{
- return wrapping ? true : super.getScrollableTracksViewportWidth();
+ return lineWrap ? true : super.getScrollableTracksViewportWidth();
}
/**
@@ -211,35 +290,78 @@ public class JTextArea extends JTextComponent
}
/**
- * Checks whethet line wrapping is enabled.
+ * Checks whether line wrapping is enabled.
*
- * @return true if line wrapping is enabled, false otherwise
+ * @return <code>true</code> if line wrapping is enabled,
+ * <code>false</code> otherwise
*/
public boolean getLineWrap()
{
- return wrapping;
+ return lineWrap;
}
/**
* Enables/disables line wrapping.
*
- * @param wrapping true to enable line wrapping, false otherwise
+ * @param wrapping <code>true</code> to enable line wrapping,
+ * <code>false</code> otherwise
*/
public void setLineWrap(boolean flag)
{
- if (wrapping == flag)
+ if (lineWrap == flag)
return;
- boolean oldValue = wrapping;
- wrapping = flag;
- firePropertyChange("lineWrap", oldValue, wrapping);
+ boolean oldValue = lineWrap;
+ lineWrap = flag;
+ firePropertyChange("lineWrap", oldValue, lineWrap);
}
+ /**
+ * Checks whether word style wrapping is enabled.
+ *
+ * @return <code>true</code> if word style wrapping is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean getWrapStyleWord()
+ {
+ return wrapStyleWord;
+ }
+
+ /**
+ * Enables/Disables word style wrapping.
+ *
+ * @param flag <code>true</code> to enable word style wrapping,
+ * <code>false</code> otherwise
+ */
+ public void setWrapStyleWord(boolean flag)
+ {
+ if (wrapStyleWord == flag)
+ return;
+
+ boolean oldValue = wrapStyleWord;
+ wrapStyleWord = flag;
+ firePropertyChange("wrapStyleWord", oldValue, wrapStyleWord);
+ }
+
+ /**
+ * Returns the number of characters used for a tab.
+ * This defaults to 8.
+ *
+ * @return the current number of spaces used for a tab.
+ */
public int getTabSize()
{
return tabSize;
}
+ /**
+ * Sets the number of characters used for a tab to the
+ * supplied value. If a change to the tab size property
+ * occurs (i.e. newSize != tabSize), a property change event
+ * is fired.
+ *
+ * @param newSize The new number of characters to use for a tab.
+ */
public void setTabSize(int newSize)
{
if (tabSize == newSize)
@@ -249,4 +371,110 @@ public class JTextArea extends JTextComponent
tabSize = newSize;
firePropertyChange("tabSize", oldValue, tabSize);
}
+
+ protected int getColumnWidth()
+ {
+ FontMetrics metrics = getToolkit().getFontMetrics(getFont());
+ return metrics.charWidth('m');
+ }
+
+ public int getLineCount()
+ {
+ return getDocument().getDefaultRootElement().getElementCount();
+ }
+
+ public int getLineStartOffset(int line)
+ throws BadLocationException
+ {
+ int lineCount = getLineCount();
+
+ if (line < 0 || line > lineCount)
+ throw new BadLocationException("Non-existing line number", line);
+
+ Element lineElem = getDocument().getDefaultRootElement().getElement(line);
+ return lineElem.getStartOffset();
+ }
+
+ public int getLineEndOffset(int line)
+ throws BadLocationException
+ {
+ int lineCount = getLineCount();
+
+ if (line < 0 || line > lineCount)
+ throw new BadLocationException("Non-existing line number", line);
+
+ Element lineElem = getDocument().getDefaultRootElement().getElement(line);
+ return lineElem.getEndOffset();
+ }
+
+ public int getLineOfOffset(int offset)
+ throws BadLocationException
+ {
+ Document doc = getDocument();
+
+ if (offset < doc.getStartPosition().getOffset()
+ || offset >= doc.getEndPosition().getOffset())
+ throw new BadLocationException("offset outside of document", offset);
+
+ return doc.getDefaultRootElement().getElementIndex(offset);
+ }
+
+ protected int getRowHeight()
+ {
+ FontMetrics metrics = getToolkit().getFontMetrics(getFont());
+ return metrics.getHeight();
+ }
+
+ /**
+ * Inserts the supplied text at the specified position. Nothing
+ * happens in the case that the model or the supplied string is null
+ * or of zero length.
+ *
+ * @param string The string of text to insert.
+ * @param position The position at which to insert the supplied text.
+ * @throws IllegalArgumentException if the position is &lt; 0 or greater
+ * than the length of the current text.
+ */
+ public void insert(String string, int position)
+ {
+ // Retrieve the document model.
+ Document doc = getDocument();
+
+ // Check the model and string for validity.
+ if (doc == null
+ || string == null
+ || string.length() == 0)
+ return;
+
+ // Insert the text into the model.
+ try
+ {
+ doc.insertString(position, string, null);
+ }
+ catch (BadLocationException e)
+ {
+ throw new IllegalArgumentException("The supplied position, "
+ + position + ", was invalid.");
+ }
+ }
+
+ public void replaceRange(String text, int start, int end)
+ {
+ Document doc = getDocument();
+
+ if (start > end
+ || start < doc.getStartPosition().getOffset()
+ || end >= doc.getEndPosition().getOffset())
+ throw new IllegalArgumentException();
+
+ try
+ {
+ doc.remove(start, end);
+ doc.insertString(start, text, null);
+ }
+ catch (BadLocationException e)
+ {
+ // This cannot happen as we check offset above.
+ }
+ }
}
diff --git a/libjava/javax/swing/JTextField.java b/libjava/javax/swing/JTextField.java
index 4466f5a..5fe104b 100644
--- a/libjava/javax/swing/JTextField.java
+++ b/libjava/javax/swing/JTextField.java
@@ -42,6 +42,9 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
import javax.accessibility.AccessibleStateSet;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
@@ -83,6 +86,16 @@ public class JTextField extends JTextComponent
private int align;
+ private int scrollOffset;
+
+ /** @since 1.3 */
+ private Action action;
+
+ /** @since 1.3 */
+ private String actionCommand;
+
+ private PropertyChangeListener actionPropertyChangeListener;
+
/**
* Creates a new instance of <code>JTextField</code>.
*/
@@ -241,11 +254,14 @@ public class JTextField extends JTextComponent
public void setHorizontalAlignment(int newAlign)
{
+ if (align == newAlign)
+ return;
+
int oldAlign = align;
align = newAlign;
+ firePropertyChange("horizontalAlignment", oldAlign, newAlign);
invalidate();
repaint();
- firePropertyChange("horizontalAlignment", oldAlign, newAlign);
}
public void setFont(Font newFont)
@@ -272,4 +288,134 @@ public class JTextField extends JTextComponent
return size;
}
+
+ /**
+ * Returns the scroll offset in pixels.
+ *
+ * @return the scroll offset
+ */
+ public int getScrollOffset()
+ {
+ return scrollOffset;
+ }
+
+ /**
+ * Sets the scroll offset in pixels.
+ *
+ * @param offset the scroll offset
+ */
+ public void setScrollOffset(int offset)
+ {
+ scrollOffset = offset;
+ }
+
+ public void postActionEvent()
+ {
+ ActionEvent event = new ActionEvent(this, 0, actionCommand);
+ ActionListener[] listeners = getActionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].actionPerformed(event);
+ }
+
+ /**
+ * @since 1.3
+ */
+ public Action getAction()
+ {
+ return action;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setAction(Action newAction)
+ {
+ if (action == newAction)
+ return;
+
+ if (action != null)
+ {
+ removeActionListener(action);
+ action.removePropertyChangeListener(actionPropertyChangeListener);
+ actionPropertyChangeListener = null;
+ }
+
+ Action oldAction = action;
+ action = newAction;
+
+ if (action != null)
+ {
+ addActionListener(action);
+ actionPropertyChangeListener =
+ createActionPropertyChangeListener(action);
+ action.addPropertyChangeListener(actionPropertyChangeListener);
+ }
+
+ firePropertyChange("horizontalAlignment", oldAction, newAction);
+ }
+
+ /**
+ * @since 1.3
+ */
+ public String getActionCommand()
+ {
+ return actionCommand;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setActionCommand(String command)
+ {
+ this.actionCommand = command;
+ }
+
+ /**
+ * @since 1.3
+ */
+ protected PropertyChangeListener createActionPropertyChangeListener(Action action)
+ {
+ return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ // Update properties "action" and "horizontalAlignment".
+ String name = event.getPropertyName();
+
+ if (name.equals("enabled"))
+ {
+ boolean enabled = ((Boolean) event.getNewValue()).booleanValue();
+ JTextField.this.setEnabled(enabled);
+ }
+ else if (name.equals(Action.SHORT_DESCRIPTION))
+ {
+ JTextField.this.setToolTipText((String) event.getNewValue());
+ }
+ }
+ };
+ }
+
+ /**
+ * @since 1.3
+ */
+ protected void configurePropertiesFromAction(Action action)
+ {
+ if (action != null)
+ {
+ setEnabled(action.isEnabled());
+ setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
+ }
+ else
+ {
+ setEnabled(true);
+ setToolTipText(null);
+ }
+ }
+
+ protected int getColumnWidth()
+ {
+ FontMetrics metrics = getToolkit().getFontMetrics(getFont());
+ return metrics.charWidth('m');
+ }
}
diff --git a/libjava/javax/swing/JTextPane.java b/libjava/javax/swing/JTextPane.java
index d1bd473..95d2d50 100644
--- a/libjava/javax/swing/JTextPane.java
+++ b/libjava/javax/swing/JTextPane.java
@@ -35,11 +35,13 @@ 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.io.IOException;
import java.io.ObjectOutputStream;
+
import javax.swing.text.AttributeSet;
import javax.swing.text.Document;
import javax.swing.text.EditorKit;
diff --git a/libjava/javax/swing/JToggleButton.java b/libjava/javax/swing/JToggleButton.java
index c04bcc3..8a38d48 100644
--- a/libjava/javax/swing/JToggleButton.java
+++ b/libjava/javax/swing/JToggleButton.java
@@ -38,17 +38,103 @@ exception statement from your version. */
package javax.swing;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
import javax.swing.plaf.ButtonUI;
+/**
+ * The <code>JToggleButton</code> component provides a stateful button,
+ * which can be either selected or unselected. This provides the basis
+ * for the implementations of radio buttons (<code>JRadioButton</code>)
+ * and check boxes (<code>JCheckBox</code>).
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @author Graydon Hoare <graydon@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see JRadioButton
+ * @see JCheckBox
+ * @since 1.2
+ */
public class JToggleButton extends AbstractButton implements Accessible
{
+
+ /**
+ * This class provides accessibility support for the toggle button.
+ */
+ protected class AccessibleJToggleButton
+ extends AccessibleAbstractButton
+ implements ItemListener
+ {
+
+ /**
+ * Constructor for the accessible toggle button.
+ */
+ public AccessibleJToggleButton()
+ {
+ super();
+ /* Register the accessible toggle button as a listener for item events */
+ addItemListener(this);
+ }
+
+ /**
+ * Returns the accessible role for the toggle button.
+ *
+ * @return An instance of <code>AccessibleRole</code>, describing
+ * the role of the toggle button.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.TOGGLE_BUTTON;
+ }
+
+ /**
+ * Monitors the toggle button for state changes and fires accessible
+ * property change events when they occur.
+ *
+ * @param event the event that occurred.
+ */
+ public void itemStateChanged(ItemEvent event)
+ {
+ /* Fire a state property change event as the button's state has changed */
+ if (event.getStateChange() == ItemEvent.SELECTED)
+ {
+ /* State has changed from unselected (null) to selected */
+ firePropertyChange(ACCESSIBLE_STATE_PROPERTY, null, AccessibleState.SELECTED);
+ }
+ else
+ {
+ /* State has changed from selected to unselected (null) */
+ firePropertyChange(ACCESSIBLE_STATE_PROPERTY, AccessibleState.ENABLED, null);
+ }
+ }
+
+ }
+ /**
+ * The model handles the storage and maintenance of the state of
+ * the toggle button. This follows the same paradigm (the MVC
+ * or Model-View-Controller design pattern) employed by
+ * other Swing components, where the data associated with a component
+ * is stored separately from the display aspects.
+ */
public static class ToggleButtonModel extends DefaultButtonModel
{
+ /**
+ * Compatible with Sun's JDK.
+ */
private static final long serialVersionUID = -1589950750899943974L;
+ /**
+ * Sets the pressed state of the button. The selected state
+ * of the button also changes follwing the button being pressed.
+ *
+ * @param b true if the button is pressed down.
+ */
public void setPressed(boolean b)
{
if (! isEnabled())
@@ -63,44 +149,97 @@ public class JToggleButton extends AbstractButton implements Accessible
}
}
-
+ /**
+ * Compatible with Sun's JDK.
+ */
private static final long serialVersionUID = -3128248873429850443L;
+ /**
+ * Constructs an unselected toggle button with no text or icon.
+ */
public JToggleButton()
{
- this(null, null);
+ this(null, null, false);
}
+
+ /**
+ * Constructs a toggle button using the labelling, state
+ * and icon specified by the supplied action.
+ *
+ * @param a the action to use to define the properties of the button.
+ */
public JToggleButton(Action a)
{
this();
setAction(a);
}
+ /**
+ * Constructs an unselected toggle button with the supplied icon
+ * and no text.
+ *
+ * @param icon the icon to use.
+ */
public JToggleButton(Icon icon)
{
- this(null, icon);
+ this(null, icon, false);
}
- public JToggleButton (Icon icon, boolean selected)
+ /**
+ * Constructs a toggle button with the supplied icon and state.
+ *
+ * @param icon the icon to use.
+ * @param selected if true, the toggle button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
+ public JToggleButton(Icon icon, boolean selected)
{
this(null, icon, selected);
}
+ /**
+ * Constructs an unselected toggle button using the supplied text
+ * and no icon.
+ *
+ * @param text the text to use.
+ */
public JToggleButton(String text)
{
- this(text, null);
+ this(text, null, false);
}
+ /**
+ * Constructs a toggle button with the supplied text and state.
+ *
+ * @param text the text to use.
+ * @param selected if true, the toggle button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
public JToggleButton(String text, boolean selected)
{
this(text, null, selected);
}
+ /**
+ * Constructs an unselected toggle button with the supplied text
+ * and icon.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ */
public JToggleButton(String text, Icon icon)
{
this(text, icon, false);
}
+ /**
+ * Constructs a toggle button with the supplied text, icon and state.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ * @param selected if true, the toggle button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
public JToggleButton (String text, Icon icon, boolean selected)
{
super(text, icon);
@@ -112,34 +251,54 @@ public class JToggleButton extends AbstractButton implements Accessible
/**
* Gets the AccessibleContext associated with this <code>JToggleButton</code>.
+ * The context is created, if necessary.
*
* @return the associated context
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleJToggleButton();
+ }
+ return accessibleContext;
}
/**
* Returns a string that specifies the name of the Look and Feel
* class that renders this component.
+ *
+ * @return The Look and Feel UI class in <code>String</code> form.
*/
public String getUIClassID()
{
return "ToggleButtonUI";
}
+ /**
+ * Returns a textual representation of this component for debugging.
+ * Users should not depend on anything as regards the content or formatting
+ * of this string, except for the fact that the returned string may never be
+ * null (only empty).
+ *
+ * @return the component in <code>String</code> form for debugging.
+ */
protected String paramString()
{
return "JToggleButton";
}
-
+ /**
+ * This method resets the toggle button's UI delegate to the default UI for
+ * the current look and feel.
+ */
public void updateUI()
{
- ButtonUI b = (ButtonUI)UIManager.getUI(this);
- setUI(b);
+ setUI((ButtonUI)UIManager.getUI(this));
}
+
}
diff --git a/libjava/javax/swing/JToolBar.java b/libjava/javax/swing/JToolBar.java
index 7b5121e..db8bb56 100644
--- a/libjava/javax/swing/JToolBar.java
+++ b/libjava/javax/swing/JToolBar.java
@@ -35,25 +35,23 @@ 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.awt.Dimension;
import java.awt.Graphics;
-import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
import javax.swing.plaf.ToolBarUI;
-
/**
* JToolBar is a component that provides a toolbar to Swing programs. Users
* can add buttons (or actions that will be represented by JButtons) as well
diff --git a/libjava/javax/swing/JToolTip.java b/libjava/javax/swing/JToolTip.java
index daf9f0a..8099ef9 100644
--- a/libjava/javax/swing/JToolTip.java
+++ b/libjava/javax/swing/JToolTip.java
@@ -35,15 +35,16 @@ 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.AWTEvent;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.plaf.ToolTipUI;
-
/**
* This class is used to display ToolTips. ToolTips are small floating windows
* that display text when the mouse comes to rest over a Component. ToolTips
diff --git a/libjava/javax/swing/JTree.java b/libjava/javax/swing/JTree.java
index 4e81bff..8d52257 100644
--- a/libjava/javax/swing/JTree.java
+++ b/libjava/javax/swing/JTree.java
@@ -35,12 +35,16 @@ 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;
import java.awt.Rectangle;
+import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.event.TreeExpansionEvent;
@@ -50,10 +54,15 @@ 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.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
public class JTree extends JComponent
@@ -61,18 +70,43 @@ 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";
+ public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+ public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
+ public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
+ public static final String TREE_MODEL_PROPERTY = "model";
+ public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+
+ protected TreeCellEditor cellEditor;
protected TreeCellRenderer cellRenderer;
protected boolean editable;
+ protected boolean invokesStopCellEditing;
+ protected boolean largeModel;
protected boolean rootVisible;
+ protected int rowHeight;
+ protected boolean scrollsOnExpand;
+ protected TreeSelectionModel selectionModel;
protected boolean showsRootHandles;
+ protected int toggleClickCount;
protected TreeModel treeModel;
+ protected int visibleRowCount;
/**
* Creates a new <code>JTree</code> object.
*/
public JTree()
{
- treeModel = createTreeModel(null);
+ this(createTreeModel(null));
}
/**
@@ -82,7 +116,7 @@ public class JTree extends JComponent
*/
public JTree(Hashtable value)
{
- treeModel = createTreeModel(value);
+ this(createTreeModel(value));
}
/**
@@ -92,7 +126,7 @@ public class JTree extends JComponent
*/
public JTree(Object[] value)
{
- treeModel = createTreeModel(value);
+ this(createTreeModel(value));
}
/**
@@ -103,6 +137,8 @@ public class JTree extends JComponent
public JTree(TreeModel model)
{
treeModel = model;
+ setCellRenderer(new DefaultTreeCellRenderer());
+ updateUI();
}
/**
@@ -124,6 +160,7 @@ public class JTree extends JComponent
*/
public JTree(TreeNode root, boolean asksAllowChildren)
{
+ this(new DefaultTreeModel(root, asksAllowChildren));
}
/**
@@ -133,7 +170,81 @@ public class JTree extends JComponent
*/
public JTree(Vector value)
{
- treeModel = createTreeModel(value);
+ this(createTreeModel(value));
+ }
+
+ public static class DynamicUtilTreeNode
+ extends DefaultMutableTreeNode
+ {
+ protected Object childValue;
+ protected boolean loadedChildren;
+ public DynamicUtilTreeNode(Object value,
+ Object children)
+ {
+ super(value);
+ childValue = children;
+ loadedChildren = false;
+ }
+
+ public int getChildCount()
+ {
+ loadChildren();
+ return super.getChildCount();
+ }
+
+ protected void loadChildren()
+ {
+ if (!loadedChildren)
+ {
+ createChildren(this, childValue);
+ loadedChildren = true;
+ }
+ }
+
+ public Enumeration children()
+ {
+ loadChildren();
+ return super.children();
+ }
+
+ public boolean isLeaf()
+ {
+ return (childValue == null ||
+ !(childValue instanceof Hashtable
+ || childValue instanceof Vector
+ || childValue.getClass().isArray()));
+ }
+
+ public static void createChildren(DefaultMutableTreeNode parent,
+ Object children)
+ {
+ if (children instanceof Hashtable)
+ {
+ Hashtable tab = (Hashtable) children;
+ Enumeration e = tab.keys();
+ while (e.hasMoreElements())
+ {
+ Object key = e.nextElement();
+ Object val = tab.get(key);
+ parent.add(new DynamicUtilTreeNode(key, val));
+ }
+ }
+ else if (children instanceof Vector)
+ {
+ Iterator i = ((Vector)children).iterator();
+ while (i.hasNext())
+ {
+ Object n = i.next();
+ parent.add(new DynamicUtilTreeNode(n,n));
+ }
+ }
+ else if (children.getClass().isArray())
+ {
+ Object[] arr = (Object[]) children;
+ for (int i = 0; i < arr.length; ++i)
+ parent.add(new DynamicUtilTreeNode(arr[i], arr[i]));
+ }
+ }
}
/**
@@ -143,8 +254,7 @@ public class JTree extends JComponent
*/
protected static TreeModel createTreeModel(Object value)
{
- // FIXME: Implement this.
- return null;
+ return new DefaultTreeModel(new DynamicUtilTreeNode(value, value));
}
/**
@@ -173,6 +283,8 @@ public class JTree extends JComponent
public void updateUI()
{
setUI((TreeUI) UIManager.getUI(this));
+ revalidate();
+ repaint();
}
/**
@@ -441,7 +553,7 @@ public class JTree extends JComponent
* @return <code>true</code> if the root element is visible,
* <code>false</code> otherwise
*/
- public boolean isRootVisbile()
+ public boolean isRootVisible()
{
return rootVisible;
}
@@ -456,11 +568,21 @@ public class JTree extends JComponent
return showsRootHandles;
}
- public void setShowRootHandles(boolean flag)
+ public void setShowsRootHandles(boolean flag)
{
showsRootHandles = flag;
}
+ public TreeCellEditor getCellEditor()
+ {
+ return cellEditor;
+ }
+
+ public void setCellEditor(TreeCellEditor editor)
+ {
+ cellEditor = editor;
+ }
+
public TreeCellRenderer getCellRenderer()
{
return cellRenderer;
@@ -470,4 +592,80 @@ public class JTree extends JComponent
{
cellRenderer = newRenderer;
}
+
+ public TreeSelectionModel getSelectionModel()
+ {
+ return selectionModel;
+ }
+
+ public void setSelectionModel(TreeSelectionModel model)
+ {
+ selectionModel = model;
+ }
+
+ public int getVisibleRowCount()
+ {
+ return visibleRowCount;
+ }
+
+ public void setVisibleRowCount(int rows)
+ {
+ visibleRowCount = rows;
+ }
+
+ public boolean isLargeModel()
+ {
+ return largeModel;
+ }
+
+ public void setLargeModel(boolean large)
+ {
+ largeModel = large;
+ }
+
+ public int getRowHeight()
+ {
+ return rowHeight;
+ }
+
+ public void setRowHeight(int height)
+ {
+ rowHeight = height;
+ }
+
+ public boolean getInvokesStopCellEditing()
+ {
+ return invokesStopCellEditing;
+ }
+
+ public void setInvokesStopCellEditing(boolean invoke)
+ {
+ invokesStopCellEditing = invoke;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public int getToggleClickCount()
+ {
+ return toggleClickCount;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setToggleClickCount(int count)
+ {
+ toggleClickCount = count;
+ }
+
+ public boolean getScrollsOnExpand()
+ {
+ return scrollsOnExpand;
+ }
+
+ public void setScrollsOnExpand(boolean scroll)
+ {
+ scrollsOnExpand = scroll;
+ }
}
diff --git a/libjava/javax/swing/JViewport.java b/libjava/javax/swing/JViewport.java
index a361183..9b26c8b 100644
--- a/libjava/javax/swing/JViewport.java
+++ b/libjava/javax/swing/JViewport.java
@@ -45,12 +45,10 @@ import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
-import javax.accessibility.Accessible;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ViewportUI;
-
/**
*
* <pre>
@@ -129,6 +127,7 @@ public class JViewport extends JComponent
public JViewport()
{
setOpaque(true);
+ setScrollMode(BLIT_SCROLL_MODE);
updateUI();
}
@@ -214,11 +213,17 @@ public class JViewport extends JComponent
getExtentSize());
}
+ /**
+ * @deprecated 1.4
+ */
public boolean isBackingStoreEnabled()
{
return scrollMode == BACKINGSTORE_SCROLL_MODE;
}
+ /**
+ * @deprecated 1.4
+ */
public void setBackingStoreEnabled(boolean b)
{
if (b && scrollMode != BACKINGSTORE_SCROLL_MODE)
@@ -305,23 +310,11 @@ public class JViewport extends JComponent
return false;
}
- public ChangeListener[] getChangeListeners()
- {
- return (ChangeListener[]) getListeners(ChangeListener.class);
- }
-
public void paint(Graphics g)
{
paintComponent(g);
}
- void fireStateChanged()
- {
- ChangeListener[] listeners = getChangeListeners();
- for (int i = 0; i < listeners.length; ++i)
- listeners[i].stateChanged(changeEvent);
- }
-
public void addChangeListener(ChangeListener listener)
{
listenerList.add(ChangeListener.class, listener);
@@ -332,6 +325,18 @@ public class JViewport extends JComponent
listenerList.remove(ChangeListener.class, listener);
}
+ public ChangeListener[] getChangeListeners()
+ {
+ return (ChangeListener[]) getListeners(ChangeListener.class);
+ }
+
+ protected void fireStateChanged()
+ {
+ ChangeListener[] listeners = getChangeListeners();
+ for (int i = 0; i < listeners.length; ++i)
+ listeners[i].stateChanged(changeEvent);
+ }
+
/**
* This method returns the String ID of the UI class of Separator.
*
@@ -349,4 +354,24 @@ public class JViewport extends JComponent
{
setUI((ViewportUI) UIManager.getUI(this));
}
+
+ /**
+ * This method returns the viewport's UI delegate.
+ *
+ * @return The viewport's UI delegate.
+ */
+ public ViewportUI getUI()
+ {
+ return (ViewportUI) ui;
+ }
+
+ /**
+ * This method sets the viewport's UI delegate.
+ *
+ * @param ui The viewport's UI delegate.
+ */
+ public void setUI(ViewportUI ui)
+ {
+ super.setUI(ui);
+ }
}
diff --git a/libjava/javax/swing/JWindow.java b/libjava/javax/swing/JWindow.java
index c035a1b..3601b69 100644
--- a/libjava/javax/swing/JWindow.java
+++ b/libjava/javax/swing/JWindow.java
@@ -62,10 +62,10 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
{
private static final long serialVersionUID = 5420698392125238833L;
- public final static int HIDE_ON_CLOSE = 0;
- public final static int EXIT_ON_CLOSE = 1;
- public final static int DISPOSE_ON_CLOSE = 2;
- public final static int DO_NOTHING_ON_CLOSE = 3;
+ 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;
diff --git a/libjava/javax/swing/ListModel.java b/libjava/javax/swing/ListModel.java
index 1aa7bd2..405df0e 100644
--- a/libjava/javax/swing/ListModel.java
+++ b/libjava/javax/swing/ListModel.java
@@ -36,6 +36,7 @@ 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.ListDataListener;
/**
diff --git a/libjava/javax/swing/LookAndFeel.java b/libjava/javax/swing/LookAndFeel.java
index dc28065..3a56a11 100644
--- a/libjava/javax/swing/LookAndFeel.java
+++ b/libjava/javax/swing/LookAndFeel.java
@@ -35,12 +35,13 @@ 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.Toolkit;
-import javax.swing.text.JTextComponent;
+import javax.swing.text.JTextComponent;
public abstract class LookAndFeel
{
diff --git a/libjava/javax/swing/MenuSelectionManager.java b/libjava/javax/swing/MenuSelectionManager.java
index a61ca4e..2e93c01 100644
--- a/libjava/javax/swing/MenuSelectionManager.java
+++ b/libjava/javax/swing/MenuSelectionManager.java
@@ -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;
@@ -44,13 +45,11 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Vector;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
+
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
-
/**
* This class manages current menu selectection. It provides
* methods to clear and set current selected menu path.
diff --git a/libjava/javax/swing/ProgressMonitorInputStream.java b/libjava/javax/swing/ProgressMonitorInputStream.java
index 48802c3..56ae3bc 100644
--- a/libjava/javax/swing/ProgressMonitorInputStream.java
+++ b/libjava/javax/swing/ProgressMonitorInputStream.java
@@ -35,12 +35,13 @@ 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.io.FilterInputStream;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
/**
* ProgressMonitorInputStream
diff --git a/libjava/javax/swing/RepaintManager.java b/libjava/javax/swing/RepaintManager.java
index 8910bf5..1c9208e 100644
--- a/libjava/javax/swing/RepaintManager.java
+++ b/libjava/javax/swing/RepaintManager.java
@@ -1,5 +1,5 @@
/* RepaintManager.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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;
import java.awt.Component;
@@ -42,13 +43,12 @@ import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
-
/**
* <p>The repaint manager holds a set of dirty regions, invalid components,
* and a double buffer surface. The dirty regions and invalid components
@@ -309,6 +309,9 @@ public class RepaintManager
public synchronized void addDirtyRegion(JComponent component, int x, int y,
int w, int h)
{
+ if (w == 0 || h == 0)
+ return;
+
Rectangle r = new Rectangle(x, y, w, h);
if (dirtyComponents.containsKey(component))
r = r.union((Rectangle)dirtyComponents.get(component));
diff --git a/libjava/javax/swing/RootPaneContainer.java b/libjava/javax/swing/RootPaneContainer.java
index c571eb8..d2eff35 100644
--- a/libjava/javax/swing/RootPaneContainer.java
+++ b/libjava/javax/swing/RootPaneContainer.java
@@ -35,10 +35,11 @@ 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.Container;
import java.awt.Component;
+import java.awt.Container;
/**
* RootPaneContainer
diff --git a/libjava/javax/swing/ScrollPaneLayout.java b/libjava/javax/swing/ScrollPaneLayout.java
index 1103f3f..0da8f18 100644
--- a/libjava/javax/swing/ScrollPaneLayout.java
+++ b/libjava/javax/swing/ScrollPaneLayout.java
@@ -43,9 +43,10 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
-import java.awt.Rectangle;
import java.awt.Point;
+import java.awt.Rectangle;
import java.io.Serializable;
+
import javax.swing.border.Border;
/**
@@ -320,7 +321,6 @@ public class ScrollPaneLayout
insetsSize.setSize(insets.left + insets.right,
insets.top + insets.bottom);
- maybeSetMinimumSize(viewport, viewportSize);
maybeSetMinimumSize(colHead, columnHeaderSize);
maybeSetMinimumSize(rowHead, rowHeaderSize);
diff --git a/libjava/javax/swing/SpinnerListModel.java b/libjava/javax/swing/SpinnerListModel.java
new file mode 100644
index 0000000..4da2614
--- /dev/null
+++ b/libjava/javax/swing/SpinnerListModel.java
@@ -0,0 +1,296 @@
+/* SpinnerListModel.java -- A spinner model backed by a list or an array.
+ 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;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * An implementation of <code>SpinnerModel</code> which uses the values
+ * contained within a list or an array. The backing list or array is
+ * only stored as a reference within the class. As a result, changes
+ * made elsewhere to the members of the list or array are reflected by
+ * this model.
+ * <p>
+ *
+ * The model itself inherits a list of <code>ChangeListener</code>s from
+ * <code>AbstractSpinnerModel</code>. As this code is unaware of changes
+ * made to the backing list or array, it is the responsibility of the
+ * application using the model to invoke <code>fireStateChanged()</code>,
+ * in order to notify any <code>ChangeListener</code>s, when the list or array
+ * changes. The model handles notification when the reference itself
+ * is changed via <code>setList()</code> or when the current value is
+ * set directly using <code>setValue()</code>.
+ *
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see SpinnerModel
+ * @see AbstractSpinnerModel
+ * @see JSpinner
+ * @since 1.4
+ */
+
+public class SpinnerListModel
+ extends AbstractSpinnerModel
+ implements Serializable
+{
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 3358804052191994516L;
+
+ /**
+ * The backing list for this model.
+ */
+ private List list;
+
+ /**
+ * The current index in the list.
+ */
+ private transient int index;
+
+ /**
+ * Constructs a default <code>SpinnerListModel</code>. This
+ * is a model backed by a list containing only the single
+ * <code>String</code> element, "empty".
+ */
+ public SpinnerListModel()
+ {
+ List defaultList;
+
+ /* Create an empty list */
+ defaultList = new ArrayList();
+ /* Add the string "empty" */
+ defaultList.add("empty");
+ /* Set the list */
+ setList(defaultList);
+ }
+
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied list.
+ * The model maintains a reference to this list, and returns
+ * consecutive elements in response to calls to <code>getNextValue()</code>.
+ * The initial value is that at position 0, so an initial call
+ * to <code>getValue()</code> returns the same as <code>list.get(0)</code>.
+ *
+ * @param list The list to use for this model.
+ * @throws IllegalArgumentException if the list is null or contains no
+ * elements.
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(List list)
+ {
+ /* Retain a reference to the valid list */
+ setList(list);
+ }
+
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied array.
+ * The model stores a reference to the wrapper list returned by
+ * <code>Arrays.asList()</code>. The wrapper list reflects modifications
+ * in the underlying array, so these changes will also be reflected
+ * by the model. The model produces consecutive elements from the array
+ * in response to calls to <code>getNextValue()</code>. The initial
+ * value returned by <code>getValue()</code> is the same as
+ * <code>array[0]</code>.
+ *
+ * @param array The array to use for this model.
+ * @throws IllegalArgumentException if the array is null or contains
+ * no elements.
+ * @see Arrays#asList(Object[])
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(Object[] array)
+ {
+ /* Check for a null or zero-sized array */
+ if (array == null || array.length == 0)
+ {
+ throw new IllegalArgumentException("The supplied array was invalid.");
+ }
+ /*
+ Retain a reference to a wrapper around the valid array
+ The array, in list form, will be tested again here, but we can't really
+ avoid this -- a null value to Arrays.asList will throw a NullPointerException
+ */
+ setList(Arrays.asList(array));
+ }
+
+ /**
+ * Returns the backing list for this model.
+ *
+ * @return The backing list.
+ */
+ public List getList()
+ {
+ return list;
+ }
+
+ /**
+ * Returns the next value from the list, which is the same as the element
+ * stored at the current index + 1. Null is returned if there are no more
+ * values to be returned (the end of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The next value from the list or null.
+ */
+ public Object getNextValue()
+ {
+ /* Check for a next value */
+ if (index < (list.size() - 1))
+ {
+ /* Return the element at the next index */
+ return list.get(index + 1);
+ }
+ else
+ {
+ /* Return null as this is the end of the list */
+ return null;
+ }
+ }
+
+ /**
+ * Returns the previous value from the list, which is the same as the element
+ * stored at the current index - 1. Null is returned if there are no more
+ * values to be returned (the start of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The previous value from the list or null.
+ */
+ public Object getPreviousValue()
+ {
+ /* Check for a previous value. */
+ if (index > 0)
+ {
+ /* Return the element at the previous position */
+ return list.get(index - 1);
+ }
+ else
+ {
+ /* Return null as this is the start of the list */
+ return null;
+ }
+ }
+
+ /**
+ * Returns the current value of the model. Initially, this will
+ * be the element at position 0. On later invocations, this will
+ * be the last element returned by <code>getNextValue()</code>
+ * or <code>getPreviousValue()</code>.
+ *
+ * @return The current value.
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public Object getValue()
+ {
+ return list.get(index);
+ }
+
+ /**
+ * Changes the backing list for this model. The model only stores
+ * a reference to the list, so any changes made to the list elsewhere
+ * will be reflected in the values returned by the model. A
+ * <code>ChangeEvent</code> is fired if the list being used actually
+ * changes (i.e. the new list is not referentially equal (!=) to the
+ * old one).
+ *
+ * @param list The new list to use.
+ * @throws IllegalArgumentException if the list is null or contains
+ * no elements.
+ * @see ChangeEvent
+ */
+ public void setList(List list)
+ {
+ /* Check for null or zero size list */
+ if (list == null || list.size() == 0)
+ {
+ throw new IllegalArgumentException("The supplied list was invalid.");
+ }
+ /* Check for a change of referenced list */
+ if (this.list != list)
+ {
+ /* Store the new list */
+ this.list = list;
+ /* Notify listeners of a change */
+ fireStateChanged();
+ }
+ /* We reset the other values in either case */
+ /* Set the index to 0 */
+ index = 0;
+ }
+
+ /**
+ * Sets the current value of the model to be the one supplied.
+ * The value must exist within the backing list in order for
+ * the change to take place. Otherwise, an exception is thrown.
+ * The value used is the first occurrence of the value within
+ * the backing list. Listeners are notified of this change.
+ * Following the change, <code>getNextValue()</code> and
+ * <code>getPreviousValue()</code> return the objects following
+ * and prior to the supplied value, respectively.
+ *
+ * @param value The requested new value of the list.
+ * @throws IllegalArgumentException if the supplied value does
+ * not exist in the backing list.
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public void setValue(Object value)
+ {
+ int valueIndex;
+
+ /* Search for the value in the list */
+ valueIndex = list.indexOf(value);
+ /* Check for the value being found */
+ if (valueIndex == -1)
+ {
+ throw new IllegalArgumentException("The supplied value does not "
+ + "exist in this list");
+ }
+ /* Make the indices match */
+ index = valueIndex;
+ /* Notify the listeners */
+ fireStateChanged();
+ }
+
+}
diff --git a/libjava/javax/swing/SpinnerModel.java b/libjava/javax/swing/SpinnerModel.java
index 5f8929e..ea5f431 100644
--- a/libjava/javax/swing/SpinnerModel.java
+++ b/libjava/javax/swing/SpinnerModel.java
@@ -1,5 +1,5 @@
/* SpinnerModel.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,10 +45,65 @@ import javax.swing.event.ChangeListener;
*/
public interface SpinnerModel
{
- void setValue (Object value);
- public Object getValue ();
- public Object getNextValue ();
- public Object getPreviousValue ();
- void addChangeListener (ChangeListener listener);
- void removeChangeListener (ChangeListener listener);
+ /**
+ * Sets the current value of the model to that specified.
+ * Implementations can choose to refuse to accept the value
+ * and throw an exception instead. For example, a date model
+ * may throw invalid dates, or a list model may throw out
+ * values which don't exist in the underlying list. Models
+ * may also throw out unusual values, such as null. The decision
+ * is left to the discretion of the implementator. If the
+ * operation succeeds, the implementation should also notify
+ * any registered <code>ChangeListener</code>s.
+ *
+ * @param value The new value of the model.
+ * @throws IllegalArgumentException if the model does not accept
+ * the given value.
+ */
+ void setValue(Object value);
+
+ /**
+ * Returns the current value of the model.
+ *
+ * @return The current value.
+ */
+ Object getValue();
+
+ /**
+ * Returns the next value from the model. If the model is bounded,
+ * this method may return null when the upper bound is met.
+ * The current value is not changed.
+ *
+ * @return The next value, or null if there are no more values
+ * to retrieve.
+ */
+ Object getNextValue();
+
+ /**
+ * Returns the previous value from the model. If the model is
+ * bounded, this method may return null when the lower bound is
+ * met. The current value is not changed.
+ *
+ * @return The previous value, or null if there are no more
+ * values to retrieve.
+ */
+ Object getPreviousValue();
+
+ /**
+ * Adds a <code>ChangeListener</code> to the list of registered
+ * listeners. Each listener is notified when the current value
+ * is changed.
+ *
+ * @param listener The new listener to register.
+ */
+ void addChangeListener(ChangeListener listener);
+
+ /**
+ * Removes a given <code>ChangeListener</code> from the list
+ * of registered listeners.
+ *
+ * @param listener The listener to remove.
+ */
+ void removeChangeListener(ChangeListener listener);
+
}
diff --git a/libjava/javax/swing/SpinnerNumberModel.java b/libjava/javax/swing/SpinnerNumberModel.java
index 18588b5..370007c 100644
--- a/libjava/javax/swing/SpinnerNumberModel.java
+++ b/libjava/javax/swing/SpinnerNumberModel.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package javax.swing;
+import java.io.Serializable;
+
/**
* SpinnerNumberModel
*
@@ -44,7 +46,13 @@ package javax.swing;
* @version 1.0
*/
public class SpinnerNumberModel extends AbstractSpinnerModel
+ implements Serializable
{
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 7279176385485777821L;
+
/** DOCUMENT ME! */
private Number value;
@@ -73,6 +81,8 @@ public class SpinnerNumberModel extends AbstractSpinnerModel
* @param minimum the minimum value
* @param maximum the maximum value
* @param stepSize the step size
+ * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum does not
+ * hold
*/
public SpinnerNumberModel(double value, double minimum, double maximum,
double stepSize)
@@ -88,6 +98,8 @@ public class SpinnerNumberModel extends AbstractSpinnerModel
* @param minimum the minimum value
* @param maximum the maximum value
* @param stepSize the step size
+ * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum does not
+ * hold
*/
public SpinnerNumberModel(int value, int minimum, int maximum, int stepSize)
{
@@ -238,4 +250,49 @@ public class SpinnerNumberModel extends AbstractSpinnerModel
{
return value;
}
+
+ public Comparable getMinimum()
+ {
+ return minimum;
+ }
+
+ public void setMinimum(Comparable newMinimum)
+ {
+ if (minimum != newMinimum)
+ {
+ minimum = newMinimum;
+ fireStateChanged();
+ }
+ }
+
+ public Comparable getMaximum()
+ {
+ return maximum;
+ }
+
+ public void setMaximum(Comparable newMaximum)
+ {
+ if (maximum != newMaximum)
+ {
+ maximum = newMaximum;
+ fireStateChanged();
+ }
+ }
+
+ public Number getStepSize()
+ {
+ return stepSize;
+ }
+
+ public void setStepSize(Number newStepSize)
+ {
+ if (newStepSize == null)
+ throw new IllegalArgumentException();
+
+ if (stepSize != newStepSize)
+ {
+ stepSize = newStepSize;
+ fireStateChanged();
+ }
+ }
}
diff --git a/libjava/javax/swing/SpringLayout.java b/libjava/javax/swing/SpringLayout.java
index 60a5052..07357dc 100644
--- a/libjava/javax/swing/SpringLayout.java
+++ b/libjava/javax/swing/SpringLayout.java
@@ -42,12 +42,9 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager2;
-
import java.util.HashMap;
import java.util.Map;
-import javax.swing.Spring;
-
/**
* A very flexible layout manager. Components are laid out by defining the
* relationships between them. The relationships are expressed as
@@ -91,7 +88,7 @@ public class SpringLayout implements LayoutManager2
*
* @author Roman Kennke (roman@ontographics.com)
*/
- public final static class Constraints
+ public static class Constraints
{
// The constraints for each edge, and width and height.
diff --git a/libjava/javax/swing/SwingUtilities.java b/libjava/javax/swing/SwingUtilities.java
index 731a7bc8d..feacf4f 100644
--- a/libjava/javax/swing/SwingUtilities.java
+++ b/libjava/javax/swing/SwingUtilities.java
@@ -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.applet.Applet;
@@ -56,10 +57,10 @@ import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.lang.reflect.InvocationTargetException;
+
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.InputMapUIResource;
-
/**
* This class contains a number of static utility functions which are
* useful when drawing swing components, dispatching events, or calculating
@@ -75,6 +76,11 @@ public class SwingUtilities implements SwingConstants
*/
private static OwnerFrame ownerFrame;
+ private SwingUtilities()
+ {
+ // Do nothing.
+ }
+
/**
* Calculates the portion of the base rectangle which is inside the
* insets.
@@ -1014,4 +1020,170 @@ public class SwingUtilities implements SwingConstants
child.setParent(uiInputMap);
}
}
+
+ /**
+ * Subtracts a rectangle from another and return the area as an array
+ * of rectangles.
+ * Returns the areas of rectA which are not covered by rectB.
+ * If the rectangles do not overlap, or if either parameter is
+ * <code>null</code>, a zero-size array is returned.
+ * @param rectA The first rectangle
+ * @param rectB The rectangle to subtract from the first
+ * @return An array of rectangles representing the area in rectA
+ * not overlapped by rectB
+ */
+ public static Rectangle[] computeDifference(Rectangle rectA, Rectangle rectB)
+ {
+ if (rectA == null || rectB == null)
+ return new Rectangle[0];
+
+ Rectangle[] r = new Rectangle[4];
+ int x1 = rectA.x;
+ int y1 = rectA.y;
+ int w1 = rectA.width;
+ int h1 = rectA.height;
+ int x2 = rectB.x;
+ int y2 = rectB.y;
+ int w2 = rectB.width;
+ int h2 = rectB.height;
+
+ // (outer box = rectA)
+ // -------------
+ // |_____0_____|
+ // | |rectB| |
+ // |_1|_____|_2|
+ // | 3 |
+ // -------------
+ int H0 = (y2 > y1) ? y2 - y1 : 0; // height of box 0
+ int H3 = (y2 + h2 < y1 + h1) ? y1 + h1 - y2 - h2 : 0; // height box 3
+ int W1 = (x2 > x1) ? x2 - x1 : 0; // width box 1
+ int W2 = (x1 + w1 > x2 + w2) ? x1 + w1 - x2 - w2 : 0; // w. box 2
+ int H12 = (H0 + H3 < h1) ? h1 - H0 - H3 : 0; // height box 1 & 2
+
+ if (H0 > 0)
+ r[0] = new Rectangle(x1, y1, w1, H0);
+ else
+ r[0] = null;
+
+ if (W1 > 0 && H12 > 0)
+ r[1] = new Rectangle(x1, y1 + H0, W1, H12);
+ else
+ r[1] = null;
+
+ if (W2 > 0 && H12 > 0)
+ r[2] = new Rectangle(x2 + w2, y1 + H0, W2, H12);
+ else
+ r[2] = null;
+
+ if (H3 > 0)
+ r[3] = new Rectangle(x1, y1 + H0 + H12, w1, H3);
+ else
+ r[3] = null;
+
+ // sort out null objects
+ int n = 0;
+ for (int i = 0; i < 4; i++)
+ if (r[i] != null)
+ n++;
+ Rectangle[] out = new Rectangle[n];
+ for (int i = 3; i >= 0; i--)
+ if (r[i] != null)
+ out[--n] = r[i];
+
+ return out;
+ }
+
+ /**
+ * Calculates the intersection of two rectangles.
+ *
+ * @param x upper-left x coodinate of first rectangle
+ * @param x upper-left y coodinate of first rectangle
+ * @param w width of first rectangle
+ * @param h height of first rectangle
+ * @param rect a Rectangle object of the second rectangle
+ * @throws a NullPointerException if rect is null.
+ *
+ * @return a rectangle corresponding to the intersection of the
+ * two rectangles. A zero rectangle is returned if the rectangles
+ * do not overlap.
+ */
+ public static Rectangle computeIntersection(int x, int y, int w, int h,
+ Rectangle rect)
+ {
+ int x2 = (int) rect.getX();
+ int y2 = (int) rect.getY();
+ int w2 = (int) rect.getWidth();
+ int h2 = (int) rect.getHeight();
+
+ int dx = (x > x2) ? x : x2;
+ int dy = (y > y2) ? y : y2;
+ int dw = (x + w < x2 + w2) ? (x + w - dx) : (x2 + w2 - dx);
+ int dh = (y + h < y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
+
+ if (dw >= 0 && dh >= 0)
+ return new Rectangle(dx, dy, dw, dh);
+
+ return new Rectangle(0, 0, 0, 0);
+ }
+
+ /**
+ * Calculates the width of a given string.
+ *
+ * @param fm the <code>FontMetrics</code> object to use
+ * @param str the string
+ *
+ * @return the width of the the string.
+ */
+ public static int computeStringWidth(FontMetrics fm, String str)
+ {
+ return fm.stringWidth(str);
+ }
+
+ /**
+ * Calculates the union of two rectangles.
+ *
+ * @param x upper-left x coodinate of first rectangle
+ * @param x upper-left y coodinate of first rectangle
+ * @param w width of first rectangle
+ * @param h height of first rectangle
+ * @param rect a Rectangle object of the second rectangle
+ * @throws a NullPointerException if rect is null.
+ *
+ * @return a rectangle corresponding to the union of the
+ * two rectangles. A rectangle encompassing both is returned if the
+ * rectangles do not overlap.
+ */
+ public static Rectangle computeUnion(int x, int y, int w, int h,
+ Rectangle rect)
+ {
+ int x2 = (int) rect.getX();
+ int y2 = (int) rect.getY();
+ int w2 = (int) rect.getWidth();
+ int h2 = (int) rect.getHeight();
+
+ int dx = (x < x2) ? x : x2;
+ int dy = (y < y2) ? y : y2;
+ int dw = (x + w > x2 + w2) ? (x + w - dx) : (x2 + w2 - dx);
+ int dh = (y + h > y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
+
+ if (dw >= 0 && dh >= 0)
+ return new Rectangle(dx, dy, dw, dh);
+
+ return new Rectangle(0, 0, 0, 0);
+ }
+
+ /**
+ * Tests if a rectangle contains another.
+ * @param a first rectangle
+ * @param b second rectangle
+ * @return true if a contains b, false otherwise
+ * @throws NullPointerException
+ */
+ public static boolean isRectangleContainingRectangle(Rectangle a, Rectangle b)
+ {
+ // Note: zero-size rects inclusive, differs from Rectangle.contains()
+ return b.width >= 0 && b.height >= 0 && b.width >= 0 && b.height >= 0
+ && b.x >= a.x && b.x + b.width <= a.x + a.width && b.y >= a.y
+ && b.y + b.height <= a.y + a.height;
+ }
}
diff --git a/libjava/javax/swing/Timer.java b/libjava/javax/swing/Timer.java
index 529ad19..afdf4f3 100644
--- a/libjava/javax/swing/Timer.java
+++ b/libjava/javax/swing/Timer.java
@@ -35,14 +35,15 @@ 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.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.EventListener;
-import javax.swing.event.EventListenerList;
+import javax.swing.event.EventListenerList;
/**
* DOCUMENT ME!
diff --git a/libjava/javax/swing/ToolTipManager.java b/libjava/javax/swing/ToolTipManager.java
index 3556ef0..6245786 100644
--- a/libjava/javax/swing/ToolTipManager.java
+++ b/libjava/javax/swing/ToolTipManager.java
@@ -37,28 +37,19 @@ exception statement from your version. */
package javax.swing;
-import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
-import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Rectangle;
-import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
-import javax.swing.JComponent;
-import javax.swing.Popup;
-import javax.swing.PopupFactory;
-import javax.swing.SwingUtilities;
-import javax.swing.Timer;
-
/**
* This class is responsible for the registration of JToolTips to Components
@@ -461,7 +452,13 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
{
currentPoint = event.getPoint();
if (currentTip != null)
- currentTip.setTipText(((JComponent) currentComponent).getToolTipText(event));
+ {
+ if (currentComponent == null)
+ currentComponent = (Component) event.getSource();
+
+ String text = ((JComponent) currentComponent).getToolTipText(event);
+ currentTip.setTipText(text);
+ }
if (enterTimer.isRunning())
enterTimer.restart();
}
@@ -473,7 +470,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
private void showTip()
{
- if (! enabled)
+ if (! enabled || currentComponent == null)
return;
if (currentTip == null
diff --git a/libjava/javax/swing/TransferHandler.java b/libjava/javax/swing/TransferHandler.java
index e64df9c..16b5016 100644
--- a/libjava/javax/swing/TransferHandler.java
+++ b/libjava/javax/swing/TransferHandler.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing;
import java.io.Serializable;
+import java.awt.event.InputEvent;
+import java.awt.datatransfer.*;
public class TransferHandler implements Serializable
{
@@ -48,8 +50,66 @@ public class TransferHandler implements Serializable
public static final int MOVE = 2;
public static final int COPY_OR_MOVE = 3;
+ static Action getCopyAction ()
+ {
+ return null;
+ }
+
+ static Action getCutAction ()
+ {
+ return null;
+ }
+
+ static Action getPasteAction ()
+ {
+ return null;
+ }
+
+
protected TransferHandler()
{
// Do nothing here.
}
+
+ public TransferHandler(String property)
+ {
+ }
+
+ public boolean canImport (JComponent c, DataFlavor[] flavors)
+ {
+ return false;
+ }
+
+ public Transferable createTransferable(JComponent c)
+ {
+ return null;
+ }
+
+ public void exportAsDrag (JComponent c, InputEvent e, int action)
+ {
+ }
+
+ protected void exportDone (JComponent c, Transferable data, int action)
+ {
+ }
+
+ public void exportToClipboard(JComponent c, Clipboard clip, int action)
+ {
+ }
+
+ public int getSourceActions (JComponent c)
+ {
+ return 0;
+ }
+
+ public Icon getVisualRepresentation (Transferable t)
+ {
+ return null;
+ }
+
+ public boolean importData (JComponent c, Transferable t)
+ {
+ return false;
+ }
+
}
diff --git a/libjava/javax/swing/UIDefaults.java b/libjava/javax/swing/UIDefaults.java
index f72c274..c32cebd 100644
--- a/libjava/javax/swing/UIDefaults.java
+++ b/libjava/javax/swing/UIDefaults.java
@@ -35,13 +35,13 @@ 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.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
-import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.reflect.Method;
@@ -51,7 +51,6 @@ import java.util.ListIterator;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.Set;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
@@ -479,7 +478,7 @@ public class UIDefaults extends Hashtable
propertyChangeSupport.addPropertyChangeListener(listener);
}
- void removePropertyChangeListener(PropertyChangeListener listener)
+ public void removePropertyChangeListener(PropertyChangeListener listener)
{
propertyChangeSupport.removePropertyChangeListener(listener);
}
diff --git a/libjava/javax/swing/UIManager.java b/libjava/javax/swing/UIManager.java
index a600972..9722129 100644
--- a/libjava/javax/swing/UIManager.java
+++ b/libjava/javax/swing/UIManager.java
@@ -44,6 +44,8 @@ import java.awt.Font;
import java.awt.Insets;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
+import java.util.Locale;
+
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -158,10 +160,43 @@ public class UIManager implements Serializable
}
public static LookAndFeel[] getAuxiliaryLookAndFeels()
- { return aux_installed; }
+ {
+ return aux_installed;
+ }
public static Object get(Object key)
- { return getLookAndFeel().getDefaults().get(key); }
+ {
+ return getLookAndFeel().getDefaults().get(key);
+ }
+
+ public static Object get(Object key, Locale locale)
+ {
+ return getLookAndFeel().getDefaults().get(key ,locale);
+ }
+
+ /**
+ * Returns a boolean value from the defaults table,
+ * <code>false</code> if key is not present.
+ *
+ * @since 1.4
+ */
+ public static boolean getBoolean(Object key)
+ {
+ Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key);
+ return value != null ? value.booleanValue() : false;
+ }
+
+ /**
+ * Returns a boolean value from the defaults table,
+ * <code>false</code> if key is not present.
+ *
+ * @since 1.4
+ */
+ public static boolean getBoolean(Object key, Locale locale)
+ {
+ Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key, locale);
+ return value != null ? value.booleanValue() : false;
+ }
/**
* Returns a border from the defaults table.
@@ -172,6 +207,16 @@ public class UIManager implements Serializable
}
/**
+ * Returns a border from the defaults table.
+ *
+ * @since 1.4
+ */
+ public static Border getBorder(Object key, Locale locale)
+ {
+ return (Border) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Returns a drawing color from the defaults table.
*/
public static Color getColor(Object key)
@@ -180,6 +225,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns a drawing color from the defaults table.
+ */
+ public static Color getColor(Object key, Locale locale)
+ {
+ return (Color) getLookAndFeel().getDefaults().get(key);
+ }
+
+ /**
* this string can be passed to Class.forName()
*/
public static String getCrossPlatformLookAndFeelClassName()
@@ -204,6 +257,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns a dimension from the defaults table.
+ */
+ public static Dimension getDimension(Object key, Locale locale)
+ {
+ return (Dimension) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Retrieves a font from the defaults table of the current
* LookAndFeel.
*
@@ -217,6 +278,19 @@ public class UIManager implements Serializable
}
/**
+ * Retrieves a font from the defaults table of the current
+ * LookAndFeel.
+ *
+ * @param key an Object that specifies the font. Typically,
+ * this is a String such as
+ * <code>TitledBorder.font</code>.
+ */
+ public static Font getFont(Object key, Locale locale)
+ {
+ return (Font) getLookAndFeel().getDefaults().get(key ,locale);
+ }
+
+ /**
* Returns an Icon from the defaults table.
*/
public static Icon getIcon(Object key)
@@ -225,6 +299,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns an Icon from the defaults table.
+ */
+ public static Icon getIcon(Object key, Locale locale)
+ {
+ return (Icon) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Returns an Insets object from the defaults table.
*/
public static Insets getInsets(Object key)
@@ -232,6 +314,14 @@ public class UIManager implements Serializable
return (Insets) getLookAndFeel().getDefaults().getInsets(key);
}
+ /**
+ * Returns an Insets object from the defaults table.
+ */
+ public static Insets getInsets(Object key, Locale locale)
+ {
+ return (Insets) getLookAndFeel().getDefaults().getInsets(key, locale);
+ }
+
public static LookAndFeelInfo[] getInstalledLookAndFeels()
{
return installed;
@@ -245,6 +335,14 @@ public class UIManager implements Serializable
return x.intValue();
}
+ public static int getInt(Object key, Locale locale)
+ {
+ Integer x = (Integer) getLookAndFeel().getDefaults().get(key, locale);
+ if (x == null)
+ return 0;
+ return x.intValue();
+ }
+
public static LookAndFeel getLookAndFeel()
{
return look_and_feel;
@@ -268,6 +366,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns a string from the defaults table.
+ */
+ public static String getString(Object key, Locale locale)
+ {
+ return (String) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Returns the name of the LookAndFeel class that implements the
* native systems look and feel if there is one, otherwise the name
* of the default cross platform LookAndFeel class.
diff --git a/libjava/javax/swing/border/MatteBorder.java b/libjava/javax/swing/border/MatteBorder.java
index d5dc6dd..b95814b 100644
--- a/libjava/javax/swing/border/MatteBorder.java
+++ b/libjava/javax/swing/border/MatteBorder.java
@@ -1,5 +1,5 @@
/* MatteBorder.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,8 +42,8 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
-import javax.swing.Icon;
+import javax.swing.Icon;
/**
* A border that is filled with either a solid color or with repeated
diff --git a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
index 37d6276..4ecfab4 100644
--- a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
+++ b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
@@ -1,5 +1,5 @@
/* AbstractColorChooserPanel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,15 +35,16 @@ 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.colorchooser;
import java.awt.Color;
import java.awt.Graphics;
+
import javax.swing.Icon;
import javax.swing.JColorChooser;
import javax.swing.JPanel;
-
/**
* AbstractColorChooserPanel
*
diff --git a/libjava/javax/swing/colorchooser/ColorSelectionModel.java b/libjava/javax/swing/colorchooser/ColorSelectionModel.java
index bd9abdd..2dc0e87 100644
--- a/libjava/javax/swing/colorchooser/ColorSelectionModel.java
+++ b/libjava/javax/swing/colorchooser/ColorSelectionModel.java
@@ -1,5 +1,5 @@
/* ColorSelectionModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.colorchooser;
import java.awt.Color;
+
import javax.swing.event.ChangeListener;
/**
diff --git a/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java b/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java
index 90145ed..8852935 100644
--- a/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java
+++ b/libjava/javax/swing/colorchooser/DefaultColorSelectionModel.java
@@ -1,5 +1,5 @@
/* DefaultColorSelectionModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,15 +35,16 @@ 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.colorchooser;
import java.awt.Color;
import java.io.Serializable;
+
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
-
/**
* This is the default implementation of the ColorSelectionModel interface
* that JColorChoosers use.
diff --git a/libjava/javax/swing/colorchooser/DefaultHSBChooserPanel.java b/libjava/javax/swing/colorchooser/DefaultHSBChooserPanel.java
index dcd795a..c249403 100644
--- a/libjava/javax/swing/colorchooser/DefaultHSBChooserPanel.java
+++ b/libjava/javax/swing/colorchooser/DefaultHSBChooserPanel.java
@@ -35,23 +35,22 @@ 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.colorchooser;
import java.awt.BorderLayout;
import java.awt.Color;
-import java.awt.Component;
-import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
-import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.image.MemoryImageSource;
+
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
@@ -66,7 +65,6 @@ import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-
/**
* This is the Default HSB Panel displayed in the JColorChooser.
*/
@@ -377,7 +375,7 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
b)));
spinnerTrigger = false;
- if (! handlingMouse)
+ if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting())
{
updateImage();
updateTrack();
@@ -419,11 +417,6 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
internalChange = true;
- // spinnerTrigger, internalChange, and handlingMouse are used because of the
- // we don't want things like: change spinner -> update chooser -> change spinner
- // That's because the value from before and after the update can differ
- // slightly because of the conversion.
- // FIXME: Think of better way to deal with this.
if (! spinnerTrigger)
{
hSpinner.setValue(new Integer((int) (hsbVals[0] * 360)));
@@ -438,8 +431,10 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
slider.setValue(((Number) hSpinner.getValue()).intValue());
if (! handlingMouse)
{
- gradientPoint.x = (int) ((1 - hsbVals[1]) * imgWidth);
- gradientPoint.y = (int) ((1 - hsbVals[2]) * imgHeight);
+ gradientPoint.x = (int) ((1
+ - ((Number) sSpinner.getValue()).intValue() / 100f) * imgWidth);
+ gradientPoint.y = (int) ((1
+ - ((Number) bSpinner.getValue()).intValue() / 100f) * imgHeight);
}
break;
case SLOCKED:
@@ -447,8 +442,9 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
slider.setValue(((Number) sSpinner.getValue()).intValue());
if (! handlingMouse)
{
- gradientPoint.x = (int) (hsbVals[0] * imgWidth);
- gradientPoint.y = (int) ((1 - hsbVals[2]) * imgHeight);
+ gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / 360f * imgWidth);
+ gradientPoint.y = (int) ((1
+ - ((Number) bSpinner.getValue()).intValue() / 100f) * imgHeight);
}
break;
case BLOCKED:
@@ -456,15 +452,19 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
slider.setValue(((Number) bSpinner.getValue()).intValue());
if (! handlingMouse)
{
- gradientPoint.x = (int) (hsbVals[0] * imgWidth);
- gradientPoint.y = (int) ((1 - hsbVals[1]) * imgHeight);
+ gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / 360f * imgWidth);
+ gradientPoint.y = (int) ((1
+ - ((Number) sSpinner.getValue()).intValue() / 100f) * imgHeight);
}
break;
}
internalChange = false;
- updateImage();
- updateTrack();
+ if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting())
+ updateImage();
+
+ if (! handlingMouse || locked != HLOCKED)
+ updateTrack();
updateTextFields();
}
@@ -857,4 +857,16 @@ class DefaultHSBChooserPanel extends AbstractColorChooserPanel
trackImage = createImage(new MemoryImageSource(trackWidth, imgHeight,
trackPix, 0, trackWidth));
}
+
+ /**
+ * This method returns the HSB values for the currently selected color.
+ *
+ * @return The HSB values for the currently selected color.
+ */
+ private float[] getHSBValues()
+ {
+ Color c = getColorFromModel();
+ float[] f = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+ return f;
+ }
}
diff --git a/libjava/javax/swing/colorchooser/DefaultPreviewPanel.java b/libjava/javax/swing/colorchooser/DefaultPreviewPanel.java
index 93ecfc3..e1e7aa9 100644
--- a/libjava/javax/swing/colorchooser/DefaultPreviewPanel.java
+++ b/libjava/javax/swing/colorchooser/DefaultPreviewPanel.java
@@ -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.colorchooser;
import java.awt.Color;
@@ -43,12 +44,12 @@ import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
+
import javax.swing.JColorChooser;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
-
/**
* This is the default preview panel for the JColorChooser. The default
* preview panel is responsible for displaying the currently selected color
diff --git a/libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java b/libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java
index f6c22e8..6002854 100644
--- a/libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java
+++ b/libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java
@@ -35,18 +35,17 @@ 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.colorchooser;
-import java.awt.BorderLayout;
import java.awt.Color;
-import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
+
import javax.swing.Icon;
import javax.swing.JColorChooser;
import javax.swing.JLabel;
-import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
@@ -54,7 +53,6 @@ import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
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.
@@ -73,11 +71,14 @@ public class DefaultRGBChooserPanel extends AbstractColorChooserPanel
*/
public void stateChanged(ChangeEvent e)
{
- if (internalChange)
+ if (updateChange)
return;
+
int color = R.getValue() << 16 | G.getValue() << 8 | B.getValue();
+ sliderChange = true;
getColorSelectionModel().setSelectedColor(new Color(color));
+ sliderChange = false;
}
}
@@ -93,23 +94,32 @@ public class DefaultRGBChooserPanel extends AbstractColorChooserPanel
*/
public void stateChanged(ChangeEvent e)
{
- if (internalChange)
+ if (updateChange)
return;
+
int red = ((Number) RSpinner.getValue()).intValue();
int green = ((Number) GSpinner.getValue()).intValue();
int blue = ((Number) BSpinner.getValue()).intValue();
int color = red << 16 | green << 8 | blue;
+ spinnerChange = true;
getColorSelectionModel().setSelectedColor(new Color(color));
+ spinnerChange = false;
}
}
+ /** Whether the color change was initiated by the spinners. */
+ private transient boolean spinnerChange = false;
+
+ /** Whether the color change was initiated by the sliders. */
+ private transient boolean sliderChange = false;
+
/**
- * Whether the color change was initiated from the slider or spinner rather
- * than externally.
+ * Whether the change was forced by the chooser (meaning the color has
+ * already been changed).
*/
- private transient boolean internalChange = false;
+ private transient boolean updateChange = false;
/** The ChangeListener for the sliders. */
private transient ChangeListener colorChanger;
@@ -175,22 +185,28 @@ public class DefaultRGBChooserPanel extends AbstractColorChooserPanel
int green = rgb >> 8 & 0xff;
int blue = rgb & 0xff;
- internalChange = true;
-
- if (R != null)
- R.setValue(red);
- if (RSpinner != null)
- RSpinner.setValue(new Integer(red));
- if (G != null)
- G.setValue(green);
- if (GSpinner != null)
- GSpinner.setValue(new Integer(green));
- if (B != null)
- B.setValue(blue);
- if (BSpinner != null)
- BSpinner.setValue(new Integer(blue));
-
- internalChange = false;
+ updateChange = true;
+
+ if (! sliderChange)
+ {
+ if (R != null)
+ R.setValue(red);
+ if (G != null)
+ G.setValue(green);
+ if (B != null)
+ B.setValue(blue);
+ }
+ if (! spinnerChange)
+ {
+ if (GSpinner != null)
+ GSpinner.setValue(new Integer(green));
+ if (RSpinner != null)
+ RSpinner.setValue(new Integer(red));
+ if (BSpinner != null)
+ BSpinner.setValue(new Integer(blue));
+ }
+
+ updateChange = false;
revalidate();
repaint();
diff --git a/libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java b/libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
index 1413a5b..7e5a4ef 100644
--- a/libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
+++ b/libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
@@ -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.colorchooser;
import java.awt.BorderLayout;
@@ -48,12 +49,12 @@ import java.awt.LayoutManager;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+
import javax.swing.Icon;
import javax.swing.JColorChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
-
/**
* This class is the DefaultSwatchChooserPanel. This chooser panel displays a
* set of colors that can be picked. Recently picked items will go into a
diff --git a/libjava/javax/swing/event/AncestorEvent.java b/libjava/javax/swing/event/AncestorEvent.java
index d62be28..63f00a4 100644
--- a/libjava/javax/swing/event/AncestorEvent.java
+++ b/libjava/javax/swing/event/AncestorEvent.java
@@ -1,5 +1,5 @@
/* AncestorEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package javax.swing.event;
import java.awt.AWTEvent;
import java.awt.Container;
+
import javax.swing.JComponent;
/**
diff --git a/libjava/javax/swing/event/HyperlinkEvent.java b/libjava/javax/swing/event/HyperlinkEvent.java
index c979fbf..a3a155a 100644
--- a/libjava/javax/swing/event/HyperlinkEvent.java
+++ b/libjava/javax/swing/event/HyperlinkEvent.java
@@ -1,5 +1,5 @@
/* HyperlinkEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package javax.swing.event;
import java.net.URL;
import java.util.EventObject;
+
import javax.swing.text.Element;
/**
diff --git a/libjava/javax/swing/event/InternalFrameEvent.java b/libjava/javax/swing/event/InternalFrameEvent.java
index 863fd29..9f03116 100644
--- a/libjava/javax/swing/event/InternalFrameEvent.java
+++ b/libjava/javax/swing/event/InternalFrameEvent.java
@@ -1,5 +1,5 @@
/* InternalFrameEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.event;
import java.awt.AWTEvent;
+
import javax.swing.JInternalFrame;
/**
diff --git a/libjava/javax/swing/event/MenuDragMouseEvent.java b/libjava/javax/swing/event/MenuDragMouseEvent.java
index b1eb841..8d3a0a5 100644
--- a/libjava/javax/swing/event/MenuDragMouseEvent.java
+++ b/libjava/javax/swing/event/MenuDragMouseEvent.java
@@ -1,5 +1,5 @@
/* MenuDragMouseEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,12 @@ 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.event;
-// Imports
-import java.awt.event.MouseEvent;
import java.awt.Component;
+import java.awt.event.MouseEvent;
+
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
diff --git a/libjava/javax/swing/event/MenuKeyEvent.java b/libjava/javax/swing/event/MenuKeyEvent.java
index 3465336..aecc992 100644
--- a/libjava/javax/swing/event/MenuKeyEvent.java
+++ b/libjava/javax/swing/event/MenuKeyEvent.java
@@ -1,5 +1,5 @@
/* MenuKeyEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,12 @@ 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.event;
-// Imports
import java.awt.Component;
import java.awt.event.KeyEvent;
+
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
diff --git a/libjava/javax/swing/event/TableColumnModelEvent.java b/libjava/javax/swing/event/TableColumnModelEvent.java
index 2525dfc..17a71e4 100644
--- a/libjava/javax/swing/event/TableColumnModelEvent.java
+++ b/libjava/javax/swing/event/TableColumnModelEvent.java
@@ -1,5 +1,5 @@
/* TableColumnModelEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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.event;
-// Imports
import java.util.EventObject;
+
import javax.swing.table.TableColumnModel;
/**
diff --git a/libjava/javax/swing/event/TableModelEvent.java b/libjava/javax/swing/event/TableModelEvent.java
index 6bd9697..ba8a36d 100644
--- a/libjava/javax/swing/event/TableModelEvent.java
+++ b/libjava/javax/swing/event/TableModelEvent.java
@@ -1,5 +1,5 @@
/* TableModelEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.event;
import java.util.EventObject;
+
import javax.swing.table.TableModel;
/**
diff --git a/libjava/javax/swing/event/TreeExpansionEvent.java b/libjava/javax/swing/event/TreeExpansionEvent.java
index ee8b7c0..40d08f0 100644
--- a/libjava/javax/swing/event/TreeExpansionEvent.java
+++ b/libjava/javax/swing/event/TreeExpansionEvent.java
@@ -1,5 +1,5 @@
/* TreeExpansionEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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.event;
-// Imports
import java.util.EventObject;
+
import javax.swing.tree.TreePath;
/**
diff --git a/libjava/javax/swing/event/TreeModelEvent.java b/libjava/javax/swing/event/TreeModelEvent.java
index 625dfe0..7dbbc79 100644
--- a/libjava/javax/swing/event/TreeModelEvent.java
+++ b/libjava/javax/swing/event/TreeModelEvent.java
@@ -1,5 +1,5 @@
/* TreeModelEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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.event;
-// Imports
import java.util.EventObject;
+
import javax.swing.tree.TreePath;
/**
diff --git a/libjava/javax/swing/event/TreeSelectionEvent.java b/libjava/javax/swing/event/TreeSelectionEvent.java
index 238d2fc..6d2f461 100644
--- a/libjava/javax/swing/event/TreeSelectionEvent.java
+++ b/libjava/javax/swing/event/TreeSelectionEvent.java
@@ -35,9 +35,11 @@ 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.event;
import java.util.EventObject;
+
import javax.swing.tree.TreePath;
/**
diff --git a/libjava/javax/swing/event/TreeWillExpandListener.java b/libjava/javax/swing/event/TreeWillExpandListener.java
index b24c371..35364b9 100644
--- a/libjava/javax/swing/event/TreeWillExpandListener.java
+++ b/libjava/javax/swing/event/TreeWillExpandListener.java
@@ -1,5 +1,5 @@
/* TreeWillExpandListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.event;
import java.util.EventListener;
+
import javax.swing.tree.ExpandVetoException;
/**
diff --git a/libjava/javax/swing/event/UndoableEditEvent.java b/libjava/javax/swing/event/UndoableEditEvent.java
index be55e9b..9e989d1 100644
--- a/libjava/javax/swing/event/UndoableEditEvent.java
+++ b/libjava/javax/swing/event/UndoableEditEvent.java
@@ -35,9 +35,11 @@ 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.event;
import java.util.EventObject;
+
import javax.swing.undo.UndoableEdit;
/**
diff --git a/libjava/javax/swing/filechooser/FileView.java b/libjava/javax/swing/filechooser/FileView.java
index 7ff8ab0..f680e8f 100644
--- a/libjava/javax/swing/filechooser/FileView.java
+++ b/libjava/javax/swing/filechooser/FileView.java
@@ -1,5 +1,5 @@
/* FileView.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.filechooser;
import java.io.File;
+
import javax.swing.Icon;
/**
diff --git a/libjava/javax/swing/plaf/BorderUIResource.java b/libjava/javax/swing/plaf/BorderUIResource.java
index c9ed011..6b61f48 100644
--- a/libjava/javax/swing/plaf/BorderUIResource.java
+++ b/libjava/javax/swing/plaf/BorderUIResource.java
@@ -1,5 +1,5 @@
/* BorderUIResource.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,14 +38,22 @@ exception statement from your version. */
package javax.swing.plaf;
-import javax.swing.border.*;
-import javax.swing.Icon;
-import java.io.Serializable;
+import java.awt.Color;
import java.awt.Component;
+import java.awt.Font;
import java.awt.Graphics;
import java.awt.Insets;
-import java.awt.Font;
-import java.awt.Color;
+import java.io.Serializable;
+
+import javax.swing.Icon;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.border.TitledBorder;
/**
* A wrapper for {@link javax.swing.border.Border} that also
diff --git a/libjava/javax/swing/plaf/ComponentUI.java b/libjava/javax/swing/plaf/ComponentUI.java
index a2ca1f0..80e60c8 100644
--- a/libjava/javax/swing/plaf/ComponentUI.java
+++ b/libjava/javax/swing/plaf/ComponentUI.java
@@ -1,5 +1,5 @@
-/* ComponentUI.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* ComponentUI.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,10 +40,10 @@ package javax.swing.plaf;
import java.awt.Dimension;
import java.awt.Graphics;
+
import javax.accessibility.Accessible;
import javax.swing.JComponent;
-
/**
* The abstract base class for all delegates that provide the
* pluggable look and feel for Swing components. User applications
diff --git a/libjava/javax/swing/plaf/FileChooserUI.java b/libjava/javax/swing/plaf/FileChooserUI.java
index 6031c42..9037181 100644
--- a/libjava/javax/swing/plaf/FileChooserUI.java
+++ b/libjava/javax/swing/plaf/FileChooserUI.java
@@ -1,5 +1,5 @@
/* FileChooserUI.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,9 +35,11 @@ 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;
import java.io.File;
+
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileView;
diff --git a/libjava/javax/swing/plaf/IconUIResource.java b/libjava/javax/swing/plaf/IconUIResource.java
index ca1ee7d..3af16b7 100644
--- a/libjava/javax/swing/plaf/IconUIResource.java
+++ b/libjava/javax/swing/plaf/IconUIResource.java
@@ -1,5 +1,5 @@
-/* IconUIResource.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* IconUIResource.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,8 +41,8 @@ package javax.swing.plaf;
import java.awt.Component;
import java.awt.Graphics;
import java.io.Serializable;
-import javax.swing.Icon;
+import javax.swing.Icon;
/**
* An icon that is marked as <code>UIResource</code>, which
diff --git a/libjava/javax/swing/plaf/ListUI.java b/libjava/javax/swing/plaf/ListUI.java
index 71ec770..1639c41 100644
--- a/libjava/javax/swing/plaf/ListUI.java
+++ b/libjava/javax/swing/plaf/ListUI.java
@@ -1,5 +1,5 @@
-/* ListUI.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* ListUI.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,8 +40,8 @@ package javax.swing.plaf;
import java.awt.Point;
import java.awt.Rectangle;
-import javax.swing.JList;
+import javax.swing.JList;
/**
* An abstract base class for delegates that implement the pluggable
diff --git a/libjava/javax/swing/plaf/PopupMenuUI.java b/libjava/javax/swing/plaf/PopupMenuUI.java
index 1871b9b..7e71a4b 100644
--- a/libjava/javax/swing/plaf/PopupMenuUI.java
+++ b/libjava/javax/swing/plaf/PopupMenuUI.java
@@ -1,5 +1,5 @@
/* PopupMenuUI.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,14 +35,15 @@ 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;
import java.awt.event.MouseEvent;
+
import javax.swing.JPopupMenu;
import javax.swing.Popup;
import javax.swing.PopupFactory;
-
/**
* An abstract base class for delegates that implement the pluggable
* look and feel for a <code>JPopupMenu</code>.
diff --git a/libjava/javax/swing/plaf/SplitPaneUI.java b/libjava/javax/swing/plaf/SplitPaneUI.java
index 020a54a..146db76 100644
--- a/libjava/javax/swing/plaf/SplitPaneUI.java
+++ b/libjava/javax/swing/plaf/SplitPaneUI.java
@@ -1,5 +1,5 @@
/* SplitPaneUI.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,12 @@ 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;
+package javax.swing.plaf;
import java.awt.Graphics;
-import javax.swing.JSplitPane;
+import javax.swing.JSplitPane;
/**
* An abstract base class for delegates that implement the pluggable
diff --git a/libjava/javax/swing/plaf/TabbedPaneUI.java b/libjava/javax/swing/plaf/TabbedPaneUI.java
index 20c36c3..f0cf69919 100644
--- a/libjava/javax/swing/plaf/TabbedPaneUI.java
+++ b/libjava/javax/swing/plaf/TabbedPaneUI.java
@@ -1,5 +1,5 @@
-/* TabbedPaneUI.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* TabbedPaneUI.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,8 @@ exception statement from your version. */
package javax.swing.plaf;
import java.awt.Rectangle;
-import javax.swing.JTabbedPane;
+import javax.swing.JTabbedPane;
/**
* An abstract base class for delegates that implement the pluggable
diff --git a/libjava/javax/swing/plaf/TextUI.java b/libjava/javax/swing/plaf/TextUI.java
index 14f89d6..b28dd37 100644
--- a/libjava/javax/swing/plaf/TextUI.java
+++ b/libjava/javax/swing/plaf/TextUI.java
@@ -1,5 +1,5 @@
-/* TextUI.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* TextUI.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,13 +40,13 @@ package javax.swing.plaf;
import java.awt.Point;
import java.awt.Rectangle;
+
import javax.swing.text.BadLocationException;
import javax.swing.text.EditorKit;
import javax.swing.text.JTextComponent;
import javax.swing.text.Position;
import javax.swing.text.View;
-
/**
* An abstract base class for delegates that provide the user
* interface for text editors.
diff --git a/libjava/javax/swing/plaf/TreeUI.java b/libjava/javax/swing/plaf/TreeUI.java
index 55327e2..d4bee57 100644
--- a/libjava/javax/swing/plaf/TreeUI.java
+++ b/libjava/javax/swing/plaf/TreeUI.java
@@ -1,5 +1,5 @@
-/* TreeUI.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* TreeUI.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,10 +39,10 @@ exception statement from your version. */
package javax.swing.plaf;
import java.awt.Rectangle;
+
import javax.swing.JTree;
import javax.swing.tree.TreePath;
-
/**
* An abstract base class for delegates that provide the user
* interface for <code>JTree</code>.
diff --git a/libjava/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/javax/swing/plaf/basic/BasicArrowButton.java
index 8354d06..f876a78 100644
--- a/libjava/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/libjava/javax/swing/plaf/basic/BasicArrowButton.java
@@ -1,4 +1,4 @@
-/* BasicArrowButton.java
+/* BasicArrowButton.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,183 +35,98 @@ 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;
import java.awt.Component;
import java.awt.Dimension;
-import java.awt.Insets;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Polygon;
import java.awt.Rectangle;
-import javax.swing.border.Border;
-import javax.swing.Icon;
+
import javax.swing.JButton;
import javax.swing.SwingConstants;
-
+import javax.swing.border.Border;
/**
* This class draws simple arrow buttons for the Basic Look and Feel.
*/
public class BasicArrowButton extends JButton implements SwingConstants
{
- /**
- * A private helper class that draws icons.
- */
- private class arrowIcon implements Icon
- {
- /** The polygon that describes the icon. */
- private Polygon arrow;
-
- /** The size of the icon. */
- private int size = 10;
-
- /**
- * Creates a new arrowIcon object using the given arrow polygon.
- *
- * @param arrow The polygon that describes the arrow.
- */
- public arrowIcon(Polygon arrow)
- {
- this.arrow = arrow;
- }
-
- /**
- * Returns the height of the icon.
- *
- * @return The height of the icon.
- */
- public int getIconHeight()
- {
- return size;
- }
-
- /**
- * Returns the width of the icon.
- *
- * @return The width of the icon.
- */
- public int getIconWidth()
- {
- return size;
- }
-
- /**
- * Sets the size of the icon.
- *
- * @param size The size of the icon.
- */
- public void setSize(int size)
- {
- this.size = size;
- }
-
- /**
- * Sets the arrow polygon.
- *
- * @param arrow The arrow polygon.
- */
- public void setArrow(Polygon arrow)
- {
- this.arrow = arrow;
- }
-
- /**
- * Paints the icon.
- *
- * @param c The Component to paint for.
- * @param g The Graphics object to draw with.
- * @param x The X coordinate to draw at.
- * @param y The Y coordinate to draw at.
- */
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- Color arrowColor;
- if (c.isEnabled())
- arrowColor = darkShadow;
- else
- arrowColor = shadow;
-
- paintIconImpl(g, x, y, arrowColor);
- }
-
- /**
- * This method does the actual painting work.
- *
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to paint at.
- * @param y The y coordinate to paint at.
- * @param arrowColor The color to paint the arrow with.
- */
- public void paintIconImpl(Graphics g, int x, int y, Color arrowColor)
- {
- g.translate(x, y);
+ /** The default size of the Arrow buttons. */
+ private static int defaultSize = 10;
- Color saved = g.getColor();
+ /** The Polygon that points up. */
+ private static Polygon upIcon = new Polygon(new int[] { 0, 5, 9 },
+ new int[] { 7, 2, 7 }, 3);
- g.setColor(arrowColor);
+ /** The Polygon that points down. */
+ private static Polygon downIcon = new Polygon(new int[] { 1, 5, 9 },
+ new int[] { 3, 7, 3 }, 3);
- g.fillPolygon(arrow);
+ /** The Polygon that points left. */
+ private static Polygon leftIcon = new Polygon(new int[] { 7, 3, 7 },
+ new int[] { 1, 5, 9 }, 3);
- g.setColor(saved);
- g.translate(-x, -y);
- }
- }
+ /** The Polygon that points right. */
+ private static Polygon rightIcon = new Polygon(new int[] { 3, 7, 3 },
+ new int[] { 1, 5, 9 }, 3);
/** The direction to point in. */
protected int direction;
- /** The color the arrow is painted in if disabled and the bottom and
- * right edges of the button. */
- private transient Color shadow = Color.gray;
+ /**
+ * The color the arrow is painted in if disabled and the bottom and right
+ * edges of the button.
+ */
+ private transient Color shadow = Color.GRAY;
- /** The color the arrow is painted in if enabled and the bottom and
- * right edges of the button. */
- private transient Color darkShadow = Color.BLACK;
+ /**
+ * The color the arrow is painted in if enabled and the bottom and right
+ * edges of the button.
+ */
+ private transient Color darkShadow = Color.DARK_GRAY;
/** The top and left edges of the button. */
- private transient Color highlight = Color.BLACK;
+ private transient Color highlight = Color.WHITE;
/** The border around the ArrowButton. */
- private transient Border tmpBorder = new Border()
- {
- public Insets getBorderInsets(Component c)
- {
- return new Insets(0, 0, 0, 0);
- }
-
- public boolean isBorderOpaque()
+ private transient Border buttonBorder = new Border()
{
- return false;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
- {
- Rectangle bounds = getBounds();
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(2, 2, 2, 2);
+ }
- Color saved = g.getColor();
- g.setColor(highlight);
+ public boolean isBorderOpaque()
+ {
+ return true;
+ }
- g.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height);
- g.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color saved = g.getColor();
+ g.setColor(highlight);
+
+ g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
- g.setColor(shadow);
+ g.setColor(shadow);
- g.drawLine(bounds.x + 1, bounds.y + bounds.height - 1,
- bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
- g.drawLine(bounds.x + bounds.width - 1, bounds.y + 1,
- bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
+ g.setColor(darkShadow);
- g.drawLine(bounds.x, bounds.y + bounds.height, bounds.x + bounds.width,
- bounds.y + bounds.height);
- g.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width,
- bounds.y + bounds.height);
+ g.drawLine(x, y + h, x + w, y + h);
+ g.drawLine(x + w, y, x + w, y + h);
- g.setColor(saved);
- }
- };
+ g.setColor(saved);
+ }
+ };
/**
* Creates a new BasicArrowButton object.
@@ -221,12 +136,12 @@ public class BasicArrowButton extends JButton implements SwingConstants
public BasicArrowButton(int direction)
{
super();
+ setBorder(buttonBorder);
setDirection(direction);
- setBorder(tmpBorder);
}
/**
- * Creates a new BasicArrowButton object with the given colors and
+ * Creates a new BasicArrowButton object with the given colors and
* direction.
*
* @param direction The direction to point in.
@@ -246,6 +161,16 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
+ * This method returns whether the focus can traverse to this component.
+ *
+ * @return Whether the focus can traverse to this component.
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
* This method returns the direction of the arrow.
*
* @return The direction of the arrow.
@@ -262,22 +187,25 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
public void setDirection(int dir)
{
- Polygon arrow = getArrow(dir, 10);
- if (getIcon() == null)
- setIcon(new arrowIcon(arrow));
- else
- ((arrowIcon) getIcon()).setArrow(arrow);
this.direction = dir;
}
/**
- * This method paints the arrow button.
+ * This method paints the arrow button. The painting is delegated to the
+ * paintTriangle method.
*
* @param g The Graphics object to paint with.
*/
public void paint(Graphics g)
{
super.paint(g);
+ Insets insets = getInsets();
+ Rectangle bounds = getBounds();
+ int x = insets.left
+ + (bounds.width - insets.left - insets.right - defaultSize) / 2;
+ int y = insets.top
+ + (bounds.height - insets.left - insets.right - defaultSize) / 2;
+ paintTriangle(g, x, y, defaultSize, direction, isEnabled());
}
/**
@@ -287,7 +215,11 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
public Dimension getPreferredSize()
{
- return new Dimension(getIcon().getIconWidth(), getIcon().getIconHeight());
+ Insets insets = getInsets();
+ int w = defaultSize + insets.left + insets.right;
+ int h = defaultSize + insets.top + insets.bottom;
+
+ return new Dimension(w, h);
}
/**
@@ -311,8 +243,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * The method paints a triangle with the given size and direction at
- * the given x and y coordinates.
+ * The method paints a triangle with the given size and direction at the
+ * given x and y coordinates.
*
* @param g The Graphics object to paint with.
* @param x The x coordinate to paint at.
@@ -324,61 +256,90 @@ public class BasicArrowButton extends JButton implements SwingConstants
public void paintTriangle(Graphics g, int x, int y, int size, int direction,
boolean isEnabled)
{
- Polygon arrow = getArrow(direction, size);
- arrowIcon arrowI = new arrowIcon(arrow);
- arrowI.setSize(size);
-
- Color arrowColor;
- if (isEnabled())
- arrowColor = darkShadow;
- else
- arrowColor = shadow;
-
- arrowI.paintIconImpl(g, x, y, arrowColor);
- }
-
- /**
- * This is a private helper that creates polygons for a given size
- * and direction.
- *
- * @param direction The direction of the arrow.
- * @param size The size of the arrow.
- *
- * @return A new arrow polygon.
- */
- private Polygon getArrow(int direction, int size)
- {
- Polygon arrow;
- double dsize = (double) size;
-
- int one = (int) (dsize * 1 / 10);
- int two = (int) (dsize * 2 / 10);
- int five = (int) (dsize * 5 / 10);
- int eight = (int) (dsize * 8 / 10);
-
+ Polygon arrow = null;
switch (direction)
{
case NORTH:
- arrow = new Polygon(new int[] { eight, five, one },
- new int[] { eight, one, eight }, 3);
+ arrow = upIcon;
break;
case SOUTH:
- arrow = new Polygon(new int[] { eight, five, two },
- new int[] { two, eight, two }, 3);
+ arrow = downIcon;
break;
case EAST:
case RIGHT:
- arrow = new Polygon(new int[] { two, eight, two },
- new int[] { two, five, eight }, 3);
+ arrow = rightIcon;
break;
case WEST:
case LEFT:
- arrow = new Polygon(new int[] { eight, two, eight },
- new int[] { two, five, eight }, 3);
+ arrow = leftIcon;
break;
- default:
- throw new IllegalArgumentException("Invalid direction given.");
}
- return arrow;
+
+ int[] xPoints = arrow.xpoints;
+ int[] yPoints = arrow.ypoints;
+ int x1;
+ int y1;
+ int x2;
+ int y2;
+ x1 = y1 = x2 = y2 = 0;
+
+ if (size != defaultSize)
+ {
+ float scale = size * 1f / defaultSize;
+ for (int i = 0; i < 3; i++)
+ {
+ xPoints[i] *= scale;
+ yPoints[i] *= scale;
+ }
+ }
+ g.translate(x, y);
+
+ switch (direction)
+ {
+ case NORTH:
+ x1 = xPoints[0] + 2;
+ y1 = yPoints[0];
+ y2 = y1;
+ x2 = xPoints[2] - 1;
+ break;
+ case SOUTH:
+ x1 = xPoints[1];
+ y1 = yPoints[1] + 1;
+ x2 = xPoints[2] - 1;
+ y2 = yPoints[2];
+ break;
+ case LEFT:
+ case WEST:
+ x1 = xPoints[0] + 1;
+ y1 = yPoints[0] + 1;
+ x2 = x1;
+ y2 = yPoints[2] + 1;
+ break;
+ case RIGHT:
+ case EAST:
+ x1 = xPoints[2];
+ y1 = yPoints[2] + 1;
+ x2 = xPoints[1] - 1;
+ y2 = yPoints[1] + 1;
+ break;
+ }
+ Color saved = g.getColor();
+
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+
+ if (arrow != null)
+ g.fillPolygon(xPoints, yPoints, 3);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(xPoints, yPoints, 3);
+ g.setColor(Color.WHITE);
+ g.drawLine(x1, y1, x2, y2);
+ }
+ g.setColor(saved);
+ g.translate(-x, -y);
}
}
diff --git a/libjava/javax/swing/plaf/basic/BasicBorders.java b/libjava/javax/swing/plaf/basic/BasicBorders.java
index 7002d14..dd668e3 100644
--- a/libjava/javax/swing/plaf/basic/BasicBorders.java
+++ b/libjava/javax/swing/plaf/basic/BasicBorders.java
@@ -1,5 +1,5 @@
-/* BasicBorders.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* BasicBorders.java --
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,7 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.io.Serializable;
+
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JButton;
@@ -55,11 +56,10 @@ import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
-import javax.swing.plaf.UIResource;
import javax.swing.plaf.BorderUIResource;
+import javax.swing.plaf.UIResource;
import javax.swing.text.JTextComponent;
-
/**
* Provides various borders for the Basic look and feel.
*
diff --git a/libjava/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/javax/swing/plaf/basic/BasicButtonUI.java
index df7ac42..ed04d28 100644
--- a/libjava/javax/swing/plaf/basic/BasicButtonUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicButtonUI.java
@@ -37,15 +37,12 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
-import java.awt.Graphics2D;
import java.awt.Rectangle;
-import java.awt.Stroke;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
@@ -205,7 +202,7 @@ public class BasicButtonUI extends ButtonUI
return d;
}
- static private Icon currentIcon(AbstractButton b)
+ private static Icon currentIcon(AbstractButton b)
{
Icon i = b.getIcon();
ButtonModel model = b.getModel();
diff --git a/libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
index c7d88d1..a0cf5a4 100644
--- a/libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
@@ -1,4 +1,4 @@
-/* BasicCheckBoxMenuItemUI.java
+/* BasicCheckBoxMenuItemUI.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,9 +35,11 @@ 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.MouseEvent;
+
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import javax.swing.MenuElement;
@@ -46,7 +48,6 @@ import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
-
/**
* DOCUMENT ME!
*/
diff --git a/libjava/javax/swing/plaf/basic/BasicColorChooserUI.java b/libjava/javax/swing/plaf/basic/BasicColorChooserUI.java
index 1c2dcd6..61af43b 100644
--- a/libjava/javax/swing/plaf/basic/BasicColorChooserUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicColorChooserUI.java
@@ -1,4 +1,4 @@
-/* BasicColorChooserUI.java
+/* BasicColorChooserUI.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,17 +35,14 @@ 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.BorderLayout;
-import java.awt.Component;
import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.LayoutManager;
-import java.awt.Rectangle;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JColorChooser;
import javax.swing.JComponent;
import javax.swing.JPanel;
@@ -59,7 +56,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.ColorChooserUI;
import javax.swing.plaf.ComponentUI;
-
/**
* This is the UI Class for the JColorChooser in the Basic Look and Feel.
*/
diff --git a/libjava/javax/swing/plaf/basic/BasicComboBoxEditor.java b/libjava/javax/swing/plaf/basic/BasicComboBoxEditor.java
index a465ff9..b306af7 100644
--- a/libjava/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/libjava/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -35,18 +35,19 @@ 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.Component;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
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
* item in comboBox. By default, the JTextField is returned as
diff --git a/libjava/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/libjava/javax/swing/plaf/basic/BasicComboBoxRenderer.java
index 6bf6a74..5dc0f48 100644
--- a/libjava/javax/swing/plaf/basic/BasicComboBoxRenderer.java
+++ b/libjava/javax/swing/plaf/basic/BasicComboBoxRenderer.java
@@ -35,12 +35,13 @@ 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;
import java.awt.Component;
import java.awt.Dimension;
import java.io.Serializable;
+
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
@@ -51,7 +52,6 @@ import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.UIResource;
-
/**
* This class is renderer for the combo box.
*
diff --git a/libjava/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/javax/swing/plaf/basic/BasicComboBoxUI.java
index 851392a..3ba13a2 100644
--- a/libjava/javax/swing/plaf/basic/BasicComboBoxUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -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;
@@ -58,7 +59,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.EventListener;
+
import javax.accessibility.Accessible;
import javax.swing.CellRendererPane;
import javax.swing.ComboBoxEditor;
@@ -66,21 +67,14 @@ import javax.swing.ComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
-import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
-import javax.swing.SwingConstants;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicComboPopup;
-import javax.swing.plaf.basic.BasicGraphicsUtils;
-
/**
* UI Delegate for JComboBox
@@ -796,7 +790,7 @@ public class BasicComboBoxUI extends ComboBoxUI
currentValue,
-1,
isPressed,
- isPressed);
+ hasFocus);
if (! comboBox.isEnabled())
comp.setEnabled(false);
@@ -1127,8 +1121,9 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public void intervalRemoved(ListDataEvent e)
{
- // must determine if the size of the combo box should change
- // FIXME: need to implement
+ // recalculate display size of the JComboBox.
+ largestItemSize = getLargestItemSize();
+ comboBox.repaint();
}
}
@@ -1142,11 +1137,13 @@ public class BasicComboBoxUI extends ComboBoxUI
{
}
+ /**
+ * This method is invoked whenever bound property of JComboBox changes.
+ */
public void propertyChange(PropertyChangeEvent e)
{
if (e.getPropertyName().equals(JComboBox.ENABLED_CHANGED_PROPERTY))
{
- // disable arrow button
arrowButton.setEnabled(comboBox.isEnabled());
if (comboBox.isEditable())
@@ -1169,6 +1166,16 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.revalidate();
comboBox.repaint();
}
+ else if (e.getPropertyName().equals(JComboBox.MODEL_CHANGED_PROPERTY))
+ {
+ // remove ListDataListener from old model and add it to new model
+ ComboBoxModel oldModel = (ComboBoxModel) e.getOldValue();
+ if (oldModel != null)
+ oldModel.removeListDataListener(listDataListener);
+
+ if ((ComboBoxModel) e.getNewValue() != null)
+ comboBox.getModel().addListDataListener(listDataListener);
+ }
// FIXME: Need to handle changes in other bound properties.
}
diff --git a/libjava/javax/swing/plaf/basic/BasicComboPopup.java b/libjava/javax/swing/plaf/basic/BasicComboPopup.java
index 61d2dfb..bec7f05 100644
--- a/libjava/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/libjava/javax/swing/plaf/basic/BasicComboPopup.java
@@ -35,10 +35,12 @@ 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.Component;
import java.awt.Dimension;
+import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -52,16 +54,18 @@ import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
-import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPopupMenu;
+import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
@@ -70,7 +74,6 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
-
/**
* UI Delegate for ComboPopup
*
@@ -78,37 +81,32 @@ import javax.swing.event.PopupMenuListener;
*/
public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
+ /* Timer for autoscrolling */
protected Timer autoscrollTimer;
- /**
- * ComboBox associated with this popup
- */
+ /** ComboBox associated with this popup */
protected JComboBox comboBox;
- /*
- * FIXME: Document fields below
- */
+ /** FIXME: Need to document */
protected boolean hasEntered;
- protected boolean isAutoScrolling;
/**
- * ItemListener listening to the selection changes in the combo box
+ * Indicates whether the scroll bar located in popup menu with comboBox's
+ * list of items is currently autoscrolling. This happens when mouse event
+ * originated in the combo box and is dragged outside of its bounds
*/
+ protected boolean isAutoScrolling;
+
+ /** ItemListener listening to the selection changes in the combo box */
protected ItemListener itemListener;
- /**
- * This listener is not used
- */
+ /** This listener is not used */
protected KeyListener keyListener;
- /**
- * JList which is used to display item is the combo box
- */
+ /** JList which is used to display item is the combo box */
protected JList list;
- /**
- * This listener is not used
- */
+ /** This listener is not used */
protected ListDataListener listDataListener;
/**
@@ -123,14 +121,10 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected MouseMotionListener listMouseMotionListener;
- /**
- * This listener is not used
- */
+ /** This listener is not used */
protected ListSelectionListener listSelectionListener;
- /**
- * MouseListener listening to mouse events occuring in the combo box
- */
+ /** MouseListener listening to mouse events occuring in the combo box */
protected MouseListener mouseListener;
/**
@@ -145,21 +139,19 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected PropertyChangeListener propertyChangeListener;
- /*
- * FIXME: Document fields below
- */
- protected static int SCROLL_DOWN = 1;
- protected static int SCROLL_UP = 0;
+ /** direction for scrolling down list of combo box's items */
+ protected static final int SCROLL_DOWN = 1;
+
+ /** direction for scrolling up list of combo box's items */
+ protected static final int SCROLL_UP = 0;
+
+ /** Indicates auto scrolling direction */
protected int scrollDirection;
- /**
- * JScrollPane that contains list portion of the combo box
- */
+ /** JScrollPane that contains list portion of the combo box */
protected JScrollPane scroller;
- /**
- * This field is not used
- */
+ /** This field is not used */
protected boolean valueIsAdjusting;
/**
@@ -171,19 +163,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
this.comboBox = comboBox;
installComboBoxListeners();
-
- // initialize list that will be used to display elements of the combo box
- this.list = createList();
- ((JLabel) list.getCellRenderer()).setHorizontalAlignment(SwingConstants.LEFT);
- configureList();
-
- // initialize scroller. Add list to the scroller.
- scroller = createScroller();
- configureScroller();
-
- // add scroller with list inside of it to JPopupMenu
- super.add(scroller);
-
+ configurePopup();
setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());
}
@@ -196,11 +176,21 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
// popup should have same width as the comboBox and should be hight anough
// to display number of rows equal to 'maximumRowCount' property
- int popupHeight = getPopupHeightForRowCount(comboBox.getMaximumRowCount())
- + 4;
+ int popupHeight = getPopupHeightForRowCount(comboBox.getMaximumRowCount());
+ list.setPreferredSize(new Dimension(cbBounds.width, popupHeight));
super.setPopupSize(cbBounds.width, popupHeight);
+ // Highlight selected item in the combo box's drop down list
+ if (comboBox.getSelectedIndex() != -1)
+ list.setSelectedIndex(comboBox.getSelectedIndex());
+
+ //scroll scrollbar s.t. selected item is visible
+ JScrollBar scrollbar = scroller.getVerticalScrollBar();
+ int selectedIndex = comboBox.getSelectedIndex();
+ if (selectedIndex > comboBox.getMaximumRowCount())
+ scrollbar.setValue(getPopupHeightForRowCount(selectedIndex));
+
// location specified is relative to comboBox
super.show(comboBox, 0, cbBounds.height);
}
@@ -293,7 +283,10 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void firePopupMenuWillBecomeVisible()
{
- // FIXME: Need to implement
+ PopupMenuListener[] ll = comboBox.getPopupMenuListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].popupMenuWillBecomeVisible(new PopupMenuEvent(comboBox));
}
/**
@@ -302,7 +295,10 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void firePopupMenuWillBecomeInvisible()
{
- // FIXME: Need to implement
+ PopupMenuListener[] ll = comboBox.getPopupMenuListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].popupMenuWillBecomeInvisible(new PopupMenuEvent(comboBox));
}
/**
@@ -311,7 +307,10 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void firePopupMenuCanceled()
{
- // FIXME: Need to implement
+ PopupMenuListener[] ll = comboBox.getPopupMenuListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].popupMenuCanceled(new PopupMenuEvent(comboBox));
}
/**
@@ -440,11 +439,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
protected void configureList()
{
list.setModel(comboBox.getModel());
-
- if (comboBox.getItemCount() < comboBox.getMaximumRowCount())
- list.setVisibleRowCount(comboBox.getItemCount());
- else
- list.setVisibleRowCount(comboBox.getMaximumRowCount());
+ list.setVisibleRowCount(comboBox.getMaximumRowCount());
installListListeners();
}
@@ -493,7 +488,17 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void configurePopup()
{
- // FIXME: Need to implement
+ // initialize list that will be used to display combo box's items
+ this.list = createList();
+ ((JLabel) list.getCellRenderer()).setHorizontalAlignment(SwingConstants.LEFT);
+ configureList();
+
+ // initialize scroller. Add list to the scroller.
+ scroller = createScroller();
+ configureScroller();
+
+ // add scroller with list inside of it to JPopupMenu
+ super.add(scroller);
}
/*
@@ -552,37 +557,68 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
}
/**
- * DOCUMENT ME!
+ * This method start scrolling combo box's list of items either up or down
+ * depending on the specified 'direction'
*
- * @param direction DOCUMENT ME!
+ * @param direction of the scrolling.
*/
protected void startAutoScrolling(int direction)
{
- // FIXME: Need to implement
+ // FIXME: add timer
+ isAutoScrolling = true;
+
+ if (direction == SCROLL_UP)
+ autoScrollUp();
+ else
+ autoScrollDown();
}
/**
- * DOCUMENT ME!
+ * This method stops scrolling the combo box's list of items
*/
protected void stopAutoScrolling()
{
- // FIXME: Need to implement
+ // FIXME: add timer
+ isAutoScrolling = false;
}
/**
- * DOCUMENT ME!
+ * This method scrolls up list of combo box's items up and highlights that
+ * just became visible.
*/
protected void autoScrollUp()
{
- // FIXME: Need to implement
+ // scroll up the scroll bar to make the item above visible
+ JScrollBar scrollbar = scroller.getVerticalScrollBar();
+ int scrollToNext = list.getScrollableUnitIncrement(super.getBounds(),
+ SwingConstants.VERTICAL,
+ SCROLL_UP);
+
+ scrollbar.setValue(scrollbar.getValue() - scrollToNext);
+
+ // If we haven't reached the begging of the combo box's list of items,
+ // then highlight next element above currently highlighted element
+ if (list.getSelectedIndex() != 0)
+ list.setSelectedIndex(list.getSelectedIndex() - 1);
}
/**
- * DOCUMENT ME!
+ * This method scrolls down list of combo box's and highlights item in the
+ * list that just became visible.
*/
protected void autoScrollDown()
{
- // FIXME: Need to implement
+ // scroll scrollbar down to make next item visible
+ JScrollBar scrollbar = scroller.getVerticalScrollBar();
+ int scrollToNext = list.getScrollableUnitIncrement(super.getBounds(),
+ SwingConstants.VERTICAL,
+ SCROLL_DOWN);
+ scrollbar.setValue(scrollbar.getValue() + scrollToNext);
+
+ // If we haven't reached the end of the combo box's list of items
+ // then highlight next element below currently highlighted element
+ if (list.getSelectedIndex() + 1 != comboBox.getItemCount())
+ list.setSelectedIndex(list.getSelectedIndex() + 1);
}
/**
@@ -643,8 +679,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
for (int i = 0; i < maxRowCount; i++)
{
Component comp = rend.getListCellRendererComponent(list,
- list.getModel()
- .getElementAt(i),
+ comboBox.getModel()
+ .getElementAt(i),
-1, false, false);
Dimension dim = comp.getPreferredSize();
totalHeight += dim.height;
@@ -712,15 +748,36 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
}
/**
- * This method is invoked whenever mouse is released
+ * This method is invoked whenever mouse event was originated in the combo
+ * box and released either in the combBox list of items or in the combo
+ * box itself.
*
* @param e MouseEvent that should be handled
*/
public void mouseReleased(MouseEvent e)
{
- // FIXME: should handle dragging events here, if
- // mouse was dragged and released over the list of combobox's items,
- // then item over which it was released should be selected.
+ // Get component over which mouse was released
+ Component src = (Component) e.getSource();
+ int x = e.getX();
+ int y = e.getY();
+ Component releasedComponent = SwingUtilities.getDeepestComponentAt(src,
+ x, y);
+
+ // if mouse was released inside the bounds of combo box then do nothing,
+ // Otherwise if mouse was released inside the list of combo box items
+ // then change selection and close popup
+ if (! (releasedComponent instanceof JComboBox))
+ {
+ // List model contains the item over which mouse is released,
+ // since it is updated every time the mouse is moved over a different
+ // item in the list. Now that the mouse is released we need to
+ // update model of the combo box as well.
+ comboBox.setSelectedIndex(list.getSelectedIndex());
+
+ if (isAutoScrolling)
+ stopAutoScrolling();
+ hide();
+ }
}
}
@@ -737,13 +794,70 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
}
+ /**
+ * This method is responsible for highlighting item in the drop down list
+ * over which the mouse is currently being dragged.
+ */
public void mouseDragged(MouseEvent e)
{
+ // convert point of the drag event relative to combo box list component
+ // figure out over which list cell the mouse is currently being dragged
+ // and highlight the cell. The list model is changed but the change has
+ // no effect on combo box's data model. The list model is changed so
+ // that the appropriate item would be highlighted in the combo box's
+ // list.
+ if (BasicComboPopup.this.isVisible())
+ {
+ int cbHeight = (int) comboBox.getPreferredSize().getHeight();
+ int popupHeight = BasicComboPopup.this.getSize().height;
+
+ // if mouse is dragged inside the the combo box's items list.
+ if (e.getY() > cbHeight && ! (e.getY() - cbHeight >= popupHeight))
+ {
+ int index = list.locationToIndex(new Point(e.getX(),
+ (int) (e.getY()
+ - cbHeight)));
+
+ int firstVisibleIndex = list.getFirstVisibleIndex();
+
+ // list.locationToIndex returns item's index that would
+ // be located at the specified point if the first item that
+ // is visible is item 0. However in the JComboBox it is not
+ // necessarily the case since list is contained in the
+ // JScrollPane so we need to adjust the index returned.
+ if (firstVisibleIndex != 0)
+ // FIXME: adjusted index here is off by one. I am adding one
+ // here to compensate for that. This should be
+ // index += firstVisibleIndex. Remove +1 once the bug is fixed.
+ index += firstVisibleIndex + 1;
+
+ list.setSelectedIndex(index);
+ }
+ else
+ {
+ // if mouse is being dragged at the bottom of combo box's list
+ // of items or at the very top then scroll the list in the
+ // desired direction.
+ boolean movingUP = e.getY() < cbHeight;
+ boolean movingDown = e.getY() > cbHeight;
+
+ if (movingUP)
+ {
+ scrollDirection = SCROLL_UP;
+ startAutoScrolling(SCROLL_UP);
+ }
+ else if (movingDown)
+ {
+ scrollDirection = SCROLL_DOWN;
+ startAutoScrolling(SCROLL_DOWN);
+ }
+ }
+ }
}
}
/**
- * ItemHandler is an item listener that listens to selection event occuring
+ * ItemHandler is an item listener that listens to selection events occuring
* in the combo box. FIXME: should specify here what it does when item is
* selected or deselected in the combo box list.
*/
@@ -803,9 +917,11 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
public void mouseMoved(MouseEvent anEvent)
{
- // FIXME: Need to implement
- // NOTE: the change isn't reflected in data model of the combo box.
- // The items are only highlited, but not selected
+ // Highlight list cells over which the mouse is located.
+ // This changes list model, but has no effect on combo box's data model
+ int index = list.locationToIndex(anEvent.getPoint());
+ list.setSelectedIndex(index);
+ list.repaint();
}
}
@@ -828,6 +944,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
revalidate();
repaint();
}
+ if (e.getPropertyName().equals(JComboBox.MODEL_CHANGED_PROPERTY))
+ {
+ list.setModel((ComboBoxModel) e.getNewValue());
+ revalidate();
+ repaint();
+ }
}
}
diff --git a/libjava/javax/swing/plaf/basic/BasicDesktopIconUI.java b/libjava/javax/swing/plaf/basic/BasicDesktopIconUI.java
index b37c2f1..4867c27 100644
--- a/libjava/javax/swing/plaf/basic/BasicDesktopIconUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicDesktopIconUI.java
@@ -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.BorderLayout;
@@ -50,6 +51,7 @@ import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
+
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
@@ -62,8 +64,6 @@ import javax.swing.event.MouseInputAdapter;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.DesktopIconUI;
-import javax.swing.plaf.DesktopPaneUI;
-
/**
* This class acts as the UI delegate for JDesktopIcons for the Basic look and feel.
diff --git a/libjava/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/libjava/javax/swing/plaf/basic/BasicDesktopPaneUI.java
index 3d43b36..a9e7ffc 100644
--- a/libjava/javax/swing/plaf/basic/BasicDesktopPaneUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicDesktopPaneUI.java
@@ -35,31 +35,25 @@ 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.Dimension;
-import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.event.ActionEvent;
-import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException;
+
import javax.swing.AbstractAction;
import javax.swing.DefaultDesktopManager;
import javax.swing.DesktopManager;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
-import javax.swing.JInternalFrame.JDesktopIcon;
import javax.swing.KeyStroke;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
-import javax.swing.event.MouseInputAdapter;
-import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.DesktopIconUI;
import javax.swing.plaf.DesktopPaneUI;
-
/**
* This class is the UI delegate for JDesktopPane for the Basic look and feel.
*/
@@ -267,24 +261,35 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
}
}
- /** The KeyStroke associated with closing JInternalFrames. */
+ /**
+ * The KeyStroke associated with closing JInternalFrames.
+ * @deprecated
+ */
protected KeyStroke closeKey;
- /** The KeyStroke associated with maximizing JInternalFrames. */
+ /**
+ * The KeyStroke associated with maximizing JInternalFrames.
+ * @deprecated
+ */
protected KeyStroke maximizeKey;
- /** The KeyStroke associated with minimizing JInternalFrames. */
+ /**
+ * The KeyStroke associated with minimizing JInternalFrames.
+ * @deprecated
+ */
protected KeyStroke minimizeKey;
/**
* The KeyStroke associated with navigating (forward?) through
* JInternalFrames.
+ * @deprecated
*/
protected KeyStroke navigateKey;
/**
* The KeyStroke associated with navigating (backward?) through
* JInternalFrames.
+ * @deprecated
*/
protected KeyStroke navigateKey2;
diff --git a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 0645a37..b1064f4 100644
--- a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -1,5 +1,5 @@
/* BasicGraphicsUtils.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -455,7 +455,9 @@ public class BasicGraphicsUtils
drawUnderline = (underlinedIndex >= 0) && (underlinedIndex < textLength);
- if (!(g instanceof Graphics2D))
+ // FIXME: unfortunately pango and cairo can't agree on metrics
+ // so for the time being we continue to *not* use TextLayouts.
+ if (true || !(g instanceof Graphics2D))
{
/* Fall-back. This is likely to produce garbage for any text
* containing right-to-left (Hebrew or Arabic) characters, even
diff --git a/libjava/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/javax/swing/plaf/basic/BasicIconFactory.java
index 9f3a5ac..a2acc81 100644
--- a/libjava/javax/swing/plaf/basic/BasicIconFactory.java
+++ b/libjava/javax/swing/plaf/basic/BasicIconFactory.java
@@ -1,5 +1,5 @@
-/* BasicIconFactory.java
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* BasicIconFactory.java --
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,15 +38,17 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.io.Serializable;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Polygon;
+import java.io.Serializable;
+
import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
+
/**
* STUBBED
*/
@@ -54,7 +56,7 @@ public class BasicIconFactory implements Serializable
{
static final long serialVersionUID = 5605588811185324383L;
- static private class DummyIcon
+ private static class DummyIcon
implements Icon
{
public int getIconHeight() { return 10; }
diff --git a/libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index 3b8a2a2..36bb4ec 100644
--- a/libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -7,6 +7,7 @@ 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
@@ -34,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;
@@ -52,6 +54,7 @@ import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
+
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.Icon;
@@ -64,10 +67,8 @@ import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.UIManager;
import javax.swing.UIDefaults;
-
+import javax.swing.UIManager;
/**
* This class acts as a titlebar for JInternalFrames.
@@ -77,7 +78,7 @@ public class BasicInternalFrameTitlePane extends JComponent
/**
* The Action responsible for closing the JInternalFrame.
*/
- protected class CloseAction extends AbstractAction
+ public class CloseAction extends AbstractAction
{
/**
* This method is called when something closes the JInternalFrame.
@@ -102,7 +103,7 @@ public class BasicInternalFrameTitlePane extends JComponent
/**
* This Action is responsible for iconifying the JInternalFrame.
*/
- protected class IconifyAction extends AbstractAction
+ public class IconifyAction extends AbstractAction
{
/**
* This method is called when the user wants to iconify the
@@ -128,7 +129,7 @@ public class BasicInternalFrameTitlePane extends JComponent
/**
* This Action is responsible for maximizing the JInternalFrame.
*/
- protected class MaximizeAction extends AbstractAction
+ public class MaximizeAction extends AbstractAction
{
/**
* This method is called when the user wants to maximize the
@@ -154,7 +155,7 @@ public class BasicInternalFrameTitlePane extends JComponent
/**
* This Action is responsible for dragging the JInternalFrame.
*/
- protected class MoveAction extends AbstractAction
+ public class MoveAction extends AbstractAction
{
/**
* This method is called when the user wants to drag the JInternalFrame.
@@ -171,7 +172,7 @@ public class BasicInternalFrameTitlePane extends JComponent
* This Action is responsible for restoring the JInternalFrame. Restoring
* the JInternalFrame is the same as setting the maximum property to false.
*/
- protected class RestoreAction extends AbstractAction
+ public class RestoreAction extends AbstractAction
{
/**
* This method is called when the user wants to restore the
@@ -197,7 +198,7 @@ public class BasicInternalFrameTitlePane extends JComponent
/**
* This action is responsible for sizing the JInternalFrame.
*/
- protected class SizeAction extends AbstractAction
+ public class SizeAction extends AbstractAction
{
/**
* This method is called when the user wants to resize the JInternalFrame.
@@ -236,7 +237,7 @@ public class BasicInternalFrameTitlePane extends JComponent
* This class acts as the MenuBar for the TitlePane. Clicking on the Frame
* Icon in the top left corner will activate it.
*/
- protected class SystemMenuBar extends JMenuBar
+ public class SystemMenuBar extends JMenuBar
{
/**
* This method returns true if it can receive focus.
@@ -439,22 +440,22 @@ public class BasicInternalFrameTitlePane extends JComponent
}
/** The action command for the Close action. */
- protected static String CLOSE_CMD = "Close";
+ protected static final String CLOSE_CMD = "Close";
/** The action command for the Minimize action. */
- protected static String ICONIFY_CMD = "Minimize";
+ protected static final String ICONIFY_CMD = "Minimize";
/** The action command for the Maximize action. */
- protected static String MAXIMIZE_CMD = "Maximize";
+ protected static final String MAXIMIZE_CMD = "Maximize";
/** The action command for the Move action. */
- protected static String MOVE_CMD = "Move";
+ protected static final String MOVE_CMD = "Move";
/** The action command for the Restore action. */
- protected static String RESTORE_CMD = "Restore";
+ protected static final String RESTORE_CMD = "Restore";
/** The action command for the Size action. */
- protected static String SIZE_CMD = "Size";
+ protected static final String SIZE_CMD = "Size";
/** The action associated with closing the JInternalFrame. */
protected Action closeAction;
diff --git a/libjava/javax/swing/plaf/basic/BasicInternalFrameUI.java b/libjava/javax/swing/plaf/basic/BasicInternalFrameUI.java
index 7101d42..990a3e3f 100644
--- a/libjava/javax/swing/plaf/basic/BasicInternalFrameUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicInternalFrameUI.java
@@ -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.AWTEvent;
@@ -42,29 +43,22 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
-import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
+
import javax.swing.DefaultDesktopManager;
import javax.swing.DesktopManager;
-import javax.swing.Icon;
-import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
-import javax.swing.JLabel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
@@ -77,7 +71,6 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InternalFrameUI;
import javax.swing.plaf.UIResource;
-
/**
* This is the UI delegate for the Basic look and feel for JInternalFrames.
*/
@@ -1053,7 +1046,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
/** The JComponent placed at the west region of the JInternalFrame. */
protected JComponent westPane;
- /** The Keystroke bound to open the menu. */
+ /**
+ * The Keystroke bound to open the menu.
+ * @deprecated
+ */
protected KeyStroke openMenuKey;
/** The TitlePane displayed at the top of the JInternalFrame. */
diff --git a/libjava/javax/swing/plaf/basic/BasicListUI.java b/libjava/javax/swing/plaf/basic/BasicListUI.java
index bd5c53b..50bbb81 100644
--- a/libjava/javax/swing/plaf/basic/BasicListUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicListUI.java
@@ -1,4 +1,4 @@
-/* BasicListUI.java
+/* BasicListUI.java --
Copyright (C) 2002, 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.Color;
@@ -48,6 +49,7 @@ import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
@@ -63,7 +65,6 @@ import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ListUI;
-
/**
* The Basic Look and Feel UI delegate for the
* JList.
diff --git a/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java
index 689cd8f..40bf972 100644
--- a/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -46,6 +46,7 @@ import java.awt.event.KeyEvent;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.ResourceBundle;
+
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
@@ -137,6 +138,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TabbedPaneUI", "javax.swing.plaf.basic.BasicTabbedPaneUI",
"TableHeaderUI", "javax.swing.plaf.basic.BasicTableHeaderUI",
"TableUI", "javax.swing.plaf.basic.BasicTableUI",
+ "TextPaneUI", "javax.swing.plaf.basic.BasicTextPaneUI",
"TextAreaUI", "javax.swing.plaf.basic.BasicTextAreaUI",
"TextFieldUI", "javax.swing.plaf.basic.BasicTextFieldUI",
"TextPaneUI", "javax.swing.plaf.basic.BasicTextPaneUI",
@@ -900,8 +902,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel
}),
"Tree.background", new ColorUIResource(Color.white),
"Tree.changeSelectionWithFocus", Boolean.TRUE,
- // XXX Don't use gif
- "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.gif")),
+ "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),
+ "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")),
"Tree.drawsFocusBorderAroundIcon", Boolean.FALSE,
"Tree.editorBorder", new BorderUIResource.LineBorderUIResource(Color.lightGray),
"Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
@@ -949,13 +951,12 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ctrl PAGE_DOWN", "scrollDownChangeLead"
}),
"Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "Tree.expandedIcon", new IconUIResource(new ImageIcon("icons/TreeExpanded.png")),
"Tree.foreground", new ColorUIResource(Color.black),
"Tree.hash", new ColorUIResource(Color.gray),
- // XXX Don't use gif
- "Tree.leafIcon", new IconUIResource(new ImageIcon("icons/TreeLeaf.gif")),
+ "Tree.leafIcon", new IconUIResource(new ImageIcon("icons/TreeLeaf.png")),
"Tree.leftChildIndent", new Integer(7),
- // XXX Don't use gif
- "Tree.openIcon", new IconUIResource(new ImageIcon("icons/TreeOpen.gif")),
+ "Tree.openIcon", new IconUIResource(new ImageIcon("icons/TreeOpen.png")),
"Tree.rightChildIndent", new Integer(13),
"Tree.rowHeight", new Integer(16),
"Tree.scrollsOnExpand", Boolean.TRUE,
diff --git a/libjava/javax/swing/plaf/basic/BasicMenuBarUI.java b/libjava/javax/swing/plaf/basic/BasicMenuBarUI.java
index f0bd73f..a1920fb 100644
--- a/libjava/javax/swing/plaf/basic/BasicMenuBarUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicMenuBarUI.java
@@ -35,44 +35,24 @@ 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.Dimension;
-import java.awt.GridLayout;
-import java.awt.Insets;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.BoxLayout;
-import javax.swing.ButtonModel;
-import javax.swing.Icon;
-import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
-import javax.swing.JMenu;
import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.KeyStroke;
-import javax.swing.MenuElement;
-import javax.swing.MenuSelectionManager;
-import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-import javax.swing.event.MenuDragMouseEvent;
-import javax.swing.event.MenuDragMouseListener;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuKeyEvent;
-import javax.swing.event.MenuKeyListener;
-import javax.swing.event.MenuListener;
-import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuBarUI;
-import javax.swing.plaf.MenuItemUI;
-
/**
* UI Delegate for JMenuBar.
diff --git a/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java
index e52d3f6..da3f559 100644
--- a/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -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;
@@ -45,26 +46,21 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
-import java.awt.Stroke;
-import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
-import java.util.Vector;
-import javax.swing.AbstractButton;
-import javax.swing.ButtonModel;
+
import javax.swing.Icon;
-import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
import javax.swing.KeyStroke;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
+import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
@@ -76,7 +72,6 @@ import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuItemUI;
-
/**
* UI Delegate for JMenuItem.
*/
@@ -398,6 +393,9 @@ public class BasicMenuItemUI extends MenuItemUI
selectionBackground = defaults.getColor("MenuItem.selectionBackground");
selectionForeground = defaults.getColor("MenuItem.selectionForeground");
acceleratorDelimiter = defaults.getString("MenuItem.acceleratorDelimiter");
+
+ menuItem.setHorizontalTextPosition(SwingConstants.TRAILING);
+ menuItem.setHorizontalAlignment(SwingConstants.LEADING);
}
/**
@@ -557,23 +555,14 @@ public class BasicMenuItemUI extends MenuItemUI
}
}
- // paint icon
- // FIXME: should paint different icon at different button state's.
- // i.e disabled icon when button is disabled.. etc.
- Icon i = m.getIcon();
- if (i != null)
- {
- i.paintIcon(c, g, vr.x, vr.y);
-
- // Adjust view rectangle, s.t text would be drawn after menu item's icon.
- vr.x += i.getIconWidth() + defaultTextIconGap;
- }
-
// paint text and user menu icon if it exists
- SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), m.getIcon(),
+ Icon i = m.getIcon();
+ SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i,
vertAlign, horAlign, vertTextPos,
horTextPos, vr, ir, tr,
defaultTextIconGap);
+ if (i != null)
+ i.paintIcon(c, g, ir.x, ir.y);
paintText(g, m, tr, m.getText());
diff --git a/libjava/javax/swing/plaf/basic/BasicMenuUI.java b/libjava/javax/swing/plaf/basic/BasicMenuUI.java
index 01dca76..98af954 100644
--- a/libjava/javax/swing/plaf/basic/BasicMenuUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicMenuUI.java
@@ -35,26 +35,18 @@ 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.Component;
import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
-import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
@@ -68,8 +60,6 @@ import javax.swing.event.MenuKeyListener;
import javax.swing.event.MenuListener;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.MenuItemUI;
-
/**
* UI Delegate for JMenu
diff --git a/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
index 8a696b8..609fd11 100644
--- a/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -1,4 +1,4 @@
-/* BasicOptionPaneUI.java
+/* BasicOptionPaneUI.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.BorderLayout;
@@ -42,21 +43,19 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Polygon;
-import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
+
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.Icon;
@@ -75,10 +74,8 @@ import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.IconUIResource;
import javax.swing.plaf.OptionPaneUI;
-
/**
* This class is the UI delegate for JOptionPane in the Basic Look and Feel.
*/
@@ -475,7 +472,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
* A helper class that implements Icon. This is used temporarily until
* ImageIcons are fixed.
*/
- private static class messageIcon implements Icon
+ private static class MessageIcon implements Icon
{
/**
* This method returns the width of the icon.
@@ -512,7 +509,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
}
/** The icon displayed for ERROR_MESSAGE. */
- private static messageIcon errorIcon = new messageIcon()
+ private static MessageIcon errorIcon = new MessageIcon()
{
public void paintIcon(Component c, Graphics g, int x, int y)
{
@@ -534,7 +531,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
};
/** The icon displayed for INFORMATION_MESSAGE. */
- private static messageIcon infoIcon = new messageIcon()
+ private static MessageIcon infoIcon = new MessageIcon()
{
public void paintIcon(Component c, Graphics g, int x, int y)
{
@@ -560,7 +557,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
};
/** The icon displayed for WARNING_MESSAGE. */
- private static messageIcon warningIcon = new messageIcon()
+ private static MessageIcon warningIcon = new MessageIcon()
{
public void paintIcon(Component c, Graphics g, int x, int y)
{
@@ -585,7 +582,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
};
/** The icon displayed for MESSAGE_ICON. */
- private static messageIcon questionIcon = new messageIcon()
+ private static MessageIcon questionIcon = new MessageIcon()
{
public void paintIcon(Component c, Graphics g, int x, int y)
{
diff --git a/libjava/javax/swing/plaf/basic/BasicPasswordFieldUI.java b/libjava/javax/swing/plaf/basic/BasicPasswordFieldUI.java
index fe1c490..0350f74 100644
--- a/libjava/javax/swing/plaf/basic/BasicPasswordFieldUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicPasswordFieldUI.java
@@ -41,6 +41,7 @@ package javax.swing.plaf.basic;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
+import javax.swing.text.PasswordView;
import javax.swing.text.View;
public class BasicPasswordFieldUI extends BasicTextFieldUI
@@ -49,6 +50,11 @@ public class BasicPasswordFieldUI extends BasicTextFieldUI
{
}
+ public View create(Element elem)
+ {
+ return new PasswordView(elem);
+ }
+
public static ComponentUI createUI(JComponent c)
{
return new BasicPasswordFieldUI();
diff --git a/libjava/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java b/libjava/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java
index caa5f8d..d0df9d3 100644
--- a/libjava/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java
@@ -1,4 +1,4 @@
-/* BasicPopupMenuSeparatorUI.java
+/* BasicPopupMenuSeparatorUI.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,22 +35,18 @@ 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;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.Rectangle;
+
import javax.swing.JComponent;
import javax.swing.JPopupMenu;
-import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.SeparatorUI;
-
/**
* The Basic Look and Feel UI delegate for JPopupMenu.Separator.
diff --git a/libjava/javax/swing/plaf/basic/BasicPopupMenuUI.java b/libjava/javax/swing/plaf/basic/BasicPopupMenuUI.java
index 35fb005..796af56 100644
--- a/libjava/javax/swing/plaf/basic/BasicPopupMenuUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicPopupMenuUI.java
@@ -37,58 +37,25 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.AWTKeyStroke;
-import java.awt.BasicStroke;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.Stroke;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.EventListener;
-import javax.swing.AbstractButton;
-import javax.swing.ButtonModel;
-import javax.swing.Icon;
-import javax.swing.JCheckBoxMenuItem;
+
import javax.swing.JComponent;
-import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.KeyStroke;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.MenuDragMouseEvent;
-import javax.swing.event.MenuDragMouseListener;
-import javax.swing.event.MenuKeyEvent;
-import javax.swing.event.MenuKeyListener;
import javax.swing.event.MouseInputListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.MenuItemUI;
import javax.swing.plaf.PopupMenuUI;
diff --git a/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java b/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java
index fa84267..9398ab8 100644
--- a/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java
@@ -1,4 +1,4 @@
-/* BasicProgressBarUI.java
+/* BasicProgressBarUI.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.Color;
@@ -49,6 +50,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;
@@ -61,7 +63,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ProgressBarUI;
-
/**
* The Basic Look and Feel UI delegate for the
* JProgressBar.
diff --git a/libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java b/libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
index a63c95f..3b17f36 100644
--- a/libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
@@ -1,4 +1,4 @@
-/* BasicRadioButtonMenuItemUI.java
+/* BasicRadioButtonMenuItemUI.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,9 +35,11 @@ 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.MouseEvent;
+
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import javax.swing.MenuElement;
@@ -46,7 +48,6 @@ import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
-
/**
* UI Delegator for JRadioButtonMenuItem
*/
diff --git a/libjava/javax/swing/plaf/basic/BasicRootPaneUI.java b/libjava/javax/swing/plaf/basic/BasicRootPaneUI.java
index 7201549..110200e 100644
--- a/libjava/javax/swing/plaf/basic/BasicRootPaneUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicRootPaneUI.java
@@ -1,4 +1,4 @@
-/* BasicPanelUI.java
+/* BasicPanelUI.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,12 +40,12 @@ package javax.swing.plaf.basic;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.RootPaneUI;
-
public class BasicRootPaneUI extends RootPaneUI
implements PropertyChangeListener
{
diff --git a/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java
index 913b326..446726e 100644
--- a/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -1,4 +1,4 @@
-/* BasicScrollBarUI.java
+/* BasicScrollBarUI.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.Color;
@@ -56,7 +57,6 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BoundedRangeModel;
-import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
@@ -70,7 +70,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI;
-
/**
* The Basic Look and Feel UI delegate for JScrollBar.
*/
@@ -78,15 +77,14 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
SwingConstants
{
/**
- * A helper class that listens to the two JButtons on each end
- * of the JScrollBar.
+ * A helper class that listens to the two JButtons on each end of the
+ * JScrollBar.
*/
protected class ArrowButtonListener extends MouseAdapter
{
/**
- * Move the thumb in the direction specified by the
- * button's arrow. If this button is held down, then
- * it should keep moving the thumb.
+ * Move the thumb in the direction specified by the button's arrow. If
+ * this button is held down, then it should keep moving the thumb.
*
* @param e The MouseEvent fired by the JButton.
*/
@@ -113,8 +111,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * A helper class that listens to the ScrollBar's model
- * for ChangeEvents.
+ * A helper class that listens to the ScrollBar's model for ChangeEvents.
*/
protected class ModelListener implements ChangeListener
{
@@ -127,7 +124,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
// System.err.println(this + ".stateChanged()");
calculatePreferredSize();
- layoutContainer(scrollbar);
+ layoutContainer(scrollbar);
getThumbBounds();
scrollbar.repaint();
}
@@ -157,19 +154,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
decrButton.removeMouseListener(buttonListener);
incrButton = createIncreaseButton(scrollbar.getOrientation());
decrButton = createDecreaseButton(scrollbar.getOrientation());
- incrButton.addMouseListener(buttonListener);
- decrButton.addMouseListener(buttonListener);
- calculatePreferredSize();
- layoutContainer(scrollbar);
- }
+ incrButton.addMouseListener(buttonListener);
+ decrButton.addMouseListener(buttonListener);
+ calculatePreferredSize();
+ layoutContainer(scrollbar);
+ }
layoutContainer(scrollbar);
scrollbar.repaint();
}
}
/**
- * A helper class that listens for events from
- * the timer that is used to move the thumb.
+ * A helper class that listens for events from the timer that is used to
+ * move the thumb.
*/
protected class ScrollListener implements ActionListener
{
@@ -180,8 +177,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
private transient boolean block;
/**
- * Creates a new ScrollListener object.
- * The default is scrolling positively with block movement.
+ * Creates a new ScrollListener object. The default is scrolling
+ * positively with block movement.
*/
public ScrollListener()
{
@@ -190,8 +187,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * Creates a new ScrollListener object using
- * the given direction and block.
+ * Creates a new ScrollListener object using the given direction and
+ * block.
*
* @param dir The direction to move in.
* @param block Whether movement will be in blocks.
@@ -234,8 +231,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// Only need to check it if it's block scrolling
// We only block scroll if the click occurs
// in the track.
-
- if (!trackListener.shouldScroll(direction))
+ if (! trackListener.shouldScroll(direction))
{
trackHighlight = NO_HIGHLIGHT;
scrollbar.repaint();
@@ -260,13 +256,14 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
/** The current Y coordinate of the mouse. */
protected int currentMouseY;
- /** The offset between the current mouse cursor and the
- current value of the scrollbar. */
+ /**
+ * The offset between the current mouse cursor and the current value of
+ * the scrollbar.
+ */
protected int offset;
/**
- * This method is called when the mouse is being
- * dragged.
+ * This method is called when the mouse is being dragged.
*
* @param e The MouseEvent given.
*/
@@ -275,15 +272,15 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
currentMouseX = e.getX();
currentMouseY = e.getY();
if (scrollbar.getValueIsAdjusting())
- {
- int value;
- if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
- value = valueForXPosition(currentMouseX) - offset;
- else
- value = valueForYPosition(currentMouseY) - offset;
-
- scrollbar.setValue(value);
- }
+ {
+ int value;
+ if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
+ value = valueForXPosition(currentMouseX) - offset;
+ else
+ value = valueForYPosition(currentMouseY) - offset;
+
+ scrollbar.setValue(value);
+ }
}
/**
@@ -298,9 +295,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method is called when the mouse is
- * pressed. When it is pressed, the thumb should
- * move in blocks towards the cursor.
+ * This method is called when the mouse is pressed. When it is pressed,
+ * the thumb should move in blocks towards the cursor.
*
* @param e The MouseEvent given.
*/
@@ -318,7 +314,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
if (value == scrollbar.getValue())
return;
- if (!thumbRect.contains(e.getPoint()))
+ if (! thumbRect.contains(e.getPoint()))
{
scrollTimer.stop();
scrollListener.setScrollByBlock(true);
@@ -344,13 +340,13 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// to that value.
scrollbar.setValueIsAdjusting(true);
offset = value - scrollbar.getValue();
- }
- scrollbar.repaint();
+ }
+ scrollbar.repaint();
}
/**
- * This method is called when the mouse is released.
- * It should stop movement on the thumb
+ * This method is called when the mouse is released. It should stop
+ * movement on the thumb
*
* @param e The MouseEvent given.
*/
@@ -358,32 +354,32 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
trackHighlight = NO_HIGHLIGHT;
scrollTimer.stop();
-
+
if (scrollbar.getValueIsAdjusting())
- scrollbar.setValueIsAdjusting(false);
+ scrollbar.setValueIsAdjusting(false);
scrollbar.repaint();
}
-
+
/**
- * A helper method that decides whether we should
- * keep scrolling in the given direction.
+ * A helper method that decides whether we should keep scrolling in the
+ * given direction.
*
* @param direction The direction to check for.
*
* @return Whether the thumb should keep scrolling.
*/
- public boolean shouldScroll (int direction)
+ public boolean shouldScroll(int direction)
{
int value;
if (scrollbar.getOrientation() == HORIZONTAL)
- value = valueForXPosition(currentMouseX);
+ value = valueForXPosition(currentMouseX);
else
- value = valueForYPosition(currentMouseY);
+ value = valueForYPosition(currentMouseY);
if (direction == POSITIVE_SCROLL)
- return (value > scrollbar.getValue());
+ return (value > scrollbar.getValue());
else
- return (value < scrollbar.getValue());
+ return (value < scrollbar.getValue());
}
}
@@ -393,8 +389,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
/** The listener that listens to the model. */
protected ModelListener modelListener;
- /** The listener that listens to the scrollbar for property
- changes. */
+ /** The listener that listens to the scrollbar for property changes. */
protected PropertyChangeListener propertyChangeListener;
/** The listener that listens to the timer. */
@@ -410,10 +405,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JButton incrButton;
/** The dimensions of the maximum thumb size. */
- protected static Dimension maximumThumbSize;
+ protected Dimension maximumThumbSize;
/** The dimensions of the minimum thumb size. */
- protected static Dimension minimumThumbSize;
+ protected Dimension minimumThumbSize;
/** The color of the thumb. */
protected Color thumbColor;
@@ -427,8 +422,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
/** The outer light shadow for the thumb. */
protected Color thumbLightShadowColor;
- /** The color that is used when the mouse press
- occurs in the track. */
+ /** The color that is used when the mouse press occurs in the track. */
protected Color trackHighlightColor;
/** The color of the track. */
@@ -441,19 +435,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected Rectangle thumbRect;
/** Indicates that the decrease highlight should be painted. */
- protected static int DECREASE_HIGHLIGHT = 1;
+ protected static final int DECREASE_HIGHLIGHT = 1;
/** Indicates that the increase highlight should be painted. */
- protected static int INCREASE_HIGHLIGHT = 2;
+ protected static final int INCREASE_HIGHLIGHT = 2;
/** Indicates that no highlight should be painted. */
- protected static int NO_HIGHLIGHT = 0;
+ protected static final int NO_HIGHLIGHT = 0;
/** Indicates that the scrolling direction is positive. */
- private static int POSITIVE_SCROLL = 1;
+ private static final int POSITIVE_SCROLL = 1;
/** Indicates that the scrolling direction is negative. */
- private static int NEGATIVE_SCROLL = -1;
+ private static final int NEGATIVE_SCROLL = -1;
/** The cached preferred size for the scrollbar. */
private transient Dimension preferredSize;
@@ -471,88 +465,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JScrollBar scrollbar;
/**
- * A helper class that allows us to draw icons for
- * the JButton.
- */
- private static class arrowIcon implements Icon
- {
- /** The polygon that describes the icon. */
- private Polygon arrow;
-
- /**
- * Creates a new arrowIcon object.
- *
- * @param arrow The polygon that describes the arrow.
- */
- public arrowIcon(Polygon arrow)
- {
- this.arrow = arrow;
- }
-
- /**
- * Returns the height of the icon.
- *
- * @return The height of the icon.
- */
- public int getIconHeight()
- {
- return 10;
- }
-
- /**
- * Returns the width of the icon.
- *
- * @return The width of the icon.
- */
- public int getIconWidth()
- {
- return 10;
- }
-
- /**
- * Paints the icon.
- *
- * @param c The Component to paint for.
- * @param g The Graphics object to draw with.
- * @param x The X coordinate to draw at.
- * @param y The Y coordinate to draw at.
- */
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- g.translate(x, y);
-
- Color saved = g.getColor();
-
- g.setColor(Color.BLACK);
-
- g.fillPolygon(arrow);
-
- g.setColor(saved);
- g.translate(-x, -y);
- }
- }
-
- /** The Icon that points up. */
- private static Icon upIcon = new arrowIcon(new Polygon(new int[] { 2, 5, 8 },
- new int[] { 7, 3, 7 },
- 3));
-
- /** The Icon that points down. */
- private static Icon downIcon = new arrowIcon(new Polygon(new int[] { 2, 5, 8 },
- new int[] { 3, 7, 3 },
- 3));
-
- /** The Icon that points left. */
- private static Icon leftIcon = new arrowIcon(new Polygon(new int[] { 7, 3, 7 },
- new int[] { 2, 5, 8 },
- 3));
-
- /** The Icon that points right. */
- private static Icon rightIcon = new arrowIcon(new Polygon(new int[] { 3, 7, 3},
- new int[] { 2, 5, 8},
- 3));
-
- /**
* This method adds a component to the layout.
*
* @param name The name to associate with the component that is added.
@@ -565,19 +477,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method configures the scrollbar's colors. This can be
- * done by looking up the standard colors from the Look and Feel defaults.
+ * This method configures the scrollbar's colors. This can be done by
+ * looking up the standard colors from the Look and Feel defaults.
*/
protected void configureScrollBarColors()
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
+
trackColor = defaults.getColor("ScrollBar.track");
trackHighlightColor = defaults.getColor("ScrollBar.trackHighlight");
thumbColor = defaults.getColor("ScrollBar.thumb");
thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight");
thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
- thumbLightShadowColor = defaults.getColor("ScrollBar.thumbLightShadow");
+ thumbLightShadowColor = defaults.getColor("ScrollBar.thumbLightShadow");
}
/**
@@ -590,9 +502,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
return new ArrowButtonListener();
}
- /**
- * This method creates a new JButton with the appropriate
- * icon for the orientation.
+ /**
+ * This method creates a new JButton with the appropriate icon for the
+ * orientation.
*
* @param orientation The orientation this JButton uses.
*
@@ -601,26 +513,22 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JButton createIncreaseButton(int orientation)
{
if (incrButton == null)
+ incrButton = new BasicArrowButton((orientation == SwingConstants.HORIZONTAL)
+ ? SwingConstants.EAST
+ : SwingConstants.SOUTH);
+ else
{
- incrButton = new JButton();
- incrButton.setMargin(new Insets(0,0,0,0));
- incrButton.setHorizontalAlignment(SwingConstants.CENTER);
- incrButton.setHorizontalTextPosition(SwingConstants.CENTER);
- incrButton.setVerticalAlignment(SwingConstants.CENTER);
- incrButton.setVerticalTextPosition(SwingConstants.CENTER);
+ if (orientation == SwingConstants.HORIZONTAL)
+ ((BasicArrowButton) incrButton).setDirection(SwingConstants.EAST);
+ else
+ ((BasicArrowButton) incrButton).setDirection(SwingConstants.SOUTH);
}
-
- if (orientation == SwingConstants.HORIZONTAL)
- incrButton.setIcon(rightIcon);
- else
- incrButton.setIcon(downIcon);
-
return incrButton;
}
/**
- * This method creates a new JButton with the appropriate
- * icon for the orientation.
+ * This method creates a new JButton with the appropriate icon for the
+ * orientation.
*
* @param orientation The orientation this JButton uses.
*
@@ -629,20 +537,16 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JButton createDecreaseButton(int orientation)
{
if (decrButton == null)
+ decrButton = new BasicArrowButton((orientation == SwingConstants.HORIZONTAL)
+ ? SwingConstants.WEST
+ : SwingConstants.NORTH);
+ else
{
- decrButton = new JButton();
- decrButton.setMargin(new Insets(0,0,0,0));
- decrButton.setHorizontalAlignment(SwingConstants.CENTER);
- decrButton.setHorizontalTextPosition(SwingConstants.CENTER);
- decrButton.setVerticalAlignment(SwingConstants.CENTER);
- decrButton.setVerticalTextPosition(SwingConstants.CENTER);
+ if (orientation == SwingConstants.HORIZONTAL)
+ ((BasicArrowButton) decrButton).setDirection(SwingConstants.WEST);
+ else
+ ((BasicArrowButton) decrButton).setDirection(SwingConstants.NORTH);
}
-
- if (orientation == SwingConstants.HORIZONTAL)
- decrButton.setIcon(leftIcon);
- else
- decrButton.setIcon(upIcon);
-
return decrButton;
}
@@ -743,13 +647,12 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method calculates the preferred size since
- * calling getPreferredSize() returns a cached value.
+ * This method calculates the preferred size since calling
+ * getPreferredSize() returns a cached value.
*/
private void calculatePreferredSize()
{
// System.err.println(this + ".calculatePreferredSize()");
-
int height;
int width;
height = width = 0;
@@ -790,11 +693,11 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method returns a cached value of the preferredSize.
- * The only restrictions are: If the scrollbar is horizontal, the
- * height should be the maximum of the height of the JButtons and
- * the minimum width of the thumb. For vertical scrollbars, the
- * calculation is similar (swap width for height and vice versa).
+ * This method returns a cached value of the preferredSize. The only
+ * restrictions are: If the scrollbar is horizontal, the height should be
+ * the maximum of the height of the JButtons and the minimum width of the
+ * thumb. For vertical scrollbars, the calculation is similar (swap width
+ * for height and vice versa).
*
* @param c The JComponent to measure.
*
@@ -807,9 +710,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method returns the thumb's bounds based on the
- * current value of the scrollbar. This method updates the
- * cached value and returns that.
+ * This method returns the thumb's bounds based on the current value of the
+ * scrollbar. This method updates the cached value and returns that.
*
* @return The thumb bounds.
*/
@@ -821,24 +723,22 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
int extent = scrollbar.getVisibleAmount();
// System.err.println(this + ".getThumbBounds()");
-
if (max == min)
- {
- thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y;
- if (scrollbar.getOrientation() == HORIZONTAL)
{
- thumbRect.width = getMinimumThumbSize().width;
- thumbRect.height = trackRect.height;
- }
- else
- {
- thumbRect.width = trackRect.width;
- thumbRect.height = getMinimumThumbSize().height;
+ thumbRect.x = trackRect.x;
+ thumbRect.y = trackRect.y;
+ if (scrollbar.getOrientation() == HORIZONTAL)
+ {
+ thumbRect.width = getMinimumThumbSize().width;
+ thumbRect.height = trackRect.height;
+ }
+ else
+ {
+ thumbRect.width = trackRect.width;
+ thumbRect.height = getMinimumThumbSize().height;
+ }
+ return thumbRect;
}
- return thumbRect;
- }
-
if (scrollbar.getOrientation() == HORIZONTAL)
{
@@ -852,8 +752,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
else
{
thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y
- + value * trackRect.height / (max - min);
+ thumbRect.y = trackRect.y + value * trackRect.height / (max - min);
thumbRect.width = trackRect.width;
thumbRect.height = extent * trackRect.height / (max - min);
@@ -862,8 +761,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method calculates the bounds of the track. This method
- * updates the cached value and returns it.
+ * This method calculates the bounds of the track. This method updates the
+ * cached value and returns it.
*
* @return The track's bounds.
*/
@@ -889,8 +788,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs any addition Components that
- * are a part of or related to this scrollbar.
+ * This method installs any addition Components that are a part of or
+ * related to this scrollbar.
*/
protected void installComponents()
{
@@ -901,8 +800,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs the defaults for the scrollbar specified
- * by the Basic Look and Feel.
+ * This method installs the defaults for the scrollbar specified by the
+ * Basic Look and Feel.
*/
protected void installDefaults()
{
@@ -926,9 +825,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs any listeners for the scrollbar.
- * This method also installs listeners for things such as
- * the JButtons and the timer.
+ * This method installs any listeners for the scrollbar. This method also
+ * installs listeners for things such as the JButtons and the timer.
*/
protected void installListeners()
{
@@ -951,10 +849,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs the UI for the component.
- * This can include setting up listeners, defaults,
- * and components. This also includes initializing any data
- * objects.
+ * This method installs the UI for the component. This can include setting
+ * up listeners, defaults, and components. This also includes initializing
+ * any data objects.
*
* @param c The JComponent to install.
*/
@@ -977,7 +874,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
configureScrollBarColors();
calculatePreferredSize();
- layoutContainer(scrollbar);
+ layoutContainer(scrollbar);
}
}
@@ -1073,9 +970,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method is called when repainting and the mouse is
- * pressed in the track. It paints the track below the thumb
- * with the trackHighlight color.
+ * This method is called when repainting and the mouse is pressed in the
+ * track. It paints the track below the thumb with the trackHighlight
+ * color.
*
* @param g The Graphics object to paint with.
*/
@@ -1088,15 +985,15 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
g.fillRect(trackRect.x, trackRect.y, thumbRect.x - trackRect.x,
trackRect.height);
else
- g.fillRect(trackRect.x, trackRect.y, trackRect.width,
+ g.fillRect(trackRect.x, trackRect.y, trackRect.width,
thumbRect.y - trackRect.y);
g.setColor(saved);
}
/**
- * This method is called when repainting and the mouse is
- * pressed in the track. It paints the track above the thumb
- * with the trackHighlight color.
+ * This method is called when repainting and the mouse is pressed in the
+ * track. It paints the track above the thumb with the trackHighlight
+ * color.
*
* @param g The Graphics objet to paint with.
*/
@@ -1109,11 +1006,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
g.fillRect(thumbRect.x + thumbRect.width, trackRect.y,
trackRect.x + trackRect.width - thumbRect.x - thumbRect.width,
trackRect.height);
- else
- g.fillRect(trackRect.x, thumbRect.y + thumbRect.height,
- trackRect.width,
- trackRect.y + trackRect.height - thumbRect.y -
- thumbRect.height);
+ else
+ g.fillRect(trackRect.x, thumbRect.y + thumbRect.height, trackRect.width,
+ trackRect.y + trackRect.height - thumbRect.y
+ - thumbRect.height);
g.setColor(saved);
}
@@ -1217,25 +1113,25 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * The method scrolls the thumb by a block in the
- * direction specified.
+ * The method scrolls the thumb by a block in the direction specified.
*
* @param direction The direction to scroll.
*/
protected void scrollByBlock(int direction)
{
- scrollbar.setValue(scrollbar.getValue() + scrollbar.getBlockIncrement(direction));
+ scrollbar.setValue(scrollbar.getValue()
+ + scrollbar.getBlockIncrement(direction));
}
/**
- * The method scrolls the thumb by a unit in the
- * direction specified.
+ * The method scrolls the thumb by a unit in the direction specified.
*
* @param direction The direction to scroll.
*/
protected void scrollByUnit(int direction)
{
- scrollbar.setValue(scrollbar.getValue() + scrollbar.getUnitIncrement(direction));
+ scrollbar.setValue(scrollbar.getValue()
+ + scrollbar.getUnitIncrement(direction));
}
/**
@@ -1255,8 +1151,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any components that
- * are a part of or related to this scrollbar.
+ * This method uninstalls any components that are a part of or related to
+ * this scrollbar.
*/
protected void uninstallComponents()
{
@@ -1267,8 +1163,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any defaults that this
- * scrollbar acquired from the Basic Look and Feel defaults.
+ * This method uninstalls any defaults that this scrollbar acquired from the
+ * Basic Look and Feel defaults.
*/
protected void uninstallDefaults()
{
@@ -1278,8 +1174,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any keyboard
- * actions this scrollbar acquired during install.
+ * This method uninstalls any keyboard actions this scrollbar acquired
+ * during install.
*/
protected void uninstallKeyboardActions()
{
@@ -1287,22 +1183,21 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any listeners that
- * were registered during install.
+ * This method uninstalls any listeners that were registered during install.
*/
protected void uninstallListeners()
{
scrollTimer.removeActionListener(scrollListener);
-
+
scrollbar.getModel().removeChangeListener(modelListener);
scrollbar.removePropertyChangeListener(propertyChangeListener);
-
+
decrButton.removeMouseListener(buttonListener);
incrButton.removeMouseListener(buttonListener);
-
+
scrollbar.removeMouseListener(trackListener);
scrollbar.removeMouseMotionListener(trackListener);
-
+
propertyChangeListener = null;
modelListener = null;
buttonListener = null;
@@ -1311,10 +1206,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls the UI. This includes
- * removing any defaults, listeners, and components
- * that this UI may have initialized. It also nulls
- * any instance data.
+ * This method uninstalls the UI. This includes removing any defaults,
+ * listeners, and components that this UI may have initialized. It also
+ * nulls any instance data.
*
* @param c The Component to uninstall for.
*/
@@ -1323,19 +1217,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
uninstallDefaults();
uninstallListeners();
uninstallComponents();
-
+
scrollTimer = null;
-
+
thumbRect = null;
trackRect = null;
-
+
trackColor = null;
trackHighlightColor = null;
thumbColor = null;
thumbHighlightColor = null;
thumbDarkShadowColor = null;
thumbLightShadowColor = null;
-
+
scrollbar = null;
}
diff --git a/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java b/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java
index 9149cb8..db2d164 100644
--- a/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicSeparatorUI.java
@@ -1,4 +1,4 @@
-/* BasicSeparatorUI.java
+/* BasicSeparatorUI.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,20 +35,22 @@ 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.Dimension;
import java.awt.Color;
-import java.awt.Rectangle;
+import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.SeparatorUI;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import java.awt.Rectangle;
+
import javax.swing.JComponent;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.SeparatorUI;
/**
* The Basic Look and Feel UI delegate for JSeparator.
diff --git a/libjava/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/javax/swing/plaf/basic/BasicSliderUI.java
index b5c95cb..648e332 100644
--- a/libjava/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicSliderUI.java
@@ -1,4 +1,4 @@
-/* BasicSliderUI.java
+/* BasicSliderUI.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.Color;
@@ -58,6 +59,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Dictionary;
import java.util.Enumeration;
+
import javax.swing.BoundedRangeModel;
import javax.swing.JComponent;
import javax.swing.JLabel;
@@ -72,7 +74,6 @@ import javax.swing.event.MouseInputAdapter;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SliderUI;
-
/**
* <p>
* BasicSliderUI.java This is the UI delegate in the Basic look and feel that
@@ -320,7 +321,7 @@ public class BasicSliderUI extends SliderUI
/**
* Helper class that listens for mouse events.
*/
- protected class TrackListener extends MouseInputAdapter
+ public class TrackListener extends MouseInputAdapter
{
/** The current X position of the mouse. */
protected int currentMouseX;
@@ -1955,10 +1956,10 @@ public class BasicSliderUI extends SliderUI
}
g.setColor(Color.WHITE);
- g.drawPolygon(bright);
+ g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints);
g.setColor(Color.BLACK);
- g.drawPolygon(dark);
+ g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints);
g.setColor(Color.GRAY);
g.fillPolygon(all);
diff --git a/libjava/javax/swing/plaf/basic/BasicSpinnerUI.java b/libjava/javax/swing/plaf/basic/BasicSpinnerUI.java
index 0f5e761..919cde7 100644
--- a/libjava/javax/swing/plaf/basic/BasicSpinnerUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -1,5 +1,5 @@
/* SpinnerUI.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 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.Component;
@@ -48,6 +49,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JSpinner;
@@ -57,7 +59,6 @@ import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SpinnerUI;
-
/**
* DOCUMENT ME!
*
diff --git a/libjava/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/libjava/javax/swing/plaf/basic/BasicSplitPaneDivider.java
index e06eb05..1ee1bb6 100644
--- a/libjava/javax/swing/plaf/basic/BasicSplitPaneDivider.java
+++ b/libjava/javax/swing/plaf/basic/BasicSplitPaneDivider.java
@@ -1,4 +1,4 @@
-/* BasicSplitPaneDivider.java
+/* BasicSplitPaneDivider.java --
Copyright (C) 2003, 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.Color;
@@ -49,12 +50,12 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.swing.JButton;
import javax.swing.JSplitPane;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
-
/**
* The divider that separates the two parts of a JSplitPane in the Basic look
* and feel.
@@ -153,32 +154,35 @@ public class BasicSplitPaneDivider extends Container
// left (top), middle, right(bottom)
// 0 1 2
- /** Keeps track of where the divider should be placed when using one touch expand
- * buttons. */
+ /**
+ * Keeps track of where the divider should be placed when using one touch
+ * expand buttons.
+ */
private transient int currentDividerLocation = 1;
private transient Border tmpBorder = new Border()
- {
- public Insets getBorderInsets(Component c)
{
- return new Insets(2, 2, 2, 2);
- }
-
- public boolean isBorderOpaque()
- {
- return false;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
- {
- Color saved = g.getColor();
- g.setColor(Color.BLACK);
-
- g.drawRect(x + 2, y + 2, width - 4, height - 4);
-
- g.setColor(saved);
- }
- };
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
+ public boolean isBorderOpaque()
+ {
+ return false;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y,
+ int width, int height)
+ {
+ Color saved = g.getColor();
+ g.setColor(Color.BLACK);
+
+ g.drawRect(x + 2, y + 2, width - 4, height - 4);
+
+ g.setColor(saved);
+ }
+ };
/**
* Constructs a new divider.
@@ -420,7 +424,7 @@ public class BasicSplitPaneDivider extends Container
if (orientation == JSplitPane.VERTICAL_SPLIT)
dir = SwingConstants.NORTH;
JButton button = new BasicArrowButton(dir);
- button.setBorderPainted(false);
+ button.setBorder(null);
return button;
}
@@ -437,7 +441,7 @@ public class BasicSplitPaneDivider extends Container
if (orientation == JSplitPane.VERTICAL_SPLIT)
dir = SwingConstants.SOUTH;
JButton button = new BasicArrowButton(dir);
- button.setBorderPainted(false);
+ button.setBorder(null);
return button;
}
@@ -484,11 +488,10 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This helper method moves the divider to one of the
- * three locations when using one touch expand buttons.
- * Location 0 is the left (or top) most location.
- * Location 1 is the middle.
- * Location 2 is the right (or bottom) most location.
+ * This helper method moves the divider to one of the three locations when
+ * using one touch expand buttons. Location 0 is the left (or top) most
+ * location. Location 1 is the middle. Location 2 is the right (or bottom)
+ * most location.
*
* @param locationIndex The location to move to.
*/
@@ -612,8 +615,10 @@ public class BasicSplitPaneDivider extends Container
*/
protected class DragController
{
- /** The difference between where the mouse is clicked and the
- * initial divider location. */
+ /**
+ * The difference between where the mouse is clicked and the initial
+ * divider location.
+ */
transient int offset;
/**
@@ -650,8 +655,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method returns one of the two paramters
- * for the orientation. In this case, it returns x.
+ * This method returns one of the two paramters for the orientation. In
+ * this case, it returns x.
*
* @param x The x coordinate.
* @param y The y coordinate.
@@ -664,8 +669,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to pass on the drag information
- * to the UI through dragDividerTo.
+ * This method is called to pass on the drag information to the UI through
+ * dragDividerTo.
*
* @param newX The x coordinate of the MouseEvent.
* @param newY The y coordinate of the MouseEvent.
@@ -677,8 +682,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to pass on the drag information
- * to the UI through dragDividerTo.
+ * This method is called to pass on the drag information to the UI
+ * through dragDividerTo.
*
* @param e The MouseEvent.
*/
@@ -689,8 +694,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to finish the drag session
- * by calling finishDraggingTo.
+ * This method is called to finish the drag session by calling
+ * finishDraggingTo.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -701,8 +706,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to finish the drag session
- * by calling finishDraggingTo.
+ * This method is called to finish the drag session by calling
+ * finishDraggingTo.
*
* @param e The MouseEvent.
*/
@@ -710,10 +715,10 @@ public class BasicSplitPaneDivider extends Container
{
finishDraggingTo(positionForMouseEvent(e));
}
-
+
/**
- * This is a helper method that includes the offset
- * in the needed location.
+ * This is a helper method that includes the offset in the needed
+ * location.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -727,8 +732,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This is a helper class that controls dragging when
- * the orientation is VERTICAL_SPLIT.
+ * This is a helper class that controls dragging when the orientation is
+ * VERTICAL_SPLIT.
*/
protected class VerticalDragController extends DragController
{
@@ -744,8 +749,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method returns one of the two parameters given
- * the orientation. In this case, it returns y.
+ * This method returns one of the two parameters given the orientation. In
+ * this case, it returns y.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -758,8 +763,7 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method returns the new location of the divider
- * given a MouseEvent.
+ * This method returns the new location of the divider given a MouseEvent.
*
* @param e The MouseEvent.
*
@@ -771,8 +775,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This is a helper method that includes the offset
- * in the needed location.
+ * This is a helper method that includes the offset in the needed
+ * location.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -782,12 +786,11 @@ public class BasicSplitPaneDivider extends Container
int adjust(int x, int y)
{
return getNeededLocation(x, y) + getY() - offset;
- }
+ }
}
/**
- * This helper class acts as the Layout Manager for
- * the divider.
+ * This helper class acts as the Layout Manager for the divider.
*/
protected class DividerLayout implements LayoutManager
{
@@ -858,8 +861,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method changes the button orientation when
- * the orientation of the SplitPane changes.
+ * This method changes the button orientation when the orientation of the
+ * SplitPane changes.
*/
private void changeButtonOrientation()
{
diff --git a/libjava/javax/swing/plaf/basic/BasicSplitPaneUI.java b/libjava/javax/swing/plaf/basic/BasicSplitPaneUI.java
index f73b520..fbcc188 100644
--- a/libjava/javax/swing/plaf/basic/BasicSplitPaneUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicSplitPaneUI.java
@@ -1,4 +1,4 @@
-/* BasicSplitPaneUI.java
+/* BasicSplitPaneUI.java --
Copyright (C) 2003, 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.Canvas;
@@ -51,10 +52,9 @@ import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import javax.swing.JButton;
+
import javax.swing.JComponent;
import javax.swing.JSplitPane;
import javax.swing.KeyStroke;
@@ -63,7 +63,6 @@ import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SplitPaneUI;
-
/**
* This is the Basic Look and Feel implementation of the SplitPaneUI class.
*/
@@ -682,7 +681,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
* This is a deprecated class. It is supposed to be used for handling down
* and right key presses.
*/
- protected class KeyboardDownRightHandler implements ActionListener
+ public class KeyboardDownRightHandler implements ActionListener
{
/**
* This method is called when the down or right keys are pressed.
@@ -699,7 +698,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
* This is a deprecated class. It is supposed to be used for handling end
* key presses.
*/
- protected class KeyboardEndHandler implements ActionListener
+ public class KeyboardEndHandler implements ActionListener
{
/**
* This method is called when the end key is pressed.
@@ -716,7 +715,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
* This is a deprecated class. It is supposed to be used for handling home
* key presses.
*/
- protected class KeyboardHomeHandler implements ActionListener
+ public class KeyboardHomeHandler implements ActionListener
{
/**
* This method is called when the home key is pressed.
@@ -733,7 +732,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
* This is a deprecated class. It is supposed to be used for handling resize
* toggles.
*/
- protected class KeyboardResizeToggleHandler implements ActionListener
+ public class KeyboardResizeToggleHandler implements ActionListener
{
/**
* This method is called when a resize is toggled.
@@ -750,7 +749,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
* This is a deprecated class. It is supposed to be used for handler up and
* left key presses.
*/
- protected class KeyboardUpLeftHandler implements ActionListener
+ public class KeyboardUpLeftHandler implements ActionListener
{
/**
* This method is called when the left or up keys are pressed.
@@ -767,7 +766,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
* This helper class handles PropertyChangeEvents from the JSplitPane. When
* a property changes, this will update the UI accordingly.
*/
- protected class PropertyHandler implements PropertyChangeListener
+ public class PropertyHandler implements PropertyChangeListener
{
/**
* This method is called whenever one of the JSplitPane's properties
@@ -846,43 +845,43 @@ public class BasicSplitPaneUI extends SplitPaneUI
/** The JSplitPane's focus handler. */
protected FocusListener focusListener;
- /** Deprecated. The handler for down and right key presses. */
+ /** @deprecated The handler for down and right key presses. */
protected ActionListener keyboardDownRightListener;
- /** Deprecated. The handler for end key presses. */
+ /** @deprecated The handler for end key presses. */
protected ActionListener keyboardEndListener;
- /** Deprecated. The handler for home key presses. */
+ /** @deprecated The handler for home key presses. */
protected ActionListener keyboardHomeListener;
- /** Deprecated. The handler for toggling resizes. */
+ /** @deprecated The handler for toggling resizes. */
protected ActionListener keyboardResizeToggleListener;
- /** Deprecated. The handler for up and left key presses. */
+ /** @deprecated The handler for up and left key presses. */
protected ActionListener keyboardUpLeftListener;
/** The JSplitPane's current layout manager. */
protected BasicHorizontalLayoutManager layoutManager;
- /** Deprecated. The divider resize toggle key. */
+ /** @deprecated The divider resize toggle key. */
protected KeyStroke dividerResizeToggleKey;
- /** Deprecated. The down key. */
+ /** @deprecated The down key. */
protected KeyStroke downKey;
- /** Deprecated. The end key. */
+ /** @deprecated The end key. */
protected KeyStroke endKey;
- /** Deprecated. The home key. */
+ /** @deprecated The home key. */
protected KeyStroke homeKey;
- /** Deprecated. The left key. */
+ /** @deprecated The left key. */
protected KeyStroke leftKey;
- /** Deprecated. The right key. */
+ /** @deprecated The right key. */
protected KeyStroke rightKey;
- /** Deprecated. The up key. */
+ /** @deprecated The up key. */
protected KeyStroke upKey;
/** Set to true when dragging heavy weight components. */
@@ -892,7 +891,8 @@ public class BasicSplitPaneUI extends SplitPaneUI
* The constraints object used when adding the non-continuous divider to the
* JSplitPane.
*/
- protected static String NON_CONTINUOUS_DIVIDER;
+ protected static final String NON_CONTINUOUS_DIVIDER
+ = "nonContinuousDivider";
/** The dark divider used when dragging in non-continuous layout mode. */
protected Component nonContinuousLayoutDivider;
@@ -1042,10 +1042,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
}
/**
- * Deprecated. This method creates a new ActionListener for up and left key
- * presses.
+ * This method creates a new ActionListener for up and left key presses.
*
* @return A new ActionListener for up and left keys.
+ *
+ * @deprecated 1.3
*/
protected ActionListener createKeyboardUpLeftListener()
{
@@ -1053,10 +1054,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
}
/**
- * Deprecated. This method creates a new ActionListener for down and right
- * key presses.
+ * This method creates a new ActionListener for down and right key presses.
*
* @return A new ActionListener for down and right keys.
+ *
+ * @deprecated 1.3
*/
protected ActionListener createKeyboardDownRightListener()
{
@@ -1064,10 +1066,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
}
/**
- * Deprecated. This method creates a new ActionListener for home key
- * presses.
+ * This method creates a new ActionListener for home key presses.
*
* @return A new ActionListener for home keys.
+ *
+ * @deprecated
*/
protected ActionListener createKeyboardHomeListener()
{
@@ -1075,9 +1078,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
}
/**
- * Deprecated. This method creates a new ActionListener for end key presses.
+ * This method creates a new ActionListener for end key presses.i
*
* @return A new ActionListener for end keys.
+ *
+ * @deprecated 1.3
*/
protected ActionListener createKeyboardEndListener()
{
@@ -1085,10 +1090,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
}
/**
- * Depcreated. This method creates a new ActionListener for resize toggle
- * key events.
+ * This method creates a new ActionListener for resize toggle key events.
*
* @return A new ActionListener for resize toggle keys.
+ *
+ * @deprecated 1.3
*/
protected ActionListener createKeyboardResizeToggleListener()
{
@@ -1482,10 +1488,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
}
/**
- * Deprecated. This method returns the width of one of the sides of the
- * divider's border.
+ * This method returns the width of one of the sides of the divider's border.
*
* @return The width of one side of the divider's border.
+ *
+ * @deprecated 1.3
*/
protected int getDividerBorderSize()
{
diff --git a/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index 44e302b..7073086 100644
--- a/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -28,7 +28,7 @@ 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 of7 the license of that
+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
@@ -132,11 +132,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
if (++currentScrollLocation >= tabCount)
currentScrollLocation = tabCount - 1;
- if (currentScrollLocation == tabCount - 1)
- incrButton.setEnabled(false);
+
+ int width = 0;
+ for (int i = currentScrollLocation - 1; i < tabCount; i++)
+ width += rects[i].width;
+ if (width < viewport.getWidth())
+ // FIXME: Still getting mouse events after the button is disabled.
+ // incrButton.setEnabled(false);
+ currentScrollLocation--;
else if (! decrButton.isEnabled())
decrButton.setEnabled(true);
- tabPane.layout();
+ tabPane.revalidate();
tabPane.repaint();
return;
}
@@ -148,7 +154,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
decrButton.setEnabled(false);
else if (! incrButton.isEnabled())
incrButton.setEnabled(true);
- tabPane.layout();
+ tabPane.revalidate();
tabPane.repaint();
return;
}
@@ -160,7 +166,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// e.g. in the inset area.
if (index != -1 && tabPane.isEnabledAt(index))
tabPane.setSelectedIndex(index);
- tabPane.layout();
+ tabPane.revalidate();
tabPane.repaint();
}
}
@@ -168,7 +174,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
/**
* This class handles PropertyChangeEvents fired from the JTabbedPane.
*/
- protected class PropertyChangeHandler implements PropertyChangeListener
+ public class PropertyChangeHandler implements PropertyChangeListener
{
/**
* This method is called whenever one of the properties of the JTabbedPane
@@ -269,18 +275,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- width = calculateMaxTabWidth(tabPlacement) * tabPane.getTabCount();
- calcRect = tabPane.getParent().getBounds();
- width = Math.max(width, componentWidth);
+ int min = calculateMaxTabWidth(tabPlacement);
+ width = Math.max(min, componentWidth);
int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width);
height = tabAreaHeight + componentHeight;
}
else
{
- height = calculateMaxTabHeight(tabPlacement) * tabPane.getTabCount();
- calcRect = tabPane.getParent().getBounds();
- height = Math.max(height, componentHeight);
+ int min = calculateMaxTabHeight(tabPlacement);
+ height = Math.max(min, componentHeight);
int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height);
width = tabAreaWidth + componentWidth;
@@ -454,7 +458,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
for (int j = first; j <= last; j++)
rects[j].y += (runCount - i) * maxTabHeight
- + (runCount - i) * tabRunOverlay;
+ - (runCount - i) * tabRunOverlay;
}
if (tabPlacement == SwingConstants.BOTTOM)
@@ -810,7 +814,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
protected void rotateTabRuns(int tabPlacement, int selectedRun)
{
- if (selectedRun == 1 || selectedRun == -1)
+ if (runCount == 1 || selectedRun == 1 || selectedRun == -1)
return;
int[] newTabRuns = new int[tabRuns.length];
int currentRun = selectedRun;
@@ -1025,6 +1029,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
super.layoutContainer(pane);
int tabCount = tabPane.getTabCount();
+ Point p = null;
if (tabCount == 0)
return;
int tabPlacement = tabPane.getTabPlacement();
@@ -1083,20 +1088,21 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
int w = Math.max(rects[tabC].width + rects[tabC].x, tabAreaRect.width);
int h = Math.max(rects[tabC].height, tabAreaRect.height);
- Point p = findPointForIndex(currentScrollLocation);
+ p = findPointForIndex(currentScrollLocation);
// we want to cover that entire space so that borders that run under
// the tab area don't show up when we move the viewport around.
panel.setSize(w + p.x, h + p.y);
}
- viewport.setViewPosition(findPointForIndex(currentScrollLocation));
+ viewport.setViewPosition(p);
+ viewport.repaint();
}
}
/**
* This class handles ChangeEvents from the JTabbedPane.
*/
- protected class TabSelectionHandler implements ChangeListener
+ public class TabSelectionHandler implements ChangeListener
{
/**
* This method is called whenever a ChangeEvent is fired from the
@@ -1257,16 +1263,32 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
/** This array keeps track of which tabs are in which run. See above. */
protected int[] tabRuns;
- /** Deprecated. This is the keystroke for moving down. */
+ /**
+ * This is the keystroke for moving down.
+ *
+ * @deprecated 1.3
+ */
protected KeyStroke downKey;
- /** Deprecated. This is the keystroke for moving left. */
+ /**
+ * This is the keystroke for moving left.
+ *
+ * @deprecated 1.3
+ */
protected KeyStroke leftKey;
- /** Deprecated. This is the keystroke for moving right. */
+ /**
+ * This is the keystroke for moving right.
+ *
+ * @deprecated 1.3
+ */
protected KeyStroke rightKey;
- /** Deprecated. This is the keystroke for moving up. */
+ /**
+ * This is the keystroke for moving up.
+ *
+ * @deprecated 1.3
+ */
protected KeyStroke upKey;
/** The listener that listens for focus events. */
@@ -1446,6 +1468,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
incrButton = createIncreaseButton();
decrButton = createDecreaseButton();
viewport = new ScrollingViewport();
+ viewport.setLayout(null);
panel = new ScrollingPanel();
viewport.setView(panel);
tabPane.add(incrButton);
@@ -1690,6 +1713,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
+ boolean isScroll = tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT;
+
// Please note: the ordering of the painting is important.
// we WANT to paint the outermost run first and then work our way in.
int tabCount = tabPane.getTabCount();
@@ -1702,17 +1727,33 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
for (int i = 0; i < runCount; i++)
{
int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
- if (first == tabCount)
+ if (isScroll)
+ first = currentScrollLocation;
+ else if (first == tabCount)
first = 0;
int last = lastTabInRun(tabCount, currRun);
+ if (isScroll)
+ {
+ for (int k = first; k < tabCount; k++)
+ {
+ if (rects[k].x + rects[k].width - rects[first].x > viewport
+ .getWidth())
+ {
+ last = k;
+ break;
+ }
+ }
+ }
+
for (int j = first; j <= last; j++)
{
- if (j != selectedIndex)
+ if (j != selectedIndex || isScroll)
paintTab(g, tabPlacement, rects, j, ir, tr);
}
- currRun = getNextTabRun(currRun);
+ currRun = getPreviousTabRun(currRun);
}
- paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);
+ if (! isScroll)
+ paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);
}
/**
@@ -1975,7 +2016,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int x, int y, int w, int h, boolean isSelected)
{
Color saved = g.getColor();
-
+
if (! isSelected || tabPlacement != SwingConstants.TOP)
{
g.setColor(shadow);
@@ -2030,7 +2071,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
Color bg = tabPane.getBackgroundAt(tabIndex);
if (bg == null)
- bg = tabPane.getBackground();
+ bg = Color.GRAY;
g.setColor(bg);
}
@@ -2083,14 +2124,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
if (tabPlacement == SwingConstants.TOP)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
g.drawLine(x, y, startgap - diff, y);
g.drawLine(endgap - diff, y, x + w, y);
}
@@ -2123,14 +2164,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
-
if (tabPlacement == SwingConstants.LEFT)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
g.drawLine(x, y, x, startgap - diff);
g.drawLine(x, endgap - diff, x, y + h);
}
@@ -2162,14 +2203,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
if (tabPlacement == SwingConstants.BOTTOM)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
g.setColor(shadow);
g.drawLine(x + 1, y + h - 1, startgap - diff, y + h - 1);
g.drawLine(endgap - diff, y + h - 1, x + w - 1, y + h - 1);
@@ -2209,14 +2250,15 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int endgap = rects[selectedIndex].y + rects[selectedIndex].height;
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
if (tabPlacement == SwingConstants.RIGHT)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
g.setColor(shadow);
g.drawLine(x + w - 1, y + 1, x + w - 1, startgap - diff);
g.drawLine(x + w - 1, endgap - diff, x + w - 1, y + h - 1);
diff --git a/libjava/javax/swing/plaf/basic/BasicTableHeaderUI.java b/libjava/javax/swing/plaf/basic/BasicTableHeaderUI.java
index c55c940..ea7dfc0 100644
--- a/libjava/javax/swing/plaf/basic/BasicTableHeaderUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTableHeaderUI.java
@@ -1,4 +1,4 @@
-/* BasicTableHeaderUI.java
+/* BasicTableHeaderUI.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.Component;
@@ -42,6 +43,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
+
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
import javax.swing.UIDefaults;
@@ -55,7 +57,6 @@ import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
-
public class BasicTableHeaderUI
extends TableHeaderUI
{
@@ -180,84 +181,6 @@ public class BasicTableHeaderUI
}
}
-
- public Dimension getMaximumSize(JComponent c)
- {
- TableColumnModel cmod = header.getColumnModel();
- TableCellRenderer defaultRend = header.getDefaultRenderer();
- int ncols = cmod.getColumnCount();
- int spacing = 0;
- Dimension ret = getPreferredSize(c);
-
- if (header.getTable() != null
- && header.getTable().getInterCellSpacing() != null)
- spacing = header.getTable().getInterCellSpacing().width;
-
- ret.width = 0;
- for (int i = 0; i < ncols; ++i)
- {
- TableColumn col = cmod.getColumn(i);
- TableCellRenderer rend = col.getHeaderRenderer();
- if (rend == null)
- rend = defaultRend;
- Object val = col.getHeaderValue();
- Component comp = rend.getTableCellRendererComponent(header.getTable(),
- val,
- false, // isSelected
- false, // isFocused
- -1, i);
- comp.setFont(header.getFont());
- comp.setBackground(header.getBackground());
- comp.setForeground(header.getForeground());
- if (comp instanceof JComponent)
- ((JComponent)comp).setBorder(cellBorder);
-
- Dimension d = comp.getMaximumSize();
- ret.width += col.getMaxWidth();
- ret.height = Math.max(ret.height, d.height);
- ret.width += spacing;
- }
- return ret;
- }
-
- public Dimension getMinimumSize(JComponent c)
- {
- TableColumnModel cmod = header.getColumnModel();
- TableCellRenderer defaultRend = header.getDefaultRenderer();
- int ncols = cmod.getColumnCount();
- int spacing = 0;
- Dimension ret = getPreferredSize(c);
-
- if (header.getTable() != null
- && header.getTable().getInterCellSpacing() != null)
- spacing = header.getTable().getInterCellSpacing().width;
-
- ret.width = 0;
- for (int i = 0; i < ncols; ++i)
- {
- TableColumn col = cmod.getColumn(i);
- TableCellRenderer rend = col.getHeaderRenderer();
- if (rend == null)
- rend = defaultRend;
- Object val = col.getHeaderValue();
- Component comp = rend.getTableCellRendererComponent(header.getTable(),
- val,
- false, // isSelected
- false, // isFocused
- -1, i);
- comp.setFont(header.getFont());
- comp.setBackground(header.getBackground());
- comp.setForeground(header.getForeground());
- if (comp instanceof JComponent)
- ((JComponent)comp).setBorder(cellBorder);
-
- Dimension d = comp.getMinimumSize();
- ret.width += col.getMinWidth();
- ret.width += spacing;
- ret.height = Math.max(ret.height, d.height);
- }
- return ret;
- }
public Dimension getPreferredSize(JComponent c)
{
@@ -290,10 +213,10 @@ public class BasicTableHeaderUI
((JComponent)comp).setBorder(cellBorder);
Dimension d = comp.getPreferredSize();
- ret.width += d.width;
ret.width += spacing;
ret.height = Math.max(d.height, ret.height);
}
+ ret.width = cmod.getTotalColumnWidth();
return ret;
}
diff --git a/libjava/javax/swing/plaf/basic/BasicTableUI.java b/libjava/javax/swing/plaf/basic/BasicTableUI.java
index 5fa8fb7..eb0054b 100644
--- a/libjava/javax/swing/plaf/basic/BasicTableUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTableUI.java
@@ -1,4 +1,4 @@
-/* BasicTableUI.java
+/* BasicTableUI.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.Color;
@@ -43,29 +44,28 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
+
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.TableUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-
public class BasicTableUI
extends TableUI
{
-
public static ComponentUI createUI(JComponent comp)
{
return new BasicTableUI();
diff --git a/libjava/javax/swing/plaf/basic/BasicTextAreaUI.java b/libjava/javax/swing/plaf/basic/BasicTextAreaUI.java
index f1714c2..61d025d 100644
--- a/libjava/javax/swing/plaf/basic/BasicTextAreaUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTextAreaUI.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
diff --git a/libjava/javax/swing/plaf/basic/BasicTextFieldUI.java b/libjava/javax/swing/plaf/basic/BasicTextFieldUI.java
index b43fd97..e7cf33b 100644
--- a/libjava/javax/swing/plaf/basic/BasicTextFieldUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTextFieldUI.java
@@ -41,11 +41,9 @@ package javax.swing.plaf.basic;
import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
-import javax.swing.JTextField;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.FieldView;
-import javax.swing.text.PlainDocument;
import javax.swing.text.View;
public class BasicTextFieldUI extends BasicTextUI
diff --git a/libjava/javax/swing/plaf/basic/BasicTextPaneUI.java b/libjava/javax/swing/plaf/basic/BasicTextPaneUI.java
new file mode 100644
index 0000000..615c74b
--- /dev/null
+++ b/libjava/javax/swing/plaf/basic/BasicTextPaneUI.java
@@ -0,0 +1,69 @@
+/* BasicTextPaneUI.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.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 static ComponentUI createUI(JComponent comp)
+ {
+ return new BasicTextPaneUI();
+ }
+
+ public BasicTextPaneUI()
+ {
+ }
+
+ public View create(Element elem)
+ {
+ return new PlainView(elem);
+ }
+
+ protected String getPropertyPrefix()
+ {
+ return "TextPane";
+ }
+}
diff --git a/libjava/javax/swing/plaf/basic/BasicTextUI.java b/libjava/javax/swing/plaf/basic/BasicTextUI.java
index 2ccf2fa..b3d03db 100644
--- a/libjava/javax/swing/plaf/basic/BasicTextUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTextUI.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -46,6 +45,8 @@ import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -56,7 +57,6 @@ import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
-import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.TextUI;
import javax.swing.plaf.UIResource;
import javax.swing.text.BadLocationException;
@@ -70,7 +70,6 @@ import javax.swing.text.Element;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import javax.swing.text.Keymap;
-import javax.swing.text.PlainDocument;
import javax.swing.text.PlainView;
import javax.swing.text.Position;
import javax.swing.text.View;
@@ -231,9 +230,20 @@ public abstract class BasicTextUI extends TextUI
caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
}
+ private FocusListener focuslistener = new FocusListener() {
+ public void focusGained(FocusEvent e)
+ {
+ textComponent.repaint();
+ }
+ public void focusLost(FocusEvent e)
+ {
+ textComponent.repaint();
+ }
+ };
+
protected void installListeners()
{
- // Do nothing here.
+ textComponent.addFocusListener(focuslistener);
}
protected String getKeymapName()
@@ -331,7 +341,7 @@ public abstract class BasicTextUI extends TextUI
protected void uninstallListeners()
{
- // Do nothing here.
+ textComponent.removeFocusListener(focuslistener);
}
protected void uninstallKeyboardActions()
@@ -370,7 +380,7 @@ public abstract class BasicTextUI extends TextUI
rootView.paint(g, getVisibleEditorRect());
- if (caret != null)
+ if (caret != null && textComponent.hasFocus())
caret.paint(g);
}
@@ -464,8 +474,17 @@ public abstract class BasicTextUI extends TextUI
protected void modelChanged()
{
+ if (textComponent == null || rootView == null)
+ return;
ViewFactory factory = rootView.getViewFactory();
- Element elem = textComponent.getDocument().getDefaultRootElement();
+ if (factory == null)
+ return;
+ Document doc = textComponent.getDocument();
+ if (doc == null)
+ return;
+ Element elem = doc.getDefaultRootElement();
+ if (elem == null)
+ return;
setView(factory.create(elem));
}
}
diff --git a/libjava/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java b/libjava/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
index f35968c..72554c0 100644
--- a/libjava/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
@@ -1,4 +1,4 @@
-/* BasicToolBarSeparatorUI.java
+/* BasicToolBarSeparatorUI.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,22 +35,17 @@ 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;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Rectangle;
+
import javax.swing.JComponent;
-import javax.swing.JToolBar.Separator;
import javax.swing.JSeparator;
-import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.SeparatorUI;
-
/**
* The Basic Look and Feel UI delegate for Separator.
diff --git a/libjava/javax/swing/plaf/basic/BasicToolBarUI.java b/libjava/javax/swing/plaf/basic/BasicToolBarUI.java
index 99e4475..8315fc0 100644
--- a/libjava/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -1,4 +1,4 @@
-/* BasicToolBarUI.java
+/* BasicToolBarUI.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,16 +35,15 @@ 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.BorderLayout;
import java.awt.Color;
import java.awt.Component;
-import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
@@ -53,15 +52,14 @@ import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.Enumeration;
import java.util.Hashtable;
+
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
@@ -74,13 +72,11 @@ import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.MouseInputListener;
-import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.BorderUIResource.EtchedBorderUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ToolBarUI;
import javax.swing.plaf.UIResource;
-
/**
* This is the Basic Look and Feel UI class for JToolBar.
*/
@@ -1331,10 +1327,10 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
private static class ToolBarBorder implements Border
{
/** The size of the larger, draggable side of the border. */
- private static int offset = 10;
+ private static final int offset = 10;
/** The other sides. */
- private static int regular = 2;
+ private static final int regular = 2;
/**
* This method returns the border insets for the JToolBar.
diff --git a/libjava/javax/swing/plaf/basic/BasicToolTipUI.java b/libjava/javax/swing/plaf/basic/BasicToolTipUI.java
index 3b5941f..b561cce 100644
--- a/libjava/javax/swing/plaf/basic/BasicToolTipUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicToolTipUI.java
@@ -1,39 +1,40 @@
/* BasicToolTipUI.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. */
+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.basic;
@@ -44,6 +45,7 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
+
import javax.swing.JComponent;
import javax.swing.JToolTip;
import javax.swing.SwingConstants;
@@ -54,7 +56,6 @@ import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ToolTipUI;
-
/**
* This is the Basic Look and Feel UI class for JToolTip.
*/
diff --git a/libjava/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/javax/swing/plaf/basic/BasicTreeUI.java
index dac2f01..93e3900 100644
--- a/libjava/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicTreeUI.java
@@ -1,5 +1,5 @@
-/* BasicTreeUI.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* BasicTreeUI.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,21 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
import java.awt.Rectangle;
+
+import javax.swing.JComponent;
+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;
/**
* A delegate providing the user interface for <code>JTree</code>
@@ -57,6 +67,7 @@ import javax.swing.tree.TreePath;
public class BasicTreeUI
extends TreeUI
{
+
/**
* Determines the geometric extent of the label that is
* drawn for a path.
@@ -191,7 +202,6 @@ public class BasicTreeUI
return true; // FIXME: not implemented
}
-
/**
* Cancels editing a tree cell, discarding any entered value.
* If no editing session is active, nothing happens. The cell
@@ -233,4 +243,157 @@ public class BasicTreeUI
{
return null; // FIXME: not implemented
}
+
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicTreeUI();
+ }
+
+ int rightChildIndent;
+ int leftChildIndent;
+ int rowHeight;
+ Color hashColor;
+
+ protected void installDefaults(JTree tree)
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ tree.setFont(defaults.getFont("Tree.font"));
+ tree.setForeground(defaults.getColor("Tree.foreground"));
+ tree.setBackground(defaults.getColor("Tree.background"));
+ tree.setOpaque(true);
+
+ hashColor = defaults.getColor("Tree.hash");
+ rightChildIndent = defaults.getInt("Tree.rightChildIndent");
+ leftChildIndent = defaults.getInt("Tree.leftChildIndent");
+ rowHeight = defaults.getInt("Tree.rowHeight");
+ }
+
+ protected void installKeyboardActions()
+ {
+ }
+
+ protected void installListeners()
+ {
+ }
+
+ public void installUI(JComponent c)
+ {
+ installDefaults((JTree) c);
+ }
+
+
+ protected void uninstallDefaults(JTree tree)
+ {
+ tree.setFont(null);
+ tree.setForeground(null);
+ tree.setBackground(null);
+
+ tree.setCellRenderer(null);
+ }
+
+ public void uninstallUI(JComponent c)
+ {
+ uninstallDefaults((JTree) c);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ return new Dimension(200,200);
+ }
+
+ protected void paintLeaf(Graphics g, int x, int y, JTree tree, Object leaf)
+ {
+ Component c = tree.getCellRenderer().getTreeCellRendererComponent(tree,
+ leaf,
+ false, // selected
+ false, // expanded
+ true, // leaf
+ 0, // row
+ false // hasFocus
+ );
+ g.translate(x, y);
+ c.paint(g);
+ g.translate(-x, -y);
+ }
+
+ protected void paintNonLeaf(Graphics g, int x, int y, JTree tree, Object nonLeaf)
+ {
+ Component c = tree.getCellRenderer().getTreeCellRendererComponent(tree,
+ nonLeaf,
+ false, // selected
+ false, // expanded
+ false, // leaf
+ 0, // row
+ false // hasFocus
+ );
+ g.translate(x, y);
+ c.paint(g);
+ g.translate(-x, -y);
+ }
+
+ protected int paintRecursive(Graphics g,
+ int indentation,
+ int descent,
+ int childNumber,
+ int depth,
+ JTree tree,
+ TreeModel mod,
+ Object curr)
+ {
+ Rectangle clip = g.getClipBounds();
+ if (indentation > clip.x + clip.width + rightChildIndent ||
+ descent > clip.y + clip.height + rowHeight)
+ return descent;
+
+
+ int halfHeight = rowHeight / 2;
+ int halfWidth = rightChildIndent / 2;
+ int y0 = descent + halfHeight;
+
+ if (mod.isLeaf(curr))
+ {
+ paintLeaf(g, indentation, descent, tree, curr);
+ descent += rowHeight;
+ }
+ else
+ {
+ if (depth > 0 || tree.isRootVisible())
+ {
+ paintNonLeaf(g, indentation, descent, tree, curr);
+ descent += rowHeight;
+ y0 += halfHeight;
+ }
+ int max = mod.getChildCount(curr);
+ for (int i = 0; i < max; ++i)
+ {
+ g.setColor(hashColor);
+ g.drawLine(indentation + halfWidth, descent + halfHeight,
+ indentation + rightChildIndent, descent + halfHeight);
+ descent = paintRecursive(g,
+ indentation + rightChildIndent, descent,
+ i, depth+1,
+ tree, mod, mod.getChild(curr, i));
+ }
+ }
+
+ int y1 = descent - halfHeight;
+ if (y0 != y1)
+ {
+ g.setColor(hashColor);
+ g.drawLine(indentation + halfWidth, y0,
+ indentation + halfWidth, y1);
+ }
+
+ return descent;
+ }
+
+ public void paint(Graphics g, JComponent c)
+ {
+ JTree tree = (JTree) c;
+ TreeModel mod = tree.getModel();
+ g.translate(10, 10);
+ paintRecursive(g, 0, 0, 0, 0, tree, mod, mod.getRoot());
+ g.translate(-10, -10);
+ }
}
diff --git a/libjava/javax/swing/plaf/basic/BasicViewportUI.java b/libjava/javax/swing/plaf/basic/BasicViewportUI.java
index feefaca..1e0421b 100644
--- a/libjava/javax/swing/plaf/basic/BasicViewportUI.java
+++ b/libjava/javax/swing/plaf/basic/BasicViewportUI.java
@@ -1,4 +1,4 @@
-/* BasicViewportUI.java
+/* BasicViewportUI.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,7 @@ import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.image.ImageObserver;
+
import javax.swing.JComponent;
import javax.swing.JViewport;
import javax.swing.ViewportLayout;
@@ -119,17 +120,16 @@ public class BasicViewportUI extends ViewportUI
}
public void paint(Graphics g, JComponent c)
- {
-
- JViewport v = (JViewport)c;
- Component view = v.getView();
+ {
+ JViewport port = (JViewport)c;
+ Component view = port.getView();
if (view == null)
return;
- Point pos = v.getViewPosition();
+ Point pos = port.getViewPosition();
Rectangle viewBounds = view.getBounds();
- Rectangle portBounds = v.getBounds();
+ Rectangle portBounds = port.getBounds();
if (viewBounds.width == 0
|| viewBounds.height == 0
@@ -137,6 +137,51 @@ public class BasicViewportUI extends ViewportUI
|| portBounds.height == 0)
return;
+ switch (port.getScrollMode())
+ {
+
+ case JViewport.BACKINGSTORE_SCROLL_MODE:
+ paintBackingStore(g, port, view, pos, viewBounds, portBounds);
+ break;
+
+ case JViewport.BLIT_SCROLL_MODE:
+ // FIXME: implement separate blit mode
+
+ case JViewport.SIMPLE_SCROLL_MODE:
+ default:
+ paintSimple(g, port, view, pos, viewBounds, portBounds);
+ break;
+ }
+ }
+
+ private void paintSimple(Graphics g,
+ JViewport v,
+ Component view,
+ Point pos,
+ Rectangle viewBounds,
+ Rectangle portBounds)
+ {
+ Rectangle oldClip = g.getClipBounds ();
+ g.setClip (oldClip.intersection (viewBounds));
+ g.translate (-pos.x, -pos.y);
+ try
+ {
+ view.paint(g);
+ }
+ finally
+ {
+ g.translate (pos.x, pos.y);
+ g.setClip (oldClip);
+ }
+ }
+
+ private void paintBackingStore(Graphics g,
+ JViewport v,
+ Component view,
+ Point pos,
+ Rectangle viewBounds,
+ Rectangle portBounds)
+ {
if (backingStoreImage == null
|| backingStoreWidth != viewBounds.width
|| backingStoreHeight != viewBounds.height)
@@ -148,18 +193,17 @@ public class BasicViewportUI extends ViewportUI
Graphics g2 = backingStoreImage.getGraphics();
-
- if (c.getBackground() != null)
+ if (v.getBackground() != null)
{
// fill the backing store background
java.awt.Color save = g2.getColor();
- g2.setColor(c.getBackground());
+ g2.setColor(v.getBackground());
g2.fillRect (0, 0, backingStoreWidth, backingStoreHeight);
g2.setColor(save);
// fill the viewport background
save = g.getColor();
- g.setColor(c.getBackground());
+ g.setColor(v.getBackground());
g.fillRect (0, 0, portBounds.width, portBounds.height);
g.setColor(save);
diff --git a/libjava/javax/swing/plaf/basic/ComboPopup.java b/libjava/javax/swing/plaf/basic/ComboPopup.java
index d4ef1f2..4cd518d 100644
--- a/libjava/javax/swing/plaf/basic/ComboPopup.java
+++ b/libjava/javax/swing/plaf/basic/ComboPopup.java
@@ -1,4 +1,4 @@
-/* ComboPopup.java
+/* ComboPopup.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,14 +35,14 @@ 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.KeyListener;
-import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
-import javax.swing.JList;
+import javax.swing.JList;
public interface ComboPopup
{
diff --git a/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java b/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java
index 20becaf..fb6f27b 100644
--- a/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java
+++ b/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -43,7 +43,9 @@ import javax.swing.UIDefaults;
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"; }
diff --git a/libjava/javax/swing/table/AbstractTableModel.java b/libjava/javax/swing/table/AbstractTableModel.java
index dd8eb69..076487f 100644
--- a/libjava/javax/swing/table/AbstractTableModel.java
+++ b/libjava/javax/swing/table/AbstractTableModel.java
@@ -1,5 +1,5 @@
/* AbstractTableModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,12 @@ 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.table;
import java.io.Serializable;
import java.util.EventListener;
+
import javax.swing.event.EventListenerList;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
diff --git a/libjava/javax/swing/table/DefaultTableCellRenderer.java b/libjava/javax/swing/table/DefaultTableCellRenderer.java
index ef82988..ac5edb9 100644
--- a/libjava/javax/swing/table/DefaultTableCellRenderer.java
+++ b/libjava/javax/swing/table/DefaultTableCellRenderer.java
@@ -1,4 +1,4 @@
-/* DefaultTableCellRenderer.java
+/* DefaultTableCellRenderer.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,14 @@ 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.table;
import java.awt.Color;
import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serializable;
+
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.border.Border;
diff --git a/libjava/javax/swing/table/DefaultTableColumnModel.java b/libjava/javax/swing/table/DefaultTableColumnModel.java
index d7a3c35..b66b695 100644
--- a/libjava/javax/swing/table/DefaultTableColumnModel.java
+++ b/libjava/javax/swing/table/DefaultTableColumnModel.java
@@ -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.table;
import java.beans.PropertyChangeEvent;
@@ -43,8 +44,9 @@ import java.io.Serializable;
import java.util.Enumeration;
import java.util.EventListener;
import java.util.Vector;
-import javax.swing.ListSelectionModel;
+
import javax.swing.DefaultListSelectionModel;
+import javax.swing.ListSelectionModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.EventListenerList;
import javax.swing.event.ListSelectionEvent;
@@ -52,7 +54,6 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
-
/**
* DefaultTableColumnModel
* @author Andrew Selkirk
@@ -288,26 +289,35 @@ public class DefaultTableColumnModel
/**
* addColumnModelListener
- * @param value0 TODO
+ * @param listener the listener to add
*/
public void addColumnModelListener(TableColumnModelListener listener)
{
listenerList.add(TableColumnModelListener.class, listener);
}
- /**
- * removeColumnModelListener
- * @param value0 TODO
- */
- public void removeColumnModelListener(TableColumnModelListener value0)
+ /**
+ * removeColumnModelListener
+ * @param listener the listener to remove
+ */
+ public void removeColumnModelListener(TableColumnModelListener listener)
{
- // TODO
+ listenerList.remove(TableColumnModelListener.class, listener);
}
- /**
- * fireColumnAdded
- * @param value0 TODO
- */
+ /**
+ * @since 1.4
+ */
+ public TableColumnModelListener[] getColumnModelListeners()
+ {
+ return (TableColumnModelListener[])
+ listenerList.getListeners(TableColumnModelListener.class);
+ }
+
+ /**
+ * fireColumnAdded
+ * @param value0 TODO
+ */
protected void fireColumnAdded(TableColumnModelEvent value0)
{
// TODO
diff --git a/libjava/javax/swing/table/DefaultTableModel.java b/libjava/javax/swing/table/DefaultTableModel.java
index 8e11130..dd8e3b8 100644
--- a/libjava/javax/swing/table/DefaultTableModel.java
+++ b/libjava/javax/swing/table/DefaultTableModel.java
@@ -1,5 +1,5 @@
/* DefaultTableModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package javax.swing.table;
import java.io.Serializable;
import java.util.Vector;
+
import javax.swing.event.TableModelEvent;
/**
diff --git a/libjava/javax/swing/table/JTableHeader.java b/libjava/javax/swing/table/JTableHeader.java
index 9e55647..95ff920 100644
--- a/libjava/javax/swing/table/JTableHeader.java
+++ b/libjava/javax/swing/table/JTableHeader.java
@@ -1,4 +1,4 @@
-/* JTableHeader.java
+/* JTableHeader.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package javax.swing.table;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
@@ -47,7 +45,7 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
-import java.beans.PropertyChangeEvent;
+import java.awt.event.FocusListener;
import java.beans.PropertyChangeListener;
import java.util.Locale;
@@ -55,9 +53,9 @@ import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleSelection;
import javax.accessibility.AccessibleStateSet;
-import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleText;
import javax.accessibility.AccessibleValue;
import javax.swing.JComponent;
@@ -76,178 +74,222 @@ public class JTableHeader extends JComponent
{
throw new Error("not implemented");
}
+
public void addPropertyChangeListener(PropertyChangeListener l)
{
throw new Error("not implemented");
}
+
public boolean contains(Point p)
{
throw new Error("not implemented");
}
+
public AccessibleAction getAccessibleAction()
{
throw new Error("not implemented");
}
+
public Accessible getAccessibleAt(Point p)
{
throw new Error("not implemented");
}
+
public Accessible getAccessibleChild(int i)
{
throw new Error("not implemented");
}
+
public int getAccessibleChildrenCount()
{
throw new Error("not implemented");
}
+
public AccessibleComponent getAccessibleComponent()
{
throw new Error("not implemented");
}
+
public AccessibleContext getAccessibleContext()
{
throw new Error("not implemented");
}
+
public String getAccessibleDescription()
{
throw new Error("not implemented");
}
+
public int getAccessibleIndexInParent()
{
throw new Error("not implemented");
}
+
public String getAccessibleName()
{
throw new Error("not implemented");
}
+
public AccessibleRole getAccessibleRole()
{
throw new Error("not implemented");
}
+
public AccessibleSelection getAccessibleSelection()
{
throw new Error("not implemented");
}
+
public AccessibleStateSet getAccessibleStateSet()
{
throw new Error("not implemented");
}
+
public AccessibleText getAccessibleText()
{
throw new Error("not implemented");
}
+
public AccessibleValue getAccessibleValue()
{
throw new Error("not implemented");
}
+
public Color getBackground()
{
throw new Error("not implemented");
}
+
public Rectangle getBounds()
{
throw new Error("not implemented");
}
+
public Cursor getCursor()
{
throw new Error("not implemented");
}
+
public Font getFont()
{
throw new Error("not implemented");
}
+
public FontMetrics getFontMetrics(Font f)
{
throw new Error("not implemented");
}
+
public Color getForeground()
{
throw new Error("not implemented");
}
+
public Locale getLocale()
{
throw new Error("not implemented");
}
+
public Point getLocation()
{
throw new Error("not implemented");
}
+
public Point getLocationOnScreen()
{
throw new Error("not implemented");
}
+
public Dimension getSize()
{
throw new Error("not implemented");
}
+
public boolean isEnabled()
{
throw new Error("not implemented");
}
+
public boolean isFocusTraversable()
{
throw new Error("not implemented");
}
+
public boolean isShowing()
{
throw new Error("not implemented");
}
+
public boolean isVisible()
{
throw new Error("not implemented");
}
+
public void removeFocusListener(FocusListener l)
{
throw new Error("not implemented");
}
+
public void removePropertyChangeListener(PropertyChangeListener l)
{
throw new Error("not implemented");
}
+
public void requestFocus()
{
throw new Error("not implemented");
}
+
public void setAccessibleDescription(String s)
{
throw new Error("not implemented");
}
+
public void setAccessibleName(String s)
{
throw new Error("not implemented");
}
+
public void setBackground(Color c)
{
throw new Error("not implemented");
}
+
public void setBounds(Rectangle r)
{
throw new Error("not implemented");
}
+
public void setCursor(Cursor c)
{
throw new Error("not implemented");
}
+
public void setEnabled(boolean b)
{
throw new Error("not implemented");
}
+
public void setFont(Font f)
{
throw new Error("not implemented");
}
+
public void setForeground(Color c)
{
throw new Error("not implemented");
}
+
public void setLocation(Point p)
{
throw new Error("not implemented");
}
+
public void setSize(Dimension d)
{
throw new Error("not implemented");
}
+
public void setVisible(boolean b)
{
throw new Error("not implemented");
@@ -265,17 +307,17 @@ public class JTableHeader extends JComponent
/**
* The columnModel property.
*/
- TableColumnModel columnModel;
+ protected TableColumnModel columnModel;
/**
* The draggedColumn property.
*/
- TableColumn draggedColumn;
+ protected TableColumn draggedColumn;
/**
* The draggedDistance property.
*/
- int draggedDistance;
+ protected int draggedDistance;
/**
* The opaque property.
@@ -285,27 +327,27 @@ public class JTableHeader extends JComponent
/**
* The reorderingAllowed property.
*/
- boolean reorderingAllowed;
+ protected boolean reorderingAllowed;
/**
* The resizingAllowed property.
*/
- boolean resizingAllowed;
+ protected boolean resizingAllowed = true;
/**
* The resizingColumn property.
*/
- TableColumn resizingColumn;
+ protected TableColumn resizingColumn;
/**
* The table property.
*/
- JTable table;
+ protected JTable table;
/**
* The updateTableInRealTime property.
*/
- boolean updateTableInRealTime;
+ protected boolean updateTableInRealTime;
TableCellRenderer cellRenderer;
@@ -317,7 +359,7 @@ public class JTableHeader extends JComponent
public JTableHeader(TableColumnModel cm)
{
accessibleContext = new AccessibleJTableHeader();
- columnModel = cm == null ? createDefaultTableColumnModel() : cm;
+ columnModel = cm == null ? createDefaultColumnModel() : cm;
draggedColumn = null;
draggedDistance = 0;
opaque = true;
@@ -330,12 +372,11 @@ public class JTableHeader extends JComponent
updateUI();
}
- protected TableColumnModel createDefaultTableColumnModel()
+ protected TableColumnModel createDefaultColumnModel()
{
return new DefaultTableColumnModel();
}
-
/**
* Get the value of the {@link #accessibleContext} property.
*
@@ -536,6 +577,11 @@ public class JTableHeader extends JComponent
return cellRenderer;
}
+ public void setDefaultRenderer(TableCellRenderer cellRenderer)
+ {
+ this.cellRenderer = cellRenderer;
+ }
+
public Rectangle getHeaderRect(int column)
{
Rectangle r = getTable().getCellRect(-1, column, true);
diff --git a/libjava/javax/swing/table/TableCellEditor.java b/libjava/javax/swing/table/TableCellEditor.java
index bb7904e..d83812c 100644
--- a/libjava/javax/swing/table/TableCellEditor.java
+++ b/libjava/javax/swing/table/TableCellEditor.java
@@ -1,5 +1,5 @@
/* TableCellEditor.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,13 @@ 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.table;
-// Imports
import java.awt.Component;
-import javax.swing.JTable;
+
import javax.swing.CellEditor;
+import javax.swing.JTable;
/**
* TableCellEditor public interface
diff --git a/libjava/javax/swing/table/TableCellRenderer.java b/libjava/javax/swing/table/TableCellRenderer.java
index 6ad91c7..580226b 100644
--- a/libjava/javax/swing/table/TableCellRenderer.java
+++ b/libjava/javax/swing/table/TableCellRenderer.java
@@ -1,5 +1,5 @@
/* TableCellRenderer.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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.table;
-// Imports
import java.awt.Component;
+
import javax.swing.JTable;
/**
diff --git a/libjava/javax/swing/table/TableColumn.java b/libjava/javax/swing/table/TableColumn.java
index 02ef7f8..0aaad8b 100644
--- a/libjava/javax/swing/table/TableColumn.java
+++ b/libjava/javax/swing/table/TableColumn.java
@@ -1,5 +1,5 @@
/* TableColumn.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,13 @@ 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.table;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
-import javax.swing.event.SwingPropertyChangeSupport;
+import javax.swing.event.SwingPropertyChangeSupport;
/**
* TableColumn
@@ -52,89 +53,91 @@ public class TableColumn
{
static final long serialVersionUID = -6113660025878112608L;
- /**
- * COLUMN_WIDTH_PROPERTY
- */
- public static final String COLUMN_WIDTH_PROPERTY = "columWidth";
+ /**
+ * COLUMN_WIDTH_PROPERTY
+ */
+ public static final String COLUMN_WIDTH_PROPERTY = "columWidth";
- /**
- * HEADER_VALUE_PROPERTY
- */
- public static final String HEADER_VALUE_PROPERTY = "headerValue";
+ /**
+ * HEADER_VALUE_PROPERTY
+ */
+ public static final String HEADER_VALUE_PROPERTY = "headerValue";
- /**
- * HEADER_RENDERER_PROPERTY
- */
- public static final String HEADER_RENDERER_PROPERTY = "headerRenderer";
+ /**
+ * HEADER_RENDERER_PROPERTY
+ */
+ public static final String HEADER_RENDERER_PROPERTY = "headerRenderer";
- /**
- * CELL_RENDERER_PROPERTY
- */
- public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
+ /**
+ * CELL_RENDERER_PROPERTY
+ */
+ public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
- /**
- * modelIndex
- */
- protected int modelIndex;
+ /**
+ * modelIndex
+ */
+ protected int modelIndex;
- /**
- * identifier
- */
- protected Object identifier;
+ /**
+ * identifier
+ */
+ protected Object identifier;
- /**
- * width
- */
- protected int width;
+ /**
+ * width
+ */
+ protected int width;
- /**
- * minWidth
- */
- protected int minWidth = 15;
+ /**
+ * minWidth
+ */
+ protected int minWidth = 15;
- /**
- * preferredWidth
- */
- private int preferredWidth;
+ /**
+ * preferredWidth
+ */
+ private int preferredWidth;
- /**
- * maxWidth
- */
- protected int maxWidth = Integer.MAX_VALUE;
+ /**
+ * maxWidth
+ */
+ protected int maxWidth = Integer.MAX_VALUE;
- /**
- * headerRenderer
- */
- protected TableCellRenderer headerRenderer;
+ /**
+ * headerRenderer
+ */
+ protected TableCellRenderer headerRenderer;
- /**
- * headerValue
- */
- protected Object headerValue;
+ /**
+ * headerValue
+ */
+ protected Object headerValue;
- /**
- * cellRenderer
- */
- protected TableCellRenderer cellRenderer;
+ /**
+ * cellRenderer
+ */
+ protected TableCellRenderer cellRenderer;
- /**
- * cellEditor
- */
- protected TableCellEditor cellEditor;
+ /**
+ * cellEditor
+ */
+ protected TableCellEditor cellEditor;
- /**
- * isResizable
- */
- protected boolean isResizable = true;
+ /**
+ * isResizable
+ */
+ protected boolean isResizable = true;
- /**
- * resizedPostingDisableCount
- */
- protected transient int resizedPostingDisableCount;
+ /**
+ * resizedPostingDisableCount
+ *
+ * @deprecated 1.3
+ */
+ protected transient int resizedPostingDisableCount;
- /**
- * changeSupport
- */
+ /**
+ * changeSupport
+ */
private SwingPropertyChangeSupport changeSupport =
new SwingPropertyChangeSupport(this);
@@ -215,14 +218,15 @@ public class TableColumn
*/
private void firePropertyChange(String property, boolean oldValue,
boolean newValue)
- {
- firePropertyChange(property, new Boolean(oldValue), new Boolean(newValue));
- }
+ {
+ firePropertyChange(property, Boolean.valueOf(oldValue),
+ Boolean.valueOf(newValue));
+ }
- /**
- * setModelIndex
- * @param modelIndex TODO
- */
+ /**
+ * setModelIndex
+ * @param modelIndex TODO
+ */
public void setModelIndex(int modelIndex)
{
this.modelIndex = modelIndex;
@@ -470,17 +474,21 @@ public class TableColumn
// TODO
}
- /**
- * disableResizedPosting
- */
+ /**
+ * disableResizedPosting
+ *
+ * @deprecated 1.3
+ */
public void disableResizedPosting()
{
// Does nothing
}
- /**
- * enableResizedPosting
- */
+ /**
+ * enableResizedPosting
+ *
+ * @deprecated 1.3
+ */
public void enableResizedPosting()
{
// Does nothing
@@ -504,8 +512,16 @@ public class TableColumn
changeSupport.removePropertyChangeListener(listener);
}
- /**
- * createDefaultHeaderRenderer
+ /**
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ /**
+ * createDefaultHeaderRenderer
* @return TableCellRenderer
*/
protected TableCellRenderer createDefaultHeaderRenderer()
diff --git a/libjava/javax/swing/table/TableColumnModel.java b/libjava/javax/swing/table/TableColumnModel.java
index ef0897d..b825ca0 100644
--- a/libjava/javax/swing/table/TableColumnModel.java
+++ b/libjava/javax/swing/table/TableColumnModel.java
@@ -1,5 +1,5 @@
/* TableColumnModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,13 +35,14 @@ 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.table;
import java.util.Enumeration;
+
import javax.swing.ListSelectionModel;
import javax.swing.event.TableColumnModelListener;
-
/**
* TableColumnModel public interface
* @author Andrew Selkirk
diff --git a/libjava/javax/swing/text/AbstractDocument.java b/libjava/javax/swing/text/AbstractDocument.java
index a7c8c90..f579fbb 100644
--- a/libjava/javax/swing/text/AbstractDocument.java
+++ b/libjava/javax/swing/text/AbstractDocument.java
@@ -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;
@@ -43,6 +44,7 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.EventListener;
import java.util.Vector;
+
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.EventListenerList;
@@ -53,7 +55,6 @@ import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CompoundEdit;
import javax.swing.undo.UndoableEdit;
-
public abstract class AbstractDocument
implements Document, Serializable
{
diff --git a/libjava/javax/swing/text/AttributeSet.java b/libjava/javax/swing/text/AttributeSet.java
index 3f38a4c..68d36bc 100644
--- a/libjava/javax/swing/text/AttributeSet.java
+++ b/libjava/javax/swing/text/AttributeSet.java
@@ -57,8 +57,8 @@ public interface AttributeSet
{
}
- static Object NameAttribute = StyleConstants.NameAttribute;
- static Object ResolveAttribute = StyleConstants.ResolveAttribute;
+ Object NameAttribute = StyleConstants.NameAttribute;
+ Object ResolveAttribute = StyleConstants.ResolveAttribute;
boolean containsAttribute(Object name, Object value);
boolean containsAttributes(AttributeSet attributes);
diff --git a/libjava/javax/swing/text/Caret.java b/libjava/javax/swing/text/Caret.java
index 7393a75..62263a6 100644
--- a/libjava/javax/swing/text/Caret.java
+++ b/libjava/javax/swing/text/Caret.java
@@ -35,10 +35,12 @@ 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.Graphics;
import java.awt.Point;
+
import javax.swing.event.ChangeListener;
public interface Caret
diff --git a/libjava/javax/swing/text/DefaultCaret.java b/libjava/javax/swing/text/DefaultCaret.java
index 516f072..15a7669 100644
--- a/libjava/javax/swing/text/DefaultCaret.java
+++ b/libjava/javax/swing/text/DefaultCaret.java
@@ -37,7 +37,6 @@ exception statement from your version. */
package javax.swing.text;
-import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
diff --git a/libjava/javax/swing/text/DefaultEditorKit.java b/libjava/javax/swing/text/DefaultEditorKit.java
index 03d4ef3..0e3be20 100644
--- a/libjava/javax/swing/text/DefaultEditorKit.java
+++ b/libjava/javax/swing/text/DefaultEditorKit.java
@@ -35,19 +35,20 @@ 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.Toolkit;
import java.awt.event.ActionEvent;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
+
import javax.swing.Action;
import javax.swing.JEditorPane;
-
public class DefaultEditorKit extends EditorKit
{
public static class BeepAction
diff --git a/libjava/javax/swing/text/DefaultHighlighter.java b/libjava/javax/swing/text/DefaultHighlighter.java
index 234fcad..8d0491b 100644
--- a/libjava/javax/swing/text/DefaultHighlighter.java
+++ b/libjava/javax/swing/text/DefaultHighlighter.java
@@ -44,10 +44,6 @@ import java.awt.Rectangle;
import java.awt.Shape;
import java.util.Vector;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.View;
-
-
public class DefaultHighlighter extends LayeredHighlighter
{
public static class DefaultHighlightPainter
@@ -168,11 +164,22 @@ public class DefaultHighlighter extends LayeredHighlighter
private JTextComponent textComponent;
private Vector highlights = new Vector();
+ private boolean drawsLayeredHighlights = true;
public DefaultHighlighter()
{
}
+ public boolean getDrawsLayeredHighlights()
+ {
+ return drawsLayeredHighlights;
+ }
+
+ public void setDrawsLayeredHighlights(boolean newValue)
+ {
+ drawsLayeredHighlights = newValue;
+ }
+
private void checkPositions(int p0, int p1)
throws BadLocationException
{
diff --git a/libjava/javax/swing/text/Document.java b/libjava/javax/swing/text/Document.java
index d197924..d3bbabb 100644
--- a/libjava/javax/swing/text/Document.java
+++ b/libjava/javax/swing/text/Document.java
@@ -44,7 +44,7 @@ import javax.swing.event.UndoableEditListener;
public interface Document
{
String StreamDescriptionProperty = "stream";
- String TitleProperty = "text";
+ String TitleProperty = "title";
void addDocumentListener(DocumentListener listener);
diff --git a/libjava/javax/swing/text/DocumentFilter.java b/libjava/javax/swing/text/DocumentFilter.java
index 7a8e95d..ff96d07 100644
--- a/libjava/javax/swing/text/DocumentFilter.java
+++ b/libjava/javax/swing/text/DocumentFilter.java
@@ -1,5 +1,5 @@
/* DocumentFilter.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,4 +40,44 @@ package javax.swing.text;
public class DocumentFilter
{
+ public abstract static class FilterBypass
+ {
+ public FilterBypass()
+ {
+ // Do nothing here.
+ }
+
+ public abstract Document getDocument();
+
+ public abstract void insertString(int offset, String string,
+ AttributeSet attr)
+ throws BadLocationException;
+
+ public abstract void remove(int offset, int length)
+ throws BadLocationException;
+
+ public abstract void replace(int offset, int length, String string,
+ AttributeSet attrs)
+ throws BadLocationException;
+ }
+
+ public void insertString(DocumentFilter.FilterBypass fb, int offset,
+ String string, AttributeSet attr)
+ throws BadLocationException
+ {
+ fb.insertString(offset, string, attr);
+ }
+
+ public void remove(DocumentFilter.FilterBypass fb, int offset, int length)
+ throws BadLocationException
+ {
+ fb.remove(offset, length);
+ }
+
+ public void replace(DocumentFilter.FilterBypass fb, int offset, int length,
+ String text, AttributeSet attr)
+ throws BadLocationException
+ {
+ fb.replace(offset, length, text, attr);
+ }
}
diff --git a/libjava/javax/swing/text/EditorKit.java b/libjava/javax/swing/text/EditorKit.java
index 0609332..efca965 100644
--- a/libjava/javax/swing/text/EditorKit.java
+++ b/libjava/javax/swing/text/EditorKit.java
@@ -35,18 +35,19 @@ 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.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
+
import javax.swing.Action;
import javax.swing.JEditorPane;
-
public abstract class EditorKit
implements Cloneable, Serializable
{
diff --git a/libjava/javax/swing/text/FieldView.java b/libjava/javax/swing/text/FieldView.java
index 06514b7..3f1de37 100644
--- a/libjava/javax/swing/text/FieldView.java
+++ b/libjava/javax/swing/text/FieldView.java
@@ -43,7 +43,6 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Shape;
-
public class FieldView extends PlainView
{
public FieldView(Element elem)
@@ -79,7 +78,6 @@ public class FieldView extends PlainView
{
// This should never happen.
text = "";
- System.out.println("Michael: FieldView.getPreferredSpan: Error");
}
return fm.stringWidth(text);
diff --git a/libjava/javax/swing/text/GapContent.java b/libjava/javax/swing/text/GapContent.java
index 9344682..5826128 100644
--- a/libjava/javax/swing/text/GapContent.java
+++ b/libjava/javax/swing/text/GapContent.java
@@ -93,7 +93,7 @@ public class GapContent
public String getString(int where, int len) throws BadLocationException
{
- return buf.toString();
+ return buf.substring(where, where+len);
}
public void getChars(int where, int len, Segment txt)
diff --git a/libjava/javax/swing/text/Highlighter.java b/libjava/javax/swing/text/Highlighter.java
index 77471d1..affec9b 100644
--- a/libjava/javax/swing/text/Highlighter.java
+++ b/libjava/javax/swing/text/Highlighter.java
@@ -55,8 +55,7 @@ public interface Highlighter
public interface HighlightPainter
{
- public void paint(Graphics g, int p0, int p1, Shape bounds,
- JTextComponent c);
+ void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c);
}
void install(JTextComponent c);
diff --git a/libjava/javax/swing/text/JTextComponent.java b/libjava/javax/swing/text/JTextComponent.java
index ea69f5d..0bca84b 100644
--- a/libjava/javax/swing/text/JTextComponent.java
+++ b/libjava/javax/swing/text/JTextComponent.java
@@ -35,19 +35,17 @@ 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.AWTEvent;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
-import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.InputMethodListener;
import java.awt.event.KeyEvent;
-
import java.util.Enumeration;
import java.util.Hashtable;
@@ -58,7 +56,6 @@ import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleText;
import javax.swing.Action;
import javax.swing.ActionMap;
-import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JViewport;
@@ -73,7 +70,6 @@ import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TextUI;
-
public abstract class JTextComponent extends JComponent
implements Scrollable, Accessible
{
@@ -629,7 +625,7 @@ public abstract class JTextComponent extends JComponent
* @see #setKeymap()
* @see #keymap
*/
- Keymap getKeymap()
+ public Keymap getKeymap()
{
return keymap;
}
@@ -800,6 +796,7 @@ public abstract class JTextComponent extends JComponent
private Color selectionColor;
private boolean editable;
private Insets margin;
+ private boolean dragEnabled;
/**
* Creates a new <code>JTextComponent</code> instance.
@@ -921,6 +918,26 @@ public abstract class JTextComponent extends JComponent
}
/**
+ * Retrieves the currently selected text in this text document.
+ *
+ * @return the selected text
+ *
+ * @exception NullPointerException if the underlaying document is null
+ */
+ public String getSelectedText()
+ {
+ try
+ {
+ return doc.getText(getSelectionStart(), getSelectionEnd());
+ }
+ catch (BadLocationException e)
+ {
+ // This should never happen.
+ return null;
+ }
+ }
+
+ /**
* Returns a string that specifies the name of the Look and Feel class
* that renders this component.
*
@@ -998,12 +1015,16 @@ public abstract class JTextComponent extends JComponent
/**
* Enables/disabled this text component's editability.
*
- * @param editable true to make it editable, false otherwise.
+ * @param newValue true to make it editable, false otherwise.
*/
- public void setEditable(boolean editable)
+ public void setEditable(boolean newValue)
{
- firePropertyChange("editable", this.editable, editable);
- this.editable = editable;
+ if (editable == newValue)
+ return;
+
+ boolean oldValue = editable;
+ editable = newValue;
+ firePropertyChange("editable", oldValue, newValue);
}
/**
@@ -1225,17 +1246,22 @@ public abstract class JTextComponent extends JComponent
try
{
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+
// Remove selected text.
if (dot != mark)
- doc.remove(Math.min(dot, mark), Math.max(dot, mark));
+ doc.remove(start, end - start);
// Insert new text.
- doc.insertString(Math.min(dot, mark), content, null);
+ doc.insertString(start, content, null);
+
+ // Set dot to new position.
+ setCaretPosition(start + content.length());
}
catch (BadLocationException e)
{
// This should never happen.
- System.out.println("Michael: JTextComponent.replaceSelection: Error");
}
}
@@ -1333,4 +1359,14 @@ public abstract class JTextComponent extends JComponent
{
return getUI().modelToView(this, position);
}
+
+ public boolean getDragEnabled()
+ {
+ return dragEnabled;
+ }
+
+ public void setDragEnabled(boolean enabled)
+ {
+ dragEnabled = enabled;
+ }
}
diff --git a/libjava/javax/swing/text/LayeredHighlighter.java b/libjava/javax/swing/text/LayeredHighlighter.java
index 4593221..0b063e5 100644
--- a/libjava/javax/swing/text/LayeredHighlighter.java
+++ b/libjava/javax/swing/text/LayeredHighlighter.java
@@ -40,10 +40,6 @@ package javax.swing.text;
import java.awt.Graphics;
import java.awt.Shape;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.View;
-
-
public abstract class LayeredHighlighter
implements Highlighter
{
diff --git a/libjava/javax/swing/text/NavigationFilter.java b/libjava/javax/swing/text/NavigationFilter.java
index 37d1c38..cdf9e77 100644
--- a/libjava/javax/swing/text/NavigationFilter.java
+++ b/libjava/javax/swing/text/NavigationFilter.java
@@ -1,5 +1,5 @@
/* NavigationFilter.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,4 +40,32 @@ package javax.swing.text;
public class NavigationFilter
{
+ public abstract static class FilterBypass
+ {
+ public FilterBypass()
+ {
+ // Do nothing here.
+ }
+
+ public abstract Caret getCaret();
+ public abstract void moveDot(int dot, Position.Bias bias);
+ public abstract void setDot(int dot, Position.Bias bias);
+ }
+
+ public NavigationFilter()
+ {
+ // Do nothing here.
+ }
+
+ public void moveDot(NavigationFilter.FilterBypass fb, int dot,
+ Position.Bias bias)
+ {
+ fb.moveDot(dot, bias);
+ }
+
+ public void setDot(NavigationFilter.FilterBypass fb, int dot,
+ Position.Bias bias)
+ {
+ fb.setDot(dot, bias);
+ }
}
diff --git a/libjava/javax/swing/text/PasswordView.java b/libjava/javax/swing/text/PasswordView.java
new file mode 100644
index 0000000..f9db041
--- /dev/null
+++ b/libjava/javax/swing/text/PasswordView.java
@@ -0,0 +1,138 @@
+/* PasswordView.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.Graphics;
+
+import javax.swing.JPasswordField;
+
+public class PasswordView extends FieldView
+{
+ /**
+ * Buffer for putting the echo char into it and
+ * then using it to draw it into the view.
+ */
+ private char[] oneCharBuffer = new char[1];
+
+ public PasswordView(Element elem)
+ {
+ super(elem);
+ }
+
+ protected int drawEchoCharacter(Graphics g, int x, int y, char ch)
+ {
+ // Update font metrics.
+ updateMetrics();
+
+ // Draw character.
+ oneCharBuffer[0] = ch;
+ g.drawChars(oneCharBuffer, 0, 1, x, y);
+
+ // Return new x position right of drawn character.
+ return x + metrics.charWidth(ch);
+ }
+
+ private char getEchoChar()
+ {
+ char ch = ((JPasswordField) getContainer()).getEchoChar();
+
+ if (ch == 0)
+ ch = '*';
+
+ return ch;
+ }
+
+ protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ // FIXME: Throw BadLocationException somehow.
+
+ // Update font metrics.
+ updateMetrics();
+
+ // Get echo character.
+ char ch = getEchoChar();
+
+ // Set color for selected text.
+ g.setColor(selectedColor);
+ g.setColor(Color.BLACK);
+
+ // Initialize buffer for faster drawing of all characters.
+ int len = p1 - p0;
+ char[] buffer = new char[len];
+ for (int index = 0; index < len; ++index)
+ buffer[index] = ch;
+
+ // Draw echo charaters.
+ g.drawChars(buffer, 0, len, x, y);
+
+ // Return new x position right of all drawn characters.
+ return x + len * metrics.charWidth(ch);
+ }
+
+ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ // FIXME: Throw BadLocationException somehow.
+
+ // Update font metrics.
+ updateMetrics();
+
+ // Get echo character.
+ char ch = getEchoChar();
+
+ // Set color for unselected text.
+ g.setColor(unselectedColor);
+ g.setColor(Color.BLACK);
+
+ // Initialize buffer for faster drawing of all characters.
+ int len = p1 - p0;
+ char[] buffer = new char[len];
+ for (int index = 0; index < len; ++index)
+ buffer[index] = ch;
+
+ // Draw echo charaters.
+ g.drawChars(buffer, 0, len, x, y);
+
+ // Return new x position right of all drawn characters.
+ return x + len * metrics.charWidth(ch);
+ }
+}
+
diff --git a/libjava/javax/swing/text/PlainDocument.java b/libjava/javax/swing/text/PlainDocument.java
index 4a8adfc..2280870 100644
--- a/libjava/javax/swing/text/PlainDocument.java
+++ b/libjava/javax/swing/text/PlainDocument.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package javax.swing.text;
+import java.util.ArrayList;
+
public class PlainDocument extends AbstractDocument
{
private static final long serialVersionUID = 4758290289196893664L;
@@ -59,14 +61,53 @@ public class PlainDocument extends AbstractDocument
rootElement = createDefaultRoot();
}
+ protected void reindex()
+ {
+ Element[] lines;
+ try
+ {
+ String str = content.getString(0, content.length());
+
+ ArrayList elts = new ArrayList();
+ int j = 0;
+ for (int i = str.indexOf('\n', 0); i != -1; i = str.indexOf('\n', i+1))
+ {
+ elts.add(createLeafElement(rootElement, null, j, i));
+ j = i;
+ }
+
+ if (j < content.length())
+ elts.add(createLeafElement(rootElement, null, 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);
+ }
+
+ ((BranchElement) rootElement).replace(0, rootElement.getElementCount(), lines);
+ }
+
protected AbstractDocument.AbstractElement createDefaultRoot()
{
- BranchElement rootElement =
- (BranchElement) createBranchElement(null, null);
- Element[] lines = new Element[1];
- lines[0] = createLeafElement(rootElement, null, 0, 1);
- rootElement.replace(0, 0, lines);
- return rootElement;
+ rootElement = createBranchElement(null, null);
+ reindex();
+ return (AbstractElement) rootElement;
+ }
+
+ protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)
+ {
+ reindex();
+ }
+
+ protected void removeUpdate(DefaultDocumentEvent chng)
+ {
+ reindex();
}
public Element getDefaultRootElement()
diff --git a/libjava/javax/swing/text/PlainView.java b/libjava/javax/swing/text/PlainView.java
index 3dd8fe4..bcec353 100644
--- a/libjava/javax/swing/text/PlainView.java
+++ b/libjava/javax/swing/text/PlainView.java
@@ -50,9 +50,9 @@ import java.awt.Shape;
public class PlainView extends View
implements TabExpander
{
- private Color selectedColor;
- private Color unselectedColor;
- private Font font;
+ Color selectedColor;
+ Color unselectedColor;
+ Font font;
protected FontMetrics metrics;
@@ -130,7 +130,7 @@ public class PlainView extends View
}
}
- public int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+ protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
g.setColor(selectedColor);
@@ -139,7 +139,7 @@ public class PlainView extends View
return Utilities.drawTabbedText(segment, x, y, g, this, 0);
}
- public int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
g.setColor(unselectedColor);
diff --git a/libjava/javax/swing/text/SimpleAttributeSet.java b/libjava/javax/swing/text/SimpleAttributeSet.java
index 746056d..1578a48 100644
--- a/libjava/javax/swing/text/SimpleAttributeSet.java
+++ b/libjava/javax/swing/text/SimpleAttributeSet.java
@@ -35,19 +35,19 @@ 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.Enumeration;
import java.util.Hashtable;
-import java.lang.Cloneable;
public class SimpleAttributeSet
implements MutableAttributeSet, Serializable, Cloneable
{
- Hashtable tab;
+ public static final AttributeSet EMPTY = new SimpleAttributeSet();
- static AttributeSet EMPTY = new SimpleAttributeSet();
+ Hashtable tab;
public SimpleAttributeSet()
{
@@ -57,7 +57,8 @@ public class SimpleAttributeSet
public SimpleAttributeSet(AttributeSet a)
{
tab = new Hashtable();
- addAttributes(a);
+ if (a != null)
+ addAttributes(a);
}
public void addAttribute(Object name, Object value)
diff --git a/libjava/javax/swing/text/StyleConstants.java b/libjava/javax/swing/text/StyleConstants.java
index 2201c47..e1232af 100644
--- a/libjava/javax/swing/text/StyleConstants.java
+++ b/libjava/javax/swing/text/StyleConstants.java
@@ -35,16 +35,55 @@ 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.Component;
+
import javax.swing.Icon;
public class StyleConstants
{
+ public static final int ALIGN_LEFT = 0;
+ public static final int ALIGN_CENTER = 1;
+ public static final int ALIGN_RIGHT = 2;
+ public static final int ALIGN_JUSTIFIED = 3;
+
+ public static final Object Background = CharacterConstants.Background;
+ public static final Object BidiLevel = CharacterConstants.BidiLevel;
+ public static final Object Bold = CharacterConstants.Bold;
+ public static final Object ComponentAttribute = CharacterConstants.ComponentAttribute;
+ public static final Object FontFamily = CharacterConstants.Family;
+ public static final Object FontSize = CharacterConstants.Size;
+ public static final Object Foreground = CharacterConstants.Foreground;
+ public static final Object IconAttribute = CharacterConstants.IconAttribute;
+ public static final Object Italic = CharacterConstants.Italic;
+ public static final Object StrikeThrough = CharacterConstants.StrikeThrough;
+ public static final Object Subscript = CharacterConstants.Subscript;
+ public static final Object Superscript = CharacterConstants.Superscript;
+ public static final Object Underline = CharacterConstants.Underline;
+
+ public static final Object Alignment = ParagraphConstants.Alignment;
+ public static final Object FirstLineIndent = ParagraphConstants.FirstLineIndent;
+ public static final Object LeftIndent = ParagraphConstants.LeftIndent;
+ public static final Object LineSpacing = ParagraphConstants.LineSpacing;
+ public static final Object Orientation = ParagraphConstants.Orientation;
+ public static final Object RightIndent = ParagraphConstants.RightIndent;
+ public static final Object SpaceAbove = ParagraphConstants.SpaceAbove;
+ public static final Object SpaceBelow = ParagraphConstants.SpaceBelow;
+ public static final Object TabSet = ParagraphConstants.TabSet;
+
+ public static final String ComponentElementName = "component";
+ public static final String IconElementName = "icon";
+
+ public static final Object ComposedTextAttribute = new StyleConstants("composed text");
+ public static final Object ModelAttribute = new StyleConstants("model");
+ public static final Object NameAttribute = new StyleConstants("name");
+ public static final Object ResolveAttribute = new StyleConstants("resolver");
String keyname;
+
private StyleConstants(String k)
{
keyname = k;
@@ -55,43 +94,6 @@ public class StyleConstants
return keyname;
}
- public static int ALIGN_CENTER;
- public static int ALIGN_JUSTIFIED;
- public static int ALIGN_LEFT;
- public static int ALIGN_RIGHT;
-
- public static Object Background = CharacterConstants.Background;
- public static Object BidiLevel = CharacterConstants.BidiLevel;
- public static Object Bold = CharacterConstants.Bold;
- public static Object ComponentAttribute = CharacterConstants.ComponentAttribute;
- public static Object FontFamily = CharacterConstants.Family;
- public static Object FontSize = CharacterConstants.Size;
- public static Object Foreground = CharacterConstants.Foreground;
- public static Object IconAttribute = CharacterConstants.IconAttribute;
- public static Object Italic = CharacterConstants.Italic;
- public static Object StrikeThrough = CharacterConstants.StrikeThrough;
- public static Object Subscript = CharacterConstants.Subscript;
- public static Object Superscript = CharacterConstants.Superscript;
- public static Object Underline = CharacterConstants.Underline;
-
- public static Object Alignment = ParagraphConstants.Alignment;
- public static Object FirstLineIndent = ParagraphConstants.FirstLineIndent;
- public static Object LeftIndent = ParagraphConstants.LeftIndent;
- public static Object LineSpacing = ParagraphConstants.LineSpacing;
- public static Object Orientation = ParagraphConstants.Orientation;
- public static Object RightIndent = ParagraphConstants.RightIndent;
- public static Object SpaceAbove = ParagraphConstants.SpaceAbove;
- public static Object SpaceBelow = ParagraphConstants.SpaceBelow;
- public static Object TabSet = ParagraphConstants.TabSet;
-
- public static String ComponentElementName = new String("component");
- public static String IconElementName = new String("icon");
-
- public static Object ComposedTextAttribute = new StyleConstants("composed text");
- public static Object ModelAttribute = new StyleConstants("model");
- public static Object NameAttribute = new StyleConstants("name");
- public static Object ResolveAttribute = new StyleConstants("resolver");
-
public static int getAlignment(AttributeSet a)
{
if (a.isDefined(Alignment))
@@ -277,7 +279,7 @@ public class StyleConstants
public static void setBold(MutableAttributeSet a, boolean b)
{
- a.addAttribute(Bold, new Boolean(b));
+ a.addAttribute(Bold, Boolean.valueOf(b));
}
public static void setComponent(MutableAttributeSet a, Component c)
@@ -312,7 +314,7 @@ public class StyleConstants
public static void setItalic(MutableAttributeSet a, boolean b)
{
- a.addAttribute(Italic, new Boolean(b));
+ a.addAttribute(Italic, Boolean.valueOf(b));
}
public static void setLeftIndent(MutableAttributeSet a, float i)
@@ -342,17 +344,17 @@ public class StyleConstants
public static void setStrikeThrough(MutableAttributeSet a, boolean b)
{
- a.addAttribute(StrikeThrough, new Boolean(b));
+ a.addAttribute(StrikeThrough, Boolean.valueOf(b));
}
public static void setSubscript(MutableAttributeSet a, boolean b)
{
- a.addAttribute(Subscript, new Boolean(b));
+ a.addAttribute(Subscript, Boolean.valueOf(b));
}
public static void setSuperscript(MutableAttributeSet a, boolean b)
{
- a.addAttribute(Superscript, new Boolean(b));
+ a.addAttribute(Superscript, Boolean.valueOf(b));
}
public static void setTabSet(MutableAttributeSet a, javax.swing.text.TabSet tabs)
@@ -362,7 +364,7 @@ public class StyleConstants
public static void setUnderline(MutableAttributeSet a, boolean b)
{
- a.addAttribute(Underline, new Boolean(b));
+ a.addAttribute(Underline, Boolean.valueOf(b));
}
// The remainder are so-called "typesafe enumerations" which
diff --git a/libjava/javax/swing/text/StyleContext.java b/libjava/javax/swing/text/StyleContext.java
index 8accd9b..beb809b 100644
--- a/libjava/javax/swing/text/StyleContext.java
+++ b/libjava/javax/swing/text/StyleContext.java
@@ -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.Color;
@@ -45,13 +46,14 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import javax.swing.event.EventListenerList;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
import java.util.Enumeration;
import java.util.EventListener;
import java.util.Hashtable;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
public class StyleContext
implements Serializable, AbstractDocument.AttributeContext
{
diff --git a/libjava/javax/swing/text/StyledEditorKit.java b/libjava/javax/swing/text/StyledEditorKit.java
index d3db03e..f185830 100644
--- a/libjava/javax/swing/text/StyledEditorKit.java
+++ b/libjava/javax/swing/text/StyledEditorKit.java
@@ -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.Color;
@@ -42,12 +43,12 @@ import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
+
import javax.swing.Action;
import javax.swing.JEditorPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
-
/**
* StyledEditorKit
*
diff --git a/libjava/javax/swing/text/TextAction.java b/libjava/javax/swing/text/TextAction.java
index 029eed9..d07bcbf 100644
--- a/libjava/javax/swing/text/TextAction.java
+++ b/libjava/javax/swing/text/TextAction.java
@@ -35,13 +35,14 @@ 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.event.ActionEvent;
+
import javax.swing.AbstractAction;
import javax.swing.Action;
-
/**
* TextAction
* @author Andrew Selkirk
diff --git a/libjava/javax/swing/text/Utilities.java b/libjava/javax/swing/text/Utilities.java
index 61c13ee..6d2b546 100644
--- a/libjava/javax/swing/text/Utilities.java
+++ b/libjava/javax/swing/text/Utilities.java
@@ -91,13 +91,29 @@ public class Utilities
FontMetrics metrics = g.getFontMetrics();
int ascent = metrics.getAscent();
+ int pixelWidth = 0;
+ int pos = 0;
+ int len = 0;
+
for (int offset = s.offset; offset < (s.offset + s.count); ++offset)
{
- switch (buffer[offset])
+ char c = buffer[offset];
+ if (c == '\t' || c == '\n')
+ {
+ if (len > 0) {
+ g.drawChars(buffer, pos, len, pixelX, pixelY + ascent);
+ pixelX += pixelWidth;
+ pixelWidth = 0;
+ }
+ pos = offset+1;
+ len = 0;
+ }
+
+ switch (c)
{
case '\t':
// In case we have a tab, we just 'jump' over the tab.
- // When we have no tab expander we just use the width of 'm'.
+ // When we have no tab expander we just use the width of ' '.
if (e != null)
pixelX = (int) e.nextTabStop((float) pixelX,
startOffset + offset - s.offset);
@@ -105,20 +121,20 @@ public class Utilities
pixelX += metrics.charWidth(' ');
break;
case '\n':
- // In case we have a newline, we must draw
- // the buffer and jump on the next line.
- g.drawChars(buffer, offset, 1, pixelX, y);
+ // In case we have a newline, we must jump to the next line.
pixelY += metrics.getHeight();
pixelX = x;
break;
default:
- // Here we draw the char.
- g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent);
- pixelX += metrics.charWidth(buffer[offset]);
+ ++len;
+ pixelWidth += metrics.charWidth(buffer[offset]);
break;
}
}
+ if (len > 0)
+ g.drawChars(buffer, pos, len, pixelX, pixelY + ascent);
+
return pixelX;
}
diff --git a/libjava/javax/swing/text/View.java b/libjava/javax/swing/text/View.java
index 730753a..f9e44a9 100644
--- a/libjava/javax/swing/text/View.java
+++ b/libjava/javax/swing/text/View.java
@@ -40,7 +40,7 @@ package javax.swing.text;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Shape;
-import java.util.Vector;
+
import javax.swing.SwingConstants;
public abstract class View implements SwingConstants
diff --git a/libjava/javax/swing/text/html/HTML.java b/libjava/javax/swing/text/html/HTML.java
index 7a24036..098a147 100644
--- a/libjava/javax/swing/text/html/HTML.java
+++ b/libjava/javax/swing/text/html/HTML.java
@@ -59,6 +59,11 @@ public class HTML
public static class UnknownTag extends Tag implements Serializable
{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -1534369342247250625L;
+
public UnknownTag(String id)
{
super(id);
diff --git a/libjava/javax/swing/tree/AbstractLayoutCache.java b/libjava/javax/swing/tree/AbstractLayoutCache.java
index 4362684..6fb75f7 100644
--- a/libjava/javax/swing/tree/AbstractLayoutCache.java
+++ b/libjava/javax/swing/tree/AbstractLayoutCache.java
@@ -1,5 +1,5 @@
/* AbstractLayoutCache.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,58 +40,43 @@ package javax.swing.tree;
import java.awt.Rectangle;
import java.util.Enumeration;
+
import javax.swing.event.TreeModelEvent;
/**
- * AbstractLayoutCache
+ * class AbstractLayoutCache
+ *
* @author Andrew Selkirk
*/
public abstract class AbstractLayoutCache implements RowMapper
{
-
- //-------------------------------------------------------------
- // Classes ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
- * NodeDimensions
+ * class NodeDimensions
*/
- public abstract static class NodeDimensions {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
+ public abstract static class NodeDimensions
+ {
/**
- * Constructor NodeDimensions
+ * Creates <code>NodeDimensions</code> object.
*/
- public NodeDimensions() {
- // TODO
- } // NodeDimensions()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ public NodeDimensions()
+ {
+ // Do nothing here.
+ }
/**
* getNodeDimensions
+ *
* @param value0 TODO
* @param value1 TODO
* @param value2 TODO
* @param value3 TODO
* @param value4 TODO
- * @returns Rectangle
+ * @return Rectangle
*/
- public abstract Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4);
-
-
- } // NodeDimensions
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
+ public abstract Rectangle getNodeDimensions(Object value0, int value1,
+ int value2, boolean value3,
+ Rectangle value4);
+ }
/**
* nodeDimensions
@@ -118,201 +103,241 @@ public abstract class AbstractLayoutCache implements RowMapper
*/
protected int rowHeight;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AbstractLayoutCache
*/
- public AbstractLayoutCache() {
- // TODO
- } // AbstractLayoutCache()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ public AbstractLayoutCache()
+ {
+ // Do nothing here.
+ }
/**
* setNodeDimensions
- * @param value0 TODO
+ *
+ * @param dimensions TODO
*/
- public void setNodeDimensions(NodeDimensions value0) {
- // TODO
- } // setNodeDimensions()
+ public void setNodeDimensions(NodeDimensions dimensions)
+ {
+ nodeDimensions = dimensions;
+ }
/**
* getNodeDimensions
- * @returns NodeDimensions
+ *
+ * @return NodeDimensions
*/
- public NodeDimensions getNodeDimensions() {
- return null; // TODO
- } // getNodeDimensions()
+ public NodeDimensions getNodeDimensions()
+ {
+ return nodeDimensions;
+ }
/**
* getNodeDimensions
+ *
* @param value0 TODO
* @param value1 TODO
* @param value2 TODO
* @param value3 TODO
* @param value4 TODO
- * @returns Rectangle
+ *
+ * @return Rectangle
*/
- protected Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4) {
+ protected Rectangle getNodeDimensions(Object value0, int value1, int value2, boolean value3, Rectangle value4)
+ {
return null; // TODO
- } // getNodeDimensions()
+ }
/**
- * setModel
- * @param value0 TODO
+ * Sets the model that provides the tree data.
+ *
+ * @param the model
*/
- public void setModel(TreeModel value0) {
- // TODO
- } // setModel()
+ public void setModel(TreeModel model)
+ {
+ treeModel = model;
+ }
/**
- * getModel
- * @returns TreeModel
+ * Returns the model that provides the tree data.
+ *
+ * @return the model
*/
- public TreeModel getModel() {
- return null; // TODO
- } // getModel()
+ public TreeModel getModel()
+ {
+ return treeModel;
+ }
/**
* setRootVisible
- * @param value0 TODO
+ *
+ * @param visible <code>true</code> if root should be visible,
+ * <code>false</code> otherwise
*/
- public void setRootVisible(boolean value0) {
- // TODO
- } // setRootVisible()
+ public void setRootVisible(boolean visible)
+ {
+ rootVisible = visible;
+ }
/**
* isRootVisible
- * @returns boolean
+ *
+ * @return <code>true</code> if root is visible,
+ * <code>false</code> otherwise
*/
- public boolean isRootVisible() {
- return false; // TODO
- } // isRootVisible()
+ public boolean isRootVisible()
+ {
+ return rootVisible;
+ }
/**
* setRowHeight
- * @param value0 TODO
+ *
+ * @param height the row height
*/
- public void setRowHeight(int value0) {
- // TODO
- } // setRowHeight()
+ public void setRowHeight(int height)
+ {
+ rowHeight = height;
+ }
/**
* getRowHeight
- * @returns int
+ *
+ * @return the row height
*/
- public int getRowHeight() {
- return 0; // TODO
- } // getRowHeight()
+ public int getRowHeight()
+ {
+ return rowHeight;
+ }
/**
* setSelectionModel
- * @param value0 TODO
+ *
+ * @param model the model
*/
- public void setSelectionModel(TreeSelectionModel value0) {
- // TODO
- } // setSelectionModel()
+ public void setSelectionModel(TreeSelectionModel model)
+ {
+ treeSelectionModel = model;
+ }
/**
* getSelectionModel
- * @returns TreeSelectionModel
+ *
+ * @return the model
*/
- public TreeSelectionModel getSelectionModel() {
- return null; // TODO
- } // getSelectionModel()
+ public TreeSelectionModel getSelectionModel()
+ {
+ return treeSelectionModel;
+ }
/**
* getPreferredHeight
- * @returns int
+ *
+ * @return int
*/
- public int getPreferredHeight() {
+ public int getPreferredHeight()
+ {
return 0; // TODO
- } // getPreferredHeight()
+ }
/**
* getPreferredWidth
+ *
* @param value0 TODO
- * @returns int
+ *
+ * @return int
*/
- public int getPreferredWidth(Rectangle value0) {
+ public int getPreferredWidth(Rectangle value0)
+ {
return 0; // TODO
- } // getPreferredWidth()
+ }
/**
* isExpanded
+ *
* @param value0 TODO
- * @returns boolean
+ *
+ * @return boolean
*/
public abstract boolean isExpanded(TreePath value0);
/**
* getBounds
+ *
* @param value0 TODO
* @param value1 TODO
- * @returns Rectangle
+ *
+ * @return Rectangle
*/
public abstract Rectangle getBounds(TreePath value0, Rectangle value1);
/**
* getPathForRow
- * @param value0 TODO
- * @returns TreePath
+ *
+ * @param row the row
+ *
+ * @return the tree path
*/
- public abstract TreePath getPathForRow(int value0);
+ public abstract TreePath getPathForRow(int row);
/**
* getRowForPath
- * @param value0 TODO
- * @returns int
+ *
+ * @param path the tree path
+ *
+ * @return the row
*/
- public abstract int getRowForPath(TreePath value0);
+ public abstract int getRowForPath(TreePath path);
/**
* getPathClosestTo
+ *
* @param value0 TODO
* @param value1 TODO
- * @returns TreePath
+ *
+ * @return the tree path
*/
public abstract TreePath getPathClosestTo(int value0, int value1);
/**
* getVisiblePathsFrom
- * @param value0 TODO
- * @returns Enumeration
+ *
+ * @param path the tree path
+ *
+ * @return Enumeration
*/
- public abstract Enumeration getVisiblePathsFrom(TreePath value0);
+ public abstract Enumeration getVisiblePathsFrom(TreePath path);
/**
* getVisibleChildCount
- * @param value0 TODO
- * @returns int
+ *
+ * @param path the tree path
+ *
+ * @return int
*/
public abstract int getVisibleChildCount(TreePath value0);
/**
* setExpandedState
+ *
* @param value0 TODO
+ *
* @param value1 TODO
*/
public abstract void setExpandedState(TreePath value0, boolean value1);
/**
* getExpandedState
- * @param value0 TODO
- * @returns boolean
+ *
+ * @param path the tree path
+ *
+ * @return boolean
*/
- public abstract boolean getExpandedState(TreePath value0);
+ public abstract boolean getExpandedState(TreePath path);
/**
* getRowCount
- * @returns int
+ *
+ * @return the number of rows
*/
public abstract int getRowCount();
@@ -323,50 +348,58 @@ public abstract class AbstractLayoutCache implements RowMapper
/**
* invalidatePathBounds
- * @param value0 TODO
+ *
+ * @param path the tree path
*/
- public abstract void invalidatePathBounds(TreePath value0);
+ public abstract void invalidatePathBounds(TreePath path);
/**
* treeNodesChanged
- * @param value0 TODO
+ *
+ * @param event the event to send
*/
- public abstract void treeNodesChanged(TreeModelEvent value0);
+ public abstract void treeNodesChanged(TreeModelEvent event);
/**
* treeNodesInserted
- * @param value0 TODO
+ *
+ * @param event the event to send
*/
- public abstract void treeNodesInserted(TreeModelEvent value0);
+ public abstract void treeNodesInserted(TreeModelEvent event);
/**
* treeNodesRemoved
- * @param value0 TODO
+ *
+ * @param event the event to send
*/
- public abstract void treeNodesRemoved(TreeModelEvent value0);
+ public abstract void treeNodesRemoved(TreeModelEvent event);
/**
* treeStructureChanged
- * @param value0 TODO
+ *
+ * @param event the event to send
*/
- public abstract void treeStructureChanged(TreeModelEvent value0);
+ public abstract void treeStructureChanged(TreeModelEvent event);
/**
* getRowsForPaths
- * @param value0 TODO
- * @returns int[]
+ *
+ * @param paths the tree paths
+ *
+ * @return an array of rows
*/
- public int[] getRowsForPaths(TreePath[] value0) {
+ public int[] getRowsForPaths(TreePath[] paths)
+ {
return null; // TODO
- } // getRowsForPaths()
+ }
/**
* isFixedRowHeight
- * @returns boolean
+ *
+ * @return boolean
*/
- protected boolean isFixedRowHeight() {
+ protected boolean isFixedRowHeight()
+ {
return false; // TODO
- } // isFixedRowHeight()
-
-
-} // AbstractLayoutCache
+ }
+}
diff --git a/libjava/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/javax/swing/tree/DefaultTreeCellEditor.java
index bebdc6a..af28020 100644
--- a/libjava/javax/swing/tree/DefaultTreeCellEditor.java
+++ b/libjava/javax/swing/tree/DefaultTreeCellEditor.java
@@ -56,6 +56,7 @@ import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.border.Border;
import javax.swing.event.CellEditorListener;
+import javax.swing.event.EventListenerList;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
@@ -63,440 +64,453 @@ import javax.swing.event.TreeSelectionListener;
* DefaultTreeCellEditor
* @author Andrew Selkirk
*/
-public class DefaultTreeCellEditor implements ActionListener, TreeCellEditor, TreeSelectionListener {
-
- //-------------------------------------------------------------
- // Classes ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * EditorContainer
- */
- public class EditorContainer extends Container {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor EditorContainer
- * @param value0 TODO
- */
- public EditorContainer(DefaultTreeCellEditor value0) {
- // TODO
- } // EditorContainer()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getPreferredSize
- * @returns Dimension
- */
- public Dimension getPreferredSize() {
- return null; // TODO
- } // getPreferredSize()
-
- /**
- * paint
- * @param value0 TODO
- */
- public void paint(Graphics value0) {
- // TODO
- } // paint()
-
- /**
- * doLayout
- */
- public void doLayout() {
- // TODO
- } // doLayout()
-
-
- } // EditorContainer
-
- /**
- * DefaultTextField
- */
- public class DefaultTextField extends JTextField {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * border
- */
- protected Border border;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultTextField
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTextField(DefaultTreeCellEditor value0, Border value1) {
- // TODO
- } // DefaultTextField()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getFont
- * @returns Font
- */
- public Font getFont() {
- return null; // TODO
- } // getFont()
-
- /**
- * getBorder
- * @returns Border
- */
- public Border getBorder() {
- return null; // TODO
- } // getBorder()
-
- /**
- * getPreferredSize
- * @returns Dimension
- */
- public Dimension getPreferredSize() {
- return null; // TODO
- } // getPreferredSize()
-
-
- } // DefaultTextField
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * realEditor
- */
- protected TreeCellEditor realEditor;
-
- /**
- * renderer
- */
- protected DefaultTreeCellRenderer renderer;
-
- /**
- * editingContainer
- */
- protected Container editingContainer;
-
- /**
- * editingComponent
- */
- protected transient Component editingComponent;
-
- /**
- * canEdit
- */
- protected boolean canEdit;
-
- /**
- * offset
- */
- protected transient int offset;
-
- /**
- * tree
- */
- protected transient JTree tree;
-
- /**
- * lastPath
- */
- protected transient TreePath lastPath;
-
- /**
- * timer
- */
- protected transient javax.swing.Timer timer; // TODO
-
- /**
- * lastRow
- */
- protected transient int lastRow;
-
- /**
- * borderSelectionColor
- */
- protected Color borderSelectionColor;
-
- /**
- * editingIcon
- */
- protected transient Icon editingIcon;
-
- /**
- * font
- */
- protected Font font;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultTreeCellEditor
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1) {
- // TODO
- } // DefaultTreeCellEditor()
-
- /**
- * Constructor DefaultTreeCellEditor
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1, TreeCellEditor value2) {
- // TODO
- } // DefaultTreeCellEditor()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * 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()
-
- /**
- * setBorderSelectionColor
- * @param value0 TODO
- */
- public void setBorderSelectionColor(Color value0) {
- // TODO
- } // setBorderSelectionColor()
-
- /**
- * getBorderSelectionColor
- * @returns Color
- */
- public Color getBorderSelectionColor() {
- return null; // TODO
- } // getBorderSelectionColor()
-
- /**
- * setFont
- * @param value0 TODO
- */
- public void setFont(Font value0) {
- // TODO
- } // setFont()
-
- /**
- * getFont
- * @returns Font
- */
- public Font getFont() {
- return null; // TODO
- } // getFont()
-
- /**
- * getTreeCellEditorComponent
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- * @param value5 TODO
- * @returns Component
- */
- public Component getTreeCellEditorComponent(JTree value0, Object value1, boolean value2, boolean value3, boolean value4, int value5) {
- return null; // TODO
- } // getTreeCellEditorComponent()
-
- /**
- * getCellEditorValue
- * @returns Object
- */
- public Object getCellEditorValue() {
- return null; // TODO
- } // getCellEditorValue()
-
- /**
- * isCellEditable
- * @param value0 TODO
- * @returns boolean
- */
- public boolean isCellEditable(EventObject value0) {
- return false; // TODO
- } // isCellEditable()
-
- /**
- * shouldSelectCell
- * @param value0 TODO
- * @returns boolean
- */
- public boolean shouldSelectCell(EventObject value0) {
- return false; // TODO
- } // shouldSelectCell()
-
- /**
- * stopCellEditing
- * @returns boolean
- */
- public boolean stopCellEditing() {
- return false; // TODO
- } // stopCellEditing()
-
- /**
- * cancelCellEditing
- */
- public void cancelCellEditing() {
- // TODO
- } // cancelCellEditing()
-
- /**
- * addCellEditorListener
- * @param value0 TODO
- */
- public void addCellEditorListener(CellEditorListener value0) {
- // TODO
- } // addCellEditorListener()
-
- /**
- * removeCellEditorListener
- * @param value0 TODO
- */
- public void removeCellEditorListener(CellEditorListener value0) {
- // TODO
- } // removeCellEditorListener()
-
- /**
- * valueChanged
- * @param value0 TODO
- */
- public void valueChanged(TreeSelectionEvent value0) {
- // TODO
- } // valueChanged()
-
- /**
- * actionPerformed
- * @param value0 TODO
- */
- public void actionPerformed(ActionEvent value0) {
- // TODO
- } // actionPerformed()
-
- /**
- * setTree
- * @param value0 TODO
- */
- protected void setTree(JTree value0) {
- // TODO
- } // setTree()
-
- /**
- * shouldStartEditingTimer
- * @param value0 TODO
- * @returns boolean
- */
- protected boolean shouldStartEditingTimer(EventObject value0) {
- return false; // TODO
- } // shouldStartEditingTimer()
-
- /**
- * startEditingTimer
- */
- protected void startEditingTimer() {
- // TODO
- } // startEditingTimer()
-
- /**
- * canEditImmediately
- * @param value0 TODO
- * @returns boolean
- */
- protected boolean canEditImmediately(EventObject value0) {
- return false; // TODO
- } // canEditImmediately()
-
- /**
- * inHitRegion
- * @param value0 TODO
- * @param value1 TODO
- * @returns boolean
- */
- protected boolean inHitRegion(int value0, int value1) {
- return false; // TODO
- } // inHitRegion()
-
- /**
- * determineOffset
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- * @param value5 TODO
- */
- protected void determineOffset(JTree value0, Object value1, boolean value2, boolean value3, boolean value4, int value5) {
- // TODO
- } // determineOffset()
-
- /**
- * prepareForEditing
- */
- protected void prepareForEditing() {
- // TODO
- } // prepareForEditing()
-
- /**
- * createContainer
- * @returns Container
- */
- protected Container createContainer() {
- return null; // TODO
- } // createContainer()
-
- /**
- * createTreeCellEditor
- * @returns TreeCellEditor
- */
- protected TreeCellEditor createTreeCellEditor() {
- return null; // TODO
- } // createTreeCellEditor()
-
-
-} // DefaultTreeCellEditor
+public class DefaultTreeCellEditor
+ implements ActionListener, TreeCellEditor, TreeSelectionListener
+{
+ /**
+ * EditorContainer
+ */
+ public class EditorContainer extends Container
+ {
+ /**
+ * Creates an <code>EditorContainer</code> object.
+ */
+ public EditorContainer()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * This method only exists for API compatibility and is useless as it does
+ * nothing. It got probably introduced by accident.
+ */
+ public void EditorContainer()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * getPreferredSize
+ * @return Dimension
+ */
+ public Dimension getPreferredSize()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * paint
+ * @param value0 TODO
+ */
+ public void paint(Graphics value0)
+ {
+ // TODO
+ }
+
+ /**
+ * doLayout
+ */
+ public void doLayout()
+ {
+ // TODO
+ }
+ }
+
+ /**
+ * DefaultTextField
+ */
+ public class DefaultTextField extends JTextField
+ {
+ /**
+ * border
+ */
+ protected Border border;
+
+ /**
+ * Creates a <code>DefaultTextField</code> object.
+ *
+ * @param border the border to use
+ */
+ public DefaultTextField(Border border)
+ {
+ this.border = border;
+ }
+
+ /**
+ * getFont
+ * @return Font
+ */
+ public Font getFont()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * Returns the border of the text field.
+ *
+ * @return the border
+ */
+ public Border getBorder()
+ {
+ return border;
+ }
+
+ /**
+ * getPreferredSize
+ * @return Dimension
+ */
+ public Dimension getPreferredSize()
+ {
+ return null; // TODO
+ }
+ }
+
+ private EventListenerList listenerList = new EventListenerList();
+
+ /**
+ * realEditor
+ */
+ protected TreeCellEditor realEditor;
+
+ /**
+ * renderer
+ */
+ protected DefaultTreeCellRenderer renderer;
+
+ /**
+ * editingContainer
+ */
+ protected Container editingContainer;
+
+ /**
+ * editingComponent
+ */
+ protected transient Component editingComponent;
+
+ /**
+ * canEdit
+ */
+ protected boolean canEdit;
+
+ /**
+ * offset
+ */
+ protected transient int offset;
+
+ /**
+ * tree
+ */
+ protected transient JTree tree;
+
+ /**
+ * lastPath
+ */
+ protected transient TreePath lastPath;
+
+ /**
+ * timer
+ */
+ protected transient javax.swing.Timer timer; // TODO
+
+ /**
+ * lastRow
+ */
+ protected transient int lastRow;
+
+ /**
+ * borderSelectionColor
+ */
+ protected Color borderSelectionColor;
+
+ /**
+ * editingIcon
+ */
+ protected transient Icon editingIcon;
+
+ /**
+ * font
+ */
+ protected Font font;
+
+ /**
+ * Constructor DefaultTreeCellEditor
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1)
+ {
+ // TODO
+ }
+
+ /**
+ * Constructor DefaultTreeCellEditor
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1,
+ TreeCellEditor value2)
+ {
+ // TODO
+ }
+
+ /**
+ * writeObject
+ * @param value0 TODO
+ * @exception IOException TODO
+ */
+ private void writeObject(ObjectOutputStream value0) throws IOException
+ {
+ // TODO
+ }
+
+ /**
+ * readObject
+ * @param value0 TODO
+ * @exception IOException TODO
+ * @exception ClassNotFoundException TODO
+ */
+ private void readObject(ObjectInputStream value0)
+ throws IOException, ClassNotFoundException
+ {
+ // TODO
+ }
+
+ /**
+ * setBorderSelectionColor
+ * @param value0 TODO
+ */
+ public void setBorderSelectionColor(Color value0)
+ {
+ // TODO
+ }
+
+ /**
+ * getBorderSelectionColor
+ * @return Color
+ */
+ public Color getBorderSelectionColor()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setFont
+ * @param value0 TODO
+ */
+ public void setFont(Font value0)
+ {
+ // TODO
+ }
+
+ /**
+ * getFont
+ * @return Font
+ */
+ public Font getFont()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getTreeCellEditorComponent
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ * @param value3 TODO
+ * @param value4 TODO
+ * @param value5 TODO
+ * @return Component
+ */
+ public Component getTreeCellEditorComponent(JTree value0, Object value1,
+ boolean value2, boolean value3,
+ boolean value4, int value5)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getCellEditorValue
+ * @return Object
+ */
+ public Object getCellEditorValue()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * isCellEditable
+ * @param value0 TODO
+ * @return boolean
+ */
+ public boolean isCellEditable(EventObject value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * shouldSelectCell
+ * @param value0 TODO
+ * @return boolean
+ */
+ public boolean shouldSelectCell(EventObject value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * stopCellEditing
+ * @return boolean
+ */
+ public boolean stopCellEditing()
+ {
+ return false; // TODO
+ }
+
+ /**
+ * cancelCellEditing
+ */
+ public void cancelCellEditing()
+ {
+ // TODO
+ }
+
+ /**
+ * Adds a <code>CellEditorListener</code> object to this editor.
+ *
+ * @param listener the listener to add
+ */
+ public void addCellEditorListener(CellEditorListener listener)
+ {
+ listenerList.add(CellEditorListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>CellEditorListener</code> object.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeCellEditorListener(CellEditorListener listener)
+ {
+ listenerList.remove(CellEditorListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>CellEditorListener</code> objects to this editor.
+ *
+ * @return an array of listeners
+ *
+ * @since 1.4
+ */
+ public CellEditorListener[] getCellEditorListeners()
+ {
+ return (CellEditorListener[]) listenerList.getListeners(CellEditorListener.class);
+ }
+
+ /**
+ * valueChanged
+ * @param value0 TODO
+ */
+ public void valueChanged(TreeSelectionEvent value0)
+ {
+ // TODO
+ }
+
+ /**
+ * actionPerformed
+ * @param value0 TODO
+ */
+ public void actionPerformed(ActionEvent value0)
+ {
+ // TODO
+ }
+
+ /**
+ * setTree
+ * @param value0 TODO
+ */
+ protected void setTree(JTree value0)
+ {
+ // TODO
+ }
+
+ /**
+ * shouldStartEditingTimer
+ * @param value0 TODO
+ * @return boolean
+ */
+ protected boolean shouldStartEditingTimer(EventObject value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * startEditingTimer
+ */
+ protected void startEditingTimer()
+ {
+ // TODO
+ }
+
+ /**
+ * canEditImmediately
+ * @param value0 TODO
+ * @return boolean
+ */
+ protected boolean canEditImmediately(EventObject value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * inHitRegion
+ * @param value0 TODO
+ * @param value1 TODO
+ * @return boolean
+ */
+ protected boolean inHitRegion(int value0, int value1)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * determineOffset
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ * @param value3 TODO
+ * @param value4 TODO
+ * @param value5 TODO
+ */
+ protected void determineOffset(JTree value0, Object value1, boolean value2,
+ boolean value3, boolean value4, int value5)
+ {
+ // TODO
+ }
+
+ /**
+ * prepareForEditing
+ */
+ protected void prepareForEditing()
+ {
+ // TODO
+ }
+
+ /**
+ * createContainer
+ * @return Container
+ */
+ protected Container createContainer()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * createTreeCellEditor
+ * @return TreeCellEditor
+ */
+ protected TreeCellEditor createTreeCellEditor()
+ {
+ return null; // TODO
+ }
+}
diff --git a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java
index f0eb454..beae384 100644
--- a/libjava/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/libjava/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -1,5 +1,5 @@
/* DefaultTreeCellRenderer.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,9 +44,13 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
+
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JTree;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.UIResource;
/**
* DefaultTreeCellRenderer
@@ -124,8 +128,18 @@ public class DefaultTreeCellRenderer
* Constructor DefaultTreeCellRenderer
*/
public DefaultTreeCellRenderer() {
- // TODO
- } // DefaultTreeCellRenderer()
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ setLeafIcon(getDefaultLeafIcon());
+ setOpenIcon(getDefaultOpenIcon());
+ setClosedIcon(getDefaultClosedIcon());
+
+ setTextNonSelectionColor(defaults.getColor("Tree.textForeground"));
+ setTextSelectionColor(defaults.getColor("Tree.selectionForeground"));
+ setBackgroundNonSelectionColor(defaults.getColor("Tree.textBackground"));
+ setBackgroundSelectionColor(defaults.getColor("Tree.selectionBackground"));
+ setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor"));
+ }
//-------------------------------------------------------------
@@ -137,168 +151,172 @@ public class DefaultTreeCellRenderer
* @returns Icon
*/
public Icon getDefaultOpenIcon() {
- return null; // TODO
- } // getDefaultOpenIcon()
+ return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon");
+ }
/**
* getDefaultClosedIcon
* @returns Icon
*/
public Icon getDefaultClosedIcon() {
- return null; // TODO
- } // getDefaultClosedIcon()
+ return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon");
+ }
/**
* getDefaultLeafIcon
* @returns Icon
*/
public Icon getDefaultLeafIcon() {
- return null; // TODO
- } // getDefaultLeafIcon()
+ return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon");
+ }
/**
* setOpenIcon
* @param value0 TODO
*/
- public void setOpenIcon(Icon value0) {
- // TODO
- } // setOpenIcon()
+ public void setOpenIcon(Icon i) {
+ openIcon = i;
+ }
/**
* getOpenIcon
* @returns Icon
*/
public Icon getOpenIcon() {
- return null; // TODO
- } // getOpenIcon()
+ return openIcon;
+ }
/**
* setClosedIcon
* @param value0 TODO
*/
- public void setClosedIcon(Icon value0) {
- // TODO
- } // setClosedIcon()
+ public void setClosedIcon(Icon i) {
+ closedIcon = i;
+ }
/**
* getClosedIcon
* @returns Icon
*/
public Icon getClosedIcon() {
- return null; // TODO
- } // getClosedIcon()
+ return closedIcon;
+ }
/**
* setLeafIcon
* @param value0 TODO
*/
- public void setLeafIcon(Icon value0) {
- // TODO
- } // setLeafIcon()
+ public void setLeafIcon(Icon i) {
+ leafIcon = i;
+ }
/**
* getLeafIcon
* @returns Icon
*/
public Icon getLeafIcon() {
- return null; // TODO
- } // getLeafIcon()
+ return leafIcon;
+ }
/**
* setTextSelectionColor
* @param value0 TODO
*/
- public void setTextSelectionColor(Color value0) {
- // TODO
- } // setTextSelectionColor()
+ public void setTextSelectionColor(Color c) {
+ textSelectionColor = c;
+ }
/**
* getTextSelectionColor
* @returns Color
*/
public Color getTextSelectionColor() {
- return null; // TODO
- } // getTextSelectionColor()
+ return textSelectionColor;
+ }
/**
* setTextNonSelectionColor
* @param value0 TODO
*/
- public void setTextNonSelectionColor(Color value0) {
- // TODO
- } // setTextNonSelectionColor()
+ public void setTextNonSelectionColor(Color c) {
+ textNonSelectionColor = c;
+ }
/**
* getTextNonSelectionColor
* @returns Color
*/
public Color getTextNonSelectionColor() {
- return null; // TODO
- } // getTextNonSelectionColor()
+ return textNonSelectionColor;
+ }
/**
* setBackgroundSelectionColor
* @param value0 TODO
*/
- public void setBackgroundSelectionColor(Color value0) {
- // TODO
- } // setBackgroundSelectionColor()
+ public void setBackgroundSelectionColor(Color c) {
+ backgroundSelectionColor = c;
+ }
/**
* getBackgroundSelectionColor
* @returns Color
*/
public Color getBackgroundSelectionColor() {
- return null; // TODO
- } // getBackgroundSelectionColor()
+ return backgroundSelectionColor;
+ }
/**
* setBackgroundNonSelectionColor
* @param value0 TODO
*/
- public void setBackgroundNonSelectionColor(Color value0) {
- // TODO
- } // setBackgroundNonSelectionColor()
+ public void setBackgroundNonSelectionColor(Color c) {
+ backgroundNonSelectionColor = c;
+ }
/**
* getBackgroundNonSelectionColor
* @returns Color
*/
public Color getBackgroundNonSelectionColor() {
- return null; // TODO
- } // getBackgroundNonSelectionColor()
+ return backgroundNonSelectionColor;
+ }
/**
* setBorderSelectionColor
* @param value0 TODO
*/
- public void setBorderSelectionColor(Color value0) {
- // TODO
- } // setBorderSelectionColor()
+ public void setBorderSelectionColor(Color c) {
+ borderSelectionColor = c;
+ }
/**
* getBorderSelectionColor
* @returns Color
*/
public Color getBorderSelectionColor() {
- return null; // TODO
- } // getBorderSelectionColor()
+ return borderSelectionColor;
+ }
/**
* setFont
* @param value0 TODO
*/
- public void setFont(Font value0) {
- // TODO
- } // setFont()
+ public void setFont(Font f) {
+ if (f != null && f instanceof UIResource)
+ f = null;
+ super.setFont(f);
+ }
/**
* setBackground
* @param value0 TODO
*/
- public void setBackground(Color value0) {
- // TODO
- } // setBackground()
+ public void setBackground(Color c) {
+ if (c != null && c instanceof UIResource)
+ c = null;
+ super.setBackground(c);
+ }
/**
* getTreeCellRendererComponent
@@ -311,17 +329,37 @@ public class DefaultTreeCellRenderer
* @param value6 TODO
* @returns Component
*/
- public Component getTreeCellRendererComponent(JTree value0, Object value1, boolean value2, boolean value3, boolean value4, int value5, boolean value6) {
- return null; // TODO
- } // getTreeCellRendererComponent()
+ public Component getTreeCellRendererComponent(JTree tree,
+ Object val,
+ boolean selected,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus) {
+ this.selected = selected;
+ this.hasFocus = hasFocus;
+
+ if (leaf)
+ setIcon(getLeafIcon());
+ else if (expanded)
+ setIcon(getOpenIcon());
+ else
+ setIcon(getClosedIcon());
+
+ setText(val.toString());
+ setHorizontalAlignment(LEFT);
+ setVerticalAlignment(TOP);
+
+ return this;
+ }
/**
* paint
* @param value0 TODO
*/
- public void paint(Graphics value0) {
- // TODO
- } // paint()
+ public void paint(Graphics g) {
+ super.paint(g);
+ }
/**
* getPreferredSize
diff --git a/libjava/javax/swing/tree/DefaultTreeModel.java b/libjava/javax/swing/tree/DefaultTreeModel.java
index 4f546ac..2e34a35 100644
--- a/libjava/javax/swing/tree/DefaultTreeModel.java
+++ b/libjava/javax/swing/tree/DefaultTreeModel.java
@@ -1,5 +1,5 @@
/* DefaultTreeModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,335 +43,409 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventListener;
+
import javax.swing.event.EventListenerList;
+import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
/**
* DefaultTreeModel
* @author Andrew Selkirk
*/
-public class DefaultTreeModel implements Serializable, TreeModel
+public class DefaultTreeModel
+ implements Serializable, TreeModel
{
static final long serialVersionUID = -2621068368932566998L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * root
- */
- protected TreeNode root = null;
-
- /**
- * listenerList
- */
- protected EventListenerList listenerList = new EventListenerList();
-
- /**
- * asksAllowsChildren
- */
- protected boolean asksAllowsChildren;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultTreeModel
- * @param value0 TODO
- */
- public DefaultTreeModel(TreeNode root) {
- setRoot(root);
- } // DefaultTreeModel()
-
- /**
- * Constructor DefaultTreeModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) {
- setRoot(root);
- this.asksAllowsChildren = asksAllowsChildren;
- } // DefaultTreeModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * 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()
-
- /**
- * asksAllowsChildren
- * @returns boolean
- */
- public boolean asksAllowsChildren() {
- return asksAllowsChildren;
- } // asksAllowsChildren()
-
- /**
- * setAsksAllowsChildren
- * @param value0 TODO
- */
- public void setAsksAllowsChildren(boolean value) {
- asksAllowsChildren = value; // TODO
- } // setAsksAllowsChildren()
-
- /**
- * setRoot
- * @param value0 TODO
- */
- public void setRoot(TreeNode root) {
-
- // Sanity Check
- if (root == null) {
- throw new IllegalArgumentException("null root");
- } // if
-
- // Set new root
- this.root = root;
-
- // TODO
- } // setRoot()
-
- /**
- * getRoot
- * @returns Object
- */
- public Object getRoot() {
- return root;
- } // getRoot()
-
- /**
- * getIndexOfChild
- * @param value0 TODO
- * @param value1 TODO
- * @returns int
- */
- public int getIndexOfChild(Object parent, Object child) {
- return 0; // TODO
- } // getIndexOfChild()
-
- /**
- * getChild
- * @param value0 TODO
- * @param value1 TODO
- * @returns Object
- */
- public Object getChild(Object value0, int value1) {
- return null; // TODO
- } // getChild()
-
- /**
- * getChildCount
- * @param value0 TODO
- * @returns int
- */
- public int getChildCount(Object value0) {
- return 0; // TODO
- } // getChildCount()
-
- /**
- * isLeaf
- * @param value0 TODO
- * @returns boolean
- */
- public boolean isLeaf(Object value0) {
- return false; // TODO
- } // isLeaf()
-
- /**
- * reload
- */
- public void reload() {
- // TODO
- } // reload()
-
- /**
- * reload
- * @param value0 TODO
- */
- public void reload(TreeNode value0) {
- // TODO
- } // reload()
-
- /**
- * valueForPathChanged
- * @param value0 TODO
- * @param value1 TODO
- */
- public void valueForPathChanged(TreePath value0, Object value1) {
- // TODO
- } // valueForPathChanged()
-
- /**
- * insertNodeInto
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1, int value2) {
- // TODO
- } // insertNodeInto()
-
- /**
- * removeNodeFromParent
- * @param value0 TODO
- */
- public void removeNodeFromParent(MutableTreeNode value0) {
- // TODO
- } // removeNodeFromParent()
-
- /**
- * nodeChanged
- * @param value0 TODO
- */
- public void nodeChanged(TreeNode value0) {
- // TODO
- } // nodeChanged()
-
- /**
- * nodesWereInserted
- * @param value0 TODO
- * @param value1 TODO
- */
- public void nodesWereInserted(TreeNode value0, int[] value1) {
- // TODO
- } // nodesWereInserted()
-
- /**
- * nodesWereRemoved
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2) {
- // TODO
- } // nodesWereRemoved()
-
- /**
- * nodesChanged
- * @param value0 TODO
- * @param value1 TODO
- */
- public void nodesChanged(TreeNode value0, int[] value1) {
- // TODO
- } // nodesChanged()
-
- /**
- * nodeStructureChanged
- * @param value0 TODO
- */
- public void nodeStructureChanged(TreeNode value0) {
- // TODO
- } // nodeStructureChanged()
-
- /**
- * getPathToRoot
- * @param value0 TODO
- * @returns TreeNode[]
- */
- public TreeNode[] getPathToRoot(TreeNode value0) {
- return null; // TODO
- } // getPathToRoot()
-
- /**
- * getPathToRoot
- * @param value0 TODO
- * @param value1 TODO
- * @returns TreeNode[]
- */
- protected TreeNode[] getPathToRoot(TreeNode value0, int value1) {
- return null; // TODO
- } // getPathToRoot()
-
- /**
- * addTreeModelListener
- * @param value0 TODO
- */
- public void addTreeModelListener(TreeModelListener listener) {
- listenerList.add(TreeModelListener.class, listener);
- } // addTreeModelListener()
-
- /**
- * removeTreeModelListener
- * @param value0 TODO
- */
- public void removeTreeModelListener(TreeModelListener listener) {
- listenerList.remove(TreeModelListener.class, listener);
- } // removeTreeModelListener()
-
- /**
- * fireTreeNodesChanged
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- */
- protected void fireTreeNodesChanged(Object value0, Object[] value1, int[] value2, Object[] value3) {
- // TODO
- } // fireTreeNodesChanged()
-
- /**
- * fireTreeNodesInserted
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- */
- protected void fireTreeNodesInserted(Object value0, Object[] value1, int[] value2, Object[] value3) {
- // TODO
- } // fireTreeNodesInserted()
-
- /**
- * fireTreeNodesRemoved
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- */
- protected void fireTreeNodesRemoved(Object value0, Object[] value1, int[] value2, Object[] value3) {
- // TODO
- } // fireTreeNodesRemoved()
-
- /**
- * fireTreeStructureChanged
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- */
- protected void fireTreeStructureChanged(Object value0, Object[] value1, int[] value2, Object[] value3) {
- // TODO
- } // fireTreeStructureChanged()
-
- /**
- * getListeners
- * @param value0 TODO
- * @returns EventListener[]
- */
- public EventListener[] getListeners(Class classType) {
- return listenerList.getListeners(classType);
- } // getListeners()
-
-
-} // DefaultTreeModel
+ /**
+ * root
+ */
+ protected TreeNode root = null;
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList = new EventListenerList();
+
+ /**
+ * asksAllowsChildren
+ */
+ protected boolean asksAllowsChildren;
+
+ /**
+ * Constructor DefaultTreeModel
+ * @param value0 TODO
+ */
+ public DefaultTreeModel(TreeNode root)
+ {
+ setRoot(root);
+ }
+
+ /**
+ * Constructor DefaultTreeModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren)
+ {
+ setRoot(root);
+ this.asksAllowsChildren = asksAllowsChildren;
+ }
+
+ /**
+ * writeObject
+ * @param value0 TODO
+ * @exception IOException TODO
+ */
+ private void writeObject(ObjectOutputStream value0) throws IOException
+ {
+ // TODO
+ }
+
+ /**
+ * readObject
+ * @param value0 TODO
+ * @exception IOException TODO
+ * @exception ClassNotFoundException TODO
+ */
+ private void readObject(ObjectInputStream value0)
+ throws IOException, ClassNotFoundException
+ {
+ // TODO
+ }
+
+ /**
+ * asksAllowsChildren
+ * @return boolean
+ */
+ public boolean asksAllowsChildren()
+ {
+ return asksAllowsChildren;
+ }
+
+ /**
+ * setAsksAllowsChildren
+ * @param value0 TODO
+ */
+ public void setAsksAllowsChildren(boolean value)
+ {
+ asksAllowsChildren = value; // TODO
+ }
+
+ /**
+ * setRoot
+ * @param value0 TODO
+ */
+ public void setRoot(TreeNode root)
+ {
+ // Sanity Check
+ if (root == null)
+ {
+ throw new IllegalArgumentException("null root");
+ }
+ // Set new root
+ this.root = root;
+
+ // TODO
+ }
+
+ /**
+ * getRoot
+ * @return Object
+ */
+ public Object getRoot()
+ {
+ return root;
+ }
+
+ /**
+ * getIndexOfChild
+ * @param value0 TODO
+ * @param value1 TODO
+ * @return int
+ */
+ public int getIndexOfChild(Object parent, Object child)
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * getChild
+ * @param value0 TODO
+ * @param value1 TODO
+ * @return Object
+ */
+ public Object getChild(Object node, int idx)
+ {
+ if (node instanceof TreeNode)
+ return ((TreeNode)node).getChildAt(idx);
+ else
+ return null;
+ }
+
+ /**
+ * getChildCount
+ * @param value0 TODO
+ * @return int
+ */
+ public int getChildCount(Object node)
+ {
+ if (node instanceof TreeNode)
+ return ((TreeNode)node).getChildCount();
+ else
+ return 0;
+ }
+
+ /**
+ * isLeaf
+ * @param value0 TODO
+ * @return boolean
+ */
+ public boolean isLeaf(Object node)
+ {
+ if (node instanceof TreeNode)
+ return ((TreeNode)node).isLeaf();
+ else
+ return true;
+ }
+
+ /**
+ * reload
+ */
+ public void reload()
+ {
+ // TODO
+ }
+
+ /**
+ * reload
+ * @param value0 TODO
+ */
+ public void reload(TreeNode value0)
+ {
+ // TODO
+ }
+
+ /**
+ * valueForPathChanged
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void valueForPathChanged(TreePath value0, Object value1)
+ {
+ // TODO
+ }
+
+ /**
+ * insertNodeInto
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void insertNodeInto(MutableTreeNode value0, MutableTreeNode value1,
+ int value2)
+ {
+ // TODO
+ }
+
+ /**
+ * removeNodeFromParent
+ * @param value0 TODO
+ */
+ public void removeNodeFromParent(MutableTreeNode value0)
+ {
+ // TODO
+ }
+
+ /**
+ * nodeChanged
+ * @param value0 TODO
+ */
+ public void nodeChanged(TreeNode value0)
+ {
+ // TODO
+ }
+
+ /**
+ * nodesWereInserted
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void nodesWereInserted(TreeNode value0, int[] value1)
+ {
+ // TODO
+ }
+
+ /**
+ * nodesWereRemoved
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void nodesWereRemoved(TreeNode value0, int[] value1, Object[] value2)
+ {
+ // TODO
+ }
+
+ /**
+ * nodesChanged
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void nodesChanged(TreeNode value0, int[] value1)
+ {
+ // TODO
+ }
+
+ /**
+ * nodeStructureChanged
+ * @param value0 TODO
+ */
+ public void nodeStructureChanged(TreeNode value0)
+ {
+ // TODO
+ }
+
+ /**
+ * getPathToRoot
+ * @param value0 TODO
+ * @return TreeNode[]
+ */
+ public TreeNode[] getPathToRoot(TreeNode value0)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getPathToRoot
+ * @param value0 TODO
+ * @param value1 TODO
+ * @return TreeNode[]
+ */
+ protected TreeNode[] getPathToRoot(TreeNode value0, int value1)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * Registers a listere to the model.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeModelListener(TreeModelListener listener)
+ {
+ listenerList.add(TreeModelListener.class, listener);
+ }
+
+ /**
+ * Removes a listener from the model.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeModelListener(TreeModelListener listener)
+ {
+ listenerList.remove(TreeModelListener.class, listener);
+ }
+
+ /**
+ * Returns all registered <code>TreeModelListener</code> listeners.
+ *
+ * @return an array of listeners.
+ *
+ * @since 1.4
+ */
+ public TreeModelListener[] getTreeModelListeners()
+ {
+ return (TreeModelListener[]) listenerList.getListeners(TreeModelListener.class);
+ }
+
+ /**
+ * fireTreeNodesChanged
+ *
+ * @param source the node being changed
+ * @param path the path to the root node
+ * @param childIndices the indices of the changed elements
+ * @param children the changed elements
+ */
+ protected void fireTreeNodesChanged(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event =
+ new TreeModelEvent(source, path, childIndices, children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeNodesChanged(event);
+ }
+
+ /**
+ * fireTreeNodesInserted
+ *
+ * @param source the node where new nodes got inserted
+ * @param path the path to the root node
+ * @param childIndices the indices of the new elements
+ * @param children the new elements
+ */
+ protected void fireTreeNodesInserted(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event =
+ new TreeModelEvent(source, path, childIndices, children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeNodesInserted(event);
+ }
+
+ /**
+ * fireTreeNodesRemoved
+ *
+ * @param source the node where nodes got removed-
+ * @param path the path to the root node
+ * @param childIndices the indices of the removed elements
+ * @param children the removed elements
+ */
+ protected void fireTreeNodesRemoved(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event =
+ new TreeModelEvent(source, path, childIndices, children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeNodesRemoved(event);
+ }
+
+ /**
+ * fireTreeStructureChanged
+ *
+ * @param source the node where the model has changed
+ * @param path the path to the root node
+ * @param childIndices the indices of the affected elements
+ * @param children the affected elements
+ */
+ protected void fireTreeStructureChanged(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ TreeModelEvent event =
+ new TreeModelEvent(source, path, childIndices, children);
+ TreeModelListener[] listeners = getTreeModelListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].treeStructureChanged(event);
+ }
+
+ /**
+ * Returns the registered listeners of a given type.
+ *
+ * @param listenerType the listener type to return
+ *
+ * @return an array of listeners
+ *
+ * @since 1.3
+ */
+ public EventListener[] getListeners(Class listenerType)
+ {
+ return listenerList.getListeners(listenerType);
+ }
+}
diff --git a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java
index 79f642a..4fe69f4 100644
--- a/libjava/javax/swing/tree/DefaultTreeSelectionModel.java
+++ b/libjava/javax/swing/tree/DefaultTreeSelectionModel.java
@@ -1,5 +1,5 @@
/* DefaultTreeSelectionModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,9 +45,10 @@ import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventListener;
import java.util.Vector;
+
import javax.swing.DefaultListSelectionModel;
-import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.event.EventListenerList;
+import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
@@ -60,402 +61,464 @@ public class DefaultTreeSelectionModel
{
static final long serialVersionUID = 3288129636638950196L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * SELECTION_MODE_PROPERTY
- */
- public static final String SELECTION_MODE_PROPERTY = "selectionMode";
-
- /**
- * changeSupport
- */
- protected SwingPropertyChangeSupport changeSupport;
-
- /**
- * selection
- */
- protected TreePath[] selection;
-
- /**
- * listenerList
- */
- protected EventListenerList listenerList;
-
- /**
- * rowMapper
- */
- protected transient RowMapper rowMapper;
-
- /**
- * listSelectionModel
- */
- protected DefaultListSelectionModel listSelectionModel;
-
- /**
- * selectionMode
- */
- protected int selectionMode;
-
- /**
- * leadPath
- */
- protected TreePath leadPath;
-
- /**
- * leadIndex
- */
- protected int leadIndex;
-
- /**
- * leadRow
- */
- protected int leadRow;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultTreeSelectionModel
- */
- public DefaultTreeSelectionModel() {
- // TODO
- } // DefaultTreeSelectionModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * clone
- * @exception CloneNotSupportedException TODO
- * @returns Object
- */
- public Object clone() throws CloneNotSupportedException {
- return null; // TODO
- } // clone()
-
- /**
- * toString
- * @returns String
- */
- public String toString() {
- return null; // TODO
- } // toString()
-
- /**
- * 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()
-
- /**
- * setRowMapper
- * @param value0 TODO
- */
- public void setRowMapper(RowMapper value0) {
- // TODO
- } // setRowMapper()
-
- /**
- * getRowMapper
- * @returns RowMapper
- */
- public RowMapper getRowMapper() {
- return null; // TODO
- } // getRowMapper()
-
- /**
- * setSelectionMode
- * @param value0 TODO
- */
- public void setSelectionMode(int value0) {
- // TODO
- } // setSelectionMode()
-
- /**
- * getSelectionMode
- * @returns int
- */
- public int getSelectionMode() {
- return 0; // TODO
- } // getSelectionMode()
-
- /**
- * setSelectionPath
- * @param value0 TODO
- */
- public void setSelectionPath(TreePath value0) {
- // TODO
- } // setSelectionPath()
-
- /**
- * setSelectionPaths
- * @param value0 TODO
- */
- public void setSelectionPaths(TreePath[] value0) {
- // TODO
- } // setSelectionPaths()
-
- /**
- * addSelectionPath
- * @param value0 TODO
- */
- public void addSelectionPath(TreePath value0) {
- // TODO
- } // addSelectionPath()
-
- /**
- * addSelectionPaths
- * @param value0 TODO
- */
- public void addSelectionPaths(TreePath[] value0) {
- // TODO
- } // addSelectionPaths()
-
- /**
- * removeSelectionPath
- * @param value0 TODO
- */
- public void removeSelectionPath(TreePath value0) {
- // TODO
- } // removeSelectionPath()
-
- /**
- * removeSelectionPaths
- * @param value0 TODO
- */
- public void removeSelectionPaths(TreePath[] value0) {
- // TODO
- } // removeSelectionPaths()
-
- /**
- * getSelectionPath
- * @returns TreePath
- */
- public TreePath getSelectionPath() {
- return null; // TODO
- } // getSelectionPath()
-
- /**
- * getSelectionPaths
- * @returns TreePath[]
- */
- public TreePath[] getSelectionPaths() {
- return null; // TODO
- } // getSelectionPaths()
-
- /**
- * getSelectionCount
- * @returns int
- */
- public int getSelectionCount() {
- return 0; // TODO
- } // getSelectionCount()
-
- /**
- * isPathSelected
- * @param value0 TODO
- * @returns boolean
- */
- public boolean isPathSelected(TreePath value0) {
- return false; // TODO
- } // isPathSelected()
-
- /**
- * isSelectionEmpty
- * @returns boolean
- */
- public boolean isSelectionEmpty() {
- return false; // TODO
- } // isSelectionEmpty()
-
- /**
- * clearSelection
- */
- public void clearSelection() {
- // TODO
- } // clearSelection()
-
- /**
- * addTreeSelectionListener
- * @param value0 TODO
- */
- public void addTreeSelectionListener(TreeSelectionListener value0) {
- // TODO
- } // addTreeSelectionListener()
-
- /**
- * removeTreeSelectionListener
- * @param value0 TODO
- */
- public void removeTreeSelectionListener(TreeSelectionListener value0) {
- // TODO
- } // removeTreeSelectionListener()
-
- /**
- * fireValueChanged
- * @param value0 TODO
- */
- protected void fireValueChanged(TreeSelectionEvent value0) {
- // TODO
- } // fireValueChanged()
-
- /**
- * getListeners
- * @param value0 TODO
- * @returns EventListener[]
- */
- public EventListener[] getListeners(Class value0) {
- return null; // TODO
- } // getListeners()
-
- /**
- * getSelectionRows
- * @returns int[]
- */
- public int[] getSelectionRows() {
- return null; // TODO
- } // getSelectionRows()
-
- /**
- * getMinSelectionRow
- * @returns int
- */
- public int getMinSelectionRow() {
- return 0; // TODO
- } // getMinSelectionRow()
-
- /**
- * getMaxSelectionRow
- * @returns int
- */
- public int getMaxSelectionRow() {
- return 0; // TODO
- } // getMaxSelectionRow()
-
- /**
- * isRowSelected
- * @param value0 TODO
- * @returns boolean
- */
- public boolean isRowSelected(int value0) {
- return false; // TODO
- } // isRowSelected()
-
- /**
- * resetRowSelection
- */
- public void resetRowSelection() {
- // TODO
- } // resetRowSelection()
-
- /**
- * getLeadSelectionRow
- * @returns int
- */
- public int getLeadSelectionRow() {
- return 0; // TODO
- } // getLeadSelectionRow()
-
- /**
- * getLeadSelectionPath
- * @returns TreePath
- */
- public TreePath getLeadSelectionPath() {
- return null; // TODO
- } // getLeadSelectionPath()
-
- /**
- * addPropertyChangeListener
- * @param value0 TODO
- */
- public synchronized void addPropertyChangeListener(PropertyChangeListener value0) {
- // TODO
- } // addPropertyChangeListener()
-
- /**
- * removePropertyChangeListener
- * @param value0 TODO
- */
- public synchronized void removePropertyChangeListener(PropertyChangeListener value0) {
- // TODO
- } // removePropertyChangeListener()
-
- /**
- * insureRowContinuity
- */
- protected void insureRowContinuity() {
- // TODO
- } // insureRowContinuity()
-
- /**
- * arePathsContiguous
- * @param value0 TODO
- * @returns boolean
- */
- protected boolean arePathsContiguous(TreePath[] value0) {
- return false; // TODO
- } // arePathsContiguous()
-
- /**
- * canPathsBeAdded
- * @param value0 TODO
- * @returns boolean
- */
- protected boolean canPathsBeAdded(TreePath[] value0) {
- return false; // TODO
- } // canPathsBeAdded()
-
- /**
- * canPathsBeRemoved
- * @param value0 TODO
- * @returns boolean
- */
- protected boolean canPathsBeRemoved(TreePath[] value0) {
- return false; // TODO
- } // canPathsBeRemoved()
-
- /**
- * notifyPathChange
- * @param value0 TODO
- * @param value1 TODO
- */
- protected void notifyPathChange(Vector value0, TreePath value1) {
- // TODO
- } // notifyPathChange()
-
- /**
- * updateLeadIndex
- */
- protected void updateLeadIndex() {
- // TODO
- } // updateLeadIndex()
-
- /**
- * insureUniqueness
- */
- protected void insureUniqueness() {
- // TODO
- } // insureUniqueness()
-
-
-} // DefaultTreeSelectionModel
+ /**
+ * SELECTION_MODE_PROPERTY
+ */
+ public static final String SELECTION_MODE_PROPERTY = "selectionMode";
+
+ /**
+ * changeSupport
+ */
+ protected SwingPropertyChangeSupport changeSupport;
+
+ /**
+ * selection
+ */
+ protected TreePath[] selection;
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList;
+
+ /**
+ * rowMapper
+ */
+ protected transient RowMapper rowMapper;
+
+ /**
+ * listSelectionModel
+ */
+ protected DefaultListSelectionModel listSelectionModel;
+
+ /**
+ * selectionMode
+ */
+ protected int selectionMode;
+
+ /**
+ * leadPath
+ */
+ protected TreePath leadPath;
+
+ /**
+ * leadIndex
+ */
+ protected int leadIndex;
+
+ /**
+ * leadRow
+ */
+ protected int leadRow;
+
+ /**
+ * Constructor DefaultTreeSelectionModel
+ */
+ public DefaultTreeSelectionModel()
+ {
+ // TODO
+ }
+
+ /**
+ * clone
+ * @exception CloneNotSupportedException TODO
+ * @return Object
+ */
+ public Object clone() throws CloneNotSupportedException
+ {
+ return null; // TODO
+ }
+
+ /**
+ * toString
+ * @return String
+ */
+ public String toString()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * writeObject
+ * @param value0 TODO
+ * @exception IOException TODO
+ */
+ private void writeObject(ObjectOutputStream value0) throws IOException
+ {
+ // TODO
+ }
+
+ /**
+ * readObject
+ * @param value0 TODO
+ * @exception IOException TODO
+ * @exception ClassNotFoundException TODO
+ */
+ private void readObject(ObjectInputStream value0)
+ throws IOException, ClassNotFoundException
+ {
+ // TODO
+ }
+
+ /**
+ * setRowMapper
+ * @param value0 TODO
+ */
+ public void setRowMapper(RowMapper value0)
+ {
+ // TODO
+ }
+
+ /**
+ * getRowMapper
+ * @return RowMapper
+ */
+ public RowMapper getRowMapper()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setSelectionMode
+ * @param value0 TODO
+ */
+ public void setSelectionMode(int value0)
+ {
+ // TODO
+ }
+
+ /**
+ * getSelectionMode
+ * @return int
+ */
+ public int getSelectionMode()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * setSelectionPath
+ * @param value0 TODO
+ */
+ public void setSelectionPath(TreePath value0)
+ {
+ // TODO
+ }
+
+ /**
+ * setSelectionPaths
+ * @param value0 TODO
+ */
+ public void setSelectionPaths(TreePath[] value0)
+ {
+ // TODO
+ }
+
+ /**
+ * addSelectionPath
+ * @param value0 TODO
+ */
+ public void addSelectionPath(TreePath value0)
+ {
+ // TODO
+ }
+
+ /**
+ * addSelectionPaths
+ * @param value0 TODO
+ */
+ public void addSelectionPaths(TreePath[] value0)
+ {
+ // TODO
+ }
+
+ /**
+ * removeSelectionPath
+ * @param value0 TODO
+ */
+ public void removeSelectionPath(TreePath value0)
+ {
+ // TODO
+ }
+
+ /**
+ * removeSelectionPaths
+ * @param value0 TODO
+ */
+ public void removeSelectionPaths(TreePath[] value0)
+ {
+ // TODO
+ }
+
+ /**
+ * getSelectionPath
+ * @return TreePath
+ */
+ public TreePath getSelectionPath()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getSelectionPaths
+ * @return TreePath[]
+ */
+ public TreePath[] getSelectionPaths()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getSelectionCount
+ * @return int
+ */
+ public int getSelectionCount()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * isPathSelected
+ * @param value0 TODO
+ * @return boolean
+ */
+ public boolean isPathSelected(TreePath value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * isSelectionEmpty
+ * @return boolean
+ */
+ public boolean isSelectionEmpty()
+ {
+ return false; // TODO
+ }
+
+ /**
+ * clearSelection
+ */
+ public void clearSelection()
+ {
+ // TODO
+ }
+
+ /**
+ * Adds a <code>TreeSelectionListener</code> object to this model.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.add(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeSelectionListener</code> object from this model.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.remove(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Returns all <code>TreeSelectionListener</code> added to this model.
+ *
+ * @return an array of listeners
+ *
+ * @since 1.4
+ */
+ public TreeSelectionListener[] getTreeSelectionListeners()
+ {
+ return (TreeSelectionListener[]) listenerList.getListeners(TreeSelectionListener.class);
+ }
+
+ /**
+ * fireValueChanged
+ *
+ * @param event the event to fire.
+ */
+ protected void fireValueChanged(TreeSelectionEvent event)
+ {
+ TreeSelectionListener[] listeners = getTreeSelectionListeners();
+
+ for (int i = listeners.length - 1; i >= 0; --i)
+ listeners[i].valueChanged(event);
+ }
+
+ /**
+ * Returns all added listeners of a special type.
+ *
+ * @param listenerType the listener type
+ *
+ * @return an array of listeners
+ *
+ * @since 1.3
+ */
+ public EventListener[] getListeners(Class listenerType)
+ {
+ return listenerList.getListeners(listenerType);
+ }
+
+ /**
+ * getSelectionRows
+ * @return int[]
+ */
+ public int[] getSelectionRows()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getMinSelectionRow
+ * @return int
+ */
+ public int getMinSelectionRow()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * getMaxSelectionRow
+ * @return int
+ */
+ public int getMaxSelectionRow()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * isRowSelected
+ * @param value0 TODO
+ * @return boolean
+ */
+ public boolean isRowSelected(int value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * resetRowSelection
+ */
+ public void resetRowSelection()
+ {
+ // TODO
+ }
+
+ /**
+ * getLeadSelectionRow
+ * @return int
+ */
+ public int getLeadSelectionRow()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * getLeadSelectionPath
+ * @return TreePath
+ */
+ public TreePath getLeadSelectionPath()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * Adds a <code>PropertyChangeListener</code> object to this model.
+ *
+ * @param listener the listener to add.
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes a <code>PropertyChangeListener</code> object from this model.
+ *
+ * @param listener the listener to remove.
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns all added <code>PropertyChangeListener</code> objects.
+ *
+ * @return an array of listeners.
+ *
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ /**
+ * insureRowContinuity
+ */
+ protected void insureRowContinuity()
+ {
+ // TODO
+ }
+
+ /**
+ * arePathsContiguous
+ * @param value0 TODO
+ * @return boolean
+ */
+ protected boolean arePathsContiguous(TreePath[] value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * canPathsBeAdded
+ * @param value0 TODO
+ * @return boolean
+ */
+ protected boolean canPathsBeAdded(TreePath[] value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * canPathsBeRemoved
+ * @param value0 TODO
+ * @return boolean
+ */
+ protected boolean canPathsBeRemoved(TreePath[] value0)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * notifyPathChange
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ protected void notifyPathChange(Vector value0, TreePath value1)
+ {
+ // TODO
+ }
+
+ /**
+ * updateLeadIndex
+ */
+ protected void updateLeadIndex()
+ {
+ // TODO
+ }
+
+ /**
+ * insureUniqueness
+ */
+ protected void insureUniqueness()
+ {
+ // TODO
+ }
+}
diff --git a/libjava/javax/swing/tree/FixedHeightLayoutCache.java b/libjava/javax/swing/tree/FixedHeightLayoutCache.java
index dae3422..5cb6d3a 100644
--- a/libjava/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/libjava/javax/swing/tree/FixedHeightLayoutCache.java
@@ -1,5 +1,5 @@
/* FixedHeightLayoutCache.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package javax.swing.tree;
import java.awt.Rectangle;
import java.util.Enumeration;
+
import javax.swing.event.TreeModelEvent;
/**
diff --git a/libjava/javax/swing/tree/TreeCellEditor.java b/libjava/javax/swing/tree/TreeCellEditor.java
index bdc0b5d..d9de676 100644
--- a/libjava/javax/swing/tree/TreeCellEditor.java
+++ b/libjava/javax/swing/tree/TreeCellEditor.java
@@ -1,5 +1,5 @@
/* TreeCellEditor.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,14 +39,16 @@ exception statement from your version. */
package javax.swing.tree;
import java.awt.Component;
+
+import javax.swing.CellEditor;
import javax.swing.JTree;
/**
* TreeCellEditor public interface
* @author Andrew Selkirk
*/
-public interface TreeCellEditor {
-
+public interface TreeCellEditor extends CellEditor
+{
/**
* getTreeCellEditorComponent
* @param tree TODO
diff --git a/libjava/javax/swing/tree/TreeCellRenderer.java b/libjava/javax/swing/tree/TreeCellRenderer.java
index 3be8870e..ebd173e 100644
--- a/libjava/javax/swing/tree/TreeCellRenderer.java
+++ b/libjava/javax/swing/tree/TreeCellRenderer.java
@@ -1,5 +1,5 @@
/* TreeCellRenderer.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ 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.tree;
-// Imports
import java.awt.Component;
+
import javax.swing.JTree;
/**
diff --git a/libjava/javax/swing/tree/TreeSelectionModel.java b/libjava/javax/swing/tree/TreeSelectionModel.java
index 85dfe29..c72617b 100644
--- a/libjava/javax/swing/tree/TreeSelectionModel.java
+++ b/libjava/javax/swing/tree/TreeSelectionModel.java
@@ -1,5 +1,5 @@
/* TreeSelectionModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.tree;
import java.beans.PropertyChangeListener;
+
import javax.swing.event.TreeSelectionListener;
/**
diff --git a/libjava/javax/swing/tree/VariableHeightLayoutCache.java b/libjava/javax/swing/tree/VariableHeightLayoutCache.java
index 445faa9..14e6ea9 100644
--- a/libjava/javax/swing/tree/VariableHeightLayoutCache.java
+++ b/libjava/javax/swing/tree/VariableHeightLayoutCache.java
@@ -1,5 +1,5 @@
/* VariableHeightLayoutCache.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package javax.swing.tree;
import java.awt.Rectangle;
import java.util.Enumeration;
+
import javax.swing.event.TreeModelEvent;
/**
diff --git a/libjava/javax/swing/undo/AbstractUndoableEdit.java b/libjava/javax/swing/undo/AbstractUndoableEdit.java
index e694c0a..5ba68f5 100644
--- a/libjava/javax/swing/undo/AbstractUndoableEdit.java
+++ b/libjava/javax/swing/undo/AbstractUndoableEdit.java
@@ -1,5 +1,5 @@
-/* AbstractUndoableEdit.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* AbstractUndoableEdit.java --
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,8 @@ exception statement from your version. */
package javax.swing.undo;
import java.io.Serializable;
-import javax.swing.UIManager;
+import javax.swing.UIManager;
/**
* A default implementation of <code>UndoableEdit</code> that can be
diff --git a/libjava/javax/swing/undo/UndoableEditSupport.java b/libjava/javax/swing/undo/UndoableEditSupport.java
index 7f7bb8e..8b4cef7 100644
--- a/libjava/javax/swing/undo/UndoableEditSupport.java
+++ b/libjava/javax/swing/undo/UndoableEditSupport.java
@@ -40,10 +40,10 @@ package javax.swing.undo;
import java.util.Iterator;
import java.util.Vector;
+
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
-
/**
* A helper class for supporting {@link
* javax.swing.event.UndoableEditListener}.
diff --git a/libjava/jni/gtk-peer/gdkfont.h b/libjava/jni/gtk-peer/gdkfont.h
index f2ee86a..792cee4 100644
--- a/libjava/jni/gtk-peer/gdkfont.h
+++ b/libjava/jni/gtk-peer/gdkfont.h
@@ -38,7 +38,7 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-#include "gtkcairopeer.h"
+#include "gtkpeer.h"
#include <pango/pango.h>
#include <pango/pango-context.h>
@@ -47,6 +47,7 @@
extern struct state_table *native_font_state_table;
extern struct state_table *native_glyphvector_state_table;
+extern struct state_table *native_text_layout_state_table;
#define NSA_FONT_INIT(env, clazz) \
native_font_state_table = init_state_table (env, clazz)
@@ -73,11 +74,49 @@ extern struct state_table *native_glyphvector_state_table;
#define NSA_DEL_GV_PTR(env, obj) \
remove_state_slot (env, obj, native_glyphvector_state_table)
+
+#define NSA_TEXT_LAYOUT_INIT(env, clazz) \
+ native_text_layout_state_table = init_state_table (env, clazz)
+
+#define NSA_GET_TEXT_LAYOUT_PTR(env, obj) \
+ get_state (env, obj, native_text_layout_state_table)
+
+#define NSA_SET_TEXT_LAYOUT_PTR(env, obj, ptr) \
+ set_state (env, obj, native_text_layout_state_table, (void *)ptr)
+
+#define NSA_DEL_TEXT_LAYOUT_PTR(env, obj) \
+ remove_state_slot (env, obj, native_text_layout_state_table)
+
+#define FONT_METRICS_ASCENT 0
+#define FONT_METRICS_MAX_ASCENT 1
+#define FONT_METRICS_DESCENT 2
+#define FONT_METRICS_MAX_DESCENT 3
+#define FONT_METRICS_MAX_ADVANCE 4
+#define NUM_FONT_METRICS 5
+
+#define TEXT_METRICS_X_BEARING 0
+#define TEXT_METRICS_Y_BEARING 1
+#define TEXT_METRICS_WIDTH 2
+#define TEXT_METRICS_HEIGHT 3
+#define TEXT_METRICS_X_ADVANCE 4
+#define TEXT_METRICS_Y_ADVANCE 5
+#define NUM_TEXT_METRICS 6
+
struct peerfont
{
PangoFont *font;
PangoFontDescription *desc;
PangoContext *ctx;
+ PangoLayout *layout;
+ /*
+ * The GdkGraphics2D (using cairo) may store a pointer to a
+ * cairo_font_t here; since we want to work equally well with
+ * the GdkGraphics class (using GDK) we do not explicitly mention
+ * cairo types here; it is up to the higher level driver routine
+ * in GdkClasspathFontPeer.java to decide which backend functions
+ * to invoke.
+ */
+ void *graphics_resource;
};
struct glyphvec
@@ -90,4 +129,9 @@ struct glyphvec
PangoContext *ctx;
};
+struct textlayout
+{
+ PangoLayout *pango_layout;
+};
+
#endif /* __GDKFONT_H__ */
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
index 44f2c39..c94e664 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
@@ -45,19 +45,21 @@ exception statement from your version. */
* Signature: (J)V
*
* Purpose: Run the C function whose function pointer is
- *
+ *
*/
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun(JNIEnv *gdk_env, jobject lcl_obj,
- jlong funcAddr, jlong funcArg)
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun
+ (JNIEnv *gdk_env __attribute__((unused)),
+ jobject lcl_obj __attribute__((unused)),
+ jlong funcAddr, jlong funcArg)
{
/* Convert the function's address back into a pointer to a C function. */
- void *(*funcPtr)(void *) = (void *(*)(void *)) funcAddr;
-
+ void *(*funcPtr)(void *) = (void *(*)(void *)) (size_t)funcAddr;
+
/* We do not need to worry about the return value from funcPtr(); it's
just thrown away. That is part of the g_threads spec, so no reason
to worry about returning it. */
- (void) funcPtr((void *) funcArg);
+ (void) funcPtr((void *) (size_t)funcArg);
/* Fall off the end and terminate the thread of control. */
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c
deleted file mode 100644
index c10b945..0000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c
- Copyright (C) 1999, 2003 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 <math.h>
-
-#include "gdkfont.h"
-#include "gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.h"
-
-#define ASCENT 0
-#define MAX_ASCENT 1
-#define DESCENT 2
-#define MAX_DESCENT 3
-#define MAX_ADVANCE 4
-#define NUM_METRICS 5
-
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics_initState
- (JNIEnv *env, jobject self, jobject font)
-{
- jintArray array;
- jint *metrics;
- struct peerfont *pf = NULL;
- FT_Matrix mat;
- double pointsize;
- FT_Face face;
-
- pf = NSA_GET_FONT_PTR(env, font);
- g_assert (pf != NULL);
-
- array = (*env)->NewIntArray (env, NUM_METRICS);
- metrics = (*env)->GetIntArrayElements (env, array, NULL);
-
- gdk_threads_enter ();
-
-#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)
-
- pointsize = pango_font_description_get_size (pf->desc);
- pointsize /= (double) PANGO_SCALE;
-
- 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);
-
- face = pango_ft2_font_get_face (pf->font);
- FT_Set_Transform(face, &mat, NULL);
- FT_Set_Char_Size( face,
- DOUBLE_TO_26_6 (pointsize),
- DOUBLE_TO_26_6 (pointsize),
- 0, 0);
-
- metrics[ASCENT] = ceil (DOUBLE_FROM_26_6(face->size->metrics.ascender));
- metrics[MAX_ASCENT] = metrics[ASCENT];
- metrics[DESCENT] = floor (DOUBLE_FROM_26_6(face->size->metrics.descender));
- if (metrics[DESCENT] < 0)
- metrics[DESCENT] = - metrics[DESCENT];
- metrics[MAX_DESCENT] = metrics[DESCENT];
- metrics[MAX_ADVANCE] = ceil (DOUBLE_FROM_26_6(face->size->metrics.max_advance));
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements (env, array, metrics, 0);
-
- return array;
-}
-
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
index bb406c5..5248938 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
@@ -1,5 +1,5 @@
/* gdkfontmetrics.c
- Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,110 +36,80 @@ 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>
-#define ASCENT 0
-#define MAX_ASCENT 1
-#define DESCENT 2
-#define MAX_DESCENT 3
-#define MAX_ADVANCE 4
-#define NUM_METRICS 5
-
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_initState
- (JNIEnv *env, jobject obj __attribute__((unused)),
- jstring fname, jint style, jint size)
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics
+ (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jdoubleArray java_metrics)
{
- jintArray array;
- jint *metrics;
- const char *font_name;
- PangoFontDescription *font_desc;
- PangoContext *context;
+ struct peerfont *pfont = NULL;
+ jdouble *native_metrics = NULL;
PangoFontMetrics *pango_metrics;
- array = (*env)->NewIntArray (env, NUM_METRICS);
-
- metrics = (*env)->GetIntArrayElements (env, array, NULL);
- font_name = (*env)->GetStringUTFChars (env, fname, NULL);
-
- gdk_threads_enter ();
-
- font_desc = pango_font_description_from_string (font_name);
- pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
+ gdk_threads_enter();
- if (style & AWT_STYLE_BOLD)
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+ pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+ g_assert (pfont != NULL);
- if (style & AWT_STYLE_ITALIC)
- pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
-
- context = gdk_pango_context_get();
- pango_context_set_font_description (context, font_desc);
-
- pango_metrics = pango_context_get_metrics (context, font_desc,
+ pango_metrics = pango_context_get_metrics (pfont->ctx, pfont->desc,
gtk_get_default_language ());
- metrics[ASCENT] =
- PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics));
- metrics[MAX_ASCENT] = metrics[ASCENT];
- metrics[DESCENT] =
- PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics));
- metrics[MAX_DESCENT] = metrics[DESCENT];
- metrics[MAX_ADVANCE] =
- PANGO_PIXELS (pango_font_metrics_get_approximate_char_width (pango_metrics));
-
- pango_font_metrics_unref (pango_metrics);
-
- pango_font_description_free (font_desc);
+ native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+ g_assert (native_metrics != NULL);
- gdk_threads_leave ();
+ 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);
- (*env)->ReleaseStringUTFChars (env, fname, font_name);
- (*env)->ReleaseIntArrayElements (env, array, metrics, 0);
+ pango_font_metrics_unref (pango_metrics);
- return array;
+ gdk_threads_leave();
}
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_stringWidth
- (JNIEnv *env, jobject obj __attribute__((unused)),
- jstring fname, jint style, jint size, jstring str)
+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)
{
- PangoFontDescription *font_desc;
- PangoContext *context;
- PangoLayout *layout;
- int width = 0;
- const char *cstr;
- const char *font_name;
-
- cstr = (*env)->GetStringUTFChars (env, str, NULL);
- font_name = (*env)->GetStringUTFChars (env, fname, NULL);
-
- gdk_threads_enter ();
-
- font_desc = pango_font_description_from_string (font_name);
- pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
+ struct peerfont *pfont = NULL;
+ const char *cstr = NULL;
+ jdouble *native_metrics = NULL;
+ PangoRectangle log;
- if (style & AWT_STYLE_BOLD)
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+ gdk_threads_enter();
- if (style & AWT_STYLE_ITALIC)
- pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+ pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
+ g_assert (pfont != NULL);
- context = gdk_pango_context_get();
- pango_context_set_font_description (context, font_desc);
-
- layout = pango_layout_new (context);
-
- pango_layout_set_text (layout, cstr, -1);
+ cstr = (*env)->GetStringUTFChars (env, str, NULL);
+ g_assert(cstr != NULL);
- pango_layout_get_pixel_size (layout, &width, NULL);
+ pango_layout_set_text (pfont->layout, cstr, -1);
+ pango_layout_get_extents (pfont->layout, NULL, &log);
- pango_font_description_free (font_desc);
+ (*env)->ReleaseStringUTFChars (env, str, cstr);
+ pango_layout_set_text (pfont->layout, "", -1);
- gdk_threads_leave ();
+ native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+ g_assert (native_metrics != NULL);
- (*env)->ReleaseStringUTFChars (env, fname, font_name);
- (*env)->ReleaseStringUTFChars (env, str, cstr);
+ 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);
- return width;
+ gdk_threads_leave();
}
+
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 34d5571..d992653 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -1,5 +1,5 @@
/* gnu_java_awt_GdkFont.c
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,7 @@
exception statement from your version. */
#include "gdkfont.h"
-#include "gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h"
+#include "gnu_java_awt_peer_gtk_GdkFontPeer.h"
struct state_table *native_font_state_table;
@@ -47,6 +47,7 @@ pango text objects:
Font <-> - PangoFont
- PangoFontDescription
- PangoContext
+ - PangoLayout (for rendering and measuring)
GlyphVector <-> - GList of PangoGlyphItem
- PangoFontDescription
@@ -68,17 +69,18 @@ enum java_awt_font_baseline {
java_awt_font_HANGING_BASELINE = 2
};
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_initStaticState
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState
(JNIEnv *env, jclass clazz)
{
NSA_FONT_INIT (env, clazz);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_initState
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_initState
(JNIEnv *env, jobject self)
{
struct peerfont *pfont = NULL;
-
gdk_threads_enter ();
g_assert (self != NULL);
pfont = (struct peerfont *) g_malloc0 (sizeof (struct peerfont));
@@ -88,7 +90,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_initState
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_dispose
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
(JNIEnv *env, jobject self)
{
struct peerfont *pfont = NULL;
@@ -96,23 +99,26 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_dispose
gdk_threads_enter ();
pfont = (struct peerfont *)NSA_DEL_FONT_PTR (env, self);
g_assert (pfont != NULL);
- if (pfont->ctx != NULL)
- g_object_unref (pfont->ctx);
+ if (pfont->layout != NULL)
+ g_object_unref (pfont->font);
if (pfont->font != NULL)
g_object_unref (pfont->font);
+ if (pfont->ctx != NULL)
+ g_object_unref (pfont->ctx);
if (pfont->desc != NULL)
pango_font_description_free (pfont->desc);
g_free (pfont);
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_setFont
- (JNIEnv *env, jobject self, jstring family_name_str, jint style_int, jint size)
+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)
{
struct peerfont *pfont = NULL;
- PangoFontMap *map = NULL;
char const *family_name = NULL;
enum java_awt_font_style style;
+ PangoFT2FontMap *ft2_map;
gdk_threads_enter ();
style = (enum java_awt_font_style) style_int;
@@ -143,25 +149,38 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_setFont
if (style & java_awt_font_ITALIC)
pango_font_description_set_style (pfont->desc, PANGO_STYLE_ITALIC);
-
- /*
- FIXME: these are possibly wrong, and should in any case
- probably be cached between calls.
- */
- map = pango_ft2_font_map_for_display ();
- g_assert (map != NULL);
-
- if (pfont->ctx == NULL)
- pfont->ctx = pango_ft2_font_map_create_context (PANGO_FT2_FONT_MAP (map));
- g_assert (pfont->ctx != NULL);
+ if (useGraphics2D)
+ {
+ if (pfont->ctx == NULL)
+ {
+ ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_for_display ());
+ pfont->ctx = pango_ft2_font_map_create_context (ft2_map);
+ }
+ }
+ else
+ {
+ if (pfont->ctx == NULL)
+ pfont->ctx = gdk_pango_context_get();
+ }
+ g_assert (pfont->ctx != NULL);
+
if (pfont->font != NULL)
- g_object_unref (pfont->font);
-
- pfont->font = pango_font_map_load_font (map, pfont->ctx, pfont->desc);
+ {
+ g_object_unref (pfont->font);
+ pfont->font = NULL;
+ }
+
+ pango_context_set_font_description (pfont->ctx, pfont->desc);
+ pango_context_set_language (pfont->ctx, gtk_get_default_language());
+ pfont->font = pango_context_load_font (pfont->ctx, pfont->desc);
g_assert (pfont->font != NULL);
+ if (pfont->layout == NULL)
+ pfont->layout = pango_layout_new (pfont->ctx);
+ g_assert (pfont->layout != NULL);
+
gdk_threads_leave ();
}
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
index 5e85624..df72097 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
@@ -1,5 +1,5 @@
/* gdkglyphvector.c
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,14 +52,16 @@ typedef struct {
#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
+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)
+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;
@@ -114,12 +116,13 @@ static void seek_glyphstring_idx (GList *list, int idx,
{
GList *i = NULL;
PangoGlyphItem *gi = NULL;
+ int begin = 0;
g_assert (list != NULL);
g_assert (gs != NULL);
g_assert (nidx != NULL);
- int begin = 0;
+
for (i = g_list_first (list); i != NULL; i = g_list_next (i))
{
g_assert (i->data != NULL);
@@ -217,7 +220,8 @@ static jdoubleArray rect_to_array (JNIEnv *env, const rect_t *r)
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose
(JNIEnv *env, jobject self)
{
struct glyphvec *vec = NULL;
@@ -244,7 +248,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars
(JNIEnv *env, jobject self, jstring chars)
{
struct glyphvec *vec = NULL;
@@ -273,56 +278,66 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars
pango_context_set_font_description (vec->ctx, vec->desc);
- items = pango_itemize (vec->ctx, str, 0, len, attrs, NULL);
- g_assert (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)
+ items = pango_itemize (vec->ctx, str, 0, len, attrs, NULL);
+ if (items != 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);
-
- pango_shape (str + gi->item->offset,
- gi->item->length,
- &(gi->item->analysis),
- gi->glyphs);
-
- vec->glyphitems = g_list_append (vec->glyphitems, gi);
+
+ /*
+ 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);
}
- /*
- 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)
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes
+ (JNIEnv *env, jobject self, jintArray codes __attribute__ ((unused)))
{
struct glyphvec *vec = NULL;
@@ -341,7 +356,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes
}
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode
(JNIEnv *env, jobject self, jint idx)
{
struct glyphvec *vec = NULL;
@@ -363,7 +379,8 @@ JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode
}
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs
(JNIEnv *env, jobject self)
{
GList *i = NULL;
@@ -389,8 +406,9 @@ JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs
}
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex
- (JNIEnv *env, jobject self, jint idx)
+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
@@ -418,7 +436,8 @@ assume_pointsize_and_identity_transform(double pointsize,
0, 0);
}
-JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkExtents
+JNIEXPORT jdoubleArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkExtents
(JNIEnv *env, jobject self)
{
struct glyphvec *vec = NULL;
@@ -436,33 +455,36 @@ JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkE
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))
+ if (vec->glyphitems != NULL)
{
- 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);
+ pointsize = pango_font_description_get_size (vec->desc);
+ pointsize /= (double) PANGO_SCALE;
- for (j = 0; j < gi->glyphs->num_glyphs; ++j)
+ for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
{
- 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);
- }
- }
+ 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 ();
@@ -470,7 +492,8 @@ JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkE
}
-JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogicalExtents
+JNIEXPORT jdoubleArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogicalExtents
(JNIEnv *env, jobject self)
{
struct glyphvec *vec = NULL;
@@ -527,7 +550,8 @@ JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogi
}
-JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLogicalExtents
+JNIEXPORT jdoubleArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLogicalExtents
(JNIEnv *env, jobject self, jint idx)
{
struct glyphvec *vec = NULL;
@@ -572,7 +596,8 @@ JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLo
}
-JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphInkExtents
+JNIEXPORT jdoubleArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphInkExtents
(JNIEnv *env, jobject self, jint idx)
{
struct glyphvec *vec = NULL;
@@ -612,8 +637,9 @@ JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIn
}
-JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal
- (JNIEnv *env, jobject self, jint idx)
+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;
@@ -645,7 +671,8 @@ JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHori
}
-JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_isEqual
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGlyphVector_isEqual
(JNIEnv *env, jobject self, jobject other)
{
struct glyphvec *vec1 = NULL, *vec2 = NULL;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index a79ed5e..a91eea1 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -36,6 +36,7 @@ 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_GdkGraphics.h"
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
@@ -45,8 +46,10 @@ exception statement from your version. */
GdkPoint *
translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
jint npoints, jint x_offset, jint y_offset);
+static void realize_cb (GtkWidget *widget, jobject peer);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
(JNIEnv *env, jobject obj, jobject old)
{
struct graphics *g, *g_old;
@@ -73,7 +76,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
NSA_SET_PTR (env, obj, g);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
(JNIEnv *env, jobject obj, jint width, jint height)
{
struct graphics *g;
@@ -87,6 +91,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
g->cm = gdk_rgb_get_cmap ();
gdk_colormap_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
+
gdk_threads_leave ();
NSA_SET_PTR (env, obj, g);
@@ -94,7 +99,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
/* copy the native state of the peer (GtkWidget *) to the native state
of the graphics object */
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
(JNIEnv *env, jobject obj, jobject peer)
{
struct graphics *g = (struct graphics *) malloc (sizeof (struct graphics));
@@ -108,19 +114,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_ja
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
-
- if (GTK_IS_WINDOW (widget))
- {
- g->drawable = find_gtk_layout (widget)->bin_window;
- }
- else if (GTK_IS_LAYOUT (widget))
- {
- g->drawable = (GdkDrawable *) GTK_LAYOUT (widget)->bin_window;
- }
- else
- {
- g->drawable = (GdkDrawable *) widget->window;
- }
+ g->drawable = (GdkDrawable *) widget->window;
gdk_window_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
@@ -134,11 +128,29 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_ja
NSA_SET_PTR (env, obj, g);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_connectSignals
+ (JNIEnv *env, jobject obj, jobject peer)
+{
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, peer);
+
+ gdk_threads_enter ();
+
+ g_signal_connect_after (G_OBJECT (ptr), "realize",
+ G_CALLBACK (realize_cb), obj);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
(JNIEnv *env, jobject obj)
{
struct graphics *g;
+
g = (struct graphics *) NSA_DEL_PTR (env, obj);
if (!g) return; /* dispose has been called more than once */
@@ -157,10 +169,12 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
gdk_threads_leave ();
+
free (g);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
(JNIEnv *env, jobject obj, jint x, jint y)
{
struct graphics *g;
@@ -175,62 +189,48 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
- (JNIEnv *env, jobject obj, jstring str, jint x, jint y,
- jstring fname, jint style, jint size)
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
+ (JNIEnv *env, jobject obj, jobject font, jstring str, jint x, jint y)
{
+ struct peerfont *pfont = NULL;
struct graphics *g;
const char *cstr;
- const char *font_name;
int baseline_y;
- PangoFontDescription *font_desc;
- PangoContext *context;
- PangoLayout *layout;
PangoLayoutIter *iter;
g = (struct graphics *) NSA_GET_PTR (env, obj);
+ g_assert (g != NULL);
+
+ pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
+ g_assert (pfont != NULL);
cstr = (*env)->GetStringUTFChars (env, str, NULL);
- font_name = (*env)->GetStringUTFChars (env, fname, NULL);
gdk_threads_enter ();
- font_desc = pango_font_description_from_string (font_name);
-
- pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
-
- if (style & AWT_STYLE_BOLD)
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
-
- if (style & AWT_STYLE_ITALIC)
- pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
-
- context = gdk_pango_context_get();
- pango_context_set_font_description (context, font_desc);
-
- layout = pango_layout_new (context);
-
- pango_layout_set_text (layout, cstr, -1);
- iter = pango_layout_get_iter (layout);
+ pango_layout_set_font_description (pfont->layout, pfont->desc);
+ pango_layout_set_text (pfont->layout, cstr, -1);
+ iter = pango_layout_get_iter (pfont->layout);
baseline_y = pango_layout_iter_get_baseline (iter);
gdk_draw_layout (g->drawable, g->gc,
x + g->x_offset,
y + g->y_offset - PANGO_PIXELS (baseline_y),
- layout);
+ pfont->layout);
- pango_font_description_free (font_desc);
pango_layout_iter_free (iter);
+ pango_layout_set_text (pfont->layout, "", -1);
gdk_flush ();
gdk_threads_leave ();
- (*env)->ReleaseStringUTFChars (env, fname, font_name);
(*env)->ReleaseStringUTFChars (env, str, cstr);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
(JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2)
{
struct graphics *g;
@@ -245,7 +245,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g;
@@ -260,7 +261,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g;
@@ -274,7 +276,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
(JNIEnv *env, jobject obj, jint x, jint y,
jint width, jint height, jint dx, jint dy)
{
@@ -293,7 +296,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap
(JNIEnv *env, jobject obj, jobject offscreen,
jint x, jint y, jint width, jint height)
{
@@ -366,7 +370,8 @@ static void flip_pixbuf (GdkPixbuf *pixbuf,
}
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyAndScalePixmap
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_copyAndScalePixmap
(JNIEnv *env, jobject obj, jobject offscreen, jboolean flip_x, jboolean flip_y,
jint src_x, jint src_y, jint src_width, jint src_height,
jint dest_x, jint dest_y, jint dest_width, jint dest_height)
@@ -421,19 +426,26 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyAndScalePixmap
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g;
GdkGCValues saved;
+ GtkWidget *widget;
+ union widget_union w;
g = (struct graphics *) NSA_GET_PTR (env, obj);
gdk_threads_enter ();
if (GDK_IS_WINDOW (g->drawable))
{
- gdk_window_clear_area ((GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset, width, height);
+ w.widget = &widget;
+ gdk_window_get_user_data (GDK_WINDOW (g->drawable), w.void_widget);
+ if (widget == NULL || !GTK_IS_EVENT_BOX (widget))
+ gdk_window_clear_area ((GdkWindow *) g->drawable,
+ x + g->x_offset, y + g->y_offset,
+ width, height);
}
else
{
@@ -443,11 +455,11 @@ JNIEXPORT void JNICALL 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 ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
(JNIEnv *env, jobject obj, jint func)
{
struct graphics *g;
@@ -459,7 +471,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
(JNIEnv *env, jobject obj, jint red, jint green, jint blue)
{
GdkColor color;
@@ -478,7 +491,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
jint angle1, jint angle2)
{
@@ -521,7 +535,8 @@ translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
return points;
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
jint npoints)
{
@@ -540,7 +555,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
g_free (points);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
jint npoints)
{
@@ -564,7 +580,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
g_free (points);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
jint npoints)
{
@@ -582,7 +599,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
g_free (points);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
jint angle1, jint angle2)
{
@@ -598,7 +616,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g;
@@ -613,7 +632,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g;
@@ -628,7 +648,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
struct graphics *g;
@@ -645,3 +666,13 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
gdk_gc_set_clip_rectangle (g->gc, &rectangle);
gdk_threads_leave ();
}
+
+static void realize_cb (GtkWidget *widget __attribute__ ((unused)),
+ jobject peer)
+{
+ gdk_threads_leave ();
+
+ (*gdk_env)->CallVoidMethod (gdk_env, peer, initComponentGraphicsID);
+
+ gdk_threads_enter ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
index 3bed318..90b6aa1 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
@@ -64,7 +64,8 @@ struct state_table *native_graphics2d_state_table;
#define NSA_DEL_G2D_PTR(env, obj) \
remove_state_slot (env, obj, native_graphics2d_state_table)
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState
(JNIEnv *env, jclass clazz)
{
gdk_threads_enter();
@@ -159,18 +160,7 @@ grab_current_drawable (GtkWidget *widget, GdkDrawable **draw, GdkWindow **win)
g_assert (draw != NULL);
g_assert (win != NULL);
- if (GTK_IS_WINDOW (widget))
- {
- *win = find_gtk_layout (widget)->bin_window;
- }
- else if (GTK_IS_LAYOUT (widget))
- {
- *win = GTK_LAYOUT (widget)->bin_window;
- }
- else
- {
- *win = widget->window;
- }
+ *win = widget->window;
*draw = *win;
gdk_window_get_internal_paint_info (*win, draw, 0, 0);
@@ -326,7 +316,18 @@ check_for_debug (struct graphics2d *gr)
gr->debug = (gboolean)(getenv("DEBUGJ2D") != NULL);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState
+static void
+realize_cb (GtkWidget *widget, jobject peer)
+{
+ gdk_threads_leave ();
+
+ (*gdk_env)->CallVoidMethod (gdk_env, peer, initComponentGraphics2DID);
+
+ gdk_threads_enter ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState
(JNIEnv *env, jobject obj, jobject old)
{
struct graphics2d *g = NULL, *g_old = NULL;
@@ -361,7 +362,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
(JNIEnv *env, jobject obj, jint width, jint height)
{
struct graphics2d *gr;
@@ -394,7 +396,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
(JNIEnv *env, jobject self, jobject other, jint x, jint y)
{
struct graphics2d *src = NULL, *dst = NULL;
@@ -413,7 +416,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
begin_drawing_operation(dst);
- gdk_flush();
+ /* gdk_flush(); */
gdk_drawable_get_size (src->drawable, &s_width, &s_height);
gdk_drawable_get_size (dst->drawable, &d_width, &d_height);
@@ -442,7 +445,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
(JNIEnv *env, jobject obj, jobject peer)
{
struct graphics2d *gr = NULL;
@@ -478,7 +482,24 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_connectSignals
+ (JNIEnv *env, jobject obj, jobject peer)
+{
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, peer);
+
+ gdk_threads_enter ();
+
+ g_signal_connect_after (G_OBJECT (ptr), "realize",
+ G_CALLBACK (realize_cb), obj);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -517,7 +538,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient
(JNIEnv *env, jobject obj,
jdouble x1, jdouble y1,
jdouble x2, jdouble y2,
@@ -641,7 +663,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
(JNIEnv *env, jobject obj, jintArray jarr, jint w, jint h, jint stride)
{
struct graphics2d *gr = NULL;
@@ -687,7 +710,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
(JNIEnv *env, jobject obj, jintArray java_pixels,
jint w, jint h, jint stride, jdoubleArray java_matrix)
{
@@ -724,6 +748,7 @@ JNIEXPORT void JNICALL 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);
@@ -737,7 +762,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
gdk_threads_leave();
}
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -776,12 +802,12 @@ JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePix
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]);
+ for (i=0; i<width * height; i++)
+ {
+ native_pixels[i] = SWAPU32 ((unsigned)native_pixels[i]);
}
#endif
@@ -797,7 +823,8 @@ JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePix
/* passthrough methods to cairo */
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -812,7 +839,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -828,7 +856,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
(JNIEnv *env, jobject obj, jdoubleArray java_matrix)
{
struct graphics2d *gr = NULL;
@@ -838,7 +867,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
+ /* cairoSetMatrix was called before this graphics object's component
+ was realized. */
+ if (gr == NULL) { gdk_threads_leave (); return; }
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
g_assert (native_matrix != NULL);
@@ -864,92 +895,385 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont
- (JNIEnv *env, jobject obj, jobject font)
+static void
+install_font_peer(cairo_t *cr,
+ struct peerfont *pfont,
+ int debug)
{
- struct graphics2d *gr = NULL;
- struct peerfont *pfont = NULL;
- cairo_font_t *ft = NULL;
+ cairo_font_t *ft;
FT_Face face = NULL;
+ g_assert(cr != NULL);
+ g_assert(pfont != NULL);
+
+ if (pfont->graphics_resource == NULL)
+ {
+ face = pango_ft2_font_get_face (pfont->font);
+ g_assert (face != NULL);
+
+ ft = cairo_ft_font_create_for_ft_face (face);
+ g_assert (ft != NULL);
+
+ 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));
+
+ 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));
+ ft = cairo_current_font (cr);
+ pfont->graphics_resource = ft;
+ }
+ else
+ {
+ if (debug) printf ("install_font_peer reused existing font resource\n");
+ ft = (cairo_font_t *) pfont->graphics_resource;
+ cairo_set_font (cr, ft);
+ }
+}
+
+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)
+{
+ struct peerfont *pfont = NULL;
+
+ g_assert(java_font != NULL);
+
gdk_threads_enter();
- if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
+ pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+ g_assert (pfont != NULL);
+ if (pfont->graphics_resource != NULL)
+ {
+ cairo_font_destroy ((cairo_font_t *) pfont->graphics_resource);
+ pfont->graphics_resource = NULL;
+ }
+ gdk_threads_leave();
+}
- gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
+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;
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
+ g_assert(java_font != NULL);
+ gdk_threads_enter();
+
+ pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
g_assert (pfont != NULL);
- face = pango_ft2_font_get_face (pfont->font);
- g_assert (face != 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();
+}
- ft = cairo_ft_font_create_for_ft_face (face);
- g_assert (ft != NULL);
+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;
- if (gr->debug) printf ("cairo_set_font '%s'\n", face->family_name);
-
- cairo_set_font (gr->cr, ft);
+ 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);
- cairo_scale_font (gr->cr,
- pango_font_description_get_size (pfont->desc) /
- (double)PANGO_SCALE);
+ 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;
- cairo_font_destroy (ft);
+ (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoShowGlyphs
- (JNIEnv *env, jobject obj, jintArray java_codes, jfloatArray java_posns)
+static void
+paint_glyph_run(struct graphics2d *gr,
+ cairo_glyph_t **glyphs,
+ gint *n_glyphs,
+ PangoLayoutRun *run)
+{
+ gint i = 0;
+ gint x = 0, y = 0;
+
+ g_assert (gr != NULL);
+ g_assert (glyphs != NULL);
+ g_assert (n_glyphs != NULL);
+ g_assert (run != NULL);
+
+ if (run->glyphs != NULL && run->glyphs->num_glyphs > 0)
+ {
+ if (*n_glyphs < run->glyphs->num_glyphs)
+ {
+ *glyphs = g_realloc(*glyphs,
+ (sizeof(cairo_glyph_t)
+ * run->glyphs->num_glyphs));
+ *n_glyphs = run->glyphs->num_glyphs;
+ }
+
+ g_assert (*glyphs != NULL);
+
+ if (gr->debug) printf ("painting %d glyphs: ", run->glyphs->num_glyphs);
+
+ for (i = 0; i < run->glyphs->num_glyphs; ++i)
+ {
+ (*glyphs)[i].index = run->glyphs->glyphs[i].glyph;
+
+ (*glyphs)[i].x =
+ ((double) (x + run->glyphs->glyphs[i].geometry.x_offset))
+ / ((double) PANGO_SCALE);
+
+ (*glyphs)[i].y =
+ ((double) (y + run->glyphs->glyphs[i].geometry.y_offset))
+ / ((double) PANGO_SCALE);
+
+ if (gr->debug) printf(" (%ld @ %f,%f)",
+ (*glyphs)[i].index,
+ (*glyphs)[i].x,
+ (*glyphs)[i].y);
+
+ x += run->glyphs->glyphs[i].geometry.width;
+ }
+
+ if (gr->debug) printf("\n");
+ begin_drawing_operation (gr);
+ cairo_show_glyphs (gr->cr, *glyphs, run->glyphs->num_glyphs);
+ end_drawing_operation (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;
- jfloat *native_posns = NULL;
- jint *native_codes = NULL;
- jint i;
- jint ncodes, nposns;
+ gint n_glyphs = 0;
+ PangoLayoutRun *run = NULL;
+ PangoLayoutIter *iter = NULL;
+ */
- gdk_threads_enter();
+ 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);
+ g_assert(gr != NULL);
- native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
- native_posns = (*env)->GetFloatArrayElements (env, java_posns, NULL);
- g_assert (native_codes != NULL);
- g_assert (native_posns != NULL);
+ pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, font);
+ g_assert (pfont != NULL);
- ncodes = (*env)->GetArrayLength (env, java_codes);
- nposns = (*env)->GetArrayLength (env, java_posns);
- g_assert (2 * ncodes == nposns);
+ cstr = (*env)->GetStringUTFChars (env, str, NULL);
+ g_assert(cstr != NULL);
- if (gr->debug) printf ("cairo_show_glyphs (%d glyphs)\n", ncodes);
+ if (gr->debug) printf ("painting string '%s' at (%f,%f)\n", cstr, x, y);
- glyphs = malloc (sizeof(cairo_glyph_t) * ncodes);
- g_assert (glyphs);
+ /* 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).
+ */
- for (i = 0; i < ncodes; ++i)
+ 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
{
- glyphs[i].index = native_codes[i];
- glyphs[i].x = (double) native_posns[2*i];
- glyphs[i].y = (double) native_posns[2*i + 1];
- if (gr->debug) printf ("cairo_show_glyphs (glyph %d (code %d) : %f,%f)\n",
- i, glyphs[i].index, glyphs[i].x, glyphs[i].y);
- }
+ 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);
- (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
- (*env)->ReleaseFloatArrayElements (env, java_posns, native_posns, 0);
+ cairo_translate (gr->cr, -x, -y);
+
+ pango_layout_iter_free (iter);
- begin_drawing_operation (gr);
- cairo_show_glyphs (gr->cr, glyphs, ncodes);
- end_drawing_operation (gr);
+ */
- free(glyphs);
- gdk_threads_leave();
+ 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)
+{
+
+ struct graphics2d *gr = NULL;
+ struct peerfont *pfont = NULL;
+ struct glyphvec *gv = NULL;
+ PangoLayoutRun *run = NULL;
+ cairo_glyph_t *glyphs = NULL;
+ gint n_glyphs = 0;
+
+ g_assert (self != NULL);
+ g_assert (java_vec != 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);
+ g_assert (pfont != NULL);
+
+ if (gr->debug) printf ("painting pango glyph vector\n");
+
+ install_font_peer (gr->cr, pfont, gr->debug);
+ cairo_translate (gr->cr, x, y);
+
+ /* nb. PangoLayoutRun is a typedef for PangoGlyphItem. */
+ run = (PangoLayoutRun *) gv->glyphitems;
+ if (run != NULL)
+ paint_glyph_run (gr, &glyphs, &n_glyphs, run);
+
+ if (glyphs != NULL)
+ g_free (glyphs);
+
+ cairo_translate (gr->cr, -x, -y);
+ gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGdkTextLayout
+ (JNIEnv *env, jobject self, jobject font, jobject java_layout, jfloat x, jfloat y)
+{
+ /*
+ * FIXME: Some day we expect either cairo or pango will know how to make
+ * a pango layout paint to a cairo surface. that day is not yet here.
+ */
+
+ struct graphics2d *gr = NULL;
+ struct peerfont *pfont = NULL;
+ struct textlayout *tl = NULL;
+ PangoLayoutIter *i = NULL;
+ PangoLayoutRun *run = NULL;
+ cairo_glyph_t *glyphs = NULL;
+ gint n_glyphs = 0;
+
+ g_assert (self != NULL);
+ g_assert (java_layout != NULL);
+
+ 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");
+
+ gdk_threads_enter ();
+ if (peer_is_disposed(env, self)) { gdk_threads_leave(); return; }
+
+ 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);
+ }
+ while (pango_layout_iter_next_run (i));
+
+ if (glyphs != NULL)
+ g_free (glyphs);
+
+ cairo_translate (gr->cr, -x, -y);
+
+ pango_layout_iter_free (i);
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator
(JNIEnv *env, jobject obj, jint op)
{
struct graphics2d *gr = NULL;
@@ -1013,7 +1337,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBColor
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBColor
(JNIEnv *env, jobject obj, jdouble r, jdouble g, jdouble b)
{
struct graphics2d *gr = NULL;
@@ -1039,7 +1364,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBColor
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetAlpha
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetAlpha
(JNIEnv *env, jobject obj, jdouble a)
{
struct graphics2d *gr = NULL;
@@ -1049,12 +1375,13 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetAlpha
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_set_alpha %f\n", a);
+ if (gr->debug) printf ("cairo_set_alpha %f\n", a);
cairo_set_alpha (gr->cr, a);
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule
(JNIEnv *env, jobject obj, jint rule)
{
struct graphics2d *gr = NULL;
@@ -1077,7 +1404,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth
(JNIEnv *env, jobject obj, jdouble width)
{
struct graphics2d *gr = NULL;
@@ -1092,7 +1420,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidt
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
(JNIEnv *env, jobject obj, jint cap)
{
struct graphics2d *gr = NULL;
@@ -1120,7 +1449,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
(JNIEnv *env, jobject obj, jint join)
{
struct graphics2d *gr = NULL;
@@ -1148,7 +1478,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
(JNIEnv *env, jobject obj, jdoubleArray dashes, jint ndash, jdouble offset)
{
struct graphics2d *gr = NULL;
@@ -1167,7 +1498,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit
(JNIEnv *env, jobject obj, jdouble miter)
{
struct graphics2d *gr = NULL;
@@ -1183,7 +1515,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLim
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -1192,13 +1525,14 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
+ if (gr == NULL) { gdk_threads_leave (); return; }
if (gr->debug) printf ("cairo_new_path\n");
cairo_new_path (gr->cr);
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo
(JNIEnv *env, jobject obj, jdouble x, jdouble y)
{
struct graphics2d *gr = NULL;
@@ -1213,7 +1547,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo
(JNIEnv *env, jobject obj, jdouble x, jdouble y)
{
struct graphics2d *gr = NULL;
@@ -1228,7 +1563,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo
(JNIEnv *env, jobject obj, jdouble x1, jdouble y1, jdouble x2, jdouble y2, jdouble x3, jdouble y3)
{
struct graphics2d *gr = NULL;
@@ -1243,7 +1579,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelMoveTo
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelMoveTo
(JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
{
struct graphics2d *gr = NULL;
@@ -1258,7 +1595,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelMoveTo
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelLineTo
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelLineTo
(JNIEnv *env, jobject obj, jdouble dx, jdouble dy)
{
struct graphics2d *gr = NULL;
@@ -1273,7 +1611,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelLineTo
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo
(JNIEnv *env, jobject obj, jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2, jdouble dx3, jdouble dy3)
{
struct graphics2d *gr = NULL;
@@ -1288,7 +1627,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle
(JNIEnv *env, jobject obj, jdouble x, jdouble y, jdouble width, jdouble height)
{
struct graphics2d *gr = NULL;
@@ -1297,13 +1637,14 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
+ if (gr == NULL) { gdk_threads_leave (); return; }
if (gr->debug) printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height);
cairo_rectangle (gr->cr, x, y, width, height);
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClosePath
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClosePath
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -1318,7 +1659,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClosePath
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -1335,7 +1677,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -1352,7 +1695,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
(JNIEnv *env, jobject obj)
{
struct graphics2d *gr = NULL;
@@ -1361,7 +1705,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
- g_assert (gr != NULL);
+ if (gr == NULL) { gdk_threads_leave (); return; }
if (gr->debug) printf ("cairo_clip\n");
begin_drawing_operation (gr);
cairo_init_clip (gr->cr);
@@ -1370,7 +1714,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip
gdk_threads_leave();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter
(JNIEnv *env, jobject obj, jint filter)
{
struct graphics2d *gr = NULL;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
new file mode 100644
index 0000000..578acf6
--- /dev/null
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
@@ -0,0 +1,99 @@
+/* gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.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 "gdkfont.h"
+#include "gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h"
+
+
+static gint
+cmp_families (const void *a, const void *b)
+{
+ const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
+ const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
+
+ return g_utf8_collate (a_name, b_name);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetFontFamilies
+(JNIEnv *env, jobject self __attribute__((unused)), jobjectArray family_name)
+{
+ PangoContext *context;
+ PangoFontFamily **families;
+ int n_families, idx;
+
+ gdk_threads_enter ();
+
+ context = gdk_pango_context_get();
+ g_assert (context != NULL);
+
+ pango_context_list_families (context, &families, &n_families);
+
+ qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
+
+ for (idx = 0; idx < n_families; idx++)
+ {
+ const char *name_tmp = pango_font_family_get_name (families[idx]);
+ jstring name = (*env)->NewStringUTF (env, name_tmp);
+ (*env)->SetObjectArrayElement (env, family_name, idx, name);
+ }
+ g_free (families);
+ gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetNumFontFamilies
+(JNIEnv *env __attribute__((unused)), jobject obj __attribute__((unused)))
+{
+ PangoContext *context;
+ PangoFontFamily **families;
+ gint n_families;
+ jint num;
+
+ gdk_threads_enter ();
+
+ context = gdk_pango_context_get();
+ g_assert (context != NULL);
+
+ pango_context_list_families (context, &families, &n_families);
+
+ num = n_families;
+ g_free (families);
+ gdk_threads_leave ();
+
+ return num;
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
index 7fdda31..3cb3bd2 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
@@ -99,14 +99,17 @@ area_updated (GdkPixbufLoader *loader,
JNIEnv *env;
union env_union e;
jint stride_bytes, stride_pixels, n_channels, n_pixels;
- int i;
jintArray jpixels;
jint *java_pixels;
guchar *gdk_pixels;
GdkPixbuf *pixbuf_no_alpha = NULL;
GdkPixbuf *pixbuf = NULL;
-
+
+#ifndef WORDS_BIGENDIAN
+ int i;
+#endif
+
pixbuf_no_alpha = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf_no_alpha == NULL)
return;
@@ -168,7 +171,8 @@ closed (GdkPixbufLoader *loader __attribute__((unused)), jobject *decoder)
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initState
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initState
(JNIEnv *env, jobject obj)
{
GdkPixbufLoader *loader = NULL;
@@ -189,7 +193,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initState
NSA_SET_PB_PTR (env, obj, loader);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticState
(JNIEnv *env, jclass clazz)
{
(*env)->GetJavaVM(env, &vm);
@@ -205,7 +210,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_initStaticSta
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_finish
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_finish
(JNIEnv *env, jobject obj)
{
GdkPixbufLoader *loader = NULL;
@@ -221,7 +227,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_finish
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpBytes
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkPixbufDecoder_pumpBytes
(JNIEnv *env, jobject obj, jbyteArray jarr, jint len)
{
GdkPixbufLoader *loader = NULL;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
new file mode 100644
index 0000000..d09d155
--- /dev/null
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
@@ -0,0 +1,183 @@
+/* gnu_java_awt_GdkTextLayout.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 <jni.h>
+#include <gtk/gtk.h>
+#include "native_state.h"
+#include "gdkfont.h"
+#include "gnu_java_awt_peer_gtk_GdkTextLayout.h"
+
+struct state_table *native_text_layout_state_table;
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_initStaticState
+ (JNIEnv *env, jclass clazz)
+{
+ NSA_TEXT_LAYOUT_INIT (env, clazz);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_initState
+ (JNIEnv *env, jobject self)
+{
+ struct textlayout *tl;
+
+ gdk_threads_enter ();
+ g_assert(self != NULL);
+ tl = g_malloc0 (sizeof (struct textlayout));
+ g_assert(tl != NULL);
+ tl->pango_layout = pango_layout_new(gdk_pango_context_get());
+ g_assert(tl->pango_layout != NULL);
+ NSA_SET_TEXT_LAYOUT_PTR (env, self, tl);
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_setText
+ (JNIEnv *env, jobject self, jstring text)
+{
+ struct textlayout *tl;
+ gchar *str = NULL;
+ gint len = 0;
+
+ gdk_threads_enter ();
+ g_assert(self != NULL);
+ g_assert(text != NULL);
+
+ tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, self);
+ g_assert(tl != NULL);
+ g_assert(tl->pango_layout != NULL);
+
+ len = (*env)->GetStringUTFLength (env, text);
+ str = (gchar *)(*env)->GetStringUTFChars (env, text, NULL);
+ g_assert (str != NULL);
+
+ pango_layout_set_text (tl->pango_layout, text, len);
+
+ (*env)->ReleaseStringUTFChars (env, text, str);
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_indexToPos
+ (JNIEnv *env, jobject self, jint idx, jdoubleArray javaPos)
+{
+ struct textlayout *tl;
+ PangoRectangle pangoPos;
+ jdouble *nativePos;
+
+ gdk_threads_enter ();
+ g_assert(self != NULL);
+ g_assert(javaPos != NULL);
+
+ tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, self);
+ g_assert(tl != NULL);
+ g_assert(tl->pango_layout != NULL);
+
+ g_assert((*env)->GetArrayLength (env, javaPos) == 4);
+
+ nativePos = (*env)->GetDoubleArrayElements (env, javaPos, NULL);
+
+ pango_layout_index_to_pos (tl->pango_layout, idx, &pangoPos);
+
+ nativePos[0] = (jdouble) pangoPos.x;
+ nativePos[1] = (jdouble) pangoPos.y;
+ nativePos[2] = (jdouble) pangoPos.width;
+ nativePos[3] = (jdouble) pangoPos.height;
+
+ (*env)->ReleaseDoubleArrayElements (env, javaPos, nativePos, 0);
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_getExtents
+ (JNIEnv *env, jobject self, jdoubleArray javaInkExtents, jdoubleArray javaLogExtents)
+{
+ struct textlayout *tl;
+ PangoRectangle pangoInkExtents, pangoLogExtents;
+ jdouble *nativeInkExtents, *nativeLogExtents;
+
+ gdk_threads_enter ();
+ g_assert(self != NULL);
+ g_assert(javaInkExtents != NULL);
+ g_assert(javaLogExtents != NULL);
+
+ tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, self);
+ g_assert(tl != NULL);
+ g_assert(tl->pango_layout != NULL);
+
+ g_assert((*env)->GetArrayLength (env, javaInkExtents) == 4);
+ g_assert((*env)->GetArrayLength (env, javaLogExtents) == 4);
+
+ nativeInkExtents = (*env)->GetDoubleArrayElements (env, javaInkExtents, NULL);
+ nativeLogExtents = (*env)->GetDoubleArrayElements (env, javaLogExtents, NULL);
+
+ pango_layout_get_extents (tl->pango_layout,
+ &pangoInkExtents, &pangoLogExtents);
+
+ nativeInkExtents[0] = (jdouble) pangoInkExtents.x;
+ nativeInkExtents[1] = (jdouble) pangoInkExtents.y;
+ nativeInkExtents[2] = (jdouble) pangoInkExtents.width;
+ nativeInkExtents[3] = (jdouble) pangoInkExtents.height;
+
+ nativeLogExtents[0] = (jdouble) pangoLogExtents.x;
+ nativeLogExtents[1] = (jdouble) pangoLogExtents.y;
+ nativeLogExtents[2] = (jdouble) pangoLogExtents.width;
+ nativeLogExtents[3] = (jdouble) pangoLogExtents.height;
+
+ (*env)->ReleaseDoubleArrayElements (env, javaInkExtents, nativeInkExtents, 0);
+ (*env)->ReleaseDoubleArrayElements (env, javaLogExtents, nativeLogExtents, 0);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose
+ (JNIEnv *env, jobject self)
+{
+ struct textlayout *tl;
+
+ gdk_threads_enter ();
+ g_assert(self != NULL);
+ tl = (struct textlayout *) NSA_DEL_TEXT_LAYOUT_PTR (env, self);
+ g_assert(tl != NULL);
+ if (tl->pango_layout != NULL)
+ g_object_unref (tl->pango_layout);
+ g_free(tl);
+ gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
index 08d38b5..1cb4334 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
@@ -37,14 +37,24 @@ exception statement from your version. */
#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
+static gboolean focus_in_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ jobject peer);
+static gboolean focus_out_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ jobject peer);
+
+static void block_expose_events_cb (GtkWidget *widget,
+ jobject peer);
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
(JNIEnv *env, jobject obj, jstring label)
{
const char *c_label;
+ GtkWidget *eventbox;
GtkWidget *button;
NSA_SET_GLOBAL_REF (env, obj);
@@ -53,41 +63,51 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
gdk_threads_enter ();
+ eventbox = gtk_event_box_new ();
button = gtk_button_new_with_label (c_label);
+ gtk_container_add (GTK_CONTAINER (eventbox), button);
gtk_widget_show (button);
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, label, c_label);
- NSA_SET_PTR (env, obj, button);
+ NSA_SET_PTR (env, obj, eventbox);
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectJObject
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
+ jobject *gref;
+ GtkWidget *button;
ptr = NSA_GET_PTR (env, obj);
+ gref = NSA_GET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
+ button = gtk_bin_get_child (GTK_BIN (ptr));
- connect_awt_hook (env, obj, 1, GTK_BUTTON(ptr)->event_window);
+ g_signal_connect (G_OBJECT (ptr), "event",
+ G_CALLBACK (pre_event_handler), *gref);
- gdk_threads_leave ();
-}
+ g_signal_connect (G_OBJECT (button), "event",
+ G_CALLBACK (pre_event_handler), *gref);
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
- (JNIEnv *env, jobject obj)
-{
- /* FIXME: Do we need to connect any signals here? Otherwise just do not
- override parent method. */
+ g_signal_connect (G_OBJECT (button), "focus-in-event",
+ G_CALLBACK (focus_in_cb), *gref);
+
+ g_signal_connect (G_OBJECT (button), "focus-out-event",
+ G_CALLBACK (focus_out_cb), *gref);
+
+ g_signal_connect_after (G_OBJECT (button), "pressed",
+ G_CALLBACK (block_expose_events_cb), *gref);
- /* Connect the superclass signals. */
- Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
+ g_signal_connect_after (G_OBJECT (button), "released",
+ G_CALLBACK (block_expose_events_cb), *gref);
+
+ gdk_threads_leave ();
}
JNIEXPORT void JNICALL
@@ -95,6 +115,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
(JNIEnv *env, jobject obj, jstring jtext)
{
const char *text;
+ GtkWidget *button;
GtkWidget *label;
void *ptr;
@@ -104,7 +125,8 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
gdk_threads_enter ();
- label = gtk_bin_get_child (GTK_BIN (ptr));
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ label = gtk_bin_get_child (GTK_BIN (button));
gtk_label_set_text (GTK_LABEL (label), text);
gdk_threads_leave ();
@@ -113,11 +135,12 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
void *ptr;
+ GtkWidget *button;
GtkWidget *label;
PangoFontDescription *font_desc;
@@ -127,7 +150,8 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont
gdk_threads_enter();
- label = gtk_bin_get_child (GTK_BIN (ptr));
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ label = gtk_bin_get_child (GTK_BIN (button));
font_desc = pango_font_description_from_string (font_name);
pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
@@ -148,10 +172,56 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont
}
JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetBackground
+ (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+ GdkColor normal_color;
+ GdkColor prelight_color;
+ GdkColor active_color;
+ int prelight_red;
+ int prelight_blue;
+ int prelight_green;
+ GtkWidget *button;
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ normal_color.red = (red / 255.0) * 65535;
+ normal_color.green = (green / 255.0) * 65535;
+ normal_color.blue = (blue / 255.0) * 65535;
+
+ /* This calculation only approximate the active color produced by
+ Sun's AWT. */
+ active_color.red = 0.85 * (red / 255.0) * 65535;
+ active_color.green = 0.85 * (green / 255.0) * 65535;
+ active_color.blue = 0.85 * (blue / 255.0) * 65535;
+
+ /* There is no separate prelight color in Motif. */
+ prelight_red = 1.15 * (red / 255.0) * 65535;
+ prelight_green = 1.15 * (green / 255.0) * 65535;
+ prelight_blue = 1.15 * (blue / 255.0) * 65535;
+
+ prelight_color.red = prelight_red > 65535 ? 65535 : prelight_red;
+ prelight_color.green = prelight_green > 65535 ? 65535 : prelight_green;
+ prelight_color.blue = prelight_blue > 65535 ? 65535 : prelight_blue;
+
+ gdk_threads_enter ();
+
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+
+ gtk_widget_modify_bg (button, GTK_STATE_NORMAL, &normal_color);
+ gtk_widget_modify_bg (button, GTK_STATE_ACTIVE, &active_color);
+ gtk_widget_modify_bg (button, GTK_STATE_PRELIGHT, &prelight_color);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetForeground
(JNIEnv *env, jobject obj, jint red, jint green, jint blue)
{
GdkColor color;
+ GtkWidget *button;
GtkWidget *label;
void *ptr;
@@ -163,7 +233,8 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetForeground
gdk_threads_enter ();
- label = gtk_bin_get_child (GTK_BIN(ptr));
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ label = gtk_bin_get_child (GTK_BIN (button));
gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &color);
gtk_widget_modify_fg (label, GTK_STATE_ACTIVE, &color);
@@ -176,13 +247,101 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkActivate
(JNIEnv *env, jobject obj)
{
+ GtkWidget *button;
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ gtk_widget_activate (GTK_WIDGET (button));
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetRequestFocus
+ (JNIEnv *env, jobject obj)
+{
+ void *ptr;
+ GtkWidget *button;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ gtk_widget_grab_focus (button);
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_setNativeBounds
+ (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+ GtkWidget *widget, *child;
void *ptr;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- gtk_widget_activate (GTK_WIDGET (ptr));
+ widget = GTK_WIDGET (ptr);
+
+ /* We assume that -1 is a width or height and not a request for the
+ widget's natural size. */
+ width = width < 0 ? 0 : width;
+ height = height < 0 ? 0 : height;
+ child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (!(width == 0 && height == 0))
+ {
+ /* Set the event box's size request... */
+ gtk_widget_set_size_request (widget, width, height);
+ /* ...and the button's size request... */
+ gtk_widget_set_size_request (child, width, height);
+ /* ...and the label's size request. */
+ gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (child)), width,
+ height);
+ if (widget->parent != NULL)
+ gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+ }
gdk_threads_leave ();
}
+
+static gboolean
+focus_in_cb (GtkWidget *widget __attribute((unused)),
+ GdkEventFocus *event __attribute((unused)),
+ jobject peer)
+{
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postFocusEventID,
+ AWT_FOCUS_GAINED,
+ JNI_FALSE);
+ return FALSE;
+}
+
+static gboolean
+focus_out_cb (GtkWidget *widget __attribute((unused)),
+ GdkEventFocus *event __attribute((unused)),
+ jobject peer)
+{
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postFocusEventID,
+ AWT_FOCUS_LOST,
+ JNI_FALSE);
+ return FALSE;
+}
+
+static void
+block_expose_events_cb (GtkWidget *widget, jobject peer)
+{
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ beginNativeRepaintID);
+
+ gdk_window_process_updates (widget->window, TRUE);
+
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ endNativeRepaintID);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
index 6a1a90c..63dd944 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
@@ -39,7 +39,8 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkCanvasPeer.h"
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
(JNIEnv *env, jobject obj)
{
gpointer widget;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
index f88e2e8..90923fe 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
@@ -39,7 +39,8 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.h"
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
(JNIEnv *env, jobject obj)
{
/* The actual underlying widget is owned by a different class. So
@@ -47,7 +48,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
NSA_DEL_PTR (env, obj);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
(JNIEnv *env, jobject obj, jobject checkbox)
{
GtkRadioButton *button;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
index 153b17f..ade7430 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
@@ -46,7 +46,6 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
GtkWidget *widget;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
@@ -54,7 +53,6 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
gdk_threads_enter ();
widget = gtk_check_menu_item_new_with_label (str);
- gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), 1);
gtk_widget_show (widget);
gdk_threads_leave ();
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
index 4d5c811..3b58c05 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
@@ -144,7 +144,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkToggleButtonSetActive
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
index 1284431..94c9c3d 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
@@ -45,8 +45,7 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create
(JNIEnv *env, jobject obj)
{
- GtkWidget *menu;
- GtkComboBox *combobox;
+ GtkWidget *combobox;
NSA_SET_GLOBAL_REF (env, obj);
@@ -181,7 +180,6 @@ void selection_changed (GtkComboBox *combobox, jobject peer)
jstring label;
GtkTreeModel *model;
GtkTreeIter iter;
- GValue value;
gchar *selected;
gint index;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
index a132740..986244e 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
@@ -148,8 +148,8 @@ selection_get (GtkWidget *widget __attribute__((unused)),
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,
- (char *)utf, utflen);
+ gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8,
+ (const unsigned char*)utf, utflen);
(*gdk_env)->ReleaseStringUTFChars (gdk_env, jstr, utf);
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index 8aaf0d2..3aebe77 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -49,6 +49,7 @@ static gboolean focus_in_cb (GtkWidget *widget,
static gboolean focus_out_cb (GtkWidget *widget,
GdkEventFocus *event,
jobject peer);
+
/*
* This method returns a GDK keyval that corresponds to one of the
* keysyms in the X keymap table. The return value is only used to
@@ -489,27 +490,33 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
widget = GTK_WIDGET (ptr);
parent_widget = GTK_WIDGET (parent_ptr);
- if (GTK_IS_WINDOW (parent_widget))
+ if (widget->parent == NULL)
{
- GList *children = gtk_container_children
- (GTK_CONTAINER (GTK_BIN (parent_widget)->child));
-
- if (GTK_IS_MENU_BAR (children->data))
- gtk_layout_put (GTK_LAYOUT (children->next->data), widget, 0, 0);
+ if (GTK_IS_WINDOW (parent_widget))
+ {
+ GList *children = gtk_container_children
+ (GTK_CONTAINER (parent_widget));
+
+ if (GTK_IS_MENU_BAR (children->data))
+ gtk_fixed_put (GTK_FIXED (children->next->data), widget, 0, 0);
+ else
+ gtk_fixed_put (GTK_FIXED (children->data), widget, 0, 0);
+ }
else
- gtk_layout_put (GTK_LAYOUT (children->data), widget, 0, 0);
+ if (GTK_IS_SCROLLED_WINDOW (parent_widget))
+ {
+ gtk_scrolled_window_add_with_viewport
+ (GTK_SCROLLED_WINDOW (parent_widget), widget);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent),
+ GTK_SHADOW_NONE);
+
+ }
+ else
+ {
+ if (widget->parent == NULL)
+ gtk_fixed_put (GTK_FIXED (parent_widget), widget, 0, 0);
+ }
}
- else
- if (GTK_IS_SCROLLED_WINDOW (parent_widget))
- {
- gtk_scrolled_window_add_with_viewport
- (GTK_SCROLLED_WINDOW (parent_widget), widget);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent),
- GTK_SHADOW_NONE);
-
- }
- else
- gtk_layout_put (GTK_LAYOUT (parent_widget), widget, 0, 0);
gdk_threads_leave ();
}
@@ -770,7 +777,8 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions
(*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
GtkWidget *widget;
@@ -791,8 +799,12 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBoun
gtk_widget_set_size_request (widget, width, height);
else
{
- gtk_widget_set_size_request (widget, width, height);
- gtk_layout_move (GTK_LAYOUT (widget->parent), widget, x, y);
+ if (!(width == 0 && height == 0))
+ {
+ gtk_widget_set_size_request (widget, width, height);
+ if (widget->parent != NULL)
+ gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+ }
}
gdk_threads_leave ();
@@ -908,38 +920,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetForeground
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkSetFont
- (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
-{
- const char *font_name;
- void *ptr;
- PangoFontDescription *font_desc;
-
- ptr = NSA_GET_PTR (env, obj);
-
- font_name = (*env)->GetStringUTFChars (env, name, NULL);
-
- gdk_threads_enter();
-
- font_desc = pango_font_description_from_string (font_name);
- pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
-
- if (style & AWT_STYLE_BOLD)
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
-
- if (style & AWT_STYLE_ITALIC)
- pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
-
- gtk_widget_modify_font (GTK_WIDGET(ptr), font_desc);
-
- pango_font_description_free (font_desc);
-
- gdk_threads_leave();
-
- (*env)->ReleaseStringUTFChars (env, name, font_name);
-}
-
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_show
(JNIEnv *env, jobject obj)
{
@@ -965,34 +945,36 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_hide
gdk_threads_leave();
}
-GtkLayout *
-find_gtk_layout (GtkWidget *parent)
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled
+ (JNIEnv *env, jobject obj)
{
- if (GTK_IS_WINDOW (parent))
- {
- GList *children = gtk_container_children
- (GTK_CONTAINER (GTK_BIN (parent)->child));
+ void *ptr;
+ jboolean ret_val;
+
+ ptr = NSA_GET_PTR (env, obj);
- if (GTK_IS_MENU_BAR (children->data))
- return GTK_LAYOUT (children->next->data);
- else /* GTK_IS_LAYOUT (children->data) */
- return GTK_LAYOUT (children->data);
- }
+ gdk_threads_enter ();
+ ret_val = GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (ptr));
+ gdk_threads_leave ();
- return NULL;
+ return ret_val;
}
JNIEXPORT jboolean JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isRealized
(JNIEnv *env, jobject obj)
{
void *ptr;
jboolean ret_val;
-
+
ptr = NSA_GET_PTR (env, obj);
+ if (ptr == NULL)
+ return FALSE;
+
gdk_threads_enter ();
- ret_val = GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (ptr));
+ ret_val = GTK_WIDGET_REALIZED (GTK_WIDGET (ptr));
gdk_threads_leave ();
return ret_val;
@@ -1013,197 +995,21 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab
return retval;
}
-static gboolean
-filter_expose_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
-{
- /*
- * Prevent the default event handler from getting this signal if applicable
- * FIXME: I came up with these filters by looking for patterns in the unwanted
- * expose events that are fed back to us from gtk/X. Perhaps there is
- * a way to prevent them from occuring in the first place.
- */
- if (event->type == GDK_EXPOSE && (!GTK_IS_LAYOUT(widget)
- || event->any.window != widget->window))
- {
- g_signal_stop_emission_by_name(GTK_OBJECT(widget), "event");
- return FALSE;
- }
- else
- {
- /* There may be non-expose events that are triggered while we're
- painting a heavyweight peer. */
- return pre_event_handler(widget, event, peer);
- }
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter
- (JNIEnv *env, jobject obj)
-{
- GtkObject *filterobj;
- GtkWidget *vbox, *layout;
- GList *children;
- void *ptr = NSA_GET_PTR (env, obj);
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
- gulong hid;
-
- g_assert (gref);
-
- gdk_threads_enter ();
-
- /* GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
- Events go to the GtkLayout layer, so we filter them there. */
- if (GTK_IS_WINDOW(ptr))
- {
- children = gtk_container_get_children(GTK_CONTAINER(ptr));
- vbox = children->data;
- g_assert (GTK_IS_VBOX(vbox));
-
- children = gtk_container_get_children(GTK_CONTAINER(vbox));
- do
- {
- layout = children->data;
- children = children->next;
- }
- while (!GTK_IS_LAYOUT (layout) && children != NULL);
- g_assert (GTK_IS_LAYOUT(layout));
-
- filterobj = GTK_OBJECT(layout);
- }
- else if (GTK_IS_SCROLLED_WINDOW(ptr))
- {
- /* The event will go to the parent GtkLayout. */
- filterobj = GTK_OBJECT(GTK_WIDGET(ptr)->parent);
- }
- else
- {
- filterobj = GTK_OBJECT(ptr);
- }
- hid = g_signal_handler_find(filterobj,
- G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, *pre_event_handler, NULL);
- if (hid > 0)
- {
- g_signal_handler_block(filterobj, hid);
- }
- g_signal_connect( filterobj, "event",
- G_CALLBACK(filter_expose_event_handler), *gref);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter
- (JNIEnv *env, jobject obj)
-{
- GtkObject *filterobj;
- GtkWidget *vbox, *layout;
- GList *children;
- void *ptr = NSA_GET_PTR (env, obj);
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
- gulong hid;
-
- g_assert (gref);
-
- gdk_threads_enter ();
-
- /* GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
- Events go to the GtkLayout layer, so we filter them there. */
- if (GTK_IS_WINDOW(ptr))
- {
- children = gtk_container_get_children(GTK_CONTAINER(ptr));
- vbox = children->data;
- g_assert (GTK_IS_VBOX(vbox));
-
- children = gtk_container_get_children(GTK_CONTAINER(vbox));
- do
- {
- layout = children->data;
- children = children->next;
- }
- while (!GTK_IS_LAYOUT (layout) && children != NULL);
- g_assert (GTK_IS_LAYOUT(layout));
-
- filterobj = GTK_OBJECT(layout);
- }
- else if (GTK_IS_SCROLLED_WINDOW(ptr))
- {
- /* The event will go to the parent GtkLayout. */
- filterobj = GTK_OBJECT(GTK_WIDGET(ptr)->parent);
- }
- else
- {
- filterobj = GTK_OBJECT(ptr);
- }
-
- g_signal_handlers_disconnect_by_func (filterobj,
- *filter_expose_event_handler, *gref);
- hid = g_signal_handler_find(filterobj,
- G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, *pre_event_handler, NULL);
- if (hid > 0)
- {
- g_signal_handler_unblock(filterobj, hid);
- }
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueueDrawArea
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- GdkRectangle rect;
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- rect.x = x + GTK_WIDGET(ptr)->allocation.x;
- rect.y = y + GTK_WIDGET(ptr)->allocation.y;
- rect.width = width;
- rect.height = height;
-
- gdk_threads_enter ();
-
- gdk_window_invalidate_rect (GTK_WIDGET (ptr)->window, &rect, 0);
- gdk_window_process_all_updates();
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectJObject
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
+ jobject *gref;
ptr = NSA_GET_PTR (env, obj);
+ gref = NSA_GET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
-
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals
- (JNIEnv *env, jobject obj)
-{
- void *ptr = NSA_GET_PTR (env, obj);
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
- g_assert (gref);
-
- gdk_threads_enter ();
-
- gtk_widget_realize (GTK_WIDGET (ptr));
-
- /* FIXME: We could check here if this is a scrolled window with a
- single child that does not have an associated jobject. This
- means that it is one of our wrapped widgets like List or TextArea
- and thus we could connect the signal to the child without having
- to specialize this method. */
-
/* Connect EVENT signal, which happens _before_ any specific signal. */
- g_signal_connect (GTK_OBJECT (ptr), "event",
+ g_signal_connect (GTK_OBJECT (ptr), "event",
G_CALLBACK (pre_event_handler), *gref);
g_signal_connect (G_OBJECT (ptr), "focus-in-event",
@@ -1212,6 +1018,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignal
g_signal_connect (G_OBJECT (ptr), "focus-out-event",
G_CALLBACK (focus_out_cb), *gref);
+ g_signal_connect_after (G_OBJECT (ptr), "realize",
+ G_CALLBACK (connect_awt_hook_cb), *gref);
+
gdk_threads_leave ();
}
@@ -1235,19 +1044,7 @@ find_bg_color_widget (GtkWidget *widget)
{
GtkWidget *bg_color_widget;
- if (GTK_IS_WINDOW (widget))
- {
- GtkWidget *vbox;
- GList* children;
-
- children = gtk_container_get_children(GTK_CONTAINER(widget));
- vbox = children->data;
-
- children = gtk_container_get_children(GTK_CONTAINER(vbox));
- bg_color_widget = children->data;
- }
- else
- bg_color_widget = widget;
+ bg_color_widget = widget;
return bg_color_widget;
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
index c98473f..61e1af1 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
@@ -45,22 +45,18 @@ Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
(JNIEnv *env, jobject obj, jlong socket_id)
{
GtkWidget *window;
- GtkWidget *vbox, *layout;
+ GtkWidget *fixed;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
window = gtk_plug_new ((GdkNativeWindow) socket_id);
- vbox = gtk_vbox_new (0, 0);
- layout = gtk_layout_new (NULL, NULL);
- gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
+ fixed = gtk_fixed_new ();
+ gtk_container_add (GTK_CONTAINER (window), fixed);
- gtk_widget_show (layout);
- gtk_widget_show (vbox);
+ gtk_widget_show (fixed);
gdk_threads_leave ();
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
index 7cf405d..65f64e04 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
@@ -827,14 +827,16 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
static guint button_number = -1;
static jint click_count = 1;
static int hasBeenDragged;
+ union widget_union w;
/* If it is not a focus change event, the widget must be realized already.
If not, ignore the event (Gtk+ will do the same). */
if (!(event->type == GDK_FOCUS_CHANGE || GTK_WIDGET_REALIZED(widget)))
return FALSE;
-
+
/* Do not handle propagated events. AWT has its own propagation rules */
- gdk_window_get_user_data (event->any.window, (void **) &event_widget);
+ w.widget = &event_widget;
+ gdk_window_get_user_data (event->any.window, w.void_widget);
if (event_widget != widget)
return FALSE;
@@ -1010,23 +1012,12 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
}
break;
case GDK_EXPOSE:
- {
- /* This filters out unwanted feedback expose events from gtk/X
- when we explictly invalidate and update heavyweight components,
- thus avoiding an infinite loop.
- FIXME: I'm not quite sure why we're getting these expose events.
- Maybe there is a way to avoid them? */
- if((event->any.window == widget->window && event->any.send_event)
- || GTK_IS_LAYOUT(widget))
- {
- (*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_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);
break;
case GDK_FOCUS_CHANGE:
@@ -1133,3 +1124,24 @@ connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...)
va_end (ap);
}
+/*
+ * Attach a Java object that is backed by widget. This callback is
+ * called after the widget's window has been realized. That way, we
+ * can be sure that widget->window is non-NULL, and so can have data
+ * connected to it.
+ */
+void connect_awt_hook_cb (GtkWidget *widget __attribute__((unused)),
+ jobject peer)
+{
+ void *ptr;
+
+ ptr = NSA_GET_PTR (gdk_env, peer);
+
+ connect_awt_hook (gdk_env, peer, 1, GTK_WIDGET (ptr)->window);
+
+ gdk_threads_leave ();
+
+ (*gdk_env)->CallVoidMethod (gdk_env, peer, setCursorID);
+
+ gdk_threads_enter ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
index 594fcce..3a2e41f 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
@@ -84,21 +84,6 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
NSA_SET_PTR (env, obj, widget);
}
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectJObject
- (JNIEnv *env, jobject obj)
-{
- void *ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- gtk_widget_realize (GTK_WIDGET (ptr));
-
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
-
- gdk_threads_leave ();
-}
-
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals
(JNIEnv *env, jobject obj)
@@ -109,8 +94,6 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals
gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
-
g_signal_connect (G_OBJECT (GTK_DIALOG (ptr)),
"response",
GTK_SIGNAL_FUNC (handle_response), *gref);
@@ -144,10 +127,9 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeGetDirectory
This function extracts the filename from the GtkFileFilterInfo object,
and passes it to the Java method. The Java method will call the filter's
accept() method and will give back the return value. */
-gboolean filenameFilterCallback (const GtkFileFilterInfo *filter_info,
- gpointer obj)
+static gboolean filenameFilterCallback (const GtkFileFilterInfo *filter_info,
+ gpointer obj)
{
- gchar* dirname;
jclass cx;
jmethodID id;
jstring *filename;
@@ -168,8 +150,8 @@ gboolean filenameFilterCallback (const GtkFileFilterInfo *filter_info,
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter
- (JNIEnv *env, jobject obj, jobject filter_obj)
- {
+ (JNIEnv *env, jobject obj, jobject filter_obj __attribute__((unused)))
+{
void *ptr;
GtkFileFilter *filter;
@@ -178,11 +160,8 @@ Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter
gdk_threads_enter ();
filter = gtk_file_filter_new();
- gtk_file_filter_add_custom(filter,
- GTK_FILE_FILTER_FILENAME,
- G_CALLBACK(filenameFilterCallback),
- obj,
- NULL);
+ gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_FILENAME,
+ filenameFilterCallback, obj, NULL);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(ptr), filter);
@@ -237,7 +216,7 @@ handle_response (GtkDialog *dialog __attribute__((unused)),
static jmethodID disposeID;
void *ptr;
G_CONST_RETURN gchar *fileName;
- jstring str_fileName;
+ jstring str_fileName = NULL;
/* We only need this for the case when the user closed the window,
or clicked ok or cancel. */
@@ -269,8 +248,6 @@ handle_response (GtkDialog *dialog __attribute__((unused)),
if (responseId == GTK_RESPONSE_OK) {
fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName);
- } else if (responseId == GTK_RESPONSE_CANCEL) {
- str_fileName = NULL;
}
if (!isIDSet)
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
new file mode 100644
index 0000000..5c48832
--- /dev/null
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
@@ -0,0 +1,179 @@
+/* gtkframepeer.c -- Native implementation of GtkFramePeer
+ 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_GtkFramePeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
+ (JNIEnv *env, jobject obj)
+{
+ void *ptr;
+ void *mptr;
+ void *fixed;
+ GList* children;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+ children = gtk_container_get_children (GTK_CONTAINER (fixed));
+
+ while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
+ {
+ children = children->next;
+ }
+
+ /* If there's a menu bar, remove it. */
+ if (children != NULL)
+ {
+ mptr = children->data;
+
+ /* This will actually destroy the MenuBar. By removing it from
+ its parent, the reference count for the MenuBar widget will
+ decrement to 0. The widget will be automatically destroyed by
+ GTK. */
+ gtk_container_remove (GTK_CONTAINER (fixed), GTK_WIDGET (mptr));
+ }
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
+ (JNIEnv *env, jobject obj, jobject menubar)
+{
+ void *ptr;
+ void *mptr;
+ void *fixed;
+
+ ptr = NSA_GET_PTR (env, obj);
+ mptr = NSA_GET_PTR (env, menubar);
+
+ gdk_threads_enter ();
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+ gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
+ gtk_widget_show (mptr);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
+ (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar)
+{
+ GtkWidget *ptr;
+ GtkRequisition requisition;
+
+ ptr = NSA_GET_PTR (env, menubar);
+
+ gdk_threads_enter ();
+
+ gtk_widget_size_request (ptr, &requisition);
+
+ gdk_threads_leave ();
+
+ return requisition.height;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth
+ (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar, jint width)
+{
+ GtkWidget *ptr;
+ GtkRequisition natural_req;
+
+ ptr = NSA_GET_PTR (env, menubar);
+
+ gdk_threads_enter ();
+
+ /* Get the menubar's natural size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
+ gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req);
+
+ /* Set the menubar's size request to width by natural_req.height. */
+ gtk_widget_set_size_request (GTK_WIDGET (ptr),
+ width, natural_req.height);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible
+ (JNIEnv *env, jobject obj, jboolean visible)
+{
+ void *ptr;
+ void *fixed;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+
+ if (visible)
+ gtk_widget_show (GTK_WIDGET (fixed));
+ else
+ gtk_widget_hide (GTK_WIDGET (fixed));
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder
+ (JNIEnv *env, jobject obj, jobject decoder)
+{
+ void *ptr;
+ GdkPixbufLoader *loader = NULL;
+ GdkPixbuf *pixbuf = NULL;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ loader = NSA_GET_PB_PTR (env, decoder);
+ g_assert (loader != NULL);
+
+ gdk_threads_enter ();
+
+ pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+ g_assert (pixbuf != NULL);
+
+ gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
+
+ gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
index 7b8babe..8eebce9 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
@@ -39,7 +39,8 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkGenericPeer.h"
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
(JNIEnv *env, jobject obj)
{
void *ptr;
@@ -57,3 +58,34 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
gdk_threads_leave ();
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkGenericPeer_gtkWidgetModifyFont
+ (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+ const char *font_name;
+ void *ptr;
+ PangoFontDescription *font_desc;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+ gdk_threads_enter();
+
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
+
+ if (style & AWT_STYLE_BOLD)
+ pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+ if (style & AWT_STYLE_ITALIC)
+ pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+ gtk_widget_modify_font (GTK_WIDGET(ptr), font_desc);
+
+ pango_font_description_free (font_desc);
+
+ gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, name, font_name);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
index 362f7a9..4686fed 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
@@ -41,11 +41,12 @@ exception statement from your version. */
#include <libart_lgpl/art_rgb_affine.h>
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
-(JNIEnv *env, jobject obj __attribute__((unused)), jobject gc_obj,
- jint bg_red, jint bg_green, jint bg_blue, jint x, jint y, jint width,
- jint height, jintArray jpixels, jint offset, jint scansize,
- jdoubleArray jaffine)
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
+ (JNIEnv *env, jobject obj __attribute__((unused)), jobject gc_obj,
+ jint bg_red, jint bg_green, jint bg_blue, jint x, jint y, jint width,
+ jint height, jintArray jpixels, jint offset, jint scansize,
+ jdoubleArray jaffine)
{
struct graphics *g;
jint *pixels, *elems;
@@ -147,6 +148,12 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
gdk_threads_enter ();
+ if (!g || !GDK_IS_DRAWABLE (g->drawable))
+ {
+ gdk_threads_leave ();
+ return;
+ }
+
gdk_draw_rgb_image (g->drawable,
g->gc,
x + g->x_offset,
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
index 93d30cb..25c8955 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
@@ -44,33 +44,30 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
(JNIEnv *env, jobject obj, jstring text, jfloat xalign)
{
GtkWidget *label;
- GtkWidget *ebox;
- GtkContainer *ebox_container;
+ GtkWidget *eventbox;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, text, 0);
gdk_threads_enter ();
- ebox = gtk_event_box_new ();
- ebox_container = GTK_CONTAINER (ebox);
+ eventbox = gtk_event_box_new ();
label = gtk_label_new (str);
gtk_misc_set_alignment (GTK_MISC (label), xalign, 0.5);
- gtk_container_add (ebox_container, label);
+ gtk_container_add (GTK_CONTAINER (eventbox), label);
gtk_widget_show (label);
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, text, str);
- NSA_SET_PTR (env, obj, ebox);
+ NSA_SET_PTR (env, obj, eventbox);
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
@@ -121,7 +118,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText
gdk_threads_enter ();
- label = gtk_bin_get_child (GTK_BIN(ptr));
+ label = gtk_bin_get_child (GTK_BIN (ptr));
gtk_label_set_label (GTK_LABEL (label), str);
@@ -147,3 +144,36 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_nativeSetAlignment
gdk_threads_leave ();
}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds
+ (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+ GtkWidget *widget;
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ widget = GTK_WIDGET (ptr);
+
+ /* We assume that -1 is a width or height and not a request for the
+ widget's natural size. */
+ width = width < 0 ? 0 : width;
+ height = height < 0 ? 0 : height;
+
+ if (!(width == 0 && height == 0))
+ {
+ /* Set the event box's size request... */
+ gtk_widget_set_size_request (widget, width, height);
+ /* ...and the label's size request. */
+ gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (widget)),
+ width, height);
+
+ if (widget->parent != NULL)
+ gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+ }
+
+ gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
index 7cefd8d..575f3c9 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
@@ -117,22 +117,6 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_create
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_connectJObject
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals
(JNIEnv *env, jobject obj)
{
@@ -148,8 +132,6 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals
g_assert (gref);
- gtk_widget_realize (GTK_WIDGET (ptr));
-
list = TREE_VIEW_FROM_SW (ptr);
g_signal_connect (G_OBJECT (list), "event",
@@ -163,7 +145,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
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
index 99107a1..8a2a810 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
@@ -61,6 +61,13 @@ jmethodID postListItemEventID;
jmethodID postTextEventID;
jmethodID postWindowEventID;
+jmethodID beginNativeRepaintID;
+jmethodID endNativeRepaintID;
+
+jmethodID initComponentGraphicsID;
+jmethodID initComponentGraphics2DID;
+jmethodID setCursorID;
+
JNIEnv *gdk_env;
GtkWindowGroup *global_gtk_window_group;
@@ -69,7 +76,7 @@ static void init_glib_threads(JNIEnv *, jint);
double dpi_conversion_factor;
-static void init_dpi_conversion_factor ();
+static void init_dpi_conversion_factor (void);
static void dpi_changed_cb (GtkSettings *settings,
GParamSpec *pspec);
@@ -91,9 +98,8 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz,
int argc = 1;
char **argv;
char *homedir, *rcpath = NULL;
-/* jclass gtkgenericpeer; */
jclass gtkcomponentpeer, gtkchoicepeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer,
- gtkmenuitempeer, gtktextcomponentpeer, window;
+ gtkmenuitempeer, gtktextcomponentpeer, window, gdkgraphics, gdkgraphics2d;
NSA_INIT (env, clazz);
gdk_env = env;
@@ -141,8 +147,6 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz,
g_free (argv);
/* setup cached IDs for posting GTK events to Java */
-/* gtkgenericpeer = (*env)->FindClass (env, */
-/* "gnu/java/awt/peer/gtk/GtkGenericPeer"); */
window = (*env)->FindClass (env, "java/awt/Window");
@@ -159,13 +163,10 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz,
"gnu/java/awt/peer/gtk/GtkMenuItemPeer");
gtktextcomponentpeer = (*env)->FindClass (env,
"gnu/java/awt/peer/gtk/GtkTextComponentPeer");
-/* gdkColor = (*env)->FindClass (env, */
-/* "gnu/java/awt/peer/gtk/GdkColor"); */
-/* gdkColorID = (*env)->GetMethodID (env, gdkColor, "<init>", "(III)V"); */
-/* postActionEventID = (*env)->GetMethodID (env, gtkgenericpeer, */
-/* "postActionEvent", */
-/* "(Ljava/lang/String;I)V"); */
-
+ 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");
@@ -175,6 +176,14 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz,
"()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,
@@ -201,6 +210,12 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz,
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 ();
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
index 53c7351..563bf48 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
@@ -39,12 +39,12 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkMenuBarPeer.h"
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
(JNIEnv *env, jobject obj)
{
GtkWidget *widget;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
@@ -57,7 +57,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
NSA_SET_PTR (env, obj, widget);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
(JNIEnv *env, jobject obj, jobject menupeer)
{
void *mbar, *menu;
@@ -70,7 +71,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu
(JNIEnv *env, jobject obj, jobject menupeer)
{
static void *helpmenu;
@@ -93,7 +95,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMe
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
(JNIEnv *env, jobject obj, jint index)
{
void *ptr;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
index 5d5de67..4d68fce 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
@@ -43,20 +43,21 @@ exception statement from your version. */
static void item_activate (GtkMenuItem *item __attribute__((unused)),
jobject peer_obj);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
(JNIEnv *env, jobject obj, jstring label)
{
GtkWidget *widget;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
gdk_threads_enter ();
-
- if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
+
+ /* "-" signals that we need a separator. */
+ if (strcmp (str, "-") == 0)
widget = gtk_menu_item_new ();
else
widget = gtk_menu_item_new_with_label (str);
@@ -86,7 +87,46 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_gtkWidgetModifyFont
+ (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+ const char *font_name;
+ void *ptr;
+ GtkWidget *label;
+ PangoFontDescription *font_desc;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+ gdk_threads_enter();
+
+ label = gtk_bin_get_child (GTK_BIN (ptr));
+
+ if (label)
+ {
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
+
+ if (style & AWT_STYLE_BOLD)
+ pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+ if (style & AWT_STYLE_ITALIC)
+ pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+ gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
+
+ pango_font_description_free (font_desc);
+ }
+
+ gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, name, font_name);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
(JNIEnv *env, jobject obj, jboolean enabled)
{
void *ptr;
@@ -98,11 +138,13 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
(JNIEnv *env, jobject obj, jstring label)
{
void *ptr;
const char *str;
+ GtkAccelLabel *accel_label;
ptr = NSA_GET_PTR (env, obj);
@@ -110,15 +152,10 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
gdk_threads_enter ();
- if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
- gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child);
- else
- {
- GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
+ accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
- gtk_label_set_text (GTK_LABEL (accel_label), str);
- gtk_accel_label_refetch (accel_label);
- }
+ gtk_label_set_text (GTK_LABEL (accel_label), str);
+ gtk_accel_label_refetch (accel_label);
gdk_threads_leave ();
@@ -131,4 +168,3 @@ item_activate (GtkMenuItem *item __attribute__((unused)), jobject peer_obj)
(*gdk_env)->CallVoidMethod (gdk_env, peer_obj,
postMenuActionEventID);
}
-
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
index 1ffe61b..dd5511c 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
@@ -39,7 +39,8 @@ exception statement from your version. */
#include "gtkpeer.h"
#include "gnu_java_awt_peer_gtk_GtkMenuPeer.h"
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
(JNIEnv *env, jobject obj, jobject parent)
{
void *ptr1, *ptr2;
@@ -67,13 +68,13 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
(JNIEnv *env, jobject obj, jstring label)
{
GtkWidget *menu_title, *menu, *toplevel;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
@@ -106,7 +107,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
(*env)->ReleaseStringUTFChars (env, label, str);
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addTearOff
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addTearOff
(JNIEnv *env, jobject obj)
{
void *ptr1;
@@ -124,7 +126,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addTearOff
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
(JNIEnv *env, jobject obj, jobject menuitempeer, jint key, jboolean shift)
{
void *ptr1, *ptr2;
@@ -150,7 +153,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
(JNIEnv *env, jobject obj, jint index)
{
void *ptr;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
index 835c234..f432baf0c 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
@@ -44,14 +44,15 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
(JNIEnv *env, jobject obj)
{
- gpointer widget;
+ GtkWidget *widget;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
- widget = gtk_layout_new (NULL, NULL);
+ widget = gtk_fixed_new ();
+
+ gtk_fixed_set_has_window (GTK_FIXED (widget), TRUE);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
@@ -59,18 +60,3 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
NSA_SET_PTR (env, obj, widget);
}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectJObject
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_LAYOUT (ptr)->bin_window);
-
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
index c5fffdc..6cfe254 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
@@ -58,7 +58,8 @@ menu_pos (GtkMenu *menu __attribute__((unused)),
*push_in = TRUE;
}
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
(JNIEnv *env, jobject obj, jint x, jint y, jlong time)
{
void *ptr;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
index c916b3f..4f83446 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
@@ -78,23 +78,6 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectJObject
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- gtk_widget_realize (GTK_WIDGET (ptr));
-
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
(JNIEnv *env, jobject obj)
{
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
index c9427d4..4b7f5dc 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
@@ -54,7 +54,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
text = gtk_text_view_new ();
gtk_widget_set_size_request (text, textview_width, textview_height);
- gtk_text_view_set_cursor_visible(text, TRUE);
+ gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (text), TRUE);
gtk_widget_show (text);
@@ -141,7 +141,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
index 2a6666a..a7b0a47 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
@@ -175,7 +175,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 5088931..a8e745e 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -1,5 +1,5 @@
/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,9 +37,7 @@ exception statement from your version. */
#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h"
-#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
@@ -58,8 +56,6 @@ static Bool property_notify_predicate (Display *display,
XEvent *xevent,
XPointer arg);
-static GtkLayout *find_layout (GtkWindow *window);
-
static void window_delete_cb (GtkWidget *widget, GdkEvent *event,
jobject peer);
static void window_destroy_cb (GtkWidget *widget, GdkEvent *event,
@@ -85,6 +81,19 @@ static gboolean window_property_changed_cb (GtkWidget *widget,
GdkEventProperty *event,
jobject peer);
+/* Union used for type punning. */
+union extents_union
+{
+ guchar **gu_extents;
+ unsigned long **extents;
+};
+
+union atom_list_union
+{
+ guchar **gu_extents;
+ Atom **atom_list;
+};
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
(JNIEnv *env, jobject obj, jint type, jboolean decorated,
@@ -93,8 +102,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
GtkWidget *window_widget;
GtkWindow *window;
void *window_parent;
- GtkWidget *vbox;
- GtkWidget *layout;
+ GtkWidget *fixed;
int top = 0;
int left = 0;
int bottom = 0;
@@ -124,14 +132,10 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
gtk_window_group_add_window (global_gtk_window_group, window);
- vbox = gtk_vbox_new (0, 0);
- layout = gtk_layout_new (NULL, NULL);
- gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (window_widget), vbox);
+ fixed = gtk_fixed_new ();
+ gtk_container_add (GTK_CONTAINER (window_widget), fixed);
- gtk_widget_show (layout);
- gtk_widget_show (vbox);
- gtk_widget_realize (window_widget);
+ gtk_widget_show (fixed);
if (decorated)
window_get_frame_extents (window_widget, &top, &left, &bottom, &right);
@@ -232,52 +236,20 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetVisible
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectJObject
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- GtkLayout *layout;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- layout = find_layout (GTK_WINDOW (ptr));
-
- gtk_widget_realize (GTK_WIDGET (layout));
-
- connect_awt_hook (env, obj, 1, layout->bin_window);
-
- gtk_widget_realize (ptr);
-
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
jobject *gref;
- GtkLayout *layout;
ptr = NSA_GET_PTR (env, obj);
-
gref = NSA_GET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
- gtk_widget_realize (ptr);
+ g_signal_connect (G_OBJECT (ptr), "event",
+ G_CALLBACK (pre_event_handler), *gref);
- /* Receive events from the GtkLayout too */
- layout = find_layout (GTK_WINDOW (ptr));
-
- g_signal_connect (G_OBJECT (layout), "event",
- G_CALLBACK (pre_event_handler), *gref);
-
- /* Connect signals for window event support. */
g_signal_connect (G_OBJECT (ptr), "delete-event",
G_CALLBACK (window_delete_cb), *gref);
@@ -305,16 +277,12 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
g_signal_connect (G_OBJECT (ptr), "property-notify-event",
G_CALLBACK (window_property_changed_cb), *gref);
- gdk_threads_leave ();
+ g_signal_connect_after (G_OBJECT (ptr), "realize",
+ G_CALLBACK (connect_awt_hook_cb), *gref);
- /* Connect the superclass signals. */
- Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
+ gdk_threads_leave ();
}
-/*
- * Lower the z-level of a window.
- */
-
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
jobject obj)
@@ -323,16 +291,13 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
+
gdk_window_lower (GTK_WIDGET (ptr)->window);
+ gdk_flush ();
- XFlush (GDK_DISPLAY ());
gdk_threads_leave ();
}
-/*
- * Raise the z-level of a window.
- */
-
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
jobject obj)
@@ -341,9 +306,10 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
+
gdk_window_raise (GTK_WIDGET (ptr)->window);
+ gdk_flush ();
- XFlush (GDK_DISPLAY ());
gdk_threads_leave ();
}
@@ -369,7 +335,9 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setSize
height = (height < 1) ? 1 : height;
gdk_threads_enter ();
+
gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
+
gdk_threads_leave ();
}
@@ -384,6 +352,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
height = (height < 1) ? 1 : height;
gdk_threads_enter ();
+
gtk_window_move (GTK_WINDOW(ptr), x, y);
/* The call to gdk_window_move is needed in addition to the call to
gtk_window_move. If gdk_window_move isn't called, then the
@@ -397,7 +366,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
Instead of being at the position set by setLocation, the window
is reshown at the position to which it was moved manually. */
- gdk_window_move (GTK_WIDGET (ptr)->window, x, y);
+ if (GTK_WIDGET (ptr)->window != NULL)
+ gdk_window_move (GTK_WIDGET (ptr)->window, x, y);
/* Need to change the widget's request size. */
gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
@@ -408,204 +378,12 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
- (JNIEnv *env, jobject obj)
-{
- void *wptr;
- GtkWidget *box;
- GtkWidget *mptr;
- GList* children;
-
- wptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- box = GTK_BIN (wptr)->child;
-
- children = gtk_container_get_children (GTK_CONTAINER (box));
-
- while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
- {
- children = children->next;
- }
-
- /* If there isn't a MenuBar in this Frame's list of children
- then we can just return. */
- if (!GTK_IS_MENU_SHELL (children->data))
- return;
- else
- mptr = children->data;
-
- /* This will actually destroy the MenuBar. By removing it from
- its parent, the reference count for the MenuBar widget will
- decrement to 0. The widget will be automatically destroyed
- by Gtk. */
- gtk_container_remove (GTK_CONTAINER (box), GTK_WIDGET (mptr));
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
- (JNIEnv *env, jobject obj, jobject menubar)
-{
- void *wptr;
- GtkWidget *mptr;
- GtkWidget *box;
-
- wptr = NSA_GET_PTR (env, obj);
- mptr = NSA_GET_PTR (env, menubar);
-
- gdk_threads_enter ();
-
- box = GTK_BIN (wptr)->child;
- gtk_box_pack_start (GTK_BOX (box), mptr, 0, 0, 0);
-
- gtk_widget_show (mptr);
-
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
- (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar)
-{
- GtkWidget *ptr;
- jint height;
- GtkRequisition gtkreq;
-
- ptr = NSA_GET_PTR (env, menubar);
-
- gdk_threads_enter ();
- gtk_widget_size_request (ptr, &gtkreq);
-
- height = gtkreq.height;
- gdk_threads_leave ();
- return height;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout
- (JNIEnv *env, jobject obj, jint offset)
-{
- void* ptr;
- GList* children;
- GtkLayout* layout;
- GtkWidget* widget;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- layout = find_layout (GTK_WINDOW (ptr));
-
- children = gtk_container_get_children (GTK_CONTAINER (layout));
-
- while (children != NULL)
- {
- widget = children->data;
- gtk_layout_move (layout, widget, widget->allocation.x,
- widget->allocation.y+offset);
- children = children->next;
- }
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkLayoutSetVisible
- (JNIEnv *env, jobject obj, jboolean visible)
-{
- void* ptr;
- GtkLayout* layout;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- layout = find_layout (GTK_WINDOW (ptr));
-
- if (visible)
- gtk_widget_show (GTK_WIDGET (layout));
- else
- gtk_widget_hide (GTK_WIDGET (layout));
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder
- (JNIEnv *env, jobject obj, jobject decoder)
-{
- void *ptr;
- GdkPixbufLoader *loader = NULL;
- GdkPixbuf *pixbuf = NULL;
-
- ptr = NSA_GET_PTR (env, obj);
-
- loader = NSA_GET_PB_PTR (env, decoder);
- g_assert (loader != NULL);
-
- gdk_threads_enter ();
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_assert (pixbuf != NULL);
-
- gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
-
- gdk_threads_leave ();
-}
-
-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);
-}
-
static void
window_get_frame_extents (GtkWidget *window,
int *top, int *left, int *bottom, int *right)
{
unsigned long *extents = NULL;
+ union extents_union gu_ex;
/* Guess frame extents in case _NET_FRAME_EXTENTS is not
supported. */
@@ -619,6 +397,7 @@ window_get_frame_extents (GtkWidget *window,
request_frame_extents (window);
/* Attempt to retrieve window's frame extents. */
+ gu_ex.extents = &extents;
if (gdk_property_get (window->window,
gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
gdk_atom_intern ("CARDINAL", FALSE),
@@ -628,7 +407,7 @@ window_get_frame_extents (GtkWidget *window,
NULL,
NULL,
NULL,
- (guchar **)&extents))
+ gu_ex.gu_extents))
{
*left = extents [0];
*right = extents [1];
@@ -649,7 +428,9 @@ request_frame_extents (GtkWidget *window)
/* Check if the current window manager supports
_NET_REQUEST_FRAME_EXTENTS. */
- if (gdk_net_wm_supports (request_extents))
+ /* FIXME: The window->window != NULL check is a workaround for bug
+ http://bugzilla.gnome.org/show_bug.cgi?id=17952. */
+ if (gdk_net_wm_supports (request_extents) && window->window != NULL)
{
GdkDisplay *display = gtk_widget_get_display (window);
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
@@ -740,11 +521,12 @@ window_show_cb (GtkWidget *widget __attribute__((unused)),
}
static void
-window_active_state_change_cb (GtkWidget *widget,
- GParamSpec *pspec,
- jobject peer)
+window_active_state_change_cb (GtkWidget *widget __attribute__((unused)),
+ GParamSpec *pspec __attribute__((unused)),
+ jobject peer __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,
@@ -761,42 +543,46 @@ window_active_state_change_cb (GtkWidget *widget,
static void
window_focus_state_change_cb (GtkWidget *widget,
- GParamSpec *pspec,
- jobject peer)
- {
- if (GTK_WINDOW (widget)->has_toplevel_focus)
- (*gdk_env)->CallVoidMethod (gdk_env, peer,
- postWindowEventID,
- (jint) AWT_WINDOW_ACTIVATED,
- (jobject) NULL, (jint) 0);
- else
- (*gdk_env)->CallVoidMethod (gdk_env, peer,
- postWindowEventID,
+ GParamSpec *pspec __attribute__((unused)),
+ jobject peer)
+{
+ if (GTK_WINDOW (widget)->has_toplevel_focus)
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postWindowEventID,
+ (jint) AWT_WINDOW_ACTIVATED,
+ (jobject) NULL, (jint) 0);
+ else
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postWindowEventID,
(jint) AWT_WINDOW_DEACTIVATED,
(jobject) NULL, (jint) 0);
}
static gboolean
-window_focus_in_cb (GtkWidget * widget,
- GdkEventFocus *event,
- jobject peer)
+window_focus_in_cb (GtkWidget * widget __attribute__((unused)),
+ GdkEventFocus *event __attribute__((unused)),
+ jobject peer)
{
(*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. */
return FALSE;
}
static gboolean
-window_focus_out_cb (GtkWidget * widget,
- GdkEventFocus *event,
- jobject peer)
+window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
+ GdkEventFocus *event __attribute__((unused)),
+ jobject peer)
{
(*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. */
return FALSE;
}
@@ -855,12 +641,15 @@ window_get_new_state (GtkWidget *widget)
gulong atom_count;
gulong bytes_after;
Atom *atom_list = NULL;
+ union atom_list_union alu;
gulong i;
- XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (widget->window),
+ alu.atom_list = &atom_list;
+ XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (widget->window),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
0, G_MAXLONG, False, XA_ATOM, &type, &format, &atom_count,
- &bytes_after, (guchar **)&atom_list);
+ &bytes_after, alu.gu_extents);
if (type != None)
{
@@ -889,6 +678,7 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
jobject peer)
{
unsigned long *extents;
+ union extents_union gu_ex;
static int id_set = 0;
static jmethodID postInsetsChangedEventID;
@@ -903,7 +693,7 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
"(IIII)V");
id_set = 1;
}
-
+ gu_ex.extents = &extents;
if (gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE) == event->atom
&& gdk_property_get (event->window,
gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
@@ -914,7 +704,7 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
NULL,
NULL,
NULL,
- (guchar **)&extents))
+ gu_ex.gu_extents))
(*gdk_env)->CallVoidMethod (gdk_env, peer,
postInsetsChangedEventID,
(jint) extents[2], /* top */
@@ -924,26 +714,3 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
return FALSE;
}
-
-static GtkLayout *
-find_layout (GtkWindow *window)
-{
- GList* children;
- GtkBox* vbox;
- GtkLayout* layout;
-
- children = gtk_container_get_children (GTK_CONTAINER (window));
- vbox = children->data;
- g_assert (GTK_IS_VBOX (vbox));
-
- children = gtk_container_get_children (GTK_CONTAINER (vbox));
- do
- {
- layout = children->data;
- children = children->next;
- }
- while (!GTK_IS_LAYOUT (layout) && children != NULL);
- g_assert (GTK_IS_LAYOUT (layout));
-
- return layout;
-}
diff --git a/libjava/jni/gtk-peer/gtkpeer.h b/libjava/jni/gtk-peer/gtkpeer.h
index d29b27b..e982551 100644
--- a/libjava/jni/gtk-peer/gtkpeer.h
+++ b/libjava/jni/gtk-peer/gtkpeer.h
@@ -115,6 +115,9 @@ struct graphics
GdkDrawable *drawable;
GdkGC *gc;
GdkColormap *cm;
+ PangoFontDescription *pango_font;
+ PangoContext *pango_context;
+ PangoLayout *pango_layout;
jint x_offset, y_offset;
};
@@ -447,6 +450,13 @@ extern jmethodID postListItemEventID;
extern jmethodID postTextEventID;
extern jmethodID postWindowEventID;
+extern jmethodID beginNativeRepaintID;
+extern jmethodID endNativeRepaintID;
+
+extern jmethodID initComponentGraphicsID;
+extern jmethodID initComponentGraphics2DID;
+extern jmethodID setCursorID;
+
extern jmethodID syncAttrsID;
extern jclass gdkColor;
extern jmethodID gdkColorID;
@@ -463,10 +473,10 @@ gboolean pre_event_handler (GtkWidget *widget,
jobject peer);
void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...);
+void connect_awt_hook_cb (GtkWidget *widget, jobject peer);
void set_visible (GtkWidget *widget, jboolean visible);
void set_parent (GtkWidget *widget, GtkContainer *parent);
-GtkLayout *find_gtk_layout (GtkWidget *parent);
jint keyevent_state_to_awt_mods (GdkEvent *event);
@@ -476,6 +486,13 @@ struct item_event_hook_info
const char *label;
};
+/* Union used for type punning. */
+union widget_union
+{
+ void **void_widget;
+ GtkWidget **widget;
+};
+
#define DEBUG_LOCKING 0
#if DEBUG_LOCKING