Commit 8e99fb4f by Graydon Hoare

[multiple changes]

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JTextArea.java
	(setLineWrap): Fire property change event after new value is set.
	(setTabSize): Likewise.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JTable.java
	(autoCreateColumnsFromModel): New field.
	(autoResizeMode): Likewise.
	(cellEditor): Likewise.
	(cellSelectionEnabled): Likewise.
	(columnModel): Likewise.
	(dataModel): Likewise.
	(defaultEditorsByColumnClass): Likewise.
	(defaultRenderersByColumnClass): Likewise.
	(editingColumn): Likewise.
	(editingRow): Likewise.
	(gridColor): Likewise.
	(preferredViewportSize): Likewise.
	(rowHeight): Likewise.
	(rowMargin): Likewise.
	(rowSelectionAllowed): Likewise.
	(selectionBackground): Likewise.
	(selectionForeground): Likewise.
	(selectionModel): Likewise.
	(showHorizontalLines): Likewise.
	(showVerticalLines): Likewise.
	(tableHeader): Likewise.
	(JTable): Implemented.
	(getColumnModel): Likewise.
	(getSelectedRow): Likewise.
	(getSelectionModel): Likewise.
	(setModel): Likewise.
	(setSelectionModel): Likewise.
	(createScrollPaneForTable): New method.
	(createDefaultDataModel): Likewise.
	(createDefaultListSelectionModel): Likewise.
	(getModel): Likewise.
	(getTableHeader): Likewise.
	(setTableHeader): Likewise.
	(getColumnSelectionAllowed): Likewise.
	(setColumnSelectionAllowed): Likewise.
	(getRowSelectionAllowed): Likewise.
	(setRowSelectionAllowed): Likewise.
	(getAutoResizeMode): Likewise.
	(setAutoResizeMode): Likewise.
	(getColumnCount): Likewise.
	(getRowCount): Likewise.
	(getCellRenderer): Likewise.
	* javax/swing/JTree.java
	(cellRenderer): New field.
	(editable): Likewise.
	(rootVisible): Likewise.
	(showsRootHandles): Likewise.
	(getModel): New method.
	(setModel): Likewise.
	(isEditable): Likewise.
	(setEditable): Likewise.
	(isRootVisbile): Likewise.
	(setRootVisible): Likewise.
	(getShowsRootHandles): Likewise.
	(setShowRootHandles): Likewise.
	(getCellRenderer): Likewise.
	(setCellRenderer): Likewise.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JFormattedTextField.java
	(setDocument): Implemented.
	* javax/swing/JRootPane.java:
	Fixed javadocs.
	* javax/swing/JTable.java
	(getDefaultRenderer): New method.
	* javax/swing/JTextField.java
	(setFont): Likewise.
	(getPreferredSize): Likewise.
	* javax/swing/JToggleButton.java
	(getAccessibleContext): Fix javadoc.
	* javax/swing/JTree.java:
	Add some javadocs.
	* javax/swing/JViewport.java:
	Likewise.

2004-07-21  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkFileDialogPeer.java:
	Collect all native method declaration at the top.
	(create): Set the filename filter if necessary.
	(setDirectory): Call nativeSetDirectory().
	(setFilenameFilter): Implement.
	(filenameFilterCallback): New method.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
	(create): Configure dialog to show hidden files.
	(filenameFilterCallback): New function.
	(nativeSetFilenameFilter): New function.
	(nativeSetDirectory): New function.

2004-07-21  Kim Ho  <kho@redhat.com>

	* javax/swing/plaf/basic/BasicSliderUI.java:
	Ran Jalopy.
	(paintTrack): Fill the track before painting
	the borders.

2004-07-21  Graydon Hoare  <graydon@redhat.com>

	patch from Roman Kennke <roman@ontographics.com>
	* javax/swing/Spring.java: New file.
	* javax/swing/SpringLayout.java: New file.
	* Makefile.am: Add new files.
	* Makefile.in: Regenerate.

2004-07-21  Graydon Hoare  <graydon@redhat.com>

	* javax/swing/plaf/basic/BasicSplitPaneUI.java: Minor layout fixes.
	* javax/swing/plaf/basic/BasicTabbedPaneUI.java: Likewise.
	* javax/swing/ScrollPaneLayout.java: Likewise.

2004-07-21  Kim Ho  <kho@redhat.com>

	* javax/swing/DefaultDesktopManager.java:
	(findMinimum): Removed.
	(resizeFrame): Trust the UI to pass valid
	bounds.
	* javax/swing/JOptionPane.java:
	Implemented showInternalXXXDialog methods.
	(startModal): New method.
	* javax/swing/plaf/basic/BasicInternalFrameUI.java:
	(BorderListener::mouseDragged): Verify that the new
	bounds are valid before passing them to the DesktopManager.
	(preferredLayoutSize): Delegate
	to getSize.
	(minimumLayoutSize): Ditto.
	(getSize): New method.
	(GlassPaneDispatcher): Reimplemented by copying
	a stripped down LightweightDispatcher from Container.
	(getMinimumSize): Call minimumLayoutSize.
	* javax/swing/plaf/basic/BasicOptionPaneUI.java:
	Ran Jalopy.
	(mousePressed): Add ability to properly close
	JInternalFrames.
	* javax/swing/plaf/basic/BasicToolBarUI.java:
	(DragWindow): Set owner for DragWindow.

2004-07-21  Jerry Quinn  <jlquinn@optonline.net>

	* java/awt/image/ShortLookupTable.java: New file.
	* java/awt/image/ByteLookupTable.java: New file.
	* Makefile.am: Added new files.
	* Makefile.in: Regenerated.

2004-07-21  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
	(create(GtkContainerPeer)): New native method.
	(create()): Call native create(), passing in the parent frame
	as the paramter. Natively set the current file and directory.
	(setFile): Construct an absolute filename before passing it to
	the native peer.
	(nativeGetDirectory): New method.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
	(window_closed): Removed.
	(ok_clicked): Likewise.
	(cancel_clicked): Likewise.
	(handle_response): New method.
	(create): Use GtkFileChooserDialog.
	(connectSignals): Connect to handle_response.
	(nativeGetDirectory): New method.
	(nativeSetFile): Use GtkFileChooserDialog.

2004-07-21  Jerry Quinn  <jlquinn@optonline.net>

	* java/awt/image/LookupTable.java: New file.
	* Makefile.am: Added new file.
	* Makefile.in: Regenerated.

2004-07-21  Jerry Quinn  <jlquinn@optonline.net>

	* java/awt/image/Kernel.java: New file.
	* Makefile.am: Added new file.
	* Makefile.in: Regenerated.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JCheckBoxMenuItem.java: Fixed Javadocs.
	* javax/swing/JMenu.java: Likewise.
	* javax/swing/JMenuBar.java: Likewise.
	(MARGIN_CHANGED_PROPERTY): New property.
	(setMargin): Implemented.
	* javax/swing/JMenuItem.java: Fixed javadocs.
	* javax/swing/JPopupMenuUI.java: Fixed javadocs.
	(LABEL_CHANGED_PROPERTY): New property.
	(add): changed to use createActionComponent.
	(createActionComponent): Implemented.
	(setLabel): Fire PropertyChangeEvent if label property
	changes.
	* javax/swing/JRadioButtonMenuItem.java: Fixed javadocs.
	* javax/swing/plaf/basic/BasicMenuBarUI.java: Likewise.
	(ContainerHandler): Repaint if margin property has changed.
	* javax/swing/plaf/basic/BasicMenuItemUI.java:
	(installUI): Call installComponents().
	(uninstallUI): Call uinstallComponents().
	* javax/swing/plaf/basic/BasicMenuUI.java:
	Fixed javadocs.
	* javax/swing/plaf/basic/BasicPopupMenuUI.java:
	Likewise.

2004-07-21  Kim Ho  <kho@redhat.com>

	* javax/swing/plaf/basic/BasicToolBarUI.java:
	(DragWindow): Use the right constructor.

2004-07-21  Kim Ho  <kho@redhat.com>

	* javax/swing/JToolBar.java:
	(layoutContainer): Use getComponents.
	* javax/swing/plaf/basic/BasicToolBarUI.java:
	(DragWindow): Don't use SwingUtilities'
	getOwnerFrame
	(ToolBarDialog): ditto.

2004-07-21  Kim Ho  <kho@redhat.com>

	* javax/swing/JRootPane.java:
	Ran jalopy.
	(layoutContainer): Set the glasspane's size to
	be the same as the content pane.
	(createGlassPane): Set opaque property to false.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/Component.java (requestFocus()): Don't handle Panels
	specially.
	(requestFocus(boolean)): Likewise.
	(requestFocusInWindow(boolean)): Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (create):
	Set GTK_CAN_FOCUS flag.

2004-07-21  Kim Ho  <kho@redhat.com>

	* Makefile.am: Added new file.
	* Makefile.in: Regenerated.
	* gcj/Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* javax/swing/AbstractButton.java:
	Add rollOverEnabled property.
	(setRolloverEnabled): Use new property.
	(isRolloverEnabled): Use new property.
	* javax/swing/JTabbedPane.java:
	(setComponent): Remove useless JTabbedPane.this.
	* javax/swing/JToolBar.java: Finish implementation.
	* javax/swing/plaf/basic/BasicArrowButton.java:
	(paint): Moved border painting to a border.
	* javax/swing/plaf/basic/BasicLookAndFeel.java:
	Change JToolBar look and feel defaults.
	* javax/swing/plaf/basic/BasicOptionPaneUI.java
	(actionPerformed): Return Integer index instead of name.
	(addButtonComponents): Check to see if component is
	JButton last.
	(createMessageArea): Don't use components that are not
	completed yet.
	(getIconForType): Use temporary icons.
	* javax/swing/plaf/basic/BasicSliderUI.java:
	(mousePressed): Do not return if it's on thumb.
	(paintMinorTickForHorizSlider): Use BLACK to paint ticks.
	(paintMinorTickForVertSlider): ditto.
	(paintMajorTickForHorizSlider): ditto.
	(paintMajorTickForVertSlider): ditto.
	* javax/swing/plaf/basic/BasicSplitPaneDivider.java:
	Add a border around the SplitPaneDivider.
	* javax/swing/plaf/basic/BasicSplitPaneUI.java:
	Remove comments.
	* javax/swing/plaf/basic/BasicToolBarSeparatorUI.java:
	New file. Implemented.
	* javax/swing/plaf/basic/BasicToolBarUI.java:
	Implemented.
	* testsuite/Makefile.in: Regenerated.

2004-07-21  Graydon Hoare  <graydon@redhat.com>

	* javax/swing/Timer.java (run): Queue events each time cycle.

2004-07-21  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkImagePainter.java
	(imageComplete): Call image.imageComplete().
	* java/awt/image/MemoryImageSource.java:
	Reimplement consumers as a Vector instead of a Hashtable.  This is
	because enumeration on a Hashtable is not thread-safe.
	(addConsumer): Adapt to Vector consumers.
	(isConsumer): Adapt to Vector consumers.
	(removeConsumer): Adapt to Vector consumers.
	(startProduction): Adapt to Vector consumers. Call imageComplete()
	with STATICIMAGEDONE flag instead of SINGLEFRAME flag.
	(newPixels): Adapt to Vector consumers.
	(sendPicture): Set the color model of the image consumer.
	(newPixels(IIII)): Adapt to Vector consumers.
	(newPixels(IIIIB)): Adapt to Vector consumers.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/Component.java (deliverEvent): Implement.
	(postEvent): Implement.
	(handleEvent): Implement.
	(translateEvent): New method.
	(dispatchEventImpl): Document.  Add AWT 1.0 event handling.
	* java/awt/Container.java (deliverEvent): Implement.
	* java/awt/Event.java (paramString): Fix formatting.
	* java/awt/Font.java (toString): Likewise.
	* java/awt/Window.java (postEvent): Implement.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/DefaultKeyboardFocusManager.java (dispatchEvent):
	Set window's focus owner upon receiving a FOCUS_LOST event.
	* java/awt/Window.java (Window()): Refocus the previously
	focused component within the window when the window regains the
	top-level focus.
	(setFocusOwner): New method.
	* java/awt/Component.java (requestFocus): Add FIXME.

	* libgcj.pc.in: Remove library flags.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkPanelPeer.java (handleEvent): Handle
	MOUSE_PRESSED event.
	* java/awt/Component.java (requestFocus()): Handle Panel
	specially.  Post FOCUS_LOST event on opposite component.
	(requestFocus(boolean)): Likewise.
	(requestFocusInWindow(boolean)): Likewise.
	(paramString): Reorder dimension fields.
	* java/awt/Container.java (paramString): Fix string format.
	* java/awt/DefaultKeyboardFocusManager.java (dispatchEvent):
	Handle FOCUS_LOST events.  Don't handle Windows specially.  Only
	process key events if the focus owner is non-null.
	(dispatchKeyEvent): Likewise.
	* java/awt/Frame.java (paramString): Fix formatting.
	(generateName): New method.
	(getUniqueLong): Likewise.
	* java/awt/KeyboardFocusManager.java (getFocusOwner): Check if
	the temporary focus owner is null.  If so, return the permanent
	focus owner.
	* java/awt/Panel.java (generateName): New method.
	(getUniqueLong): Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c: Rework
	signal handling to make callbacks more specific.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/Position.java
	(Bias): Implemented.

2004-07-21  Michael Koch  <konqueror@gmx.de>

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

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JTextArea.java
	(tabSize): New field.
	(getTabSize): New method.
	(setTabSize): Likewise.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ActionMap.java:
	Fixed javadocs all over.
	(serialVersionUID): Made private.
	(parent): Don't explicitely initialize with default value.
	(get): SImplified.
	(keys): Reimplemented.
	(allKeys): Likewise.
	(convertSet): Removed.
	* javax/swing/ComponentInputMap.java:
	Fixed javadocs all over.
	(ComponentInputMap): Implemented.
	(put): Likewise.
	(clear): Likewise.
	(remove): Likewise.
	(SetParent): Likewise.
	(getComponent): Likewise.
	* javax/swing/InputMap.java:
	Fixed javadocs all over.
	(serialVersionUID): Made private.
	(parent): Don't explicitely initialize with default value.
	(get): SImplified.
	(keys): Reimplemented.
	(allKeys): Likewise.
	(convertSet): Removed.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ActionMap.java,
	javax/swing/ComponentInputMap.java,
	javax/swing/InputMap.java,
	javax/swing/table/DefaultTableColumnModel.java,
	javax/swing/table/TableColumn.java,
	javax/swing/table/TableColumnModel.java,
	javax/swing/table/TableModel.java,
	javax/swing/text/AbstractDocument.java,
	javax/swing/text/TextAction.java:
	Reformated.

2004-07-21  Graydon Hoare  <graydon@redhat.com>

	* gnu/java/awt/peer/gtk/GtkToolkit.java (bufferedImageOrError):
	Make method non-static.
	* javax/swing/AbstractButton.java:
	Rename fields to match property names where possible.
	(iconTextGap): New property.
	* javax/swing/JCheckBox.java: Match AbstractButton changes.
	(init) New method, call from after various constructors.
	* javax/swing/JComponent.java (revalidate):
	Invalidate before queueing repair.
	* javax/swing/JList.java (getPreferredScrollableViewportSize):
	Reimplement in terms of visibleRowCount property.
	* javax/swing/JMenuButton.java: Match AbstractButton changes.
	* javax/swing/JScrollPane.java (createScrollListener):
	Remove tracing chatter.
	* javax/swing/JToggleButton.java: Match AbstractButton changes.
	* javax/swing/RepaintManager.java (addInvalidComponent):
	Don't invalidate.
	* javax/swing/ScrollPaneLayout.java: Various corrections to layout
	calculations.
	* javax/swing/SwingUtilities.java (layoutCompoundLabel):
	Mimic sun behavior on top left/right positioning.
	* javax/swing/ViewportLayout.java (preferredLayoutSize):
	Remove mistaken use of preferredScrollableViewportSize here.
	(layoutContainer): Use view's preferred size as basis.
	* javax/swing/plaf/basic/BasicButtonUI.java:
	Set, get, and use textIconGap property.
	(paint) Paint text returned from layout (with ellipsis).
	* javax/swing/plaf/basic/BasicListUI.java:
	Remove tracing chatter, correct various minor calculations.
	(getCellBounds): Update layout state before calculating.
	* javax/swing/plaf/basic/BasicLookAndFeel.java (Button.Margin):
	Use margin default similar to sun's.
	* javax/swing/plaf/basic/BasicScrollBarUI.java (ArrowIcon):
	(createIncreaseIcon): Center icon, minimize margins.
	(createDecreaseIcon): Likewise.
	* javax/swing/plaf/basic/BasicScrollPaneUI.java (installDefaults):
	Implement.
	(installUI): Call it.
	(uninstallDefaults): Implement.
	(uninstallUI): Call it.
	* javax/swing/plaf/basic/BasicToolBarUI.java (DragWindow):
	Call existing Window constructor.
	* javax/swing/plaf/basic/BasicViewportUI.java (paint):
	Set clip before painting.

2004-07-21  Olga Rodimina <rodimina@redhat.com>

	* javax/swing/JMenuItem.java:
	(processMouseEvent): Reimplemented to deal with
	mouse drag events.
	(createMenuDragMouseEvent): New private helper method.
	Creates MenuDragMouseEvent.
	* javax/swing/MenuSelectionManager.java
	(componentForPoint): Implemented.
	(isComponentPartOfCurrentMenu): Made public.
	(processMouseEvent): Reimplemented to deal with
	mouse drag events.
	(setSelectedPath): Corrected small mistake that caused
	path to be set incorrectly.
	(getPath): If given component is JMenu then also add this
	menu's popup menu to the selected path.
	* javax/swing/plaf/basic/BasicMenuItemUI.java:
	(getPath): Ditto.
	(getPreferredSize): Call getPreferredMenuItemSize().
	(getPreferredItemSize): Moved code from getPreferredSize to here.
	(installListeners): Install MouseMotionListeners.
	(MouseInputHandler): Pass mouse release event to MenuSelectionManager
	if mouse wasn't released in the bounds of this menu item.
	(MenuDragMouseHandler): Implemented.
	* javax/swing/plaf/basic/BasicMenuUI.java:
	(installListeners): Install MouseMotionListener and
	MenuDrageMouseListener.
	(MenuDragMouseHandler): Implemented.
	* javax/swing/plaf/basic/BasicPopupMenuUI.java:
	(uninstallListeners): Implemented.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* 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-07-21  Graydon Hoare  <graydon@redhat.com>

	* java/awt/image/BufferedImage.java (getSource): Remove tracing chatter.
	* gnu/java/awt/peer/gtk/GtkToolkit.java
	(GtkErrorImage): New helper class.
	(bufferedImageOrError): New helper method.
	(createImage): Use it.

2004-07-21  David Jee  <djee@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
	(setCaretPosition): Scroll the text view so the new caret position
	is visible on screen.

2004-07-21  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkContainerPeer.java
	(setBounds): Do not validate awtComponent here.
	* gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
	(getPreferredSize): New method.
	* java/awt/ScrollPane.java
	(ScrollPane): Set default size to 100x100.
	(addNotify): If child is not a Panel, wrap it with a new Panel.
	(paramString): Implement.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JMenu.java:
	(setSelected): Display popup menu only if this menu
	is showing on the screen.
	* javax/swing/JPopupMenu.java:
	(processMouseEvent): Added comment.
	(processKeyEvent): Likewise.
	* javax/swing/MenuSelectionManager.java:
	(clearSelectedPath): Only fireStateChanged() after
	selected path was changed, not before.
	(setSelectedPath): Likewise.
	* javax/swing/plaf/basic/BasicMenuItemUI.java:
	(paintMenuItem): Corrected position of menu item's
	icon.
	* javax/swing/plaf/basic/BasicPopupMenuUI.java:
	(installUI): Correct setDefaultLightWeightPopupEnabled call.
	(popupMenuCanceled): Reimplemented.
	(popupMenuWillBecomeVisible): Select first menu item by default
	when displaying free floating popup menus.
	(TopWindowListener): Reimplemented.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/Panel.java (dispatchEventImpl): Override to prevent
	Panel from being painted twice when it is first shown.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* java/awt/Window.java: Reverted changes from my
	previous patch for creating window without an owner.
	* javax/swing/SwingUtilities.java:
	(SwingUtilities.OwnerFrame): made static.
	(OwnerFrame.setVisible): New method. Overridden with
	empty implementation.
	(OwnerFrame.isShowing): New method. Ovverridden
	to return always true.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(GtkComponentPeer): Remove temporary try/catch block.
	(setVisible): Call show and hide.
	(show): Make native.
	(hide): Likewise.
	(getArgs): Don't add "visible" argument.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(property_notify_predicate): Return Bool instead of int.
	(find_layout): New function.
	(connectJObject): Call find_layout.
	(connectSignals): Likewise.
	(moveLayout): Likewise.
	(gtkLayoutSetVisible): Likewise.

2004-07-21  Mark Wielaard  <mark@klomp.org>

	* java/awt/event/InvocationEvent.java (dispatch): Synchronize
	on notifier object before calling notifyAll().

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* java/awt/Window.java: Changed constructors to use new
	method that is described below. Constructors call this
	methods only if newly created window should have an owner.
	(setWindowOwner): New method. Implementation for
	this method is moved from this(owner,configuration).
	* javax/swing/JWindow.java:
	(JWindow): Reimplement to use SwingUtilities.ownerFrame
	instead of owner.
	* javax/swing/SwingUtilities.java:
	(ownerFrame): Change type of this field to OwnerFrame.
	(getOwnerFrame): Changed to return object of type OwnerFrame.
	(SwingUtilities.OwnerFrame): New class. Represents owner
	of a Window that is not provided with one.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	*  javax/swing/AbstractButton.java:
	(configurePropertiesFromAction): Set action command
	to button's text by default if action command is not
	explicitely specified.
	* javax/swing/JMenu.java: Remove unnecessary listener
	and methods relevant to it.
	(setSelected): Reimplemented.
	(menuSelectionChanged): Moved most part of implementation to
	setSelected() and call it instead.
	* javax/swing/JMenuItem.java:
	(init): Comment out statement that sets paint_border to false.
	(configurePropertiesFromAction): Do not set accelerator
	for JMenu.
	(menuSelectionChanged): Change selected index in the selection
	model of menu item's parent.
	* javax/swing/JPopupMenu.java:
	(remove): Set constraints.fill field to GridBagConstraints.BOTH
	instead of GridBagConstraints.HORIZONTAL.
	(insert): Likewise.
	(createActionChangeListener): Implemented.
	(setVisible): Correct location of HeavyWeightMenu and
	don't firePopupMenuCanceled().
	(menuSelectionChanged): Implemented.
	(ActionChangeListener): New Listener. Implemented.
	* javax/swing/plaf/basic/BasicMenuBarUI.java:
	(BasicMenuBarUI.ContainerHandler): Implemented.
	* javax/swing/plaf/basic/BasicMenuItemUI.java:
	(paintMenuItem): Uncommented out code that paints
	icon, now that icons are working properly.
	(PropertyChangeListener): Implemented.
	* javax/swing/plaf/basic/BasicPopupMenuUI.java:
	Added javadocs.
	(topWindowListener): New field.
	(Constructor): initialize topWindowListener.
	(BasicPopupMenuUI.TopWindowListener): Implemented.
	(BasicPopupMenuUI.PopupMenuHandler): Implemented.
	(BasicPopupMenuUI.TopWindowListener): New ComponentListener.
	Implemented.



2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicButtonUI.java
	(paintFocus): Fixed method signature.
	(paintButtonPressed): Likewise.
	(paintButtonNormal): Likewise.
	(paintText): New method.
	* javax/swing/plaf/basic/BasicLabelUI.java
	(paint): Re-indented.
	* javax/swing/plaf/basic/BasicTextUI.java
	(installUI): Set parent textComponent to opaque.
	* javax/swing/text/DefaultHighlighter.java
	(checkPositions): New helper method.
	(addHighlight): Throws BadLocationException, check positions.
	(changeHighlight): Likewise.
	* javax/swing/text/EditorKit.java
	(EditorKit): Implements Serializable.
	* javax/swing/text/JTextComponent.java
	(getUI): Added javadoc.
	(setUI): Likewise.
	(upadteUI): Added javadoc, don't revalidate and repaint.

2004-07-21  David Jee  <djee@redhat.com>

	* java/awt/GridBagLayout.java
	(ArrangeGrid): Use PREFERREDSIZE instead of MINSIZE.
	* javax/swing/AbstractButton.java
	(setText): Reindent.
	* javax/swing/RepaintManager.java
	(addInvalidComponent): Find the first ancestor that isValidateRoot().

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JFormattedTextField.java
	(value): New field.
	(JFormattedTextField): Implemented.
	(getValue): Likewise.
	(setValue): Likewise.
	* javax/swing/LookAndFeel.java
	(getSupportsWindowDecorations): New method.
	* javax/swing/UIDefaults.java:
	Use java.beans.PropertyChangeSupport instead of doing all ourself.
	(addPropertyChangeListener): Made public.
	(addResourceBundle): Likewise.
	(removeResourceBundle): Likewise.
	(setDefaultLocale): Likewise.
	* javax/swing/plaf/basic/BasicRootPaneUI.java
	(BasicRootPaneUI): Implements PropertyChangeListener.
	(propertyChange): New method.
	* javax/swing/plaf/basic/BasicTextUI.java
	(BasicHighlighter): New inner class.
	(createHighlighter): New method.
	* javax/swing/plaf/basic/BasicToolBarUI.java
	(DragWindow): Extends java.awt.Window.
	* javax/swing/text/JTextComponent.java
	(getDocument): Removed debug output.
	* javax/swing/plaf/basic/BasicTextFieldUI.java,
	javax/swing/text/DefaultHighlighter.java,
	javax/swing/text/FieldView.java,
	javax/swing/text/PlainView.java: New files.
	* Makefile.am: Added new files.
	* Makefile.in: Regenerated.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JEditorPane.java
	(createDefaultEditorKit): Use javax.swing.text.DefaultEditorKit.
	(createEditorKitForContentType): Likewise.
	* javax/swing/text/DefaultEditorKit.java
	(serialVersionUID): Added constant field.
	(EndOfLineStringPropery): Fixed typo.
	(DefaultEditorKit): New constructor.
	* javax/swing/text/Segment.java:
	Import java.text.CharacterIterator.
	* javax/swing/text/CharacterIterator.java,
	javax/swing/text/PlainEditorKit.java: Removed.
	* Makefile.am: Removed javax/swing/text/CharacterIterator.java and
	javax/swing/text/PlainEditorKit.java.
	* Makefile.in: Regenerated.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JButton.java,
	javax/swing/text/DefaultEditorKit.java,
	javax/swing/text/EditorKit.java,
	javax/swing/text/Segment.java,
	javax/swing/text/StyledEditorKit.java:
	Reformatted.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ImageIcon.java
	(file): Removed.
	(description): Renamed from descr.
	(ImageIcon): Added missing constructors.
	(setParent): Removed.
	(setImageObserver): New method.
	(getImageObserver): New method.
	(paintIcon): Handle observer = null.
	* javax/swing/JButton.java
	(removeNotify): Fixed javadoc.
	(updateUI): Simplified.
	* javax/swing/JRootPane.java
	(serialVersionUID): New constant field.
	* javax/swing/UIManager.java:
	Fixed javadocs all over.
	(setLookAndFeel): Throws UnsupportedLookAndFeelException.
	* javax/swing/text/AbstractDocument.java
	(createPosition): Throws BadLocationException.
	(getText): Likewise.
	(remove): Likewise.
	* javax/swing/text/ComponentView.java
	(modelToView): Likewise.
	* javax/swing/text/DefaultEditorKit.java:
	Made all public methods public.
	(read): Throws BadLocationException and IOException.
	(write): Likewise.
	* javax/swing/text/EditorKit.java:
	Made all public methods public.
	(serialVersionUID): New constant field.
	(clone): New method.
	(read): Throws BadLocationException and IOException.
	(write): Likewise.
	* javax/swing/text/Segment.java
	(array): Made public.
	(count): Likewise.
	(offset): Likewise.
	(Segment): New constructors.
	(clone): Reimplemented.
	* javax/swing/text/StyledEditorKit.java
	(serialVersionUID): New constant field.

2004-07-21  Graydon Hoare  <graydon@redhat.com>

	* java/awt/image/BufferedImage.java
	(getSource): Implement.
	* javax/swing/ImageIcon.java
	(ImageIcon): Implement ctor.
	* javax/swing/ScrollPaneLayout.java
	(preferredLayoutSize): Be more careful about nulls.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AttributeSet.java
	(CharacterAttribute): New interface
	(ColorAttribute): Likewise.
	(FontCharacterAttribute): Likewise.
	(ParagraphAttribute): Likewise.
	* javax/swing/text/DefaultCaret.java
	(moveCaret): New method.
	(positionCaret): Likewise.
	(repaint): Made protected.
	* javax/swing/text/JTextComponent.java
	(KeyBinding): Made it static.
	* javax/swing/text/View.java
	(getContainer): Honor parent == null.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java:
	Reformatted.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicRootPaneUI.java:
	Import javax.swing.UIManager explicitely.
	* javax/swing/plaf/basic/BasicTabbedPaneUI.java
	(ScrollingButton): Made it static.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/UIDefaults.java
	(ActiveValue): Made public.
	(LazyValue): Likewise.
	* javax/swing/plaf/basic/BasicTextUI.java
	(RootView): Reintroduced.
	(view): Removed.
	(rootView): New field.
	(installUI): Create document if needed, initialize rootView.
	(uninstallUI): Hanle rootView.
	(paint): Likewise.
	(getRootView): Likewise.
	(setView): Likewise.
	* javax/swing/text/DefaultCaret.java:
	Renamed all "evt" variables to "event".

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* libgcj.spec.in: Add -l-java-util-logging.

2004-07-21  Andreas Tobler  <a.tobler@schweiz.ch>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
	(init_dpi_conversion_factor): Check for int_dpi < 0 in case
	gtk-xft-dpi can no calculate the right value.
	(dpi_changed_cb): Mark *pspec as unsused.

2004-07-21  David Jee  <djee@redhat.com>

	* java/awt/Component.java
	(move): Delegate to setBounds().
	(resize): Likewise.
	(reshape): Fix so it repaints parent and self only when necessary.

2004-07-21  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(GtkComponentPeer): Revert previous patch from 2004-06-22.
	(setVisible): Likewise.
	(show): Likewise.
	(hide): Likewise.
	(getArgs): Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(property_notify_predicate): Likewise.
	(find_layout): Likewise.
	(connectJObject): Likewise.
	(connectSignals): Likewise.
	(moveLayout): Likewise.
	(gtkLayoutSetVisible): Likewise.

2004-07-21  Graydon Hoare  <graydon@redhat.com>

	* Makefile.am
	(jv_convert_LDADD):
	(gij_LDADD):
	(rmic_LDADD):
	(rmiregistry_LDADD): Add lib-java-util-logging.la
	* Makefile.in: Regenerate.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java
	(replace): Dont use protected method of java.util.Vector directly.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicTextUI.java
	(installUI): Call specialized install methods.
	(installDefaults): New method.
	(installListeners): Likewise.
	(installKeyboardActions): Likewise.
	(uninstallUI): Likewise.
	(uninstallDefaults): New method.
	(uninstallListeners): Likewise.
	(uninstallKeyboardActions): Likewise.
	(getPropertyPrefix): New abstract method.
	(paint): Made final, just call paintSafely().
	(paintSavely): New method.
	(paintBackground): Likewise.
	(getVisibleEditorRect): Likewise.
	* javax/swing/text/LayeredHighlighter.java,
	javax/swing/text/TabExpander.java: New files.
	* Makefile.am: Added javax/swing/text/LayeredHighlighter.java
	and javax/swing/text/TabExpander.java.
	* Makefile.in: Regenerated.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicTextUI.java
	(BasicTextUI): Made abstract.
	(BasicCaret): New inner class.
	(view): Don't explicitely initialize with "null".
	(textComponent): New field.
	(textColor): Removed.
	(disabledTextColor): Removed.
	(normalBackgroundColor): Removed.
	(RootView): Removed commented out inner class.
	(createUI): Removed.
	(createCaret): New method.
	(getComponent): Likewise.
	(installUI): Initialize textComponent only.
	(getPreferredSize): Use installed JTextComponent.
	(setView): New method.
	(create): Likewise.
	* javax/swing/text/JTextComponent.java
	(highlighter): New field.
	(caretColor): Likewise.
	(disabledTextColor): Likewise.
	(seletedTextColor): Likewise.
	(selectionColor): Likewise.
	(setUI): New method.
	(getCaretColor): Likewise.
	(setCaretColor): Likewise.
	(getDisabledColor): Likewise.
	(setDisabledColor): Likewise.
	(getSelectedTextColor): Likewise.
	(setSelectedTextColor): Likewise.
	(getSelectionColor): Likewise.
	(setSelectionColor): Likewise.
	(getHighlighter): Likewise.
	(setHighlighter): Likewise.
	(replaceSelection): Likewise.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicScrollPaneUI.java
	(BasicScrollPaneUI): Implements ScrollPaneConstants.
	* javax/swing/plaf/basic/BasicToolBarUI.java
	(BasicToolBarUI): Implements SwingConstants.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JPopupMenu.java: Removed CVS tags.
	* javax/swing/UIDefaults.java: Reformatted.
	* javax/swing/plaf/basic/BasicRootPaneUI.java:
	Explicitely import used classes.

2004-07-21  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(GtkComponentPeer): Remove temporary try/catch block.
	(setVisible): Call show and hide.
	(show): Make native.
	(hide): Likewise.
	(getArgs): Don't add "visible" argument.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(property_notify_predicate): Return Bool instead of int.
	(find_layout): New function.
	(connectJObject): Call find_layout.
	(connectSignals): Likewise.
	(moveLayout): Likewise.
	(gtkLayoutSetVisible): Likewise.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/AbstractButton.java:
	(setDisplayedMnemonicIndex): Check if button
	text is not null before checking its length.
	* javax/swing/JMenuItem.java:
	(processMouseEvent): Disarm menu item if mouse has
	exited it.
	* javax/swing/plaf/basic/BasicMenuUI.java:
	(MouseInputHandler.mouseEntered): Do not raise
	popup menu if this menu is already selected.
	(MouseInputHandler.mousePressed): Do not fire
	MenuEvents.
	(MenuHandler): Implemented.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JCheckBoxMenuItem.java: Added Javadoc.
	(getSelectedObjects): Implemented.
	* javax/swing/JRadioButtonMenuItem.java: Added Javadoc.
	* javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java:
	Added javadoc for few methods.
	(processMouseEvent): Made public.
	* javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
	(processMouseEvent): Likewise.

2004-07-21  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/AbstractButton.java:
	(init): Set display mnemonic index to -1.
	(setMnemonic(char)): Use setMnemonic(int).
	(setMnemonic(int)): Set display mnemonic index.
	(getDisplayedMnemonicIndex): Change method signature
	by removing 'index' parameter.
	* javax/swing/plaf/basic/BasicLookAndFeel.java:
	Added default for Menu.selectionBackground.
	* javax/swing/plaf/basic/BasicMenuItemUI.java:
	(paintMenuItem): Change background color of the selected
	menu item.
	(paintText): Paint differently when menu item is disabled.
	Also paint mnemonic if it appears in the menu item's label.
	(paintAccelerator): Paint accelerator differently
	if menu item is disabled.
	* javax/swing/plaf/basic/BasicMenuUI.java:
	(installDefaults): Install defaults for
	selectionForeground and selectionBackground.
	(uninstallDefaults): Uninstall defauls for
	selectionForeground and selectionBackground.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java
	(BranchElement): Implemented.
	(LeafElement): Implemented.
	* javax/swing/text/DefaultCaret.java:
	Import used classes.
	(serialVersionUID): New constant.
	* javax/swing/text/JTextComponent.java
	(AccessibleJTextComponent): Removed dead declaration.
	(caretPos): Removed.
	(setCaret): New method.
	* javax/swing/text/PlainDocument.java
	(rootElement): New field.
	(PlainDocument): Initialize rootElement.
	(createDefaultRoot): New method.
	(getDefaultRootElement): Implemented.
	* javax/swing/text/View.java: Reformatted.
	* javax/swing/text/ViewFactory.java
	(create): Added javadoc.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ToolTipManager.java: Reformatted.

2004-07-21  Rodimina Olga  <rodimina@redhat.com>

	* javax/swing/AbstractButton.java
	(changeEvent): New field.
	(fireItemStateChanged): Change source of the event
	to 'this' before firing it to button listeners.
	(fireActionPerformed): Likewise.
	(fireStateChanged): Likewise.
	(createActionListener): Do not set source
	of the event to AbstractButton.
	* javax/swing/plaf/basic/BasicMenuBarUI.java:
	(ContainerHandler.componentAdded): Removed
	print out statement.
	(ContainerHandler.componentRemoved): Likewise.

2004-07-21  Michael Koch  <konqueror@gmx.de>

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

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ToolTipManager.java
	(stillInsideTimerAction): Fixed constructor arguments.
	(outsideTimerAction): Likewise.
	(insideTimerAction): Likewise.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JButton.java: Reformatted.
	* javax/swing/JFormattedTextField.java
	(getUIClassID): Implemented.
	* javax/swing/JRootPane.java
	(serialVersionUID): New constant.
	* javax/swing/JTextField.java
	(align): New field.
	(JTextField): Simplified.
	(getUIClassID): New method.
	(getActionListeners): Added @since tag.
	(setColumns): Invalidate layout and repaint.
	(getHorizontalAlignment): New method.
	(setHorizontalAlignment): New method.
	(selectAll): Removed.
	* javax/swing/SwingUtilities.java
	(getAncestorOfClass): Removed redundant @see tag.
	(isLeftMouseButton): Fixed implementation.
	(isMiddleMouseButton): Likewise.
	(isRightMouseButton): Likewise.
	* javax/swing/text/AbstractDocument.java
	(AttributeContext.addAttribute): New method.
	(AttributeContext.addAttributes): New method.
	(AttributeContext.getEmptySet): New method.
	(AttributeContext.reclaim): New method.
	(AttributeContext.removeAttribute): New method.
	(AttributeContext.removeAttributes): New method.
	* javax/swing/text/Document.java
	(createPosition): Throws BadLocationException.
	(getText): Likewise.
	(remove): Likewise.
	* javax/swing/text/JTextComponent.java
	(getText): Return null if no document is set. Catch
	BadLocationException.
	(getUI): Return ui.
	(updateUI): Simplified.

2004-07-21  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JButton.java
	(removeNotify): Fixed javadoc.
	(updateUI): Simplified.

2004-07-21  David Jee  <djee@redhat.com>

	* gnu/java/awt/image/ImageDecoder.java
	(startProduction): Only add consumer if it's not added yet.
	* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
	(GdkPixbufDecoder): Don't call initState() here.
	(produce): Call initState() here, to ensure area_prepared and
	area_updated signals are properly connected.
	* gnu/java/awt/peer/gtk/GtkImage.java
	(setColorModel): Use equals() to compare ColorModel objects.
	(setPixels): Likewise.
	* java/awt/image/ColorModel.java
	(equals): Fix typo. Use Arrays.equals() to compare int arrays.
	* java/awt/image/RGBImageFilter.java
	(setColorModel): Set consumer's color model.
	(setPixels): Use equals() to compare ColorModel objects.

From-SVN: r85051
parent 42611590
...@@ -1102,6 +1102,7 @@ java/awt/geom/GeneralPath.java \ ...@@ -1102,6 +1102,7 @@ java/awt/geom/GeneralPath.java \
java/awt/geom/QuadCurve2D.java \ java/awt/geom/QuadCurve2D.java \
java/awt/image/AffineTransformOp.java \ java/awt/image/AffineTransformOp.java \
java/awt/image/BufferedImage.java \ java/awt/image/BufferedImage.java \
java/awt/image/ByteLookupTable.java \
java/awt/image/ColorModel.java \ java/awt/image/ColorModel.java \
java/awt/image/ComponentColorModel.java \ java/awt/image/ComponentColorModel.java \
java/awt/image/ComponentSampleModel.java \ java/awt/image/ComponentSampleModel.java \
...@@ -1117,11 +1118,14 @@ java/awt/image/ImageConsumer.java \ ...@@ -1117,11 +1118,14 @@ java/awt/image/ImageConsumer.java \
java/awt/image/ImageObserver.java \ java/awt/image/ImageObserver.java \
java/awt/image/ImageProducer.java \ java/awt/image/ImageProducer.java \
java/awt/image/IndexColorModel.java \ java/awt/image/IndexColorModel.java \
java/awt/image/Kernel.java \
java/awt/image/LookupTable.java \
java/awt/image/PackedColorModel.java \ java/awt/image/PackedColorModel.java \
java/awt/image/PixelInterleavedSampleModel.java \ java/awt/image/PixelInterleavedSampleModel.java \
java/awt/image/Raster.java \ java/awt/image/Raster.java \
java/awt/image/RasterOp.java \ java/awt/image/RasterOp.java \
java/awt/image/SampleModel.java \ java/awt/image/SampleModel.java \
java/awt/image/ShortLookupTable.java \
java/awt/image/SinglePixelPackedSampleModel.java \ java/awt/image/SinglePixelPackedSampleModel.java \
java/awt/image/WritableRaster.java \ java/awt/image/WritableRaster.java \
java/awt/image/AreaAveragingScaleFilter.java \ java/awt/image/AreaAveragingScaleFilter.java \
...@@ -1344,8 +1348,10 @@ javax/swing/plaf/basic/BasicSliderUI.java \ ...@@ -1344,8 +1348,10 @@ javax/swing/plaf/basic/BasicSliderUI.java \
javax/swing/plaf/basic/BasicSplitPaneDivider.java \ javax/swing/plaf/basic/BasicSplitPaneDivider.java \
javax/swing/plaf/basic/BasicSplitPaneUI.java \ javax/swing/plaf/basic/BasicSplitPaneUI.java \
javax/swing/plaf/basic/BasicTabbedPaneUI.java \ javax/swing/plaf/basic/BasicTabbedPaneUI.java \
javax/swing/plaf/basic/BasicTextFieldUI.java \
javax/swing/plaf/basic/BasicTextUI.java \ javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \ javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarSeparatorUI.java \
javax/swing/plaf/basic/BasicToolBarUI.java \ javax/swing/plaf/basic/BasicToolBarUI.java \
javax/swing/plaf/basic/BasicTreeUI.java \ javax/swing/plaf/basic/BasicTreeUI.java \
javax/swing/plaf/basic/BasicViewportUI.java \ javax/swing/plaf/basic/BasicViewportUI.java \
...@@ -1459,6 +1465,8 @@ javax/swing/ListModel.java \ ...@@ -1459,6 +1465,8 @@ javax/swing/ListModel.java \
javax/swing/ListSelectionModel.java \ javax/swing/ListSelectionModel.java \
javax/swing/LookAndFeel.java \ javax/swing/LookAndFeel.java \
javax/swing/Scrollable.java \ javax/swing/Scrollable.java \
javax/swing/Spring.java \
javax/swing/SpringLayout.java \
javax/swing/SwingConstants.java \ javax/swing/SwingConstants.java \
javax/swing/SwingUtilities.java \ javax/swing/SwingUtilities.java \
javax/swing/Timer.java \ javax/swing/Timer.java \
...@@ -1513,29 +1521,34 @@ javax/swing/text/AbstractDocument.java \ ...@@ -1513,29 +1521,34 @@ javax/swing/text/AbstractDocument.java \
javax/swing/text/AttributeSet.java \ javax/swing/text/AttributeSet.java \
javax/swing/text/BadLocationException.java \ javax/swing/text/BadLocationException.java \
javax/swing/text/Caret.java \ javax/swing/text/Caret.java \
javax/swing/text/CharacterIterator.java \
javax/swing/text/ComponentView.java \ javax/swing/text/ComponentView.java \
javax/swing/text/DefaultCaret.java \ javax/swing/text/DefaultCaret.java \
javax/swing/text/DefaultEditorKit.java \ javax/swing/text/DefaultEditorKit.java \
javax/swing/text/DefaultHighlighter.java \
javax/swing/text/Document.java \ javax/swing/text/Document.java \
javax/swing/text/DocumentFilter.java \ javax/swing/text/DocumentFilter.java \
javax/swing/text/EditorKit.java \ javax/swing/text/EditorKit.java \
javax/swing/text/Element.java \ javax/swing/text/Element.java \
javax/swing/text/FieldView.java \
javax/swing/text/GapContent.java \ javax/swing/text/GapContent.java \
javax/swing/text/Highlighter.java \
javax/swing/text/JTextComponent.java \ javax/swing/text/JTextComponent.java \
javax/swing/text/Keymap.java \ javax/swing/text/Keymap.java \
javax/swing/text/LayeredHighlighter.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
javax/swing/text/PlainDocument.java \ javax/swing/text/PlainDocument.java \
javax/swing/text/PlainEditorKit.java \ javax/swing/text/PlainView.java \
javax/swing/text/Position.java \ javax/swing/text/Position.java \
javax/swing/text/Segment.java \ javax/swing/text/Segment.java \
javax/swing/text/Style.java \ javax/swing/text/Style.java \
javax/swing/text/View.java \
javax/swing/text/ViewFactory.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
javax/swing/text/StyledDocument.java \ javax/swing/text/StyledDocument.java \
javax/swing/text/StyledEditorKit.java \ javax/swing/text/StyledEditorKit.java \
javax/swing/text/TabExpander.java \
javax/swing/text/TabableView.java \
javax/swing/text/TextAction.java \ javax/swing/text/TextAction.java \
javax/swing/text/View.java \
javax/swing/text/ViewFactory.java \
javax/swing/text/html/HTML.java \ javax/swing/text/html/HTML.java \
javax/swing/text/html/parser/ParserDelegator.java \ javax/swing/text/html/parser/ParserDelegator.java \
javax/swing/tree/TreeNode.java \ javax/swing/tree/TreeNode.java \
......
...@@ -792,6 +792,7 @@ java/awt/geom/GeneralPath.java \ ...@@ -792,6 +792,7 @@ java/awt/geom/GeneralPath.java \
java/awt/geom/QuadCurve2D.java \ java/awt/geom/QuadCurve2D.java \
java/awt/image/AffineTransformOp.java \ java/awt/image/AffineTransformOp.java \
java/awt/image/BufferedImage.java \ java/awt/image/BufferedImage.java \
java/awt/image/ByteLookupTable.java \
java/awt/image/ColorModel.java \ java/awt/image/ColorModel.java \
java/awt/image/ComponentColorModel.java \ java/awt/image/ComponentColorModel.java \
java/awt/image/ComponentSampleModel.java \ java/awt/image/ComponentSampleModel.java \
...@@ -807,11 +808,14 @@ java/awt/image/ImageConsumer.java \ ...@@ -807,11 +808,14 @@ java/awt/image/ImageConsumer.java \
java/awt/image/ImageObserver.java \ java/awt/image/ImageObserver.java \
java/awt/image/ImageProducer.java \ java/awt/image/ImageProducer.java \
java/awt/image/IndexColorModel.java \ java/awt/image/IndexColorModel.java \
java/awt/image/Kernel.java \
java/awt/image/LookupTable.java \
java/awt/image/PackedColorModel.java \ java/awt/image/PackedColorModel.java \
java/awt/image/PixelInterleavedSampleModel.java \ java/awt/image/PixelInterleavedSampleModel.java \
java/awt/image/Raster.java \ java/awt/image/Raster.java \
java/awt/image/RasterOp.java \ java/awt/image/RasterOp.java \
java/awt/image/SampleModel.java \ java/awt/image/SampleModel.java \
java/awt/image/ShortLookupTable.java \
java/awt/image/SinglePixelPackedSampleModel.java \ java/awt/image/SinglePixelPackedSampleModel.java \
java/awt/image/WritableRaster.java \ java/awt/image/WritableRaster.java \
java/awt/image/AreaAveragingScaleFilter.java \ java/awt/image/AreaAveragingScaleFilter.java \
...@@ -1034,8 +1038,10 @@ javax/swing/plaf/basic/BasicSliderUI.java \ ...@@ -1034,8 +1038,10 @@ javax/swing/plaf/basic/BasicSliderUI.java \
javax/swing/plaf/basic/BasicSplitPaneDivider.java \ javax/swing/plaf/basic/BasicSplitPaneDivider.java \
javax/swing/plaf/basic/BasicSplitPaneUI.java \ javax/swing/plaf/basic/BasicSplitPaneUI.java \
javax/swing/plaf/basic/BasicTabbedPaneUI.java \ javax/swing/plaf/basic/BasicTabbedPaneUI.java \
javax/swing/plaf/basic/BasicTextFieldUI.java \
javax/swing/plaf/basic/BasicTextUI.java \ javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \ javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarSeparatorUI.java \
javax/swing/plaf/basic/BasicToolBarUI.java \ javax/swing/plaf/basic/BasicToolBarUI.java \
javax/swing/plaf/basic/BasicTreeUI.java \ javax/swing/plaf/basic/BasicTreeUI.java \
javax/swing/plaf/basic/BasicViewportUI.java \ javax/swing/plaf/basic/BasicViewportUI.java \
...@@ -1149,6 +1155,8 @@ javax/swing/ListModel.java \ ...@@ -1149,6 +1155,8 @@ javax/swing/ListModel.java \
javax/swing/ListSelectionModel.java \ javax/swing/ListSelectionModel.java \
javax/swing/LookAndFeel.java \ javax/swing/LookAndFeel.java \
javax/swing/Scrollable.java \ javax/swing/Scrollable.java \
javax/swing/Spring.java \
javax/swing/SpringLayout.java \
javax/swing/SwingConstants.java \ javax/swing/SwingConstants.java \
javax/swing/SwingUtilities.java \ javax/swing/SwingUtilities.java \
javax/swing/Timer.java \ javax/swing/Timer.java \
...@@ -1203,29 +1211,34 @@ javax/swing/text/AbstractDocument.java \ ...@@ -1203,29 +1211,34 @@ javax/swing/text/AbstractDocument.java \
javax/swing/text/AttributeSet.java \ javax/swing/text/AttributeSet.java \
javax/swing/text/BadLocationException.java \ javax/swing/text/BadLocationException.java \
javax/swing/text/Caret.java \ javax/swing/text/Caret.java \
javax/swing/text/CharacterIterator.java \
javax/swing/text/ComponentView.java \ javax/swing/text/ComponentView.java \
javax/swing/text/DefaultCaret.java \ javax/swing/text/DefaultCaret.java \
javax/swing/text/DefaultEditorKit.java \ javax/swing/text/DefaultEditorKit.java \
javax/swing/text/DefaultHighlighter.java \
javax/swing/text/Document.java \ javax/swing/text/Document.java \
javax/swing/text/DocumentFilter.java \ javax/swing/text/DocumentFilter.java \
javax/swing/text/EditorKit.java \ javax/swing/text/EditorKit.java \
javax/swing/text/Element.java \ javax/swing/text/Element.java \
javax/swing/text/FieldView.java \
javax/swing/text/GapContent.java \ javax/swing/text/GapContent.java \
javax/swing/text/Highlighter.java \
javax/swing/text/JTextComponent.java \ javax/swing/text/JTextComponent.java \
javax/swing/text/Keymap.java \ javax/swing/text/Keymap.java \
javax/swing/text/LayeredHighlighter.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
javax/swing/text/PlainDocument.java \ javax/swing/text/PlainDocument.java \
javax/swing/text/PlainEditorKit.java \ javax/swing/text/PlainView.java \
javax/swing/text/Position.java \ javax/swing/text/Position.java \
javax/swing/text/Segment.java \ javax/swing/text/Segment.java \
javax/swing/text/Style.java \ javax/swing/text/Style.java \
javax/swing/text/View.java \
javax/swing/text/ViewFactory.java \
javax/swing/text/MutableAttributeSet.java \
javax/swing/text/NavigationFilter.java \
javax/swing/text/StyledDocument.java \ javax/swing/text/StyledDocument.java \
javax/swing/text/StyledEditorKit.java \ javax/swing/text/StyledEditorKit.java \
javax/swing/text/TabExpander.java \
javax/swing/text/TabableView.java \
javax/swing/text/TextAction.java \ javax/swing/text/TextAction.java \
javax/swing/text/View.java \
javax/swing/text/ViewFactory.java \
javax/swing/text/html/HTML.java \ javax/swing/text/html/HTML.java \
javax/swing/text/html/parser/ParserDelegator.java \ javax/swing/text/html/parser/ParserDelegator.java \
javax/swing/tree/TreeNode.java \ javax/swing/tree/TreeNode.java \
...@@ -3070,7 +3083,7 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ ...@@ -3070,7 +3083,7 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DATA = $(jar_DATA) $(pkgconfig_DATA) $(toolexecmainlib_DATA) DATA = $(jar_DATA) $(pkgconfig_DATA) $(toolexecmainlib_DATA)
DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \ DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \
THANKS TODO acinclude.m4 aclocal.m4 configure configure.in \ THANKS acinclude.m4 aclocal.m4 configure configure.in \
libgcj-test.spec.in libgcj.pc.in libgcj.spec.in libgcj-test.spec.in libgcj.pc.in libgcj.spec.in
...@@ -3669,6 +3682,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3669,6 +3682,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/awt/image/BufferStrategy.P \ .deps/java/awt/image/BufferStrategy.P \
.deps/java/awt/image/BufferedImage.P \ .deps/java/awt/image/BufferedImage.P \
.deps/java/awt/image/BufferedImageOp.P \ .deps/java/awt/image/BufferedImageOp.P \
.deps/java/awt/image/ByteLookupTable.P \
.deps/java/awt/image/ColorModel.P \ .deps/java/awt/image/ColorModel.P \
.deps/java/awt/image/ComponentColorModel.P \ .deps/java/awt/image/ComponentColorModel.P \
.deps/java/awt/image/ComponentSampleModel.P \ .deps/java/awt/image/ComponentSampleModel.P \
...@@ -3685,7 +3699,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3685,7 +3699,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/awt/image/ImageObserver.P \ .deps/java/awt/image/ImageObserver.P \
.deps/java/awt/image/ImageProducer.P \ .deps/java/awt/image/ImageProducer.P \
.deps/java/awt/image/ImagingOpException.P \ .deps/java/awt/image/ImagingOpException.P \
.deps/java/awt/image/IndexColorModel.P \ .deps/java/awt/image/IndexColorModel.P .deps/java/awt/image/Kernel.P \
.deps/java/awt/image/LookupTable.P \
.deps/java/awt/image/MemoryImageSource.P \ .deps/java/awt/image/MemoryImageSource.P \
.deps/java/awt/image/PackedColorModel.P \ .deps/java/awt/image/PackedColorModel.P \
.deps/java/awt/image/PixelGrabber.P \ .deps/java/awt/image/PixelGrabber.P \
...@@ -3695,6 +3710,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3695,6 +3710,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/awt/image/RasterOp.P .deps/java/awt/image/RenderedImage.P \ .deps/java/awt/image/RasterOp.P .deps/java/awt/image/RenderedImage.P \
.deps/java/awt/image/ReplicateScaleFilter.P \ .deps/java/awt/image/ReplicateScaleFilter.P \
.deps/java/awt/image/SampleModel.P \ .deps/java/awt/image/SampleModel.P \
.deps/java/awt/image/ShortLookupTable.P \
.deps/java/awt/image/SinglePixelPackedSampleModel.P \ .deps/java/awt/image/SinglePixelPackedSampleModel.P \
.deps/java/awt/image/TileObserver.P \ .deps/java/awt/image/TileObserver.P \
.deps/java/awt/image/VolatileImage.P \ .deps/java/awt/image/VolatileImage.P \
...@@ -4587,6 +4603,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -4587,6 +4603,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/ScrollPaneLayout.P .deps/javax/swing/Scrollable.P \ .deps/javax/swing/ScrollPaneLayout.P .deps/javax/swing/Scrollable.P \
.deps/javax/swing/SingleSelectionModel.P \ .deps/javax/swing/SingleSelectionModel.P \
.deps/javax/swing/SizeRequirements.P .deps/javax/swing/SizeSequence.P \ .deps/javax/swing/SizeRequirements.P .deps/javax/swing/SizeSequence.P \
.deps/javax/swing/Spring.P .deps/javax/swing/SpringLayout.P \
.deps/javax/swing/SwingConstants.P .deps/javax/swing/SwingUtilities.P \ .deps/javax/swing/SwingConstants.P .deps/javax/swing/SwingUtilities.P \
.deps/javax/swing/Timer.P .deps/javax/swing/ToolTipManager.P \ .deps/javax/swing/Timer.P .deps/javax/swing/ToolTipManager.P \
.deps/javax/swing/UIDefaults.P .deps/javax/swing/UIManager.P \ .deps/javax/swing/UIDefaults.P .deps/javax/swing/UIManager.P \
...@@ -4717,8 +4734,10 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -4717,8 +4734,10 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/plaf/basic/BasicSplitPaneDivider.P \ .deps/javax/swing/plaf/basic/BasicSplitPaneDivider.P \
.deps/javax/swing/plaf/basic/BasicSplitPaneUI.P \ .deps/javax/swing/plaf/basic/BasicSplitPaneUI.P \
.deps/javax/swing/plaf/basic/BasicTabbedPaneUI.P \ .deps/javax/swing/plaf/basic/BasicTabbedPaneUI.P \
.deps/javax/swing/plaf/basic/BasicTextFieldUI.P \
.deps/javax/swing/plaf/basic/BasicTextUI.P \ .deps/javax/swing/plaf/basic/BasicTextUI.P \
.deps/javax/swing/plaf/basic/BasicToggleButtonUI.P \ .deps/javax/swing/plaf/basic/BasicToggleButtonUI.P \
.deps/javax/swing/plaf/basic/BasicToolBarSeparatorUI.P \
.deps/javax/swing/plaf/basic/BasicToolBarUI.P \ .deps/javax/swing/plaf/basic/BasicToolBarUI.P \
.deps/javax/swing/plaf/basic/BasicTreeUI.P \ .deps/javax/swing/plaf/basic/BasicTreeUI.P \
.deps/javax/swing/plaf/basic/BasicViewportUI.P \ .deps/javax/swing/plaf/basic/BasicViewportUI.P \
...@@ -4736,23 +4755,26 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -4736,23 +4755,26 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/text/AbstractDocument.P \ .deps/javax/swing/text/AbstractDocument.P \
.deps/javax/swing/text/AttributeSet.P \ .deps/javax/swing/text/AttributeSet.P \
.deps/javax/swing/text/BadLocationException.P \ .deps/javax/swing/text/BadLocationException.P \
.deps/javax/swing/text/Caret.P \ .deps/javax/swing/text/Caret.P .deps/javax/swing/text/ComponentView.P \
.deps/javax/swing/text/CharacterIterator.P \
.deps/javax/swing/text/ComponentView.P \
.deps/javax/swing/text/DefaultCaret.P \ .deps/javax/swing/text/DefaultCaret.P \
.deps/javax/swing/text/DefaultEditorKit.P \ .deps/javax/swing/text/DefaultEditorKit.P \
.deps/javax/swing/text/DefaultHighlighter.P \
.deps/javax/swing/text/Document.P \ .deps/javax/swing/text/Document.P \
.deps/javax/swing/text/DocumentFilter.P \ .deps/javax/swing/text/DocumentFilter.P \
.deps/javax/swing/text/EditorKit.P .deps/javax/swing/text/Element.P \ .deps/javax/swing/text/EditorKit.P .deps/javax/swing/text/Element.P \
.deps/javax/swing/text/GapContent.P \ .deps/javax/swing/text/FieldView.P .deps/javax/swing/text/GapContent.P \
.deps/javax/swing/text/Highlighter.P \
.deps/javax/swing/text/JTextComponent.P .deps/javax/swing/text/Keymap.P \ .deps/javax/swing/text/JTextComponent.P .deps/javax/swing/text/Keymap.P \
.deps/javax/swing/text/LayeredHighlighter.P \
.deps/javax/swing/text/MutableAttributeSet.P \ .deps/javax/swing/text/MutableAttributeSet.P \
.deps/javax/swing/text/NavigationFilter.P \ .deps/javax/swing/text/NavigationFilter.P \
.deps/javax/swing/text/PlainDocument.P \ .deps/javax/swing/text/PlainDocument.P \
.deps/javax/swing/text/PlainEditorKit.P \ .deps/javax/swing/text/PlainView.P .deps/javax/swing/text/Position.P \
.deps/javax/swing/text/Position.P .deps/javax/swing/text/Segment.P \ .deps/javax/swing/text/Segment.P .deps/javax/swing/text/Style.P \
.deps/javax/swing/text/Style.P .deps/javax/swing/text/StyledDocument.P \ .deps/javax/swing/text/StyledDocument.P \
.deps/javax/swing/text/StyledEditorKit.P \ .deps/javax/swing/text/StyledEditorKit.P \
.deps/javax/swing/text/TabExpander.P \
.deps/javax/swing/text/TabableView.P \
.deps/javax/swing/text/TextAction.P .deps/javax/swing/text/View.P \ .deps/javax/swing/text/TextAction.P .deps/javax/swing/text/View.P \
.deps/javax/swing/text/ViewFactory.P .deps/javax/swing/text/html/HTML.P \ .deps/javax/swing/text/ViewFactory.P .deps/javax/swing/text/html/HTML.P \
.deps/javax/swing/text/html/parser/ParserDelegator.P \ .deps/javax/swing/text/html/parser/ParserDelegator.P \
......
...@@ -98,7 +98,9 @@ public abstract class ImageDecoder implements ImageProducer ...@@ -98,7 +98,9 @@ public abstract class ImageDecoder implements ImageProducer
public void startProduction (ImageConsumer ic) public void startProduction (ImageConsumer ic)
{ {
if (!isConsumer(ic))
addConsumer (ic); addConsumer (ic);
Vector list = (Vector) consumers.clone (); Vector list = (Vector) consumers.clone ();
try try
{ {
......
...@@ -77,19 +77,16 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder ...@@ -77,19 +77,16 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
public GdkPixbufDecoder (String filename) public GdkPixbufDecoder (String filename)
{ {
super (filename); super (filename);
initState ();
} }
public GdkPixbufDecoder (URL url) public GdkPixbufDecoder (URL url)
{ {
super (url); super (url);
initState ();
} }
public GdkPixbufDecoder (byte[] imagedata, int imageoffset, int imagelength) public GdkPixbufDecoder (byte[] imagedata, int imageoffset, int imagelength)
{ {
super (imagedata, imageoffset, imagelength); super (imagedata, imageoffset, imagelength);
initState ();
} }
// called back by native side // called back by native side
...@@ -135,6 +132,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder ...@@ -135,6 +132,7 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
byte bytes[] = new byte[4096]; byte bytes[] = new byte[4096];
int len = 0; int len = 0;
initState();
while ((len = is.read (bytes)) != -1) while ((len = is.read (bytes)) != -1)
pumpBytes (bytes, len); pumpBytes (bytes, len);
......
...@@ -115,8 +115,6 @@ public class GtkComponentPeer extends GtkGenericPeer ...@@ -115,8 +115,6 @@ public class GtkComponentPeer extends GtkGenericPeer
this.awtComponent = awtComponent; this.awtComponent = awtComponent;
insets = new Insets (0, 0, 0, 0); insets = new Insets (0, 0, 0, 0);
/* temporary try/catch block until all peers use this creation method */
try {
create (); create ();
GtkArgList args = new GtkArgList (); GtkArgList args = new GtkArgList ();
...@@ -147,7 +145,7 @@ public class GtkComponentPeer extends GtkGenericPeer ...@@ -147,7 +145,7 @@ public class GtkComponentPeer extends GtkGenericPeer
Rectangle bounds = awtComponent.getBounds (); Rectangle bounds = awtComponent.getBounds ();
setBounds (bounds.x, bounds.y, bounds.width, bounds.height); setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
} catch (RuntimeException ex) { ; } setVisible (awtComponent.isVisible ());
} }
public int checkImage (Image image, int width, int height, public int checkImage (Image image, int width, int height,
...@@ -449,18 +447,14 @@ public class GtkComponentPeer extends GtkGenericPeer ...@@ -449,18 +447,14 @@ public class GtkComponentPeer extends GtkGenericPeer
public void setVisible (boolean b) public void setVisible (boolean b)
{ {
set ("visible", b); if (b)
} show ();
else
public void hide () hide ();
{
setVisible (false);
} }
public void show () public native void hide ();
{ public native void show ();
setVisible (true);
}
protected void postMouseEvent(int id, long when, int mods, int x, int y, protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger) int clickCount, boolean popupTrigger)
...@@ -514,7 +508,6 @@ public class GtkComponentPeer extends GtkGenericPeer ...@@ -514,7 +508,6 @@ public class GtkComponentPeer extends GtkGenericPeer
public void getArgs (Component component, GtkArgList args) public void getArgs (Component component, GtkArgList args)
{ {
args.add ("visible", component.isVisible ());
args.add ("sensitive", component.isEnabled ()); args.add ("sensitive", component.isEnabled ());
ComponentPeer p; ComponentPeer p;
......
...@@ -90,7 +90,6 @@ public class GtkContainerPeer extends GtkComponentPeer ...@@ -90,7 +90,6 @@ public class GtkContainerPeer extends GtkComponentPeer
public void setBounds (int x, int y, int width, int height) public void setBounds (int x, int y, int width, int height)
{ {
super.setBounds (x, y, width, height); super.setBounds (x, y, width, height);
awtComponent.validate ();
} }
public void setFont(Font f) public void setFont(Font f)
......
...@@ -45,6 +45,7 @@ import java.awt.Graphics; ...@@ -45,6 +45,7 @@ import java.awt.Graphics;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.peer.FileDialogPeer; import java.awt.peer.FileDialogPeer;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.File;
public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
{ {
...@@ -52,18 +53,34 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer ...@@ -52,18 +53,34 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
private String currentFile = null; private String currentFile = null;
private String currentDirectory = null; private String currentDirectory = null;
private FilenameFilter filter;
native void create (); native void create (GtkContainerPeer parent);
native void connectJObject ();
native void connectSignals ();
native void nativeSetFile (String file);
native public String nativeGetDirectory();
native public void nativeSetDirectory(String directory);
native void nativeSetFilenameFilter (FilenameFilter filter);
public void create() {
create((GtkContainerPeer) awtComponent.getParent().getPeer());
FileDialog fd = (FileDialog) awtComponent;
setDirectory(fd.getDirectory());
setFile(fd.getFile());
FilenameFilter filter = fd.getFilenameFilter();
if (filter != null)
setFilenameFilter(filter);
}
public GtkFileDialogPeer (FileDialog fd) public GtkFileDialogPeer (FileDialog fd)
{ {
super (fd); super (fd);
} }
native void connectJObject ();
native void connectSignals ();
native void nativeSetFile (String file);
public void setFile (String fileName) public void setFile (String fileName)
{ {
/* If nothing changed do nothing. This usually happens because /* If nothing changed do nothing. This usually happens because
...@@ -80,26 +97,16 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer ...@@ -80,26 +97,16 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
return; return;
} }
// Remove any directory path from the filename // GtkFileChooser requires absolute filenames. If the given filename
int sepIndex = fileName.lastIndexOf (FS); // is not absolute, let's construct it based on current directory.
if (sepIndex < 0)
{
currentFile = fileName; currentFile = fileName;
if (fileName.indexOf(FS) == 0)
{
nativeSetFile (fileName); nativeSetFile (fileName);
} }
else else
{ {
if (fileName.length() > (sepIndex + 1)) nativeSetFile (nativeGetDirectory() + FS + fileName);
{
String fn = fileName.substring (sepIndex + 1);
currentFile = fn;
nativeSetFile (fn);
}
else
{
currentFile = "";
nativeSetFile ("");
}
} }
} }
...@@ -120,20 +127,25 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer ...@@ -120,20 +127,25 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
} }
currentDirectory = directory; currentDirectory = directory;
nativeSetDirectory (directory);
// Gtk expects the directory to end with a file separator
if (directory.substring (directory.length () - 1).equals (FS))
nativeSetFile (directory);
else
nativeSetFile (directory + FS);
} }
public void setFilenameFilter (FilenameFilter filter) public void setFilenameFilter (FilenameFilter filter)
{ {
/* GTK has no filter callbacks yet. It works by setting a pattern this.filter = filter;
* (see gtk_file_selection_complete), which we can't convert nativeSetFilenameFilter(filter);
* to the callback paradigm. With GTK-2.4 there will be a }
* gtk_file_filter_add_custom function that we can use. */
/* This method interacts with the native callback function of the
same name. The native function will extract the filename from the
GtkFileFilterInfo object and send it to this method, which will
in turn call the filter's accept() method and give back the return
value. */
boolean filenameFilterCallback (String fullname) {
String filename = fullname.substring(fullname.lastIndexOf(FS) + 1);
String dirname = fullname.substring(0, fullname.lastIndexOf(FS));
File dir = new File(dirname);
return filter.accept(dir, filename);
} }
public Graphics getGraphics () public Graphics getGraphics ()
......
...@@ -202,7 +202,7 @@ public class GtkImage extends Image implements ImageConsumer ...@@ -202,7 +202,7 @@ public class GtkImage extends Image implements ImageConsumer
public synchronized void public synchronized void
setColorModel (ColorModel model) setColorModel (ColorModel model)
{ {
if (this.model == null || this.model == model) if (this.model == null || this.model.equals(model))
this.model = model; this.model = model;
else else
isCacheable = false; isCacheable = false;
...@@ -235,7 +235,7 @@ public class GtkImage extends Image implements ImageConsumer ...@@ -235,7 +235,7 @@ public class GtkImage extends Image implements ImageConsumer
if (!isCacheable) if (!isCacheable)
return; return;
if (cm != model || pixelCache == null) if (!cm.equals(model) || pixelCache == null)
{ {
isCacheable = false; isCacheable = false;
return; return;
......
...@@ -246,5 +246,6 @@ public class GtkImagePainter implements Runnable, ImageConsumer ...@@ -246,5 +246,6 @@ public class GtkImagePainter implements Runnable, ImageConsumer
public void public void
imageComplete (int status) imageComplete (int status)
{ {
image.imageComplete(status);
} }
} }
...@@ -38,7 +38,9 @@ exception statement from your version. */ ...@@ -38,7 +38,9 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk; package gnu.java.awt.peer.gtk;
import java.awt.AWTEvent;
import java.awt.Panel; import java.awt.Panel;
import java.awt.event.MouseEvent;
import java.awt.peer.PanelPeer; import java.awt.peer.PanelPeer;
public class GtkPanelPeer extends GtkContainerPeer public class GtkPanelPeer extends GtkContainerPeer
...@@ -51,4 +53,17 @@ public class GtkPanelPeer extends GtkContainerPeer ...@@ -51,4 +53,17 @@ public class GtkPanelPeer extends GtkContainerPeer
{ {
super (p); super (p);
} }
public void handleEvent (AWTEvent event)
{
int id = event.getID();
switch (id)
{
case MouseEvent.MOUSE_PRESSED:
awtComponent.requestFocusInWindow ();
break;
}
super.handleEvent (event);
}
} }
...@@ -39,6 +39,7 @@ exception statement from your version. */ ...@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk; package gnu.java.awt.peer.gtk;
import java.awt.Adjustable; import java.awt.Adjustable;
import java.awt.Dimension;
import java.awt.ScrollPane; import java.awt.ScrollPane;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.awt.peer.ScrollPanePeer; import java.awt.peer.ScrollPanePeer;
...@@ -87,10 +88,10 @@ public class GtkScrollPanePeer extends GtkContainerPeer ...@@ -87,10 +88,10 @@ public class GtkScrollPanePeer extends GtkContainerPeer
native public int getVScrollbarWidth (); native public int getVScrollbarWidth ();
native public void setScrollPosition (int x, int y); native public void setScrollPosition (int x, int y);
// public Dimension getPreferredSize () public Dimension getPreferredSize ()
// { {
// return new Dimension (60, 60); return awtComponent.getSize();
// } }
public void setUnitIncrement (Adjustable adj, int u) public void setUnitIncrement (Adjustable adj, int u)
{ {
......
...@@ -44,13 +44,17 @@ import java.awt.dnd.DragGestureEvent; ...@@ -44,13 +44,17 @@ import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.dnd.peer.DragSourceContextPeer;
import java.awt.font.TextAttribute; import java.awt.font.TextAttribute;
import java.awt.im.InputMethodHighlight; import java.awt.im.InputMethodHighlight;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.awt.image.ImageConsumer;
import java.awt.image.ImageProducer; import java.awt.image.ImageProducer;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.peer.*; import java.awt.peer.*;
import java.net.URL; import java.net.URL;
import java.util.HashSet;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.Properties; import java.util.Properties;
...@@ -127,10 +131,102 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -127,10 +131,102 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
return status; return status;
} }
/**
* A helper class to return to clients in cases where a BufferedImage is
* desired but its construction fails.
*/
private class GtkErrorImage extends Image
{
public GtkErrorImage()
{
}
public int getWidth(ImageObserver observer)
{
return -1;
}
public int getHeight(ImageObserver observer)
{
return -1;
}
public ImageProducer getSource()
{
return new ImageProducer()
{
HashSet consumers = new HashSet();
public void addConsumer(ImageConsumer ic)
{
consumers.add(ic);
}
public boolean isConsumer(ImageConsumer ic)
{
return consumers.contains(ic);
}
public void removeConsumer(ImageConsumer ic)
{
consumers.remove(ic);
}
public void startProduction(ImageConsumer ic)
{
consumers.add(ic);
Iterator i = consumers.iterator();
while(i.hasNext())
{
ImageConsumer c = (ImageConsumer) i.next();
c.imageComplete(ImageConsumer.IMAGEERROR);
}
}
public void requestTopDownLeftRightResend(ImageConsumer ic)
{
startProduction(ic);
}
};
}
public Graphics getGraphics()
{
return null;
}
public Object getProperty(String name, ImageObserver observer)
{
return null;
}
public Image getScaledInstance(int width, int height, int flags)
{
return new GtkErrorImage();
}
public void flush()
{
}
}
/**
* Helper to return either a BufferedImage -- the argument -- or a
* GtkErrorImage if the argument is null.
*/
private Image bufferedImageOrError(BufferedImage b)
{
if (b == null)
return new GtkErrorImage();
else
return b;
}
public Image createImage (String filename) public Image createImage (String filename)
{ {
if (useGraphics2D()) if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (filename); return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (filename));
else else
{ {
GdkPixbufDecoder d = new GdkPixbufDecoder (filename); GdkPixbufDecoder d = new GdkPixbufDecoder (filename);
...@@ -143,7 +239,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -143,7 +239,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public Image createImage (URL url) public Image createImage (URL url)
{ {
if (useGraphics2D()) if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (url); return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (url));
else else
{ {
GdkPixbufDecoder d = new GdkPixbufDecoder (url); GdkPixbufDecoder d = new GdkPixbufDecoder (url);
...@@ -156,7 +252,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -156,7 +252,7 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public Image createImage (ImageProducer producer) public Image createImage (ImageProducer producer)
{ {
if (useGraphics2D()) if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (producer); return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (producer));
else else
{ {
GtkImage image = new GtkImage (producer, null); GtkImage image = new GtkImage (producer, null);
...@@ -169,9 +265,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -169,9 +265,9 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
int imagelength) int imagelength)
{ {
if (useGraphics2D()) if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (imagedata, return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (imagedata,
imageoffset, imageoffset,
imagelength); imagelength));
else else
{ {
GdkPixbufDecoder d = new GdkPixbufDecoder (imagedata, GdkPixbufDecoder d = new GdkPixbufDecoder (imagedata,
......
...@@ -856,6 +856,16 @@ public class Container extends Component ...@@ -856,6 +856,16 @@ public class Container extends Component
*/ */
public void deliverEvent(Event e) public void deliverEvent(Event e)
{ {
if (!handleEvent (e))
{
synchronized (getTreeLock ())
{
Component parent = getParent ();
if (parent != null)
parent.deliverEvent (e);
}
}
} }
/** /**
...@@ -1027,7 +1037,7 @@ public class Container extends Component ...@@ -1027,7 +1037,7 @@ public class Container extends Component
{ {
String param = super.paramString(); String param = super.paramString();
if (layoutMgr != null) if (layoutMgr != null)
param = param + "," + layoutMgr.getClass().getName(); param = param + ",layout=" + layoutMgr.getClass().getName();
return param; return param;
} }
......
...@@ -162,16 +162,41 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager ...@@ -162,16 +162,41 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
{ {
Component target = (Component) e.getSource (); Component target = (Component) e.getSource ();
if (e.id == FocusEvent.FOCUS_GAINED if (e.id == FocusEvent.FOCUS_GAINED)
&& !(target instanceof Window))
{ {
if (((FocusEvent) e).isTemporary ()) if (((FocusEvent) e).isTemporary ())
setGlobalFocusOwner (target); setGlobalFocusOwner (target);
else else
setGlobalPermanentFocusOwner (target); 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).
// Find the target Component's top-level ancestor.
Container parent = target.getParent ();
while (parent != null
&& !(parent instanceof Window))
parent = parent.getParent ();
Window toplevel = parent == null ?
(Window) target : (Window) parent;
Component focusOwner = getFocusOwner ();
if (focusOwner != null)
toplevel.setFocusOwner (focusOwner);
if (((FocusEvent) e).isTemporary ())
setGlobalFocusOwner (null);
else
setGlobalPermanentFocusOwner (null);
}
if (!(target instanceof Window))
target.dispatchEvent (e); target.dispatchEvent (e);
return true; return true;
...@@ -192,6 +217,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager ...@@ -192,6 +217,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
// processKeyEvent checks if this event represents a focus // processKeyEvent checks if this event represents a focus
// traversal key stroke. // traversal key stroke.
Component focusOwner = getGlobalPermanentFocusOwner (); Component focusOwner = getGlobalPermanentFocusOwner ();
if (focusOwner != null)
processKeyEvent (focusOwner, (KeyEvent) e); processKeyEvent (focusOwner, (KeyEvent) e);
if (e.isConsumed ()) if (e.isConsumed ())
...@@ -230,6 +257,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager ...@@ -230,6 +257,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
{ {
Component focusOwner = getGlobalPermanentFocusOwner (); Component focusOwner = getGlobalPermanentFocusOwner ();
if (focusOwner != null)
focusOwner.dispatchEvent (e); focusOwner.dispatchEvent (e);
// Loop through all registered KeyEventPostProcessors, giving // Loop through all registered KeyEventPostProcessors, giving
......
...@@ -163,7 +163,8 @@ public class Event implements java.io.Serializable ...@@ -163,7 +163,8 @@ public class Event implements java.io.Serializable
protected String paramString () protected String paramString ()
{ {
return "id=" + id + ",x=" + x + ",y=" + y + "target=" + target; return "id=" + id + ",x=" + x + ",y=" + y
+ ",target=" + target + ",arg=" + arg;
} }
public boolean shiftDown() public boolean shiftDown()
......
...@@ -1268,10 +1268,9 @@ toString() ...@@ -1268,10 +1268,9 @@ toString()
return(getClass().getName() return(getClass().getName()
+ "(logical=" + getName () + "(logical=" + getName ()
+ ",family=" + getFamily () + ",family=" + getFamily ()
+ ",face=" + getFontName () + ",name=" + getFontName ()
+ ",style=" + getStyle () + ",style=" + getStyle ()
+ ",size=" + getSize () + ",size=" + getSize ());
+ ",transform=" + getTransform () + ")");
} }
......
...@@ -50,11 +50,6 @@ import java.util.Vector; ...@@ -50,11 +50,6 @@ import java.util.Vector;
*/ */
public class Frame extends Window implements MenuContainer public class Frame extends Window implements MenuContainer
{ {
/*
* Static Variables
*/
/** /**
* Constant for the default cursor. * Constant for the default cursor.
* @deprecated Replaced by <code>Cursor.DEFAULT_CURSOR</code> instead. * @deprecated Replaced by <code>Cursor.DEFAULT_CURSOR</code> instead.
...@@ -148,12 +143,6 @@ public static final int NORMAL = 0; ...@@ -148,12 +143,6 @@ public static final int NORMAL = 0;
// Serialization version constant // Serialization version constant
private static final long serialVersionUID = 2673458971256075116L; private static final long serialVersionUID = 2673458971256075116L;
/*************************************************************************/
/*
* Instance Variables
*/
/** /**
* @serial The version of the class data being serialized * @serial The version of the class data being serialized
* // FIXME: what is this value? * // FIXME: what is this value?
...@@ -208,11 +197,10 @@ private String title = ""; ...@@ -208,11 +197,10 @@ private String title = "";
*/ */
private boolean undecorated = false; private boolean undecorated = false;
/*************************************************************************/
/* /*
* Constructors * The number used to generate the name returned by getName.
*/ */
private static transient long next_frame_number = 0;
/** /**
* Initializes a new instance of <code>Frame</code> that is not visible * Initializes a new instance of <code>Frame</code> that is not visible
...@@ -224,8 +212,6 @@ Frame() ...@@ -224,8 +212,6 @@ Frame()
this(""); this("");
} }
/*************************************************************************/
/** /**
* Initializes a new instance of <code>Frame</code> that is not visible * Initializes a new instance of <code>Frame</code> that is not visible
* and has the specified title. * and has the specified title.
...@@ -256,12 +242,6 @@ Frame(String title, GraphicsConfiguration gc) ...@@ -256,12 +242,6 @@ Frame(String title, GraphicsConfiguration gc)
visible = false; visible = false;
} }
/*************************************************************************/
/*
* Instance Methods
*/
/** /**
* Returns this frame's title string. * Returns this frame's title string.
* *
...@@ -273,8 +253,6 @@ getTitle() ...@@ -273,8 +253,6 @@ getTitle()
return(title); return(title);
} }
/*************************************************************************/
/* /*
* Sets this frame's title to the specified value. * Sets this frame's title to the specified value.
* *
...@@ -288,8 +266,6 @@ setTitle(String title) ...@@ -288,8 +266,6 @@ setTitle(String title)
((FramePeer) peer).setTitle(title); ((FramePeer) peer).setTitle(title);
} }
/*************************************************************************/
/** /**
* Returns this frame's icon. * Returns this frame's icon.
* *
...@@ -302,8 +278,6 @@ getIconImage() ...@@ -302,8 +278,6 @@ getIconImage()
return(icon); return(icon);
} }
/*************************************************************************/
/** /**
* Sets this frame's icon to the specified value. * Sets this frame's icon to the specified value.
* *
...@@ -317,8 +291,6 @@ setIconImage(Image icon) ...@@ -317,8 +291,6 @@ setIconImage(Image icon)
((FramePeer) peer).setIconImage(icon); ((FramePeer) peer).setIconImage(icon);
} }
/*************************************************************************/
/** /**
* Returns this frame's menu bar. * Returns this frame's menu bar.
* *
...@@ -331,8 +303,6 @@ getMenuBar() ...@@ -331,8 +303,6 @@ getMenuBar()
return(menuBar); return(menuBar);
} }
/*************************************************************************/
/** /**
* Sets this frame's menu bar. * Sets this frame's menu bar.
* *
...@@ -352,8 +322,6 @@ setMenuBar(MenuBar menuBar) ...@@ -352,8 +322,6 @@ setMenuBar(MenuBar menuBar)
this.menuBar = menuBar; this.menuBar = menuBar;
} }
/*************************************************************************/
/** /**
* Tests whether or not this frame is resizable. This will be * Tests whether or not this frame is resizable. This will be
* <code>true</code> by default. * <code>true</code> by default.
...@@ -367,8 +335,6 @@ isResizable() ...@@ -367,8 +335,6 @@ isResizable()
return(resizable); return(resizable);
} }
/*************************************************************************/
/** /**
* Sets the resizability of this frame to the specified value. * Sets the resizability of this frame to the specified value.
* *
...@@ -383,8 +349,6 @@ setResizable(boolean resizable) ...@@ -383,8 +349,6 @@ setResizable(boolean resizable)
((FramePeer) peer).setResizable(resizable); ((FramePeer) peer).setResizable(resizable);
} }
/*************************************************************************/
/** /**
* Returns the cursor type of the cursor for this window. This will * Returns the cursor type of the cursor for this window. This will
* be one of the constants in this class. * be one of the constants in this class.
...@@ -399,8 +363,6 @@ getCursorType() ...@@ -399,8 +363,6 @@ getCursorType()
return(getCursor().getType()); return(getCursor().getType());
} }
/*************************************************************************/
/** /**
* Sets the cursor for this window to the specified type. The specified * Sets the cursor for this window to the specified type. The specified
* type should be one of the constants in this class. * type should be one of the constants in this class.
...@@ -415,8 +377,6 @@ setCursor(int type) ...@@ -415,8 +377,6 @@ setCursor(int type)
setCursor(new Cursor(type)); setCursor(new Cursor(type));
} }
/*************************************************************************/
/** /**
* Removes the specified component from this frame's menu. * Removes the specified component from this frame's menu.
* *
...@@ -428,8 +388,6 @@ remove(MenuComponent menu) ...@@ -428,8 +388,6 @@ remove(MenuComponent menu)
menuBar.remove(menu); menuBar.remove(menu);
} }
/*************************************************************************/
/** /**
* Notifies this frame that it should create its native peer. * Notifies this frame that it should create its native peer.
*/ */
...@@ -450,17 +408,40 @@ public void removeNotify() ...@@ -450,17 +408,40 @@ public void removeNotify()
super.removeNotify(); super.removeNotify();
} }
/*************************************************************************/
/** /**
* Returns a debugging string describing this window. * Returns a debugging string describing this window.
* *
* @return A debugging string describing this window. * @return A debugging string describing this window.
*/ */
protected String protected String paramString ()
paramString()
{ {
return(getClass().getName()); String title = getTitle ();
String resizable = "";
if (isResizable ())
resizable = ",resizable";
String state = "";
switch (getState ())
{
case NORMAL:
state = ",normal";
break;
case ICONIFIED:
state = ",iconified";
break;
case MAXIMIZED_BOTH:
state = ",maximized-both";
break;
case MAXIMIZED_HORIZ:
state = ",maximized-horiz";
break;
case MAXIMIZED_VERT:
state = ",maximized-vert";
break;
}
return super.paramString () + ",title=" + title + resizable + state;
} }
public static Frame[] public static Frame[]
...@@ -553,5 +534,19 @@ getFrames() ...@@ -553,5 +534,19 @@ getFrames()
this.undecorated = undecorated; this.undecorated = undecorated;
} }
} // class Frame
/**
* Generate a unique name for this frame.
*
* @return A unique name for this frame.
*/
String generateName ()
{
return "frame" + getUniqueLong ();
}
private static synchronized long getUniqueLong ()
{
return next_frame_number++;
}
}
...@@ -340,7 +340,7 @@ public class GridBagLayout ...@@ -340,7 +340,7 @@ public class GridBagLayout
if (components.length == 0) if (components.length == 0)
return; return;
GridBagLayoutInfo info = getLayoutInfo (parent, MINSIZE); GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);
if (info.cols == 0 && info.rows == 0) if (info.cols == 0 && info.rows == 0)
return; return;
layoutInfo = info; layoutInfo = info;
......
...@@ -246,7 +246,10 @@ public abstract class KeyboardFocusManager ...@@ -246,7 +246,10 @@ public abstract class KeyboardFocusManager
*/ */
public Component getFocusOwner () public Component getFocusOwner ()
{ {
return (Component) getObject (currentFocusOwners); Component owner = (Component) getObject (currentFocusOwners);
if (owner == null)
owner = (Component) getObject (currentPermanentFocusOwners);
return owner;
} }
/** /**
......
...@@ -38,6 +38,7 @@ exception statement from your version. */ ...@@ -38,6 +38,7 @@ exception statement from your version. */
package java.awt; package java.awt;
import java.awt.event.PaintEvent;
import javax.accessibility.Accessible; import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole; import javax.accessibility.AccessibleRole;
...@@ -62,6 +63,19 @@ public class Panel extends Container implements Accessible ...@@ -62,6 +63,19 @@ public class Panel extends Container implements Accessible
/** The cached accessible context. */ /** The cached accessible context. */
private transient AccessibleContext context; private transient AccessibleContext context;
/** Flag set when the first system-requested paint event is
dispatched. */
private transient boolean initialSystemUpdateDone;
/** Flag set when the first application-requested paint event is
consumed. */
private transient boolean initialUpdateConsumed;
/*
* The number used to generate the name returned by getName.
*/
private static transient long next_panel_number = 0;
/** /**
* Initializes a new instance of <code>Panel</code> that has a default * Initializes a new instance of <code>Panel</code> that has a default
* layout manager of <code>FlowLayout</code>. * layout manager of <code>FlowLayout</code>.
...@@ -84,6 +98,36 @@ public class Panel extends Container implements Accessible ...@@ -84,6 +98,36 @@ 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. * Notifies this object to create its native peer.
* *
* @see #isDisplayable() * @see #isDisplayable()
...@@ -141,5 +185,20 @@ public class Panel extends Container implements Accessible ...@@ -141,5 +185,20 @@ public class Panel extends Container implements Accessible
{ {
return AccessibleRole.PANEL; return AccessibleRole.PANEL;
} }
} // class AccessibleAWTPanel }
} // class Panel
/**
* Generate a unique name for this panel.
*
* @return A unique name for this panel.
*/
String generateName ()
{
return "panel" + getUniqueLong ();
}
private static synchronized long getUniqueLong ()
{
return next_panel_number++;
}
}
...@@ -157,6 +157,9 @@ ScrollPane(int scrollbarDisplayPolicy) ...@@ -157,6 +157,9 @@ ScrollPane(int scrollbarDisplayPolicy)
} }
wheelScrollingEnabled = true; wheelScrollingEnabled = true;
// Default size.
setSize(100,100);
} }
/*************************************************************************/ /*************************************************************************/
...@@ -400,6 +403,15 @@ addNotify() ...@@ -400,6 +403,15 @@ addNotify()
setPeer((ComponentPeer)getToolkit().createScrollPane(this)); setPeer((ComponentPeer)getToolkit().createScrollPane(this));
super.addNotify(); super.addNotify();
Component[] list = getComponents();
if (list != null && list.length > 0 && ! (list[0] instanceof Panel))
{
Panel panel = new Panel();
panel.setLayout(new BorderLayout());
panel.add(list[0], BorderLayout.CENTER);
add(panel);
}
} }
/*************************************************************************/ /*************************************************************************/
...@@ -527,7 +539,19 @@ printComponents(Graphics graphics) ...@@ -527,7 +539,19 @@ printComponents(Graphics graphics)
public String public String
paramString() paramString()
{ {
return(getClass().getName()); Insets insets = getInsets();
return getName() + ","
+ getX() + ","
+ getY() + ","
+ getWidth() + "x" + getHeight() + ","
+ "ScrollPosition=(" + scrollPosition.getX() + ","
+ scrollPosition.getY() + "),"
+ "Insets=(" + insets.top + ","
+ insets.left + ","
+ insets.bottom + ","
+ insets.right + "),"
+ "ScrollbarDisplayPolicy=" + getScrollbarDisplayPolicy() + ","
+ "wheelScrollingEnabled=" + isWheelScrollingEnabled();
} }
/** /**
......
...@@ -39,6 +39,8 @@ exception statement from your version. */ ...@@ -39,6 +39,8 @@ exception statement from your version. */
package java.awt; package java.awt;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener; import java.awt.event.WindowFocusListener;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
...@@ -85,6 +87,8 @@ public class Window extends Container implements Accessible ...@@ -85,6 +87,8 @@ public class Window extends Container implements Accessible
private transient boolean shown; private transient boolean shown;
private transient Component windowFocusOwner;
/** /**
* This (package access) constructor is used by subclasses that want * This (package access) constructor is used by subclasses that want
* to build windows that do not have parents. Eg. toplevel * to build windows that do not have parents. Eg. toplevel
...@@ -98,6 +102,33 @@ public class Window extends Container implements Accessible ...@@ -98,6 +102,33 @@ public class Window extends Container implements Accessible
// cycle roots. // cycle roots.
focusCycleRoot = true; focusCycleRoot = true;
setLayout(new BorderLayout()); setLayout(new BorderLayout());
addWindowFocusListener (new WindowAdapter ()
{
public void windowGainedFocus (WindowEvent event)
{
if (windowFocusOwner != null)
{
// FIXME: move this section and the other similar
// sections in Component into a separate method.
EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
synchronized (eq)
{
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
Component currentFocusOwner = manager.getGlobalPermanentFocusOwner ();
if (currentFocusOwner != null)
{
eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST,
false, windowFocusOwner));
eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED,
false, currentFocusOwner));
}
else
eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false));
}
}
}
});
} }
Window(GraphicsConfiguration gc) Window(GraphicsConfiguration gc)
...@@ -658,8 +689,22 @@ public class Window extends Container implements Accessible ...@@ -658,8 +689,22 @@ public class Window extends Container implements Accessible
// The currently-focused Component belongs to the active Window. // The currently-focused Component belongs to the active Window.
if (activeWindow == this) if (activeWindow == this)
return manager.getFocusOwner (); return manager.getFocusOwner ();
else
return windowFocusOwner;
}
return null; /**
* Set the focus owner for this window. This method is used to
* remember which component was focused when this window lost
* top-level focus, so that when it regains top-level focus the same
* child component can be refocused.
*
* @param windowFocusOwner the component in this window that owns
* the focus.
*/
void setFocusOwner (Component windowFocusOwner)
{
this.windowFocusOwner = windowFocusOwner;
} }
/** /**
...@@ -671,8 +716,7 @@ public class Window extends Container implements Accessible ...@@ -671,8 +716,7 @@ public class Window extends Container implements Accessible
*/ */
public boolean postEvent(Event e) public boolean postEvent(Event e)
{ {
// FIXME return handleEvent (e);
return false;
} }
/** /**
......
...@@ -47,6 +47,8 @@ import java.awt.Transparency; ...@@ -47,6 +47,8 @@ import java.awt.Transparency;
import java.awt.color.ColorSpace; import java.awt.color.ColorSpace;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Vector; import java.util.Vector;
import java.util.HashSet;
import java.util.Iterator;
import gnu.java.awt.ComponentDataBlitOp; import gnu.java.awt.ComponentDataBlitOp;
/** /**
...@@ -442,7 +444,57 @@ public class BufferedImage extends Image ...@@ -442,7 +444,57 @@ public class BufferedImage extends Image
public ImageProducer getSource() public ImageProducer getSource()
{ {
throw new UnsupportedOperationException("not implemented"); return new ImageProducer() {
HashSet consumers = new HashSet();
public void addConsumer(ImageConsumer ic)
{
consumers.add(ic);
}
public boolean isConsumer(ImageConsumer ic)
{
return consumers.contains(ic);
}
public void removeConsumer(ImageConsumer ic)
{
consumers.remove(ic);
}
public void startProduction(ImageConsumer ic)
{
int x = 0;
int y = 0;
int width = getWidth();
int height = getHeight();
int stride = width;
int offset = 0;
int[] pixels = getRGB(x, y,
width, height,
(int[])null, offset, stride);
ColorModel model = getColorModel();
consumers.add(ic);
Iterator i = consumers.iterator();
while(i.hasNext())
{
ImageConsumer c = (ImageConsumer) i.next();
c.setHints(ImageConsumer.SINGLEPASS);
c.setDimensions(getWidth(), getHeight());
c.setPixels(x, y, width, height, model, pixels, offset, stride);
c.imageComplete(ImageConsumer.STATICIMAGEDONE);
}
}
public void requestTopDownLeftRightResend(ImageConsumer ic)
{
startProduction(ic);
}
};
} }
public Vector getSources() public Vector getSources()
......
/* ByteLookupTable.java -- Java class for a pixel translation table.
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 java.awt.image;
/**
* ByteLookupTable represents translation arrays for pixel values. It wraps
* one or more data arrays for each layer (or component) in an image, such as
* Alpha, R, G, and B. When doing translation, the offset is subtracted from
* the pixel values to allow a subset of an array to be used.
*
* @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
* @version 1.0
*/
public class ByteLookupTable extends LookupTable
{
// Array of translation tables.
private byte data[][];
/**
* Creates a new <code>ByteLookupTable</code> instance.
*
* Offset is subtracted from pixel values when looking up in the translation
* tables. If data.length is one, the same table is applied to all pixel
* components.
*
* @param offset Offset to be subtracted.
* @param data Array of lookup tables.
* @exception IllegalArgumentException if offset < 0 or data.length < 1.
*/
public ByteLookupTable(int offset, byte[][] data)
throws IllegalArgumentException
{
super(offset, data.length);
this.data = data;
}
/**
* Creates a new <code>ByteLookupTable</code> instance.
*
* Offset is subtracted from pixel values when looking up in the translation
* table. The same table is applied to all pixel components.
*
* @param offset Offset to be subtracted.
* @param data Lookup table for all components.
* @exception IllegalArgumentException if offset < 0.
*/
public ByteLookupTable(int offset, byte[] data)
throws IllegalArgumentException
{
super(offset, 1);
this.data = new byte[][] {data};
}
/** Return the lookup tables. */
public final byte[][] getTable()
{
return data;
}
/**
* Return translated values for a pixel.
*
* For each value in the pixel src, use the value minus offset as an index
* in the component array and copy the value there to the output for the
* component. If dest is null, the output is a new array, otherwise the
* translated values are written to dest. Dest can be the same array as
* src.
*
* For example, if the pixel src is [2, 4, 3], and offset is 1, the output
* is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
* translation arrays.
*
* @param src Component values of a pixel.
* @param dest 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];
if (data.length == 1)
for (int i=0; i < src.length; i++)
dst[i] = data[0][src[i] - offset];
else
for (int i=0; i < src.length; i++)
dst[i] = data[i][src[i] - offset];
return dst;
}
/**
* Return translated values for a pixel.
*
* For each value in the pixel src, use the value minus offset as an index
* in the component array and copy the value there to the output for the
* component. If dest is null, the output is a new array, otherwise the
* translated values are written to dest. Dest can be the same array as
* src.
*
* For example, if the pixel src is [2, 4, 3], and offset is 1, the output
* is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
* translation arrays.
*
* @param src Component values of a pixel.
* @param dest 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];
if (data.length == 1)
for (int i=0; i < src.length; i++)
dst[i] = data[0][((int)src[i]) - offset];
else
for (int i=0; i < src.length; i++)
dst[i] = data[i][((int)src[i]) - offset];
return dst;
}
}
...@@ -37,6 +37,7 @@ exception statement from your version. */ ...@@ -37,6 +37,7 @@ exception statement from your version. */
package java.awt.image; package java.awt.image;
import java.util.Arrays;
import java.awt.Point; import java.awt.Point;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.color.ColorSpace; import java.awt.color.ColorSpace;
...@@ -551,8 +552,8 @@ public abstract class ColorModel implements Transparency ...@@ -551,8 +552,8 @@ public abstract class ColorModel implements Transparency
(transferType == o.transferType) && (transferType == o.transferType) &&
(transparency == o.transparency) && (transparency == o.transparency) &&
(hasAlpha == o.hasAlpha) && (hasAlpha == o.hasAlpha) &&
(isAlphaPremultiplied == isAlphaPremultiplied) && (isAlphaPremultiplied == o.isAlphaPremultiplied) &&
(bits.equals(o.bits)) && Arrays.equals(bits, o.bits) &&
(cspace.equals(o.cspace)); (cspace.equals(o.cspace));
} }
......
/* Kernel.java -- Java class for an image processing kernel
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 java.awt.image;
/**
* Kernel represents an image processing kernel. It gets used to hold
* convolution filters among other purposes. It stores an array of float
* values representing a 2-dimensional array in row-major order.
*
* @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
* @version 1.0
*/
public class Kernel implements Cloneable
{
private final int width;
private final int height;
private final float[] data;
/**
* Creates a new <code>Kernel</code> instance.
*
* @param width The 2D width of data.
* @param height The 2D height of data.
* @param data The source data array.
* @exception IllegalArgumentException if width * height < data.length.
*/
public Kernel(int width, int height, float[] data)
throws IllegalArgumentException
{
this.width = width;
this.height = height;
if (data.length < width * height || width < 0 || height < 0)
throw new IllegalArgumentException();
this.data = new float[width * height];
System.arraycopy(data, 0, this.data, 0, width * height);
}
/**
* Return the X origin: (width - 1) / 2
*/
public final int getXOrigin()
{
return (width - 1) / 2;
}
/**
* Return the Y origin: (height - 1) / 2
*/
public final int getYOrigin()
{
return (height - 1) / 2;
}
/**
* @return The kernel width.
*/
public final int getWidth()
{
return width;
}
/**
* @return The kernel height.
*/
public final int getHeight()
{
return height;
}
/**
* Return the kernel data.
*
* If data is null, allocates a new array and returns it. Otherwise, the
* kernel values are copied into data.
*
* @param data Array to copy values into, or null.
* @return The array with copied values.
* @exception IllegalArgumentException if data != null and too small.
*/
public final float[] getKernelData(float[] data)
throws IllegalArgumentException
{
if (data == null)
return (float[])this.data.clone();
if (data.length < this.data.length)
throw new IllegalArgumentException();
System.arraycopy(this.data, 0, data, 0, this.data.length);
return data;
}
/**
* @return a clone of this Kernel.
*/
public Object clone()
{
return new Kernel(width, height, data);
}
}
/* LookupTable.java -- Java class for a pixel translation table.
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 java.awt.image;
/**
* LookupTable represents translation arrays for pixel values. It wraps one
* or more data arrays for each layer (or component) in an image, such as
* Alpha, R, G, and B. When doing translation, the offset is subtracted from
* the pixel values to allow a subset of an array to be used.
*
* @see ByteLookupTable
* @see ShortLookupTable
*
* @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
* @version 1.0
*/
public abstract class LookupTable
{
// Not protected since that's part of the public API.
int offset;
int numComponents;
/**
* Creates a new <code>LookupTable</code> instance.
*
* If numComponents is 1, the same translation table is used for all pixel
* components.
*
* @param offset Offset to be subtracted.
* @param numComponents Number of image components.
* @exception IllegalArgumentException if offset < 0 or numComponents < 1.
*/
protected LookupTable(int offset, int numComponents)
throws IllegalArgumentException
{
if (offset < 0 || numComponents < 1)
throw new IllegalArgumentException();
this.offset = offset;
this.numComponents = numComponents;
}
/** Return the number of components. */
public int getNumComponents()
{
return numComponents;
}
/** Return the offset. */
public int getOffset()
{
return offset;
}
/**
* Return translated values for a pixel.
*
* For each value in the pixel src, use the value minus offset as an index
* in the component array and copy the value there to the output for the
* component. If dest is null, the output is a new array, otherwise the
* translated values are written to dest. Dest can be the same array as
* src.
*
* For example, if the pixel src is [2, 4, 3], and offset is 1, the output
* is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
* translation arrays.
*
* @param src Component values of a pixel.
* @param dest Destination array for values, or null.
* @return Translated values for the pixel.
*/
public abstract int[] lookupPixel(int[] src, int[] dest);
}
...@@ -41,6 +41,7 @@ package java.awt.image; ...@@ -41,6 +41,7 @@ package java.awt.image;
import java.awt.Image; import java.awt.Image;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Vector;
public class MemoryImageSource implements ImageProducer public class MemoryImageSource implements ImageProducer
{ {
...@@ -49,7 +50,8 @@ public class MemoryImageSource implements ImageProducer ...@@ -49,7 +50,8 @@ public class MemoryImageSource implements ImageProducer
private int pixeli[], width, height, offset, scansize; private int pixeli[], width, height, offset, scansize;
private byte pixelb[]; private byte pixelb[];
private ColorModel cm; private ColorModel cm;
private Hashtable props, consumers = new Hashtable(); private Hashtable props = new Hashtable();
private Vector consumers = new Vector();
/** /**
Constructs an ImageProducer from memory Constructs an ImageProducer from memory
...@@ -126,10 +128,10 @@ public class MemoryImageSource implements ImageProducer ...@@ -126,10 +128,10 @@ public class MemoryImageSource implements ImageProducer
* <code>ImageProducer</code>. * <code>ImageProducer</code>.
*/ */
public synchronized void addConsumer(ImageConsumer ic) { public synchronized void addConsumer(ImageConsumer ic) {
if (consumers.containsKey(ic)) if (consumers.contains(ic))
return; return;
consumers.put(ic, ic); consumers.addElement(ic);
} }
/** /**
...@@ -137,7 +139,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -137,7 +139,7 @@ public class MemoryImageSource implements ImageProducer
* already registered with this <code>ImageProducer</code>. * already registered with this <code>ImageProducer</code>.
*/ */
public synchronized boolean isConsumer(ImageConsumer ic) { public synchronized boolean isConsumer(ImageConsumer ic) {
if (consumers.containsKey(ic)) if (consumers.contains(ic))
return true; return true;
return false; return false;
} }
...@@ -147,7 +149,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -147,7 +149,7 @@ public class MemoryImageSource implements ImageProducer
* registered consumers for this <code>ImageProducer</code>. * registered consumers for this <code>ImageProducer</code>.
*/ */
public synchronized void removeConsumer(ImageConsumer ic) { public synchronized void removeConsumer(ImageConsumer ic) {
consumers.remove(ic); consumers.removeElement(ic);
} }
/** /**
...@@ -157,16 +159,16 @@ public class MemoryImageSource implements ImageProducer ...@@ -157,16 +159,16 @@ public class MemoryImageSource implements ImageProducer
* registered consumers. * registered consumers.
*/ */
public void startProduction(ImageConsumer ic) { public void startProduction(ImageConsumer ic) {
if (!(consumers.containsKey(ic))) { if (!(consumers.contains(ic))) {
consumers.put(ic, ic); consumers.addElement(ic);
} }
Enumeration e = consumers.elements();
for( ; e.hasMoreElements(); ) { Vector list = (Vector) consumers.clone();
ic = (ImageConsumer)e.nextElement(); for(int i = 0; i < list.size(); i++) {
ic = (ImageConsumer) list.elementAt(i);
sendPicture( ic ); sendPicture( ic );
ic.imageComplete( ImageConsumer.SINGLEFRAME ); ic.imageComplete( ImageConsumer.STATICIMAGEDONE );
} }
} }
/** /**
...@@ -210,9 +212,9 @@ public class MemoryImageSource implements ImageProducer ...@@ -210,9 +212,9 @@ public class MemoryImageSource implements ImageProducer
{ {
if( animated == true ) { if( animated == true ) {
ImageConsumer ic; ImageConsumer ic;
Enumeration e = consumers.elements(); Vector list = (Vector) consumers.clone();
for( ; e.hasMoreElements(); ) { for(int i = 0; i < list.size(); i++) {
ic = (ImageConsumer)e.nextElement(); ic = (ImageConsumer) list.elementAt(i);
sendPicture( ic ); sendPicture( ic );
ic.imageComplete( ImageConsumer.SINGLEFRAME ); ic.imageComplete( ImageConsumer.SINGLEFRAME );
} }
...@@ -227,6 +229,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -227,6 +229,7 @@ public class MemoryImageSource implements ImageProducer
ic.setProperties( props ); ic.setProperties( props );
} }
ic.setDimensions(width, height); ic.setDimensions(width, height);
ic.setColorModel(cm);
if( pixeli != null ) { if( pixeli != null ) {
ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize ); ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize );
} else { } else {
...@@ -249,9 +252,9 @@ public class MemoryImageSource implements ImageProducer ...@@ -249,9 +252,9 @@ public class MemoryImageSource implements ImageProducer
newPixels(); newPixels();
} else { } else {
ImageConsumer ic; ImageConsumer ic;
Enumeration e = consumers.elements(); Vector list = (Vector) consumers.clone();
for( ; e.hasMoreElements(); ) { for(int i = 0; i < list.size(); i++) {
ic = (ImageConsumer)e.nextElement(); ic = (ImageConsumer) list.elementAt(i);
ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT ); ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
if( props != null ) { if( props != null ) {
ic.setProperties( props ); ic.setProperties( props );
...@@ -294,9 +297,9 @@ public class MemoryImageSource implements ImageProducer ...@@ -294,9 +297,9 @@ public class MemoryImageSource implements ImageProducer
newPixels(); newPixels();
} else { } else {
ImageConsumer ic; ImageConsumer ic;
Enumeration e = consumers.elements(); Vector list = (Vector) consumers.clone();
for( ; e.hasMoreElements(); ) { for(int i = 0; i < list.size(); i++) {
ic = (ImageConsumer)e.nextElement(); ic = (ImageConsumer) list.elementAt(i);
ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT ); ic.setHints( ImageConsumer.TOPDOWNLEFTRIGHT );
if( props != null ) { if( props != null ) {
ic.setProperties( props ); ic.setProperties( props );
......
...@@ -79,6 +79,10 @@ public abstract class RGBImageFilter extends ImageFilter ...@@ -79,6 +79,10 @@ public abstract class RGBImageFilter extends ImageFilter
if( ( model instanceof IndexColorModel) && canFilterIndexColorModel ) { if( ( model instanceof IndexColorModel) && canFilterIndexColorModel ) {
newmodel = filterIndexColorModel( (IndexColorModel) model ); newmodel = filterIndexColorModel( (IndexColorModel) model );
consumer.setColorModel(newmodel);
}
else {
consumer.setColorModel(ColorModel.getRGBdefault());
} }
} }
......
/* ShortLookupTable.java -- Java class for a pixel translation table.
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 java.awt.image;
/**
* ShortLookupTable represents translation arrays for pixel values. It wraps
* one or more data arrays for each layer (or component) in an image, such as
* Alpha, R, G, and B. When doing translation, the offset is subtracted from
* the pixel values to allow a subset of an array to be used.
*
* @author <a href="mailto:jlquinn@optonline.net">Jerry Quinn</a>
* @version 1.0
*/
public class ShortLookupTable extends LookupTable
{
// Array of translation tables.
private short data[][];
/**
* Creates a new <code>ShortLookupTable</code> instance.
*
* Offset is subtracted from pixel values when looking up in the translation
* tables. If data.length is one, the same table is applied to all pixel
* components.
*
* @param offset Offset to be subtracted.
* @param data Array of lookup tables.
* @exception IllegalArgumentException if offset < 0 or data.length < 1.
*/
public ShortLookupTable(int offset, short[][] data)
throws IllegalArgumentException
{
super(offset, data.length);
this.data = data;
}
/**
* Creates a new <code>ShortLookupTable</code> instance.
*
* Offset is subtracted from pixel values when looking up in the translation
* table. The same table is applied to all pixel components.
*
* @param offset Offset to be subtracted.
* @param data Lookup table for all components.
* @exception IllegalArgumentException if offset < 0.
*/
public ShortLookupTable(int offset, short[] data)
throws IllegalArgumentException
{
super(offset, 1);
this.data = new short[][] {data};
}
/** Return the lookup tables. */
public final short[][] getTable()
{
return data;
}
/**
* Return translated values for a pixel.
*
* For each value in the pixel src, use the value minus offset as an index
* in the component array and copy the value there to the output for the
* component. If dest is null, the output is a new array, otherwise the
* translated values are written to dest. Dest can be the same array as
* src.
*
* For example, if the pixel src is [2, 4, 3], and offset is 1, the output
* is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
* translation arrays.
*
* @param src Component values of a pixel.
* @param dest 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];
if (data.length == 1)
for (int i=0; i < src.length; i++)
dst[i] = data[0][src[i] - offset];
else
for (int i=0; i < src.length; i++)
dst[i] = data[i][src[i] - offset];
return dst;
}
/**
* Return translated values for a pixel.
*
* For each value in the pixel src, use the value minus offset as an index
* in the component array and copy the value there to the output for the
* component. If dest is null, the output is a new array, otherwise the
* translated values are written to dest. Dest can be the same array as
* src.
*
* For example, if the pixel src is [2, 4, 3], and offset is 1, the output
* is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
* translation arrays.
*
* @param src Component values of a pixel.
* @param dest 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];
if (data.length == 1)
for (int i=0; i < src.length; i++)
dst[i] = data[0][((int)src[i]) - offset];
else
for (int i=0; i < src.length; i++)
dst[i] = data[i][((int)src[i]) - offset];
return dst;
}
}
...@@ -48,18 +48,15 @@ import java.util.Iterator; ...@@ -48,18 +48,15 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* ActionMap
* @author Andrew Selkirk * @author Andrew Selkirk
* @version 1.0 * @author Michael Koch
*/ */
public class ActionMap implements Serializable public class ActionMap
implements Serializable
{ {
static final long serialVersionUID = -6277518704513986346L; private static final long serialVersionUID = -6277518704513986346L;
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/** /**
* actionMap * actionMap
...@@ -69,170 +66,146 @@ public class ActionMap implements Serializable ...@@ -69,170 +66,146 @@ public class ActionMap implements Serializable
/** /**
* parent * parent
*/ */
private ActionMap parent = null; private ActionMap parent;
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/** /**
* Constructor ActionMap * Creates a new <code>ActionMap</code> instance.
*/ */
public ActionMap() { public ActionMap()
} // ActionMap() {
}
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/** /**
* get * Returns an action associated with an object.
* @param key TODO *
* @returns Action * @param key the key of the enty
*
* @return the action associated with key, may be null
*/ */
public Action get(Object key) { public Action get(Object key)
{
Object result = actionMap.get(key);
// Variables if (result == null)
Object result;
// Check Local store
result = actionMap.get(key);
// Check Parent
if (result == null) {
result = parent.get(key); result = parent.get(key);
} // if
return (Action) result; return (Action) result;
}
} // get()
/** /**
* put * Puts a new <code>Action</code> into the <code>ActionMap</code>.
* @param key TODO * If action is null an existing entry will be removed.
* @param action TODO *
* @param key the key for the entry
* @param action the action.
*/ */
public void put(Object key, Action action) { public void put(Object key, Action action)
if (action == null) { {
if (action == null)
actionMap.remove(key); actionMap.remove(key);
} else { else
actionMap.put(key, action); actionMap.put(key, action);
} // if }
} // put()
/** /**
* remove * Remove an entry from the <code>ActionMap</code>.
* @param key TODO *
* @param key the key of the entry to remove
*/ */
public void remove(Object key) { public void remove(Object key)
{
actionMap.remove(key); actionMap.remove(key);
} // remove() }
/** /**
* getParent * Returns the parent of this <code>ActionMap</code>.
* @returns ActionMap *
* @return the parent, may be null.
*/ */
public ActionMap getParent() { public ActionMap getParent()
{
return parent; return parent;
} // getParent() }
/** /**
* setParent * Sets a parent for this <code>ActionMap</code>.
* @param parentMap TODO *
* @param parentMap the new parent
*/ */
public void setParent(ActionMap parentMap) { public void setParent(ActionMap parentMap)
{
parent = parentMap; parent = parentMap;
} // setParent() }
/** /**
* size * Returns the number of entries in this <code>ActionMap</code>.
* @returns int *
* @return the number of entries
*/ */
public int size() { public int size()
{
return actionMap.size(); return actionMap.size();
} // size() }
/** /**
* clear * Clears the <code>ActionMap</code>.
*/ */
public void clear() { public void clear()
{
actionMap.clear(); actionMap.clear();
} // clear() }
/** /**
* keys * Returns all keys of entries in this <code>ActionMap</code>.
* @returns Object[] *
* @return an array of keys
*/ */
public Object[] keys() { public Object[] keys()
return convertSet(actionMap.keySet()); {
} // keys() return actionMap.keySet().toArray();
}
/** /**
* allKeys * Returns all keys of entries in this <code>ActionMap</code>
* @returns Object[] * and all its parents.
*
* @return an array of keys
*/ */
public Object[] allKeys() { public Object[] allKeys()
{
// Variables Set set = new HashSet();
Set set;
// Initialize
set = new HashSet();
// Get Key Sets if (parent != null)
if (parent != null) {
set.addAll(Arrays.asList(parent.allKeys())); set.addAll(Arrays.asList(parent.allKeys()));
} // if
set.addAll(actionMap.keySet());
return convertSet(set); set.addAll(actionMap.keySet());
return set.toArray();
} // allKeys() }
private Object[] convertSet(Set set) {
// Variables
int index;
Iterator iterator;
Object[] keys;
// Create Final array
keys = new Object[set.size()];
iterator = set.iterator();
index = 0;
while (iterator.hasNext()) {
keys[index++] = iterator.next();
} // while
return keys;
} // convertSet()
//-------------------------------------------------------------
// Interface: Serializable ------------------------------------
//-------------------------------------------------------------
/** /**
* writeObject * writeObject
* @param stream TODO *
* @exception IOException TODO * @param stream the stream to write to
*
* @exception IOException If an error occurs
*/ */
private void writeObject(ObjectOutputStream value0) throws IOException { private void writeObject(ObjectOutputStream stream)
throws IOException
{
// TODO // TODO
} // writeObject() }
/** /**
* readObject * readObject
* @param stream TODO *
* @exception ClassNotFoundException TODO * @param stream the stream to read from
* @exception IOException TODO *
* @exception ClassNotFoundException If the serialized class cannot be found
* @exception IOException If an error occurs
*/ */
private void readObject(ObjectInputStream value0) throws ClassNotFoundException, IOException { private void readObject(ObjectInputStream stream)
throws ClassNotFoundException, IOException
{
// TODO // TODO
} // readObject() }
}
} // ActionMap
/* ComponentInputMap.java -- /* ComponentInputMap.java --
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,79 +37,94 @@ exception statement from your version. */ ...@@ -37,79 +37,94 @@ exception statement from your version. */
package javax.swing; package javax.swing;
/** /**
* ComponentInputMap
* @author Andrew Selkirk * @author Andrew Selkirk
* @version 1.0 * @author Michael Koch
*/ */
public class ComponentInputMap extends InputMap { public class ComponentInputMap extends InputMap
{
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/** /**
* component * The component to notify.
*/ */
private JComponent component; private JComponent component;
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor ComponentInputMap
* @param value0 TODO
*/
public ComponentInputMap(JComponent value0) {
// TODO
} // ComponentInputMap()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* put
* @param keystroke TODO
* @param value TODO
*/
public void put(KeyStroke keystroke, Object value) {
// TODO
} // put()
/** /**
* clear * Creates <code>ComponentInputMap</code> object that notifies the given
*/ * component about changes to it.
public void clear() { *
// TODO * @param comp the component to notify
} // clear() *
* @exception IllegalArgumentException if comp is null
/** */
* remove public ComponentInputMap(JComponent comp)
* @param keystroke TODO {
*/ if (comp == null)
public void remove(KeyStroke keystroke) { throw new IllegalArgumentException();
// TODO
} // remove() this.component = comp;
}
/**
* setParent /**
* @param parent TODO * Puts a new entry into the <code>InputMap</code>.
*/ * If actionMapKey is null an existing entry will be removed.
public void setParent(InputMap parent) { *
// TODO * @param keystroke the keystroke for the entry
} // setParent() * @param actionMapKey the action.
*/
/** public void put(KeyStroke keystroke, Object value)
* getComponent {
* @returns JComponent super.put(keystroke, value);
*/ // FIXME: Notify component.
public JComponent getComponent() { }
return null; // TODO
} // getComponent() /**
* Clears the <code>InputMap</code>.
*/
} // ComponentInputMap public void clear()
{
super.clear();
// FIXME: Notify component.
}
/**
* Remove an entry from the <code>InputMap</code>.
*
* @param key the key of the entry to remove
*/
public void remove(KeyStroke keystroke)
{
super.remove(keystroke);
// FIXME: Notify component.
}
/**
* Sets a parent for this <code>ComponentInputMap</code>.
*
* @param parentMap the new parent
*
* @exception IllegalArgument if parentMap is not a
* <code>ComponentInputMap</code> or not associated with the same component
*/
public void setParent(InputMap parentMap)
{
if (! (parentMap instanceof ComponentInputMap))
throw new IllegalArgumentException();
if (((ComponentInputMap) parentMap).getComponent() != component)
throw new IllegalArgumentException();
super.setParent(parentMap);
// FIXME: Notify component.
}
/**
* Returns the component to notify about changes.
*
* @return a <code>JComponent</code> object
*/
public JComponent getComponent()
{
return component;
}
}
...@@ -436,7 +436,6 @@ public class DefaultDesktopManager implements DesktopManager, Serializable ...@@ -436,7 +436,6 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
int newWidth, int newHeight) int newWidth, int newHeight)
{ {
dragCache.setBounds(newX, newY, newWidth, newHeight); dragCache.setBounds(newX, newY, newWidth, newHeight);
dragCache = findMinimum(dragCache, component);
if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
{ {
...@@ -628,27 +627,4 @@ public class DefaultDesktopManager implements DesktopManager, Serializable ...@@ -628,27 +627,4 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
{ {
return frame.getWasIcon(); return frame.getWasIcon();
} // wasIcon() } // wasIcon()
/**
* This is a helper method that determines the minimum size a
* JInternalFrame can be resized to.
*
* @param r The desired size.
* @param c The JComponent to find a minimum size for.
*
* @return The minimum size a JInternalFrame can be resized to.
*/
private Rectangle findMinimum(Rectangle r, JComponent c)
{
if (r != null && c != null)
{
Dimension d = c.getPreferredSize();
if (d != null)
{
r.width = Math.max(d.width, r.width);
r.height = Math.max(d.height, r.height);
}
}
return r;
}
} // DefaultDesktopManager } // DefaultDesktopManager
...@@ -41,6 +41,7 @@ import java.awt.Component; ...@@ -41,6 +41,7 @@ import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Image; import java.awt.Image;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.image.ImageObserver;
import java.io.Serializable; import java.io.Serializable;
import java.net.URL; import java.net.URL;
...@@ -50,42 +51,62 @@ public class ImageIcon ...@@ -50,42 +51,62 @@ public class ImageIcon
{ {
private static final long serialVersionUID = 532615968316031794L; private static final long serialVersionUID = 532615968316031794L;
Image image; Image image;
String file; String description;
String descr; ImageObserver observer;
Component observer;
public ImageIcon(String s) public ImageIcon()
{ {
// if description is not specified, then file name becomes
// desciption for this icon
this(s, s);
} }
public ImageIcon(Image image) public ImageIcon(String file)
{
this(file, file);
}
public ImageIcon(String file, String description)
{
this(Toolkit.getDefaultToolkit().getImage(file), description);
}
public ImageIcon(byte[] imageData)
{
this(imageData, null);
}
public ImageIcon(byte[] imageData, String description)
{ {
this(Toolkit.getDefaultToolkit().createImage(imageData), description);
} }
public ImageIcon(URL url) public ImageIcon(URL url)
{ {
image = Toolkit.getDefaultToolkit().getImage(url); this(url, null);
} }
public ImageIcon(String file, String descr) public ImageIcon(URL url, String description)
{ {
this.file = file; this(Toolkit.getDefaultToolkit().getImage(url), description);
this.descr = descr; }
public ImageIcon(Image image)
{
this(image, null);
}
image = Toolkit.getDefaultToolkit().getImage(file); public ImageIcon(Image image, String description)
if (image == null) {
return; this.image = Toolkit.getDefaultToolkit().createImage(image.getSource());
this.description = description;
}
//loadImage(image); public ImageObserver getImageObserver()
{
return observer;
} }
// not in SUN's spec !!! public void setImageObserver(ImageObserver newObserver)
public void setParent(Component p)
{ {
observer = p; observer = newObserver;
} }
public Image getImage() public Image getImage()
...@@ -95,12 +116,12 @@ public class ImageIcon ...@@ -95,12 +116,12 @@ public class ImageIcon
public String getDescription() public String getDescription()
{ {
return descr; return description;
} }
public void setDescription(String description) public void setDescription(String description)
{ {
this.descr = description; this.description = description;
} }
public int getIconHeight() public int getIconHeight()
...@@ -115,6 +136,6 @@ public class ImageIcon ...@@ -115,6 +136,6 @@ public class ImageIcon
public void paintIcon(Component c, Graphics g, int x, int y) public void paintIcon(Component c, Graphics g, int x, int y)
{ {
g.drawImage(image, x, y, observer); g.drawImage(image, x, y, observer != null ? observer : c);
} }
} }
/* InputMap.java -- /* InputMap.java --
Copyright (C) 2002 Free Software Foundation, Inc. Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not ...@@ -35,7 +35,6 @@ 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 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 javax.swing; package javax.swing;
import java.io.IOException; import java.io.IOException;
...@@ -43,24 +42,23 @@ import java.io.ObjectInputStream; ...@@ -43,24 +42,23 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* InputMap
* @author Andrew Selkirk * @author Andrew Selkirk
* @version 1.0 * @author Michael Koch
*
* @since 1.3
*/ */
public class InputMap implements Serializable public class InputMap
implements Serializable
{ {
static final long serialVersionUID = -5429059542008604257L; private static final long serialVersionUID = -5429059542008604257L;
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/** /**
* inputMap * inputMap
...@@ -70,171 +68,147 @@ public class InputMap implements Serializable ...@@ -70,171 +68,147 @@ public class InputMap implements Serializable
/** /**
* parent * parent
*/ */
private InputMap parent = null; private InputMap parent;
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/** /**
* Constructor InputMap * Creates a new <code>InputMap</code> instance.
*/ */
public InputMap() { public InputMap()
{
// TODO // TODO
} // InputMap() }
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/** /**
* get * Returns the binding for keystroke.
* @param value0 TODO *
* @returns Object * @param key the key of the enty
*
* @return the binding associated with keystroke may be null
*/ */
public Object get(KeyStroke keystroke) { public Object get(KeyStroke keystroke)
{
// Variables Object result = inputMap.get(keystroke);
Object result;
// Check Local store if (result == null)
result = inputMap.get(keystroke);
// Check Parent
if (result == null) {
result = parent.get(keystroke); result = parent.get(keystroke);
} // if
return result; return result;
}
} // get()
/** /**
* put * Puts a new entry into the <code>InputMap</code>.
* @param keystroke TODO * If actionMapKey is null an existing entry will be removed.
* @param actionMapKey TODO *
* @param keystroke the keystroke for the entry
* @param actionMapKey the action.
*/ */
public void put(KeyStroke keystroke, Object actionMapKey) { public void put(KeyStroke keystroke, Object actionMapKey)
if (actionMapKey == null) { {
if (actionMapKey == null)
inputMap.remove(keystroke); inputMap.remove(keystroke);
} else { else
inputMap.put(keystroke, actionMapKey); inputMap.put(keystroke, actionMapKey);
} // if }
} // put()
/** /**
* remove * Remove an entry from the <code>InputMap</code>.
* @param keystroke TODO *
* @param key the key of the entry to remove
*/ */
public void remove(KeyStroke keystroke) { public void remove(KeyStroke keystroke)
{
inputMap.remove(keystroke); inputMap.remove(keystroke);
} // remove() }
/** /**
* getParent * Returns the parent of this <code>InputMap</code>.
* @returns InputMap *
* @return the parent, may be null.
*/ */
public InputMap getParent() { public InputMap getParent()
{
return parent; return parent;
} // getParent() }
/** /**
* setParent * Sets a parent for this <code>InputMap</code>.
* @param parentMap TODO *
* @param parentMap the new parent
*/ */
public void setParent(InputMap parentMap) { public void setParent(InputMap parentMap)
{
parent = parentMap; parent = parentMap;
} // setParent() }
/** /**
* size * Returns the number of entries in this <code>InputMap</code>.
* @returns int *
* @return the number of entries
*/ */
public int size() { public int size()
{
return inputMap.size(); return inputMap.size();
} // size() }
/** /**
* clear * Clears the <code>InputMap</code>.
*/ */
public void clear() { public void clear()
{
inputMap.clear(); inputMap.clear();
} // clear() }
/** /**
* keys * Returns all keys of entries in this <code>InputMap</code>.
* @returns KeyStroke[] *
* @return an array of keys
*/ */
public KeyStroke[] keys() { public KeyStroke[] keys()
return convertSet(inputMap.keySet()); {
} // keys() KeyStroke[] array = new KeyStroke[size()];
return (KeyStroke[]) inputMap.keySet().toArray(array);
}
/** /**
* allKeys * Returns all keys of entries in this <code>InputMap</code>
* @returns KeyStroke[] * and all its parents.
*
* @return an array of keys
*/ */
public KeyStroke[] allKeys() { public KeyStroke[] allKeys()
{
Set set = new HashSet();
// Variables if (parent != null)
Set set;
// Initialize
set = new HashSet();
// Get Key Sets
if (parent != null) {
set.addAll(Arrays.asList(parent.allKeys())); set.addAll(Arrays.asList(parent.allKeys()));
} // if
set.addAll(inputMap.keySet());
return convertSet(set);
} // allKeys()
private KeyStroke[] convertSet(Set set) {
// Variables
int index;
Iterator iterator;
KeyStroke[] keys;
// Create Final array set.addAll(inputMap.keySet());
keys = new KeyStroke[set.size()]; KeyStroke[] array = new KeyStroke[size()];
iterator = set.iterator(); return (KeyStroke[]) set.toArray(array);
index = 0; }
while (iterator.hasNext()) {
keys[index++] = (KeyStroke) iterator.next();
} // while
return keys;
} // convertSet()
//-------------------------------------------------------------
// Interface: Serializable ------------------------------------
//-------------------------------------------------------------
/** /**
* writeObject * writeObject
* @param stream TODO *
* @exception IOException TODO * @param stream the stream to write to
*
* @exception IOException If an error occurs
*/ */
private void writeObject(ObjectOutputStream stream) throws IOException { private void writeObject(ObjectOutputStream stream) throws IOException
{
// TODO // TODO
} // writeObject() }
/** /**
* readObject * readObject
* @param stream TODO *
* @exception ClassNotFoundException TODO * @param stream the stream to read from
* @exception IOException TODO *
* @exception ClassNotFoundException If the serialized class cannot be found
* @exception IOException If an error occurs
*/ */
private void readObject(ObjectInputStream stream) throws ClassNotFoundException, IOException { private void readObject(ObjectInputStream stream)
throws ClassNotFoundException, IOException
{
// TODO // TODO
} // readObject() }
}
} // InputMap
...@@ -41,17 +41,18 @@ import javax.accessibility.Accessible; ...@@ -41,17 +41,18 @@ import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import javax.swing.plaf.ButtonUI; import javax.swing.plaf.ButtonUI;
/** /**
* An instance of JButton can be added to a panel, frame etc * An instance of JButton can be added to a panel, frame etc
* *
* @author Ronald Veldema (rveldema@cs.vu.nl) * @author Ronald Veldema (rveldema@cs.vu.nl)
*/ */
public class JButton extends AbstractButton implements Accessible public class JButton extends AbstractButton
implements Accessible
{ {
private static final long serialVersionUID = -1907255238954382202L; private static final long serialVersionUID = -1907255238954382202L;
boolean def;
boolean def, is_def; boolean is_def;
public JButton() public JButton()
{ {
...@@ -98,8 +99,7 @@ public class JButton extends AbstractButton implements Accessible ...@@ -98,8 +99,7 @@ public class JButton extends AbstractButton implements Accessible
public String getUIClassID() public String getUIClassID()
{ {
//Returns a string that specifies the name of the Look and Feel //Returns a string that specifies the name of the L&F class that renders this component.
//class that renders this component.
return "ButtonUI"; return "ButtonUI";
} }
...@@ -120,17 +120,23 @@ public class JButton extends AbstractButton implements Accessible ...@@ -120,17 +120,23 @@ public class JButton extends AbstractButton implements Accessible
return "JButton"; return "JButton";
} }
/**
* Overrides JComponent.removeNotify to check if this button is currently
* set as the default button on the RootPane, and if so, sets the RootPane's
* default button to null to ensure the RootPane doesn't hold onto an invalid
* button reference.
*/
public void removeNotify() public void removeNotify()
{ {
//Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so, sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference.
} }
public void setDefaultCapable(boolean defaultCapable) public void setDefaultCapable(boolean defaultCapable)
{ def = defaultCapable; } {
def = defaultCapable;
}
public void updateUI() public void updateUI()
{ {
ButtonUI b = (ButtonUI)UIManager.getUI(this); setUI((ButtonUI) UIManager.getUI(this));
setUI(b);
} }
} }
...@@ -49,44 +49,76 @@ public class JCheckBox extends JToggleButton ...@@ -49,44 +49,76 @@ public class JCheckBox extends JToggleButton
{ {
private static final long serialVersionUID = -5246739313864538930L; private static final long serialVersionUID = -5246739313864538930L;
private boolean borderPaintedFlat;
private void init()
{
borderPainted = false;
contentAreaFilled = false;
}
public JCheckBox() public JCheckBox()
{ {
this(null, null); super();
init();
} }
public JCheckBox(Action a)
public JCheckBox(Action action)
{ {
this(); super(action);
setAction(a); init();
} }
public JCheckBox(Icon icon) public JCheckBox(Icon icon)
{ {
this(null, icon); super(icon);
init();
}
public JCheckBox(Icon icon, boolean selected)
{
super(icon, selected);
init();
} }
public JCheckBox(String text) public JCheckBox(String text)
{ {
this(text, null); super(text);
init();
}
public JCheckBox(String text, boolean selected)
{
super(text, selected);
init();
} }
public JCheckBox(String text, Icon icon) public JCheckBox(String text, Icon icon)
{ {
super(text, icon); super(text, icon);
paint_border = false; init();
content_area_filled = false;
} }
public JCheckBox(String text, Icon icon, boolean selected)
{
super(text, icon, selected);
init();
}
/**
* Gets the AccessibleContext associated with this JCheckBox.
*/
public AccessibleContext getAccessibleContext() public AccessibleContext getAccessibleContext()
{ {
//Gets the AccessibleContext associated with this JCheckBox.
return null; return null;
} }
/**
* Returns a string that specifies the name of the L&amp;F class
* that renders this component.
*/
public String getUIClassID() public String getUIClassID()
{ {
//Returns a string that specifies the name of the Look and Feel
//class that renders this component.
return "CheckBoxUI"; return "CheckBoxUI";
} }
...@@ -94,4 +126,15 @@ public class JCheckBox extends JToggleButton ...@@ -94,4 +126,15 @@ public class JCheckBox extends JToggleButton
{ {
return "JCheckBox"; return "JCheckBox";
} }
public boolean isBorderPaintedFlat()
{
return borderPaintedFlat;
}
public void setBorderPaintedFlat(boolean newValue)
{
firePropertyChange("borderPaintedFlat", borderPaintedFlat, newValue);
borderPaintedFlat = newValue;
}
} }
...@@ -45,16 +45,28 @@ import javax.accessibility.AccessibleRole; ...@@ -45,16 +45,28 @@ import javax.accessibility.AccessibleRole;
/** /**
* DOCUMENT ME! * This class represents JCheckBoxMenuItem. Its behaviour is very similar
* to JCheckBoxButton. Just like the JCheckBoxButton, user can check and
* uncheck this menu item by clicking on it. Also setSelected()/setState()
* can be use used for the same purpose. JCheckBoxMenuItem uses
* ToggleButtonModel to keep track of its selection.
*/ */
public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
Accessible Accessible
{ {
private static final long serialVersionUID = -6676402307973384715L; private static final long serialVersionUID = -6676402307973384715L;
/** name for the UI delegate for this menuItem. */
private static final String uiClassID = "CheckBoxMenuItemUI"; private static final String uiClassID = "CheckBoxMenuItemUI";
/** Indicates whether this menu item is checked. */
private boolean state; private boolean state;
private Object[] selectedObjects;
/**
* This array contains text of this menu item if this menu item is in
* checked state and null it is not.
*/
private Object[] selectedObjects = new Object[1];
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem object.
...@@ -65,9 +77,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -65,9 +77,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem with given icon
* *
* @param icon DOCUMENT ME! * @param icon Icon for this menu item
*/ */
public JCheckBoxMenuItem(Icon icon) public JCheckBoxMenuItem(Icon icon)
{ {
...@@ -75,9 +87,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -75,9 +87,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem with given label
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
*/ */
public JCheckBoxMenuItem(String text) public JCheckBoxMenuItem(String text)
{ {
...@@ -85,9 +97,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -85,9 +97,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem using given action
* *
* @param action DOCUMENT ME! * @param action Action for this menu item.
*/ */
public JCheckBoxMenuItem(Action action) public JCheckBoxMenuItem(Action action)
{ {
...@@ -96,10 +108,10 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -96,10 +108,10 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem object with given label and icon
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
* @param icon DOCUMENT ME! * @param icon Icon for this menu item
*/ */
public JCheckBoxMenuItem(String text, Icon icon) public JCheckBoxMenuItem(String text, Icon icon)
{ {
...@@ -107,10 +119,11 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -107,10 +119,11 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem object using specified label and
* marked as checked if given 'state' is true
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
* @param state DOCUMENT ME! * @param state True if this item should be in checked state and false otherwise
*/ */
public JCheckBoxMenuItem(String text, boolean state) public JCheckBoxMenuItem(String text, boolean state)
{ {
...@@ -118,11 +131,12 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -118,11 +131,12 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* Creates a new JCheckBoxMenuItem object. * Creates a new JCheckBoxMenuItem object with given label, icon,
* and marked as checked if given 'state' is true
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
* @param icon DOCUMENT ME! * @param icon icon for this menu item
* @param state DOCUMENT ME! * @param state True if this item should be in checked state and false otherwise
*/ */
public JCheckBoxMenuItem(String text, Icon icon, boolean state) public JCheckBoxMenuItem(String text, Icon icon, boolean state)
{ {
...@@ -131,22 +145,15 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -131,22 +145,15 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
this.state = state; this.state = state;
} }
/**
* DOCUMENT ME!
*
* @param stream DOCUMENT ME!
*
* @throws IOException DOCUMENT ME!
*/
private void writeObject(ObjectOutputStream stream) throws IOException private void writeObject(ObjectOutputStream stream) throws IOException
{ {
// TODO
} }
/** /**
* DOCUMENT ME! * This method returns a name to identify which look and feel class will be
* the UI delegate for the menuItem.
* *
* @return $returnType$ DOCUMENT ME! * @return The Look and Feel classID. "JCheckBoxMenuItemUI"
*/ */
public String getUIClassID() public String getUIClassID()
{ {
...@@ -154,9 +161,10 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -154,9 +161,10 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* DOCUMENT ME! * Returns checked state for this check box menu item.
* *
* @return $returnType$ DOCUMENT ME! * @return Returns true if this menu item is in checked state
* and false otherwise.
*/ */
public boolean getState() public boolean getState()
{ {
...@@ -164,9 +172,12 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -164,9 +172,12 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* DOCUMENT ME! * Sets state for this check box menu item. If
* given 'state' is true, then mark menu item as checked,
* and uncheck this menu item otherwise.
*
* @param state new state for this menu item
* *
* @param state DOCUMENT ME!
*/ */
public synchronized void setState(boolean state) public synchronized void setState(boolean state)
{ {
...@@ -174,38 +185,43 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -174,38 +185,43 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
} }
/** /**
* DOCUMENT ME! * This method returns array containing label of this
* menu item if it is selected and null otherwise.
* *
* @return $returnType$ DOCUMENT ME! * @return Array containing label of this
* menu item if this menu item is selected or null otherwise.
*/ */
public Object[] getSelectedObjects() public Object[] getSelectedObjects()
{ {
if (state == true)
selectedObjects[0] = this.getText();
else
selectedObjects[0] = null;
return selectedObjects; return selectedObjects;
} }
/** /**
* DOCUMENT ME! * This method overrides JComponent.requestFocus with an empty
* implementation, since JCheckBoxMenuItems should not
* receve focus in general.
*/ */
public void requestFocus() public void requestFocus()
{ {
// TODO // Should do nothing here
} }
/** /**
* DOCUMENT ME! * A string that describes this JCheckBoxMenuItem. Normally only used
* for debugging.
* *
* @return $returnType$ DOCUMENT ME! * @return A string describing this JCheckBoxMenuItem
*/ */
protected String paramString() protected String paramString()
{ {
return "JCheckBoxMenuItem"; return "JCheckBoxMenuItem";
} }
/**
* DOCUMENT ME!
*
* @return $returnType$ DOCUMENT ME!
*/
public AccessibleContext getAccessibleContext() public AccessibleContext getAccessibleContext()
{ {
if (accessibleContext == null) if (accessibleContext == null)
...@@ -214,9 +230,6 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -214,9 +230,6 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
return accessibleContext; return accessibleContext;
} }
/**
* DOCUMENT ME!
*/
protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem
{ {
private static final long serialVersionUID = 1079958073579370777L; private static final long serialVersionUID = 1079958073579370777L;
...@@ -228,11 +241,6 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, ...@@ -228,11 +241,6 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
{ {
} }
/**
* DOCUMENT ME!
*
* @return $returnType$ DOCUMENT ME!
*/
public AccessibleRole getAccessibleRole() public AccessibleRole getAccessibleRole()
{ {
return AccessibleRole.CHECK_BOX; return AccessibleRole.CHECK_BOX;
......
...@@ -1625,6 +1625,7 @@ public abstract class JComponent extends Container implements Serializable ...@@ -1625,6 +1625,7 @@ public abstract class JComponent extends Container implements Serializable
*/ */
public void revalidate() public void revalidate()
{ {
invalidate();
RepaintManager.currentManager(this).addInvalidComponent(this); RepaintManager.currentManager(this).addInvalidComponent(this);
} }
......
...@@ -39,15 +39,16 @@ package javax.swing; ...@@ -39,15 +39,16 @@ package javax.swing;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.EditorKit; import javax.swing.text.EditorKit;
import javax.swing.text.JTextComponent; import javax.swing.text.JTextComponent;
import javax.swing.text.PlainEditorKit;
public class JEditorPane extends JTextComponent public class JEditorPane extends JTextComponent
...@@ -82,12 +83,12 @@ public class JEditorPane extends JTextComponent ...@@ -82,12 +83,12 @@ public class JEditorPane extends JTextComponent
protected EditorKit createDefaultEditorKit() protected EditorKit createDefaultEditorKit()
{ {
return new PlainEditorKit(); return new DefaultEditorKit();
} }
protected static EditorKit createEditorKitForContentType(String type) public static EditorKit createEditorKitForContentType(String type)
{ {
return new PlainEditorKit(); return new DefaultEditorKit();
} }
/** /**
...@@ -197,7 +198,8 @@ public class JEditorPane extends JTextComponent ...@@ -197,7 +198,8 @@ public class JEditorPane extends JTextComponent
} }
/** /**
* Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal. * Make sure that TAB and Shift-TAB events get consumed,
* so that awt doesn't attempt focus traversal.
*/ */
protected void processKeyEvent(KeyEvent e) protected void processKeyEvent(KeyEvent e)
{ {
...@@ -228,16 +230,18 @@ public class JEditorPane extends JTextComponent ...@@ -228,16 +230,18 @@ public class JEditorPane extends JTextComponent
} }
/** /**
* Replaces the currently selected content with new content represented by the given string. * Replaces the currently selected content with new content represented
* by the given string.
*/ */
public void replaceSelection(String content) public void replaceSelection(String content)
{ {
} }
/** /**
* Scrolls the view to the given reference location (that is, the value returned by the UL.getRef method for the URL being displayed). * Scrolls the view to the given reference location (that is, the value
* returned by the UL.getRef method for the URL being displayed).
*/ */
protected void scrollToReference(String reference) public void scrollToReference(String reference)
{ {
} }
......
...@@ -131,6 +131,8 @@ public class JFormattedTextField extends JTextField ...@@ -131,6 +131,8 @@ public class JFormattedTextField extends JTextField
public static final int REVERT = 2; public static final int REVERT = 2;
public static final int PERSIST = 3; public static final int PERSIST = 3;
private Object value;
public JFormattedTextField () public JFormattedTextField ()
{ {
throw new InternalError ("not implemented"); throw new InternalError ("not implemented");
...@@ -158,7 +160,7 @@ public class JFormattedTextField extends JTextField ...@@ -158,7 +160,7 @@ public class JFormattedTextField extends JTextField
public JFormattedTextField (Object value) public JFormattedTextField (Object value)
{ {
throw new InternalError ("not implemented"); this.value = value;
} }
public void commitEdit () public void commitEdit ()
...@@ -189,12 +191,12 @@ public class JFormattedTextField extends JTextField ...@@ -189,12 +191,12 @@ public class JFormattedTextField extends JTextField
public String getUIClassID () public String getUIClassID ()
{ {
throw new InternalError ("not implemented"); return "FormattedTextFieldUI";
} }
public Object getValue () public Object getValue ()
{ {
throw new InternalError ("not implemented"); return value;
} }
protected void invalidEdit () protected void invalidEdit ()
...@@ -212,9 +214,15 @@ public class JFormattedTextField extends JTextField ...@@ -212,9 +214,15 @@ public class JFormattedTextField extends JTextField
throw new InternalError ("not implemented"); throw new InternalError ("not implemented");
} }
public void setDocument (Document document) public void setDocument(Document newdoc)
{ {
throw new InternalError ("not implemented"); Document document = getDocument();
if (document == newdoc)
return;
setDocument(newdoc);
firePropertyChange("document", document, newdoc);
} }
public void setLostFocusBehavior (int behavior) public void setLostFocusBehavior (int behavior)
...@@ -232,8 +240,8 @@ public class JFormattedTextField extends JTextField ...@@ -232,8 +240,8 @@ public class JFormattedTextField extends JTextField
throw new InternalError ("not implemented"); throw new InternalError ("not implemented");
} }
public void setValue (Object value) public void setValue (Object newValue)
{ {
throw new InternalError ("not implemented"); value = newValue;
} }
} }
...@@ -994,7 +994,32 @@ public class JList extends JComponent implements Accessible, Scrollable ...@@ -994,7 +994,32 @@ public class JList extends JComponent implements Accessible, Scrollable
*/ */
public Dimension getPreferredScrollableViewportSize() public Dimension getPreferredScrollableViewportSize()
{ {
return getPreferredSize(); int vis = getVisibleRowCount();
int nrows = getModel() == null ? 0 : getModel().getSize();
// FIXME: this is a somewhat arbitrary default, but.. ?
Dimension single = new Dimension(10, 10);;
Rectangle bounds = null;
if (vis > nrows)
{
if (fixedCellWidth != -1 &&
fixedCellHeight != -1)
{
single = new Dimension(fixedCellWidth, fixedCellHeight);
}
else if (nrows != 0 && getUI() != null)
{
Rectangle tmp = getUI().getCellBounds(this, 0, 0);
if (tmp != null)
single = tmp.getSize();
}
}
else if (getUI() != null)
{
return getUI().getCellBounds(this, 0, vis - 1).getSize();
}
return new Dimension(single.width, single.height * vis);
} }
/** /**
......
...@@ -62,9 +62,19 @@ import javax.swing.plaf.MenuItemUI; ...@@ -62,9 +62,19 @@ import javax.swing.plaf.MenuItemUI;
/** /**
* <p>
* This class represents a menu that can be added to a menu bar or * This class represents a menu that can be added to a menu bar or
* to some other menu. When JMenu is selected it displays JPopupMenu * can be a submenu in some other menu. When JMenu is selected it
* containing its menu items. * displays JPopupMenu containing its menu items.
* </p>
*
* <p>
* JMenu's fires MenuEvents when this menu's selection changes. If this menu
* is selected, then fireMenuSelectedEvent() is invoked. In case when menu is
* deselected or cancelled, then fireMenuDeselectedEvent() or
* fireMenuCancelledEvent() is invoked, respectivelly.
* </p>
*
*/ */
public class JMenu extends JMenuItem implements Accessible, MenuElement public class JMenu extends JMenuItem implements Accessible, MenuElement
{ {
...@@ -76,10 +86,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -76,10 +86,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
/** A Popup menu associated with this menu, which pops up when menu is selected */ /** A Popup menu associated with this menu, which pops up when menu is selected */
private JPopupMenu popupMenu = new JPopupMenu(); private JPopupMenu popupMenu = new JPopupMenu();
/** MenuChangeListener that listens to change events occuring in menu's model */ /** Whenever menu is selected or deselected the MenuEvent is fired to
private ChangeListener menuChangeListener; menu's registered listeners. */
/** MenuEvent */
private MenuEvent menuEvent = new MenuEvent(this); private MenuEvent menuEvent = new MenuEvent(this);
/*Amount of time, in milliseconds, that should pass before popupMenu /*Amount of time, in milliseconds, that should pass before popupMenu
...@@ -89,7 +97,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -89,7 +97,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
/* PopupListener */ /* PopupListener */
protected WinListener popupListener; protected WinListener popupListener;
/** Location at which popup menu associated with this menu will be displayed*/ /** Location at which popup menu associated with this menu will be
displayed */
private Point menuLocation; private Point menuLocation;
/** /**
...@@ -98,8 +107,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -98,8 +107,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
public JMenu() public JMenu()
{ {
super(); super();
menuChangeListener = createMenuChangeListener();
getModel().addChangeListener(menuChangeListener);
} }
/** /**
...@@ -110,8 +117,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -110,8 +117,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
public JMenu(String text) public JMenu(String text)
{ {
super(text); super(text);
menuChangeListener = createMenuChangeListener();
getModel().addChangeListener(menuChangeListener);
} }
/** /**
...@@ -123,8 +128,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -123,8 +128,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
public JMenu(Action action) public JMenu(Action action)
{ {
super(action); super(action);
menuChangeListener = createMenuChangeListener(); createActionChangeListener(this);
getModel().addChangeListener(menuChangeListener);
} }
/** /**
...@@ -335,14 +339,52 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -335,14 +339,52 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
/** /**
* Changes this menu selected state if selected is true and false otherwise * Changes this menu selected state if selected is true and false otherwise
* This method fires menuEvents to model's registered listeners. * This method fires menuEvents to menu's registered listeners.
* *
* @param selected true if the menu should be selected and false otherwise * @param selected true if the menu should be selected and false otherwise
*/ */
public void setSelected(boolean selected) public void setSelected(boolean selected)
{ {
// if this menu selection is true, then activate this menu and
// display popup associated with this menu
if (selected)
{
super.setArmed(true); super.setArmed(true);
super.setSelected(true);
// FIXME: The popup menu should be shown on the screen after certain
// number of seconds pass. The 'delay' property of this menu indicates
// this amount of seconds. 'delay' property is 0 by default.
if (this.isShowing())
{
fireMenuSelected(); fireMenuSelected();
int x = 0;
int y = 0;
if (menuLocation == null)
{
// Calculate correct position of the popup. Note that location of the popup
// passed to show() should be relative to the popup's invoker
if (isTopLevelMenu())
y = this.getHeight();
else
x = this.getWidth();
getPopupMenu().show(this, x, y);
}
else
getPopupMenu().show(this, menuLocation.x, menuLocation.y);
}
}
else
{
super.setSelected(false);
super.setArmed(false);
fireMenuDeselected();
popupMenu.setVisible(false);
}
} }
/** /**
...@@ -641,17 +683,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -641,17 +683,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
} }
/** /**
* Creates MenuChangeListener to listen to change events occuring
* in the model
*
* @return ChangeListener
*/
private ChangeListener createMenuChangeListener()
{
return new MenuChangeListener();
}
/**
* Creates WinListener that listens to the menu;s popup menu. * Creates WinListener that listens to the menu;s popup menu.
* *
* @param popup JPopupMenu to listen to * @param popup JPopupMenu to listen to
...@@ -675,34 +706,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -675,34 +706,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
{ {
// if this menu selection is true, then activate this menu and // if this menu selection is true, then activate this menu and
// display popup associated with this menu // display popup associated with this menu
if (changed) setSelected(changed);
{
setArmed(true);
fireMenuSelected();
int x = 0;
int y = 0;
if (menuLocation == null)
{
// Calculate correct position of the popup. Note that location of the popup
// passed to show() should be relative to the popup's invoker
if (isTopLevelMenu())
y = this.getHeight();
else
x = this.getWidth();
getPopupMenu().show(this, x, y);
}
else
getPopupMenu().show(this, menuLocation.x, menuLocation.y);
}
else
{
fireMenuDeselected();
popupMenu.setVisible(false);
setArmed(false);
}
} }
/** /**
...@@ -860,17 +864,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement ...@@ -860,17 +864,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
} }
} }
/** This class listens to ChangeEvent fired by menu's model*/
protected class MenuChangeListener implements ChangeListener
{
/** This method is invoked when there is change in menu's model property */
public void stateChanged(ChangeEvent e)
{
revalidate();
repaint();
}
}
/** /**
* This class listens to PropertyChangeEvents occuring in menu's action * This class listens to PropertyChangeEvents occuring in menu's action
*/ */
......
...@@ -66,7 +66,15 @@ import javax.swing.plaf.MenuItemUI; ...@@ -66,7 +66,15 @@ import javax.swing.plaf.MenuItemUI;
/** /**
* JMenuBar * <p>
* JMenuBar is a container for menu's. For a menu bar to be seen on the
* screen, at least one menu should be added to it. Just like adding
* components to container, one can use add() to add menu's to the menu bar.
* Menu's will be displayed in the menu bar in the order they were added.
* The JMenuBar uses selectionModel to keep track of selected menu index.
* JMenuBar's selectionModel will fire ChangeEvents to its registered
* listeners when the selected index changes.
* </p>
*/ */
public class JMenuBar extends JComponent implements Accessible, MenuElement public class JMenuBar extends JComponent implements Accessible, MenuElement
{ {
...@@ -76,6 +84,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -76,6 +84,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
/** Fired in a PropertyChangeEvent when the "model" changes. */ /** Fired in a PropertyChangeEvent when the "model" changes. */
public static final String MODEL_CHANGED_PROPERTY = "model"; public static final String MODEL_CHANGED_PROPERTY = "model";
/** Fired in a PropertyChangeEvent when the "margin" changes. */
public static final String MARGIN_CHANGED_PROPERTY = "margin";
private static final long serialVersionUID = -8191026883931977036L; private static final long serialVersionUID = -8191026883931977036L;
/** JMenuBar's model. It keeps track of selected menu's index */ /** JMenuBar's model. It keeps track of selected menu's index */
...@@ -112,7 +122,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -112,7 +122,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * This method overrides addNotify() in the Container to register
* this menu bar with the current keyboard manager.
*/ */
public void addNotify() public void addNotify()
{ {
...@@ -216,9 +227,9 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -216,9 +227,9 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * Returns number of menu's in this menu bar
* *
* @return DOCUMENT ME! * @return number of menu's in this menu bar
*/ */
public int getMenuCount() public int getMenuCount()
{ {
...@@ -226,9 +237,12 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -226,9 +237,12 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* Returns selection model for this menu bar. * Returns selection model for this menu bar. SelectionModel
* keeps track of the selected menu in the menu bar. Whenever
* selected property of selectionModel changes, the ChangeEvent
* will be fired its ChangeListeners.
* *
* @return selection mdoel for this menu bar. * @return selection model for this menu bar.
*/ */
public SingleSelectionModel getSelectionModel() public SingleSelectionModel getSelectionModel()
{ {
...@@ -319,9 +333,10 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -319,9 +333,10 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * A string that describes this JMenuBar. Normally only used
* for debugging.
* *
* @return DOCUMENT ME! * @return A string describing this JMenuBar
*/ */
protected String paramString() protected String paramString()
{ {
...@@ -329,11 +344,13 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -329,11 +344,13 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * Process key events forwarded from MenuSelectionManager. This method
* doesn't do anything. It is here to conform to the MenuElement interface.
*
* @param event event forwarded from MenuSelectionManager
* @param path path to the menu element from which event was generated
* @param manager MenuSelectionManager for the current menu hierarchy
* *
* @param e DOCUMENT ME!
* @param path DOCUMENT ME!
* @param manager DOCUMENT ME!
*/ */
public void processKeyEvent(KeyEvent e, MenuElement[] path, public void processKeyEvent(KeyEvent e, MenuElement[] path,
MenuSelectionManager manager) MenuSelectionManager manager)
...@@ -342,11 +359,13 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -342,11 +359,13 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * Process mouse events forwarded from MenuSelectionManager. This method
* doesn't do anything. It is here to conform to the MenuElement interface.
*
* @param event event forwarded from MenuSelectionManager
* @param path path to the menu element from which event was generated
* @param manager MenuSelectionManager for the current menu hierarchy
* *
* @param event DOCUMENT ME!
* @param path DOCUMENT ME!
* @param manager DOCUMENT ME!
*/ */
public void processMouseEvent(MouseEvent event, MenuElement[] path, public void processMouseEvent(MouseEvent event, MenuElement[] path,
MenuSelectionManager manager) MenuSelectionManager manager)
...@@ -355,7 +374,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -355,7 +374,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * This method overrides removeNotify() in the Container to
* unregister this menu bar from the current keyboard manager.
*/ */
public void removeNotify() public void removeNotify()
{ {
...@@ -364,9 +384,10 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -364,9 +384,10 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * Sets painting status of the border. If 'b' is true then menu bar's
* border will be painted, and it will not be painted otherwise.
* *
* @param b DOCUMENT ME! * @param b indicates if menu bar's border should be painted.
*/ */
public void setBorderPainted(boolean b) public void setBorderPainted(boolean b)
{ {
...@@ -381,27 +402,38 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement ...@@ -381,27 +402,38 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
} }
/** /**
* DOCUMENT ME! * Sets help menu for this menu bar
* *
* @param menu DOCUMENT ME! * @param menu help menu
*/ */
public void setHelpMenu(JMenu menu) public void setHelpMenu(JMenu menu)
{ {
} }
/** /**
* DOCUMENT ME! * Sets the menu bar's "margin" bound property, which represents
* distance between the menubar's border and its menus.
* icon. When marging property is modified, PropertyChangeEvent will
* be fired to menuBar's PropertyChangeListener's.
*
* @param m distance between the menubar's border and its menus.
* *
* @param m DOCUMENT ME!
*/ */
public void setMargin(Insets m) public void setMargin(Insets m)
{ {
if (m.equals(this.margin))
{
Insets oldMargin = this.margin;
this.margin = m;
firePropertyChange(MARGIN_CHANGED_PROPERTY, oldMargin, margin);
}
this.margin = m; this.margin = m;
} }
/** /**
* Changes menu bar's selection to the specifies menu. * Changes menu bar's selection to the specified menu.
* This method updates selected index of menu bar's model, * This method updates selected index of menu bar's selection model,
* which results in a model firing change event. * which results in a model firing change event.
* *
* @param sel menu to select * @param sel menu to select
......
...@@ -150,26 +150,11 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -150,26 +150,11 @@ public class JMenuItem extends AbstractButton implements Accessible,
setMnemonic(mnemonic); setMnemonic(mnemonic);
} }
/**
* DOCUMENT ME!
*
* @param stream DOCUMENT ME!
*
* @throws IOException DOCUMENT ME!
* @throws ClassNotFoundException DOCUMENT ME!
*/
private void readObject(ObjectInputStream stream) private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException throws IOException, ClassNotFoundException
{ {
} }
/**
* DOCUMENT ME!
*
* @param stream DOCUMENT ME!
*
* @throws IOException DOCUMENT ME!
*/
private void writeObject(ObjectOutputStream stream) throws IOException private void writeObject(ObjectOutputStream stream) throws IOException
{ {
} }
...@@ -186,10 +171,14 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -186,10 +171,14 @@ public class JMenuItem extends AbstractButton implements Accessible,
// Initializes properties for this menu item, that are different // Initializes properties for this menu item, that are different
// from Abstract button properties. // from Abstract button properties.
paint_border = false; /* NOTE: According to java specifications paint_border should be set to false,
paint_focus = false; since menu item should not have a border. However running few java programs
hori_align = JButton.LEFT; it seems that menu items and menues can have a border. Commenting
hori_text_pos = JButton.LEFT; out statement below for now. */
//borderPainted = false;
focusPainted = false;
horizontalAlignment = JButton.LEFT;
horizontalTextPosition = JButton.LEFT;
} }
/** /**
...@@ -288,9 +277,7 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -288,9 +277,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
{ {
super.configurePropertiesFromAction(action); super.configurePropertiesFromAction(action);
if (action == null) if (! (this instanceof JMenu) && action != null)
setAccelerator(null);
else
setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY))); setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
} }
...@@ -325,70 +312,76 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -325,70 +312,76 @@ public class JMenuItem extends AbstractButton implements Accessible,
public void processMouseEvent(MouseEvent event, MenuElement[] path, public void processMouseEvent(MouseEvent event, MenuElement[] path,
MenuSelectionManager manager) MenuSelectionManager manager)
{ {
// Fire MenuDragMouseEvents if mouse is being dragged.
boolean dragged = (event.getModifiers() & InputEvent.BUTTON1_MASK) != 0;
if (dragged)
processMenuDragMouseEvent(createMenuDragMouseEvent(event, path, manager));
switch (event.getID()) switch (event.getID())
{ {
case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_CLICKED:
break; break;
case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_ENTERED:
if (event.getSource() instanceof JMenuItem) if (isRolloverEnabled())
{
JMenuItem item = (JMenuItem) event.getSource();
ButtonModel model = item.getModel();
if (item.isRolloverEnabled())
model.setRollover(true); model.setRollover(true);
}
break; break;
case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_EXITED:
if (event.getSource() instanceof JMenuItem) if (isRolloverEnabled())
{
JMenuItem item = (JMenuItem) event.getSource();
ButtonModel model = item.getModel();
if (item.isRolloverEnabled())
model.setRollover(false); model.setRollover(false);
}
// for JMenu last element on the path is its popupMenu.
// JMenu shouldn't me disarmed.
if (! (path[path.length - 1] instanceof JPopupMenu) && ! dragged)
setArmed(false);
break; break;
case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_PRESSED:
if (event.getSource() instanceof JMenuItem)
{
if ((event.getModifiers() & InputEvent.BUTTON1_MASK) != 0) if ((event.getModifiers() & InputEvent.BUTTON1_MASK) != 0)
{ {
model.setArmed(true); model.setArmed(true);
model.setPressed(true); model.setPressed(true);
} }
}
break; break;
case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_RELEASED:
break; break;
case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_MOVED:
break; break;
case MouseEvent.MOUSE_DRAGGED: case MouseEvent.MOUSE_DRAGGED:
MenuDragMouseEvent e = new MenuDragMouseEvent((Component) event
.getSource(),
event.getID(),
event.getWhen(),
event.getModifiers(),
event.getX(),
event.getY(),
event.getClickCount(),
event.isPopupTrigger(),
path, manager);
processMenuDragMouseEvent(e);
break; break;
} }
} }
/** /**
* DOCUMENT ME! * Creates MenuDragMouseEvent.
* *
* @param event DOCUMENT ME! * @param event MouseEvent that occured while mouse was pressed.
* @param path DOCUMENT ME! * @param path Path the the menu element where the dragging event was
* @param manager DOCUMENT ME! * originated
* @param manager MenuSelectionManager for the current menu hierarchy.
*
* @return new MenuDragMouseEvent
*/
private MenuDragMouseEvent createMenuDragMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
{
return new MenuDragMouseEvent((Component) event.getSource(),
event.getID(), event.getWhen(),
event.getModifiers(), event.getX(),
event.getY(), event.getClickCount(),
event.isPopupTrigger(), path, manager);
}
/**
* Process key events forwarded from MenuSelectionManager.
*
* @param event event forwarded from MenuSelectionManager
* @param path path to the menu element from which event was generated
* @param manager MenuSelectionManager for the current menu hierarchy
*/ */
public void processKeyEvent(KeyEvent event, MenuElement[] path, public void processKeyEvent(KeyEvent event, MenuElement[] path,
MenuSelectionManager manager) MenuSelectionManager manager)
{ {
// TODO // Need to implement.
} }
/** /**
...@@ -426,7 +419,7 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -426,7 +419,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
*/ */
public void processMenuKeyEvent(MenuKeyEvent event) public void processMenuKeyEvent(MenuKeyEvent event)
{ {
// TODO // Need to implement.
} }
/** /**
...@@ -535,9 +528,19 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -535,9 +528,19 @@ public class JMenuItem extends AbstractButton implements Accessible,
public void menuSelectionChanged(boolean changed) public void menuSelectionChanged(boolean changed)
{ {
if (changed) if (changed)
{
model.setArmed(true); model.setArmed(true);
if (this.getParent() instanceof JPopupMenu)
((JPopupMenu) this.getParent()).setSelected(this);
}
else else
{
model.setArmed(false); model.setArmed(false);
if (this.getParent() instanceof JPopupMenu)
((JPopupMenu) this.getParent()).getSelectionModel().clearSelection();
}
} }
/** /**
...@@ -617,11 +620,6 @@ public class JMenuItem extends AbstractButton implements Accessible, ...@@ -617,11 +620,6 @@ public class JMenuItem extends AbstractButton implements Accessible,
return "JMenuItem"; return "JMenuItem";
} }
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public AccessibleContext getAccessibleContext() public AccessibleContext getAccessibleContext()
{ {
if (accessibleContext == null) if (accessibleContext == null)
......
...@@ -67,8 +67,8 @@ public class JRadioButton extends JToggleButton ...@@ -67,8 +67,8 @@ public class JRadioButton extends JToggleButton
public JRadioButton(String text, Icon icon) public JRadioButton(String text, Icon icon)
{ {
super(text, icon); super(text, icon);
paint_border = false; borderPainted = false;
content_area_filled = false; contentAreaFilled = false;
} }
......
...@@ -42,15 +42,23 @@ import java.io.ObjectOutputStream; ...@@ -42,15 +42,23 @@ import java.io.ObjectOutputStream;
import javax.accessibility.Accessible; import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole; import javax.accessibility.AccessibleRole;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/** /**
* DOCUMENT ME! * This class represents JRadioButtonMenuItem. Its behaviour is very similar
* to JRadioButton. Just like JRadioButton, user can check and uncheck this
* menu item by clicking on it. JRadioButtonMenuItem uses ToggleButtonModel
* to keep track of its selection. If the JRadioButtonMenuItem is included in
* the button group, then only one JRadioButtonMenuItem can be selected at
* one time.
*/ */
public class JRadioButtonMenuItem extends JMenuItem implements Accessible public class JRadioButtonMenuItem extends JMenuItem implements Accessible
{ {
private static final long serialVersionUID = 8482658191548521743L; private static final long serialVersionUID = 8482658191548521743L;
/** name for the UI delegate for this radio button menu item. */
private static final String uiClassID = "RadioButtonMenuItemUI"; private static final String uiClassID = "RadioButtonMenuItemUI";
/** /**
...@@ -62,9 +70,9 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -62,9 +70,9 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem with specified icon
* *
* @param icon DOCUMENT ME! * @param icon Icon to be used for this menu item
*/ */
public JRadioButtonMenuItem(Icon icon) public JRadioButtonMenuItem(Icon icon)
{ {
...@@ -72,9 +80,9 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -72,9 +80,9 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem with specified label
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
*/ */
public JRadioButtonMenuItem(String text) public JRadioButtonMenuItem(String text)
{ {
...@@ -82,9 +90,9 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -82,9 +90,9 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem using specified action
* *
* @param action DOCUMENT ME! * @param action Action for this menu item
*/ */
public JRadioButtonMenuItem(Action action) public JRadioButtonMenuItem(Action action)
{ {
...@@ -93,10 +101,10 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -93,10 +101,10 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem with specified label and icon
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
* @param icon DOCUMENT ME! * @param icon Icon for this menu item
*/ */
public JRadioButtonMenuItem(String text, Icon icon) public JRadioButtonMenuItem(String text, Icon icon)
{ {
...@@ -104,10 +112,11 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -104,10 +112,11 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem with specified label
* and marked selected if 'selected' is true.
* *
* @param text DOCUMENT ME! * @param text Text for this menu item
* @param selected DOCUMENT ME! * @param selected Selected state of this menu item
*/ */
public JRadioButtonMenuItem(String text, boolean selected) public JRadioButtonMenuItem(String text, boolean selected)
{ {
...@@ -115,10 +124,11 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -115,10 +124,11 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem with specified icon
* and given selected state
* *
* @param icon DOCUMENT ME! * @param icon Icon for this menu item
* @param selected DOCUMENT ME! * @param selected Selected state for this menu item
*/ */
public JRadioButtonMenuItem(Icon icon, boolean selected) public JRadioButtonMenuItem(Icon icon, boolean selected)
{ {
...@@ -126,11 +136,12 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -126,11 +136,12 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* Creates a new JRadioButtonMenuItem object. * Creates a new JRadioButtonMenuItem with specified label,
* icon and selected state.
* *
* @param text DOCUMENT ME! * @param text Label for this menu item
* @param icon DOCUMENT ME! * @param icon Icon to be use for this menu item
* @param selected DOCUMENT ME! * @param selected selected state of this menu item
*/ */
public JRadioButtonMenuItem(String text, Icon icon, boolean selected) public JRadioButtonMenuItem(String text, Icon icon, boolean selected)
{ {
...@@ -139,22 +150,15 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -139,22 +150,15 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
model.setSelected(selected); model.setSelected(selected);
} }
/**
* DOCUMENT ME!
*
* @param stream DOCUMENT ME!
*
* @throws IOException DOCUMENT ME!
*/
private void writeObject(ObjectOutputStream stream) throws IOException private void writeObject(ObjectOutputStream stream) throws IOException
{ {
// TODO
} }
/** /**
* DOCUMENT ME! * This method returns a name to identify which look and feel class will be
* the UI delegate for the menuItem.
* *
* @return $returnType$ DOCUMENT ME! * @return The Look and Feel classID. "JRadioButtonMenuItemUI"
*/ */
public String getUIClassID() public String getUIClassID()
{ {
...@@ -162,28 +166,26 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -162,28 +166,26 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
} }
/** /**
* DOCUMENT ME! * This method overrides JComponent.requestFocus with an empty
* implementation, since JRadioButtonMenuItems should not
* receve focus in general.
*/ */
public void requestFocus() public void requestFocus()
{ {
// TODO // Should do nothing here
} }
/** /**
* DOCUMENT ME! * A string that describes this JRadioButtonMenuItem. Normally only used
* for debugging.
* *
* @return $returnType$ DOCUMENT ME! * @return A string describing this JRadioButtonMenuItem
*/ */
protected String paramString() protected String paramString()
{ {
return "JRadioButtonMenuItem"; return "JRadioButtonMenuItem";
} }
/**
* DOCUMENT ME!
*
* @return $returnType$ DOCUMENT ME!
*/
public AccessibleContext getAccessibleContext() public AccessibleContext getAccessibleContext()
{ {
if (accessibleContext == null) if (accessibleContext == null)
...@@ -192,9 +194,6 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -192,9 +194,6 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
return accessibleContext; return accessibleContext;
} }
/**
* DOCUMENT ME!
*/
protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem
{ {
private static final long serialVersionUID = 4381471510145292179L; private static final long serialVersionUID = 4381471510145292179L;
...@@ -206,11 +205,6 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible ...@@ -206,11 +205,6 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
{ {
} }
/**
* DOCUMENT ME!
*
* @return $returnType$ DOCUMENT ME!
*/
public AccessibleRole getAccessibleRole() public AccessibleRole getAccessibleRole()
{ {
return AccessibleRole.RADIO_BUTTON; return AccessibleRole.RADIO_BUTTON;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment