Commit 4dfcdad1 by Graydon Hoare

[multiple changes]

2004-06-17  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JToolBar.java
	(name): Removed.
	(JToolBar): Use Component.setName(String) instead of doing it all
	alone.
	* javax/swing/Timer.java
	(queueEvent): Added missing modifier.

2004-06-17  Olga Rodimina  <rodimina@redhat.coom>

	* Makefile.am: Added new file.
	* Makefile.in: Re-generate.
	* javax/swing/JMenu.java:
	(insertSeparator): Implemented.
	* javax/swing/JPopupMenu.java:
	(JPopupMenu.Separator): Implemented.
	* javax/swing/MenuSelectionManager.java:
	(processMouseEvent): Use java.awt.Component
	for event source instead of javax.swing.JComponent.
	* javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java:
	New File. Implemented.

2004-06-16  David Jee  <djee@redhat.com>

	* java/awt/GridBagLayout.java
	(GetLayoutInfo): Adjust cell sizes iff parent size is not zero.
	Make sure pos_x and pos_y are never negative.

2004-04-16  Andrew Overholt  <overholt@redhat.com>

	* Makefile.am: Add new file.
	* Makefile.in: Re-generate.
	* javax/swing/JToolBar.java
	Partially implemented.
	* javax/swing/plaf/basic/BasicToolBarUI.java
	New file. Partially implemented.

2004-06-16  Graydon Hoare  <graydon@redhat.com>

	* gnu/java/awt/peer/gtk/GdkGraphics2D.java
	(setComposite): Accept AlphaComposite arguments.
	* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
	(createBufferedImage): Add new overloads.
	* gnu/java/awt/peer/gtk/GtkToolkit.java
	(createImage): Use GdkPixbufDecoder.createBufferedImage
	when useGraphics2D() is true.
	(getImage): Delegate to createImage.
	* javax/swing/JList.java
	(isSelectionEmpty):
	(getFirstVisibleIndex):
	(getLastVisibleIndex):
	(setSelectedValue):
	(ensureIndexIsVisible): New methods.
	* javax/swing/Timer.java: Reimplement.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java
	(AbstracElement): Made public, implements java.io.Serializable.
	(AttributeContext): Made public.
	(BranchElement): Likewise.
	(Content): Likewise.
	(DefaultDocumentEvent): Made public, extends
	javax.swing.undo.CompoundEdit.
	(ElementEdit): Made public, extends
	javax.swing.undo.AbstractUndoableEdit.
	(LeafElement): Made public.
	(LeafElement.LeafElement): Made public.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/JTextComponent.java: Totally reworked. Removed many
	methods (that were obviously never be intended to get included hi this
	class. Added some methods too.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/PlainDocument.java
	(serialVersionUID): New constant.
	(lineLimitAttribute): Likewise.
	(tabSizeAttribute): Likewise.
	(tabSize): New field.
	(PlainDocument): Made public.
	(PlainDocument): New constructor.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java
	(insertString): Throws BadLocationException.
	* javax/swing/text/Document.java
	(insertString): Likewise.
	* javax/swing/text/JTextComponent.java:
	Javadocs and comments cleaned up.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/event/UndoableEditListener.java: Reformatted.
	* javax/swing/text/AbstractDocument.java
	(AbstractDocument): Implements java.io.Serializable.
	(doc_list): Removed.
	(undo_list): Removed.
	(AbstractElement.serialVerionUID): New field.
	(BranchElement.serialVerionUID): Likewise.
	(DefaultDocumentEvent.serialVerionUID): Likewise.
	(ElementEdit.serialVerionUID): Likewise.
	(LeafElement.serialVerionUID): Likewise.
	(serialVerionUID): Likewise.
	(BAD_LOCATION): New constant.
	(BidiElementName): Likewise.
	(ContentElementName): Likewise.
	(ParagraphElementName): Likewise.
	(SectionElementName): Likewise.
	(ElementNameAttribute): Likewise.
	(AbstractDocument): Made protected.
	(AbstractDocument): New construtor.
	(listenerList): New field.
	(fireChangedUpdate): Implemented.
	(fireInsertUpdate): Likewise.
	(fireRemoveUpdate): Likewise.
	(fireUndoableEditUpdate): Likewise.
	(getListeners): Likewise.
	(addDocumentListener): Likewise.
	(removeDocumentListener): Likewise.
	(addUndoableEditListener): Likewise.
	(removeUndoableEditListener): Likewise.
	(getDocumentListeners): New method.
	(getUndoableEditListeners): Likewise.
	(getAsynchronousLoadPriority): Made public.
	(getBidiRootElement): Likewise.
	(setAsynchronousLoadPriority): Likewise.
	(setDocumentProperties): Likewise.
	* javax/swing/text/BadLocationException.java
	(serialVerionUID): New field.
	* javax/swing/text/DefaultCaret.java
	(changeEvent): New field.
	(listenerList): Likewise.
	(changes): Removed.
	(addChangeListener): Reimplemented.
	(removeChangeListener): Likewise.
	(getListeners): New method.
	(getChangeListeners): Likwise.
	(getComponent): Likewise.
	* javax/swing/text/GapContent.java
	(GapContent): Implements java.io.Serializable.
	(serialVerionUID): New field.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JTree.java
	(treeModel): New field.
	(JTree): New constructors, one existing one made public.
	(createTreeModel): New method.
	(addTreeExpansionListener): Likewise.
	(removeTreeExpansionListener): Likewise.
	(getTreeExpansionListeners): Likewise.
	(fireTreeCollapsed): Likewise.
	(fireTreeExpanded): Likewise.
	(addTreeSelectionListener): Likewise.
	(removeTreeSelectionListener): Likewise.
	(getTreeSelectionListeners): Likewise.
	(fireValueChanged): Likewise.
	(addTreeWillExpandListener): Likewise.
	(removeTreeWillExpandListener): Likewise.
	(getTreeWillExpandListeners): Likewise.
	(fireTreeWillCollapse): Likewise.
	(fireTreeWillExpand): Likewise.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JTree.java: Reformatted.

2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JTextArea.java: New file.
	* javax/swing/JTextField.java
	(actions): Removed.
	(notifyAction): New constant.
	(columns): New field.
	(JTextField): New constructors.
	(createDefaultModel): New method.
	(addActionListener): Reimplmemented.
	(removeActionListener): Reimplemented.
	(getActionListeners): New method.
	(fireActionPerformed): New method.
	(getColumns): New method.
	(setColumne): New method.
	* javax/swing/text/JTextComponent.java
	(AccessibleJTextComponent.serialVersionUID): New field.
	(serialVersionUID): Likewise.
	(DEFAULT_KEYMAP): Likewise.
	(FOCUS_ACCELERATOR_KEY): Likewise.
	(doc): Made private.
	(icon_gap): Likewise.
	(icon): Likewise.
	(align): Likewise.
	(JTextComponent): Some constructors removed.
	(getScrollableTracksViewportHeight): New method.
	(getScrollableTracksViewportWidth): Likewise.
	* Makefile.am: Added javax/swing/JTextArea.java.
	* Makefile.in: Regenerated.

2004-06-15  Graydon Hoare  <graydon@redhat.com>

	* javax/swing/ImageIcon.java (ImageIcon): New constructor.
	* javax/swing/JFrame.java (defaultLookAndFeelDecorated): New property.
	* javax/swing/JViewport.java
	(getExtentSize): Return size rather than preferred size.
	(toViewCoordinates): New methods.
	(getViewSize): Return size rather than preferred size.
	(setViewSize): Note view size as set.
	* javax/swing/ViewportLayout.java (layoutContainer): Reimplement.
	* javax/swing/plaf/basic/BasicScrollBarUI.java
	(getPreferredSize): Don't redo layout.
	* javax/swing/plaf/basic/BasicViewportUI.java
	(paint): Translate image properly and eat exceptions.

2004-06-15  Kim Ho  <kho@redhat.com>

	* javax/swing/JTabbedPane.java
	(setComponent): Remove old component and
	add new component.
	(setSelectedIndex): Don't operate on the
	components if they're null. Don't set index
	on the model if the index is the same.
	(insertTab): Don't add or hide the component
	if it's null. Repaint the container.
	* javax/swing/plaf/basic/BasicLookAndFeel.java
	Change colors for TabbedPane.
	* javax/swing/plaf/basic/BasicTabbedPaneUI.java
	(mousePressed): Re-layout and paint the component.
	(layoutContainer): Don't set location on the view.
	(ScrollingViewport::paint): Remove.

2004-06-14  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(gtkWidgetDispatchKeyEvent): Change warning message to comment.

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString):
	Wrap baseline y value in PANGO_PIXELS macro, rather than simply
	dividing by PANGO_SCALE.  Call gdk_flush before leaving GDK
	critical region.
	(drawLine): Call gdk_flush before leaving GDK critical region.
	(fillRect): Likewise.
	(drawRect): Likewise.
	(copyArea): Likewise.
	(copyPixmap): Likewise.
	(clearRect): Likewise.
	(drawArc): Likewise.
	(drawPolyline): Likewise.
	(drawPolygon): Likewise.
	(fillPolygon): Likewise.
	(fillArc): Likewise.
	(drawOval): Likewise.
	(fillOval): Likewise.

	* gnu/java/awt/peer/gtk/GdkFontMetrics.java (initState): Add
	style parameter.
	(GdkFontMetrics): Add style argument to initState call.
	(stringWidth(String,int,int,String)): Add style parameter.
	(stringWidth(String)): Add style argument to stringWidth call.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
	(initState): Set pango font style and weight based on AWT style
	parameter.  Pass default GTK language to
	pango_context_get_metrics.  Use PANGO_PIXELS macro rather than
	simply dividing by PANGO_SCALE.
	(stringWidth): Set pango font style and weight based on AWT style
	parameter.

	* java/awt/Button.java (next_button_number): New field.
	(paramString): Change output.
	(generateName): New method.
	(getUniqueLong): New method.

2004-06-14  Kim Ho  <kho@redhat.com>

	* javax/swing/JTabbedPane.java:
	(setComponentAt): Set the component, not
	the enabled status.
	* javax/swing/plaf/basic/BasicDesktopIconUI.java
	(actionPerformed): Let deiconize catch exception.

2004-06-14  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JPopupMenu.java:
	(setVisible): Corrected location of a
	heavyweight popup menu.

2004-06-14  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/MenuSelectionManager.java:
	Ran through jalopy to fix formatting style.

2004-06-14  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JLayeredPane.java:
	(remove): Revalidate and repaint layered pane after
	the component was removed.
	javax/swing/JMenu.java:
	(setVisible): Display popup menu at the user location,
	if one was set by the user.
	(setMenuLocation): Reimplemented. Fixed javadoc.
	* javax/swing/JMenuBar.java: Added javadoc.
	(BORDER_PAINTED_CHANGED_PROPERTY): New Property.
	(MODEL_CHANGED_PROPERTY): New Property.
	(isSelected): Implemented.
	(setBorderPainted): Fire PropertyChangeEvent
	if paintBorder property changes.
	(setSelected): Implemented.
	(setSelectionModel): Implemented.
	* javax/swing/JPopupMenu.java: Added Javadoc
	(pack): Implemented.
	(setVisible): Reimplemented.
	(show): Fixed location.
	(JPopupMenu.LigthWeightPopup): Reimplemented to use
	Container instead of JPanel.
	* javax/swing/MenuSelectionManager.java: Added Javadocs.
	(clearSelectedPath): Reimplemented to clear selectedPath
	in reverse order.
	(processMouseEvent): Reimplemented.
	(setSelectedPath): Fire stateChange event indicating that
	selected menu path has changed.
	(getPath): Change to use ArrayList instead of Vector.
	* javax/swing/plaf/basic/BasicMenuBarUI.java:
	(installUI): call installKeyboardActions().
	(uninstallUI): call uninstallKeyboardActions().

2004-06-13  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/DefaultCaret.java,
	javax/swing/text/BadLocationException.java:
	Reformatted.

2004-06-12  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkTextAreaPeer.java (DEFAULT_ROWS,
	DEFAULT_COLS): New variables.
	(create): Don't allow 0 rows or 0 columns.  Instead, set the
	values to DEFAULT_ROWS or DEFAULT_COLS.
	(getMinimumSize): Likewise.
	(getPreferredSize): Likewise.
	(minimumSize): Likewise.
	(preferredSize): Likewise.
	(create): Set peer's editable state.
	* java/awt/TextArea.java (TextArea()): Set rows and columns to
	zero.  Update javadocs.
	(TextArea(String)): Likewise.
	(TextArea(int,int)): Fix javadocs.
	(TextArea(String,int,int,int)): Only throw exception if one of
	rows or columns is zero.  Fix javadocs.

2004-06-11  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/AWTEvent.java (toString): Handle MenuComponents in
	addition to Components.

	* java/awt/MenuItem.java (dispatchEventImpl): If the event
	wasn't consumed by normal processing, send it to the parent
	menu.

	* gnu/java/awt/peer/gtk/GtkImagePainter.java
	(setPixels(int,int,int,int,ColorModel,int[],int,int)): Remove
	translation.

2004-06-11  David Jee  <djee@redhat.com>

	* java/awt/MediaTracker.java
	(addImage(Image,int)): Call imageUpdate() to udpate image status.
	(addImage(Image,int,int,int)): Likewise.

2004-06-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java,
	javax/swing/text/Document.java,
	javax/swing/text/GapContent.java,
	javax/swing/text/JTextComponent.java,
	javax/swing/text/PlainDocument.java:
	Reformatted.

2004-06-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JRootPane.java
	(AccessibleJRootPane.serialVersionUID): New field.
	(AccessibleJRootPane.AccessibleJRootPane): New constructor.
	(AccessibleJRootPane.getAccessibleRole): New method.
	(RootLayout): Implements Serializable.
	(RootLayout.serialVersionUID): New field.
	(RootLayout.RootLayout): New constructor.
	(setJMenuBar): Made public.
	(getJMenuBar): Likewise.
	(JRootPane): Likewise.
	(createContentPane): Likewise.
	(createGlassPane): Likewise.
	(createLayeredPane): Likewise.

2004-06-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/SwingUtilities.java
	(isLeftMouseButton): Fixed javadoc.
	(isMiddleMouseButton): Likewise.
	(isRightMouseButton): Likewise.

2004-06-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JScrollPane.java
	(serialVersionUID): New field.
	(columnHeader): Made protected.
	(rowHeader): Likewise.
	(lowerLeft): Likewise.
	(lowerRight): Likewise.
	(upperLeft): Likewise.
	(upperRight): Likewise.
	(horizontalScrollBar): Likewise.
	(horizontalScrollBarPolicy): Likewise.
	(verticalScrollBar): Likewise.
	(verticalScrollBarPolicy): Likewise.
	(viewport): Likewise.

2004-06-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/LookAndFeel.java: Fixed javadocs.

2004-06-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JEditorPane.java: Fixed javadocs.
	(JEditorPane): Removed redundant call to to this().
	(fireHyperlinkUpdate): Implemented.

2004-06-10  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JMenu.java: Fixed file name
	in the file comment.

2004-06-10  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JMenu.java: Added javadoc.
	(JMenu): Added MenuChangeListener to listen to
	ChangeEvents occuring in menu's model.
	(insert): Throw IllegalArgumentException if
	index is less than 0
	(setSelected): Reimplement.
	(setPopupMenuVisible): Call menu's model isEnabled()
	(setDelay): Throw IllegalArgumentException if
	given amount of delay is less than 0.
	(createActionComponent): Implemented.
	(createActionChangeListener): Implemented.
	(addSeparator): Implemented.
	(getItem): Throw IllegalArgumentException if index is
	less than 0.
	(getItemCount): Implemented.
	(fireMenuSelected): Changed to use menuEvent.
	(fireMenuDeselected): Likewise.
	(fireMenuCanceled): Likewise.
	(setAccelerator): Changed to throw an error if this
	method is used.
	(doClick): Implemented.
	(JMenu.ActionChangedListener): New inner class to handle
	PropertyChangeEvents occuring in the actions associated with menu.
	* javax/swing/plaf/basic/BasicMenuUI.java: Added javadoc.
	(BasicMenuUI): Added PropertyChangeListener to the menu.
	(createChangeListener): Implemented.
	(createMenuDragMouseListener): Likewise.
	(createMenuKeyListener): Likewise.
	(createPropertyChangeListener): Likewise.
	(uninstallListeners): Likewise.
	(BasicMenuUI.MouseInputHandler): Reimplemented.
	(BasicMenuUI.PropertyChangeHandler): New class. Not implemented yet.
	(BasicMenuUI.ChangeHandler): Likewise.
	(BasicMenuUI.MenuDragMouseHandler): Likewise.
	(BasicMenuUI.MenuKeyHandler): Likewise.

2004-06-10  David Jee  <djee@redhat.com>

	* java/awt/MediaTracker.java
	(imageUpdate): Only do notifyAll() if the image is complete.

2004-06-10  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JApplet.java:
	(getJMenuBar): Made public.
	(setJMenuBar): Likewise.
	* javax/swing/JFrame.java:
	(getJMenuBar): Made public.
	(setJMenuBar): Likewise.
	* javax/swing/JWindow.java:
	(getJMenuBar): Removed.
	(setJMenuBar): Removed.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JEditorPane.java
	(createEditorKitForContentType): Fixed visibility.
	(fireHyperlinkUpdate): Likewise.
	(getContentType): Likewise.
	(getEditorKit): Likewise.
	(getEditorKitForContentType): Likewise.
	(getPage): Likewise.
	(read): Likewise.
	(registerEditorKitForContentTyoe): Likewise.
	(replaceSelection): Likewise.
	(setContentType): Likewise.
	(setEditorKit): Likewise.
	(setPage): Likewise.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/Timer.java
	(Timer): New constructor.
	* javax/swing/plaf/basic/BasicProgressBarUI.java
	(animationTimer): Don't initialize at construction.
	(startAnimationTimer): Added since tag.
	(stopAnimationTimer): Likewise.
	(installUI): Use new Timer constructor.
	* javax/swing/plaf/basic/BasicScrollBarUI.java
	(installUI): Likewise.
	* javax/swing/plaf/basic/BasicSliderUI.java
	(installUI): Likewise.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ButtonGroup.java
	(serialVersionUID): Made private.
	(buttons): Renamed from v, added javadoc.
	(sel): Added javadoc.
	(ButtonGroup): Likewise.
	(add): Likewise.
	(remove): Likewise.
	(getElements): Likewise.
	(getSelection): Likewise.
	(setSelected): Likewise.
	(isSelected): Likewise.
	(getButtonCount): Likewise.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ButtonGroup.java,
	javax/swing/ImageIcon.java,
	javax/swing/JEditorPane.java,
	javax/swing/JRootPane.java,
	javax/swing/JTextField.java,
	javax/swing/LookAndFeel.java,
	javax/swing/plaf/basic/BasicTextUI.java:
	Reindented.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/Style.java: Added javadocs.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JComponent.java
	(fireVetoableChange): Removed redundant cast.
	* javax/swing/JLabel.java
	(getDisabledIcon): Save icon for next call.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/KeyStroke.java
	(getKeyStroke(char,boolean)): Marked deprecated.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/DefaultCellEditor.java,
	javax/swing/GrayFilter.java,
	javax/swing/event/DocumentEvent.java,
	javax/swing/text/JTextComponent.java,
	javax/swing/text/MutableAttributeSet.java:
	Reindented.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/BorderUIResource.java:
	Added serialVersionUID all over.

2004-06-10  Sascha Brawer  <brawer@dandelis.ch>

	* javax/swing/undo/UndoManager.java: Re-written from scratch.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/table/DefaultTableCellRenderer.java
	(noFocusBorder): Initialize directly.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicArrowButton.java
	(setDirection): Use method argument.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/BorderUIResource.java,
	javax/swing/plaf/ComponentUI.java,
	javax/swing/undo/CompoundEdit.java,
	javax/swing/undo/StateEdit.java:
	Fixed javadocs all over.

2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/DefaultButtonModel.java
	(ARMED): Made public final, fixed value.
	(ENABLED): Likewise.
	(PRESSED): Likewise.
	(ROLLOVER): Likewise.
	(SELECTED): Likewise.
	(stateMask): Initialize directly.
	(listenerList): Likewise.
	(mnemonic): Likewise.
	(fireStateChanged): Removed argument, use changeEvent as event.
	All places where this method is called are fixed too.
	(getActionCommant): Fixed javadoc.
	(setGroup): Fixed javadoc.
	(getGroup): New method.

2004-06-09  Olga Rodimina <rodimina@redhat.com>

	* javax/swing/AbstractButton.java
	(AbstractButton): Use init() to initialize the button.
	(init): New Method. Initializes AbstractButton.
	* javax/swing/JMenuItem.java: Documented.
	(JMenuItem): Reimplemented.
	(init): Implemented.
	(setEnabled): Changed to call super.setEnabled()
	(processMouseEvent): Reimplemented.
	(fireMenuKeyPressed): Implemented.
	(fireMenuKeyReleased): Implemented.
	(fireMenuKeyTyped): Implemented.
	(menuSelectionChanged): disarm the model if the menu item was
	deselected.
	* javax/swing/plaf/basic/BasicMenuItemUI.java:Documented.
	(getPath): Change to use ArrayList instead of Vector.
	(getPreferredSize): Renamed variable.
	(paintMenuItem): Paint margin area of menu item.
	(MouseInputHandler.mouseEntered): Set selection in MenuSelectionManager.
	(MouseInputHandler.mouseReleased): Check if mouse was pressed inside
	menu item's bounds before clearing the selection.

2004-06-09  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
	(GtkTextComponentPeer): Set caret position to 0.
	* java/awt/TextComponent.java
	(setText): Set caret position to 0.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter):
	Handle GtkScrolledWindow separately. Fix signal handler blocking.
	(Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter):
	Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
	(Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create): Make cursor
	visible.

2004-06-09  Kim Ho  <kho@redhat.com>

	* Makefile.am: New files
	* Makefile.in: Regenerated
	* java/awt/Container.java
	(getComponentAt): Removed.
	* javax/swing/AbstractAction.java
	(ENABLED_PROPERTY): New property.
	(putValue): Fire PropertyChangeEvents.
	(setEnabled): ditto.
	(firePropertyChange): Javadoc and implement
	convenience method.
	* javax/swing/AbstractButton.java
	(setAction): Don't create PropertyChangeListener
	if new Action is null.
	(setIcon): Don't set icon till after comparing
	it.
	(configurePropertiesFromAction): Check mnemonic
	key before calling intValue().
	(createActionPropertyChangeListener): Check
	properties rather than bulk change.
	* javax/swing/DefaultDesktopManager.java:
	Implement.
	* javax/swing/DesktopManager.java:
	Jalopy and javadoc.
	* javax/swing/JComponent.java
	(fireVetoableChange): Implement.
	(paintImmediately): Use root component.
	* javax/swing/JDesktopPane.java: Implement
	* javax/swing/JInternalFrame.java: Implement
	* javax/swing/JLabel.java
	(getDisabledIcon): Return grayscaled icon if
	no disabled icon specified.
	* javax/swing/JMenuBar.java
	(getComponentAtIndex): Use getComponent
	* javax/swing/JOptionPane.java
	(getDesktopPaneForComponent): Use SwingUtilities'
	getAncestorOfClass
	(getFrameForComponent): ditto.
	* javax/swing/JSplitPane.java
	(remove): Use getComponent.
	* javax/swing/SwingUtilities.java
	(convertPoint): Implement.
	* javax/swing/plaf/basic/BasicButtonUI.java
	(paintButtonNormal): Check opaqueness before
	filling background.
	* javax/swing/plaf/basic/BasicDesktopIconUI.java:
	Implement
	* javax/swing/plaf/basic/BasicDesktopPaneUI.java:
	Implement.
	* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:
	Implement.
	* javax/swing/plaf/basic/BasicInternalFrameUI.java:
	Implement.
	* javax/swing/plaf/basic/BasicLookAndFeel.java:
	Change InternalFrame and Desktop colors.

2004-06-09  David Jee  <djee@redhat.com>

	* java/awt/Container.java
	(remove): Do not set component to invisible.

2004-06-09  Michael Koch  <konqueror@gmx.de>

	* javax/swing/tree/DefaultMutableTreeNode.java
	(getLeafCount): Renamed enum to e.

2004-06-09  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicSplitPaneDivider.java
	(positionForMouseEvent): Removed redundant semicolon.
	(continueDrag): Use method arguments.

2004-06-09  Michael Koch  <konqueror@gmx.de>

	* javax/swing/border/TitledBorder.java,
	javax/swing/filechooser/FileSystemView.java,
	javax/swing/plaf/basic/BasicButtonListener.java,
	javax/swing/plaf/basic/BasicGraphicsUtils.java,
	javax/swing/plaf/basic/BasicLabelUI.java,
	javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java,
	javax/swing/plaf/basic/BasicScrollBarUI.java,
	javax/swing/plaf/basic/BasicScrollPaneUI.java,
	javax/swing/plaf/basic/BasicSliderUI.java,
	javax/swing/plaf/basic/BasicTabbedPaneUI.java,
	javax/swing/plaf/basic/BasicToggleButtonUI.java,
	javax/swing/table/JTableHeader.java,
	javax/swing/text/AbstractDocument.java,
	javax/swing/text/DefaultCaret.java,
	javax/swing/text/StyledEditorKit.java,
	javax/swing/tree/DefaultTreeCellEditor.java:
	Reworked import statements.

2004-06-08  Graydon Hoare  <graydon@redhat.com>

	* javax/swing/Box.java: Temporarily comment out code
	broken due to visibility bug.

2004-06-09  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ImageIcon.java
	(ImageIcon): Added missing constructor.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JToggleButton.java
	(JToggleButton): New constructor.
	(getAccessibleContext): Moved documentation into javadoc.
	(getUIClassID): Likewise.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/AbstractButton.java
	(getDisabledIcon): Create disabled icon if none exists yet.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicLookAndFeel.java
	(initClassDefaults): Added FormattedTextFieldUI.
	(loadResourceBundle): Renamed enum to e.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/plaf/basic/BasicButtonUI.java
	(paintIcon): Simplified.
	(paintText): Paint disabled button correctly.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JComponent.java
	(createToolTip): Use official JToolTip API.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JToolTip.java
	(JToolTip): No arguments in API.
	(setTipText): New method.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/SwingUtilities.java
	(isLeftMouseButton): New method.
	(isMiddleMouseButton): New method.
	(isRightMouseButton): New method.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/AbstractButton.java,
	javax/swing/CellRendererPane.java,
	javax/swing/JCheckBoxMenuItem.java,
	javax/swing/JColorChooser.java,
	javax/swing/JComboBox.java,
	javax/swing/JComponent.java,
	javax/swing/JDesktopPane.java,
	javax/swing/JFileChooser.java,
	javax/swing/JMenu.java,
	javax/swing/JMenuItem.java,
	javax/swing/JOptionPane.java,
	javax/swing/JPasswordField.java,
	javax/swing/JPopupMenu.java,
	javax/swing/JProgressBar.java,
	javax/swing/JRadioButtonMenuItem.java,
	javax/swing/JScrollBar.java,
	javax/swing/JSeparator.java,
	javax/swing/JSlider.java,
	javax/swing/JSplitPane.java,
	javax/swing/JTabbedPane.java,
	javax/swing/JTextField.java,
	javax/swing/JToolBar.java,
	javax/swing/text/JTextComponent.java:
	Fixed all constructors of accessibility classes.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ScrollPaneLayout.java: Renamed all memeber variables all
	over.

2004-06-08  Michael Koch  <konqueror@gmx.de>

	* javax/swing/Box.java
	(AccessibleBoxFiller): Extends AccessibleAWTComponent.
	(AccessibleBoxFiller.serialVersionUID): New member variable.
	* javax/swing/DefaultButtonModel.java
	(stateMask): Made protected.
	(listenerList): Likewise.
	(changeEvent): Likewise.
	(group): Likewise.
	(mnemonic): Likewise.
	(actionCommand): Likewise.
	(getListeners): New method.
	(getActionListeners): New method.
	(getItemListeners): New method.
	(getChangeListeners): New method.
	(fireItemStateChanged): Simplified.
	(fireActionPerformed): Simplified.
	(fireStateChanged): Simplified.
	* javax/swing/JFrame.java
	(JFrame): Implements WindowContants.
	(HIDE_ON_CLOSE): Removed.
	(EXIT_ON_CLOSE): Removed.
	(DISPOSE_ON_CLOSE): Removed.
	(DO_NOTHING_ON_CLOSE): Removed.
	(processWindowEvent): Exit with code 0.
	(setDefaultCloseOperation): Do security check before setting value.
	* javax/swing/JOptionPane.java
	(message): Initialize only in constructor.
	* javax/swing/JToolTip.java: Removed unused imports.
	* javax/swing/JViewport.java
	(serialVersionUID): New member variable.
	(SIMPLE_SCROLL_MODE): Made final, fixed value.
	(BLIT_SCROLL_MODE): Likewise.
	(BACKINGSTORE_SCROLL_MODE): Likewise.
	(scrollUnderway): Made protected.
	(isViewSizeSet): Likewise.
	* javax/swing/ListModel.java: Fixed javadoc.
	* javax/swing/Popup.java: Likewise.
	* javax/swing/RepaintManager.java
	(paintDirtyRegions): Don't use internal classes of
	java.util.AbstractMap.
	* javax/swing/ScrollPaneConstants.java: Reindented.
	* javax/swing/ScrollPaneLayout.java
	(viewport): Made protected.
	(verticalScrollBar): Made protected, renamed to vsb.
	(horizontalScrollBar): Made protected, renamed to hsb.
	(rowHeader): Made protected, renamed to rowHead.
	(columnHeader): Made protected, renamed to colHead.
	(lowerLeft): Made protected.
	(lowerRight): Made protected.
	(upperLeft): Made protected.
	(upperRight): Made protected.
	(verticalScrollBarPolicy): Made protected, renamed to vsbPolicy.
	(horizontalScrollBarPolicy): Made protected, renamed to hsbPolicy.

2004-06-07  Bernd Schmidt  <bernds@btinternet.com>

	* java/awt/MediaTracker.java (imageUpdate): Only set status to
	LOADING if flags has SOMEBITS set.

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

	* javax/swing/AbstractButton.java: Reorganized imports.
	* javax/swing/ActionMap.java: Likewise.
	* javax/swing/DefaultButtonModel.java: Likewise.
	* javax/swing/DefaultListModel.java: Likewise.
	* javax/swing/ImageIcon.java: Likewise.
	(serialVersionUID): New member variable.
	* javax/swing/JComboBox.java: Reorganized imports.
	* javax/swing/JComponent.java: Likewise.
	(ui): Made protected.
	(listenerList): Made protected.
	(TOOL_TIP_TEXT_KEY): New constant.
	(scrollRectToVisible): Removed redundant null check.
	* javax/swing/JFrame.java: Reorganized imports.
	* javax/swing/JInternalFrame.java: Reorganized imports.
	* javax/swing/JProgressBar.java: Likewise.
	* javax/swing/JRootPane.java: Likewise.
	* javax/swing/JScrollBar.java: Likewise.
	* javax/swing/JSeparator.java: Likewise.
	* javax/swing/JSlider.java: Likewise.
	* javax/swing/JTabbedPane.java: Likewise.
	* javax/swing/JTextField.java: Likewise.
	* javax/swing/JToolBar.java: Likewise.
	* javax/swing/JTree.java: Likewise.
	* javax/swing/JViewport.java: Likewise.
	* javax/swing/JWindow.java: Likewise.
	* javax/swing/KeyStroke.java: Likewise.
	* javax/swing/LookAndFeel.java: Likewise.
	* javax/swing/MenuSelectionManager.java: Likewise.
	* javax/swing/SwingUtilities.java: Likewise.
	* javax/swing/Timer.java: Likewise.
	* javax/swing/DefaultBoundedRangeModel.java: Fixed javadoc.
	* javax/swing/JList.java
	(HORIZONTAL_WRAP): Made final, fixed value.
	(VERTICAL): Likewise.
	(VERTICAL_WRAP): Likewise.

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

	* javax/swing/AbstractButton.java
	(serialVersionUID): New member variable.
	(AccessibleAbstractButton.serialVersionUID): Likewise.
	(AbstractButton): Made public.
	* javax/swing/Box.java
	(AccessibleBox.serialVersionUID): New member variable.
	(Filler.serialVersionUID): Likewise.
	* javax/swing/DefaultListSelectionModel.java
	(serialVersionUID): Likewise.
	* javax/swing/JApplet.java
	(serialVersionUID): Likewise.
	* javax/swing/JCheckBox.java
	(serialVersionUID): Likewise.
	* javax/swing/JCheckBoxMenuItem.java
	(serialVersionUID): Likewise.
	(AccessibleJCheckBoxMenuItem.serialVersionUID): Likewise.
	* javax/swing/JColorChooser.java
	(serialVersionUID): Likewise.
	(AccessibleJColorChooser.serialVersionUID): Likewise.
	* javax/swing/JComponent.java
	(serialVersionUID): Made private.
	(AccessibleJComponent.serialVersionUID): New member variable.
	* javax/swing/JDesktopPane.java
	(serialVersionUID): Likewise.
	* javax/swing/JDialog.java
	(serialVersionUID): Likewise.
	* javax/swing/JFormattedTextField.java
	(serialVersionUID): Fixed value.
	* javax/swing/JFrame.java
	(serialVersionUID): New member variable.
	(getDefaultCloseOpertation): Made public.
	* javax/swing/JLayeredPane.java
	(serialVersionUID): Likewise.
	(LAYER_PROPERTY): Made final, fixed value.
	(JLayeredPane): Made public.
	* javax/swing/JMenu.java
	(AccessibleJMenu.serialVersionUID): New member variable.
	(WinListener.serialVersionUID): Likewise.
	* javax/swing/JMenuBar.java
	(serialVersionUID): Likewise.
	(getComponentAtIndex): Added @deprecated tag.
	* javax/swing/JMenuItem.java
	(serialVersionUID): New member variable.
	(AccessibleJMenuItem.serialVersionUID): Likewise.
	* javax/swing/JOptionPane.java
	(serialVersionUID): Likewise.
	(AccessibleJOptionPane.serialVersionUID): Likewise.
	* javax/swing/JPopupMenu.java
	(serialVersionUID): Likewise.
	(AccessibleJPopupMenu.serialVersionUID): Likewise.
	(getPopupMenuListeners): New method.
	(getComponentAtIndex): Added @deprecated tag.
	* javax/swing/JProgressBar.java
	(serialVersionUID): New member variable.
	(AccessibleJProgressBar.serialVersionUID): Likewise.
	* javax/swing/JRadioButton.java
	(serialVersionUID): Likewise.
	* javax/swing/JRadioButtonMenuItem.java
	(serialVersionUID): Likewise.
	(AccessibleJRadioButtonMenuItem.serialVersionUID): Likewise.
	* javax/swing/JScrollBar.java
	(serialVersionUID): Likewise.
	(AccessibleJScrollBar.serialVersionUID): Likewise.
	* javax/swing/JSeparator.java
	(serialVersionUID): Likewise.
	(AccessibleJSeparator.serialVersionUID): Likewise.
	* javax/swing/JSlider.java: Fixed javadocs.
	(AccessibleJSlider.serialVersionUID): New member variable.
	* javax/swing/JSplitPane.java: Added copyright statement.
	(serialVersionUID): New member variable.
	(AccessibleJSplitPane.serialVersionUID): Likewise.
	* javax/swing/JTabbedPane.java
	(serialVersionUID): Likewise.
	(AccessibleJTabbedPane.serialVersionUID): Likewise.
	(ModelListener.serialVersionUID): Likewise.
	(ModelListener.ModelListener): New constructor.
	(SCROLL_TAB_LAYOUT): Made public final, fixed value.
	(WRAP_TAB_LAYOUT): Likewise.
	* javax/swing/JTable.java
	(serialVersionUID): New member variable.
	* javax/swing/JToggleButton.java
	(serialVersionUID): Likewise.
	(ToggleButtonModel): Made static.
	(ToggleButtonModel.serialVersionUID): New member variable.
	* javax/swing/JToolTip.java
	(serialVersionUID): Likewise.
	* javax/swing/JTree.java
	(serialVersionUID): Likewise.
	* javax/swing/JWindow.java
	(serialVersionUID): Likewise.
	* javax/swing/Timer.java
	(serialVersionUID): Likewise.

2004-06-06  Michael Koch  <konqueror@gmx.de>

	* javax/swing/SwingConstants.java
	(NEXT): New constant.
	(PREVIOUS): Likewise.
	* javax/swing/UIManager.java
	(LookAndFeel): Made public.
	(LookAndFeel.getClassName): Likewise.
	(LookAndFeel.getName): Likewise.

2004-06-02  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/JCheckBoxMenuItem.java:
	Removed CVS tags.
	* javax/swing/JMenu.java: Likewise.
	* javax/swing/JMenuBar.java: Likewise.
	* javax/swing/JMenuItem.java: Likewise.
	* javax/swing/JPopupMenu.java: Likewise.
	* javax/swing/JRadioButtonMenuItem.java: Likewise.
	* javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java:Likewise.
	* javax/swing/plaf/basic/BasicMenuBarUI.java: Likewise.
	* javax/swing/plaf/basic/BasicMenuItemUI.java: Likewise.
	* javax/swing/plaf/basic/BasicMenuUI.java: Likewise.
	* javax/swing/plaf/basic/BasicPopupMenuUI.java: Likewise.
	* javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java: Likewise.

2004-05-31  Olga Rodimina  <rodimina@redhat.com>

	* javax/swing/plaf/basic/BasicMenuUI.java:
	(MouseEntered): Do not call getPath() from MenuSelectionManager.
	Call getPath() from super class instead.

2004-05-31  David Jee  <djee@redhat.com>

	* java/awt/Container.java
	(remove): Set component visibility to false after removing it.

2004-05-27  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/Component.java (getForeground): Return SystemColor if
	parent is null.
	(getBackground): Likewise.

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
	(item_highlighted): New function.
	(connectSignals): Set item_highlighted as list's select
	function.

	* java/applet/Applet.java: Revert changes from 2004-04-29,
	2004-03-15 and 2004-03-14.

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString):
	Divide baseline y coordinate by PANGO_SCALE, not DPI conversion
	factor.

	* gnu/java/awt/peer/gtk/GtkTextAreaPeer.java (create): Set
	"Dialog" as the default font.
	* gnu/java/awt/peer/gtk/GtkTextFieldPeer.java (create):
	Likewise.
	* java/awt/Component.java (getFont): Return "Dialog" font by
	default.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c:
	Multiply size argument to pango_font_description_set_size by the
	DPI conversion factor rather than by PANGO_SCALE.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c: Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString):
	Divide baseline y coordinate by DPI conversion factor rather
	than by PANGO_SCALE.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c
	(area_prepared): Fix typo.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
	(gtkSetFont): Move gtk_bin_get_child inside GDK critical region.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
	(dpi_conversion_factor): New global variable.
	(init_dpi_conversion_factor): New function to calculate and
	track DPI conversion factor.
	(dpi_changed_cb): New callback.
	* jni/gtk-peer/gtkpeer.h (dpi_conversion_factor): Declare.

2004-05-27  David Jee  <djee@redhat.com>

	* gnu/java/awt/peer/gtk/GtkComponentPeer.java
	(getGraphics): Return a new GdkGraphics instance.
	* gnu/java/awt/peer/gtk/GtkContainerPeer.java
	(getGraphics): Call super.getGraphics().

2004-05-26  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(setNativeBounds): Clamp width and height values to >= 0.

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
	(find_fg_color_widget): Handle GtkOptionMenu specially.

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
	(pre_event_handler): Only post configure events to visible
	top-level windows.

2004-05-26  David Jee  <djee@redhat.com>

	* java/awt/BorderLayout.java
	(layoutContainer): Fix size calculations.

2004-05-26  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(window_wm_protocols_filter): Remove function.
	(create): Remove filter that removes WM_TAKE_FOCUS client
	messages.

From-SVN: r83324
parent 398ce3dd
......@@ -1322,7 +1322,11 @@ javax/swing/plaf/basic/BasicArrowButton.java \
javax/swing/plaf/basic/BasicButtonListener.java \
javax/swing/plaf/basic/BasicButtonUI.java \
javax/swing/plaf/basic/BasicCheckBoxUI.java \
javax/swing/plaf/basic/BasicDesktopIconUI.java \
javax/swing/plaf/basic/BasicDesktopPaneUI.java \
javax/swing/plaf/basic/BasicGraphicsUtils.java \
javax/swing/plaf/basic/BasicInternalFrameTitlePane.java \
javax/swing/plaf/basic/BasicInternalFrameUI.java \
javax/swing/plaf/basic/BasicLabelUI.java \
javax/swing/plaf/basic/BasicListUI.java \
javax/swing/plaf/basic/BasicMenuUI.java \
......@@ -1331,6 +1335,7 @@ javax/swing/plaf/basic/BasicMenuItemUI.java \
javax/swing/plaf/basic/BasicOptionPaneUI.java \
javax/swing/plaf/basic/BasicPanelUI.java \
javax/swing/plaf/basic/BasicPopupMenuUI.java \
javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java \
javax/swing/plaf/basic/BasicProgressBarUI.java \
javax/swing/plaf/basic/BasicRootPaneUI.java \
javax/swing/plaf/basic/BasicRadioButtonUI.java \
......@@ -1345,6 +1350,7 @@ javax/swing/plaf/basic/BasicSplitPaneUI.java \
javax/swing/plaf/basic/BasicTabbedPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarUI.java \
javax/swing/plaf/basic/BasicTreeUI.java \
javax/swing/plaf/basic/BasicViewportUI.java \
javax/swing/plaf/basic/BasicLookAndFeel.java \
......@@ -1444,6 +1450,7 @@ javax/swing/JRootPane.java \
javax/swing/JScrollBar.java \
javax/swing/JScrollPane.java \
javax/swing/JTabbedPane.java \
javax/swing/JTextArea.java \
javax/swing/JTextField.java \
javax/swing/JToggleButton.java \
javax/swing/JToolTip.java \
......
......@@ -1001,7 +1001,11 @@ javax/swing/plaf/basic/BasicArrowButton.java \
javax/swing/plaf/basic/BasicButtonListener.java \
javax/swing/plaf/basic/BasicButtonUI.java \
javax/swing/plaf/basic/BasicCheckBoxUI.java \
javax/swing/plaf/basic/BasicDesktopIconUI.java \
javax/swing/plaf/basic/BasicDesktopPaneUI.java \
javax/swing/plaf/basic/BasicGraphicsUtils.java \
javax/swing/plaf/basic/BasicInternalFrameTitlePane.java \
javax/swing/plaf/basic/BasicInternalFrameUI.java \
javax/swing/plaf/basic/BasicLabelUI.java \
javax/swing/plaf/basic/BasicListUI.java \
javax/swing/plaf/basic/BasicMenuUI.java \
......@@ -1010,6 +1014,7 @@ javax/swing/plaf/basic/BasicMenuItemUI.java \
javax/swing/plaf/basic/BasicOptionPaneUI.java \
javax/swing/plaf/basic/BasicPanelUI.java \
javax/swing/plaf/basic/BasicPopupMenuUI.java \
javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java \
javax/swing/plaf/basic/BasicProgressBarUI.java \
javax/swing/plaf/basic/BasicRootPaneUI.java \
javax/swing/plaf/basic/BasicRadioButtonUI.java \
......@@ -1024,6 +1029,7 @@ javax/swing/plaf/basic/BasicSplitPaneUI.java \
javax/swing/plaf/basic/BasicTabbedPaneUI.java \
javax/swing/plaf/basic/BasicTextUI.java \
javax/swing/plaf/basic/BasicToggleButtonUI.java \
javax/swing/plaf/basic/BasicToolBarUI.java \
javax/swing/plaf/basic/BasicTreeUI.java \
javax/swing/plaf/basic/BasicViewportUI.java \
javax/swing/plaf/basic/BasicLookAndFeel.java \
......@@ -1123,6 +1129,7 @@ javax/swing/JRootPane.java \
javax/swing/JScrollBar.java \
javax/swing/JScrollPane.java \
javax/swing/JTabbedPane.java \
javax/swing/JTextArea.java \
javax/swing/JTextField.java \
javax/swing/JToggleButton.java \
javax/swing/JToolTip.java \
......@@ -4545,14 +4552,14 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/JScrollBar.P .deps/javax/swing/JScrollPane.P \
.deps/javax/swing/JSeparator.P .deps/javax/swing/JSlider.P \
.deps/javax/swing/JSplitPane.P .deps/javax/swing/JTabbedPane.P \
.deps/javax/swing/JTable.P .deps/javax/swing/JTextField.P \
.deps/javax/swing/JTextPane.P .deps/javax/swing/JToggleButton.P \
.deps/javax/swing/JToolBar.P .deps/javax/swing/JToolTip.P \
.deps/javax/swing/JTree.P .deps/javax/swing/JViewport.P \
.deps/javax/swing/JWindow.P .deps/javax/swing/KeyStroke.P \
.deps/javax/swing/ListCellRenderer.P .deps/javax/swing/ListModel.P \
.deps/javax/swing/ListSelectionModel.P .deps/javax/swing/LookAndFeel.P \
.deps/javax/swing/MenuElement.P \
.deps/javax/swing/JTable.P .deps/javax/swing/JTextArea.P \
.deps/javax/swing/JTextField.P .deps/javax/swing/JTextPane.P \
.deps/javax/swing/JToggleButton.P .deps/javax/swing/JToolBar.P \
.deps/javax/swing/JToolTip.P .deps/javax/swing/JTree.P \
.deps/javax/swing/JViewport.P .deps/javax/swing/JWindow.P \
.deps/javax/swing/KeyStroke.P .deps/javax/swing/ListCellRenderer.P \
.deps/javax/swing/ListModel.P .deps/javax/swing/ListSelectionModel.P \
.deps/javax/swing/LookAndFeel.P .deps/javax/swing/MenuElement.P \
.deps/javax/swing/MenuSelectionManager.P \
.deps/javax/swing/MutableComboBoxModel.P \
.deps/javax/swing/OverlayLayout.P .deps/javax/swing/Popup.P \
......@@ -4667,8 +4674,12 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/plaf/basic/BasicButtonUI.P \
.deps/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.P \
.deps/javax/swing/plaf/basic/BasicCheckBoxUI.P \
.deps/javax/swing/plaf/basic/BasicDesktopIconUI.P \
.deps/javax/swing/plaf/basic/BasicDesktopPaneUI.P \
.deps/javax/swing/plaf/basic/BasicGraphicsUtils.P \
.deps/javax/swing/plaf/basic/BasicIconFactory.P \
.deps/javax/swing/plaf/basic/BasicInternalFrameTitlePane.P \
.deps/javax/swing/plaf/basic/BasicInternalFrameUI.P \
.deps/javax/swing/plaf/basic/BasicLabelUI.P \
.deps/javax/swing/plaf/basic/BasicListUI.P \
.deps/javax/swing/plaf/basic/BasicLookAndFeel.P \
......@@ -4677,6 +4688,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/plaf/basic/BasicMenuUI.P \
.deps/javax/swing/plaf/basic/BasicOptionPaneUI.P \
.deps/javax/swing/plaf/basic/BasicPanelUI.P \
.deps/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.P \
.deps/javax/swing/plaf/basic/BasicPopupMenuUI.P \
.deps/javax/swing/plaf/basic/BasicProgressBarUI.P \
.deps/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.P \
......@@ -4691,6 +4703,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/swing/plaf/basic/BasicTabbedPaneUI.P \
.deps/javax/swing/plaf/basic/BasicTextUI.P \
.deps/javax/swing/plaf/basic/BasicToggleButtonUI.P \
.deps/javax/swing/plaf/basic/BasicToolBarUI.P \
.deps/javax/swing/plaf/basic/BasicTreeUI.P \
.deps/javax/swing/plaf/basic/BasicViewportUI.P \
.deps/javax/swing/plaf/metal/MetalLookAndFeel.P \
......
......@@ -50,19 +50,21 @@ public class GdkFontMetrics extends FontMetrics
MAX_ADVANCE = 4;
private int[] metrics;
private native int[] initState (String fname, int size);
private native int[] initState (String fname, int style, int size);
public GdkFontMetrics (Font font)
{
super (font);
metrics = initState (font.getName (), font.getSize ());
metrics = initState (font.getName (), font.getStyle (), font.getSize ());
}
native public int stringWidth (String fname, int size, String str);
native public int stringWidth (String fname, int style, int size,
String str);
public int stringWidth (String str)
{
return stringWidth (font.getName (), font.getSize (), str);
return stringWidth (font.getName (), font.getStyle (), font.getSize (),
str);
}
public int charWidth (char ch)
......
......@@ -1260,7 +1260,18 @@ public class GdkGraphics2D extends Graphics2D
public void setComposite(Composite comp)
{
throw new java.lang.UnsupportedOperationException ();
if (comp instanceof AlphaComposite)
{
AlphaComposite a = (AlphaComposite) comp;
cairoSetOperator(a.getRule());
Color c = getColor();
setColor(new Color(c.getRed(),
c.getGreen(),
c.getBlue(),
(int) (a.getAlpha() * ((float) c.getAlpha()))));
}
else
throw new java.lang.UnsupportedOperationException ();
}
public void setRenderingHint(RenderingHints.Key hintKey,
......
......@@ -220,4 +220,31 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
dec.startProduction (bb);
return bb.getBufferedImage ();
}
public static BufferedImage createBufferedImage (URL u)
{
BufferedImageBuilder bb = new BufferedImageBuilder ();
GdkPixbufDecoder dec = new GdkPixbufDecoder (u);
dec.startProduction (bb);
return bb.getBufferedImage ();
}
public static BufferedImage createBufferedImage (byte[] imagedata, int imageoffset,
int imagelength)
{
BufferedImageBuilder bb = new BufferedImageBuilder ();
GdkPixbufDecoder dec = new GdkPixbufDecoder (imagedata, imageoffset, imagelength);
dec.startProduction (bb);
return bb.getBufferedImage ();
}
public static BufferedImage createBufferedImage (ImageProducer producer)
{
BufferedImageBuilder bb = new BufferedImageBuilder ();
producer.startProduction(bb);
return bb.getBufferedImage ();
}
}
......@@ -199,7 +199,10 @@ public class GtkComponentPeer extends GtkGenericPeer
public Graphics getGraphics ()
{
return null;
if (GtkToolkit.useGraphics2D ())
return new GdkGraphics2D (this);
else
return new GdkGraphics (this);
}
public Point getLocationOnScreen ()
......
......@@ -107,10 +107,7 @@ public class GtkContainerPeer extends GtkComponentPeer
public Graphics getGraphics ()
{
if (GtkToolkit.useGraphics2D ())
return new GdkGraphics2D (this);
else
return new GdkGraphics (this);
return super.getGraphics();
}
public void beginLayout () { }
......
......@@ -104,7 +104,7 @@ public class GtkImagePainter implements Runnable, ImageConsumer
s_width = Math.abs (sx2 - sx1);
s_height = Math.abs (sy2 - sy1);
clip = new Rectangle (sx1, sy1, s_width, s_height);
new Thread (this).start ();
}
......@@ -170,8 +170,6 @@ public class GtkImagePainter implements Runnable, ImageConsumer
offset += r.y * scansize + r.x;
r.translate (-Math.abs (clip.x - startX), -Math.abs (clip.y - startY));
width = r.width;
height = r.height;
x = r.x;
......
......@@ -47,6 +47,9 @@ import java.awt.peer.TextAreaPeer;
public class GtkTextAreaPeer extends GtkTextComponentPeer
implements TextAreaPeer
{
private static transient int DEFAULT_ROWS = 10;
private static transient int DEFAULT_COLS = 80;
native void create (int width, int height, int scrollbarVisibility);
native void gtkSetFont (String name, int style, int size);
......@@ -61,7 +64,7 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
// GtkComponent.create.
if (f == null)
{
f = new Font ("Fixed", Font.PLAIN, 12);
f = new Font ("Dialog", Font.PLAIN, 12);
awtComponent.setFont (f);
}
......@@ -72,13 +75,17 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
fm = new GdkFontMetrics (f);
TextArea ta = ((TextArea) awtComponent);
int rows = ta.getRows ();
int cols = ta.getColumns ();
int sizeRows = ta.getRows ();
int sizeCols = ta.getColumns ();
sizeRows = sizeRows == 0 ? DEFAULT_ROWS : sizeRows;
sizeCols = sizeCols == 0 ? DEFAULT_COLS : sizeCols;
int width = cols * fm.getMaxAdvance ();
int height = rows * (fm.getMaxDescent () + fm.getMaxAscent ());
int width = sizeCols * fm.getMaxAdvance ();
int height = sizeRows * (fm.getMaxDescent () + fm.getMaxAscent ());
create (width, height, ta.getScrollbarVisibility ());
setEditable (ta.isEditable ());
}
public GtkTextAreaPeer (TextArea ta)
......@@ -91,12 +98,14 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
public Dimension getMinimumSize (int rows, int cols)
{
return minimumSize (rows, cols);
return minimumSize (rows == 0 ? DEFAULT_ROWS : rows,
cols == 0 ? DEFAULT_COLS : cols);
}
public Dimension getPreferredSize (int rows, int cols)
{
return preferredSize (rows, cols);
return preferredSize (rows == 0 ? DEFAULT_ROWS : rows,
cols == 0 ? DEFAULT_COLS : cols);
}
native int getHScrollbarHeight ();
......@@ -127,8 +136,11 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
else
fm = new GdkFontMetrics (f);
width += cols * fm.getMaxAdvance ();
height += rows * (fm.getMaxDescent () + fm.getMaxAscent ());
int sizeRows = rows == 0 ? DEFAULT_ROWS : rows;
int sizeCols = cols == 0 ? DEFAULT_COLS : cols;
width += sizeCols * fm.getMaxAdvance ();
height += sizeRows * (fm.getMaxDescent () + fm.getMaxAscent ());
return new Dimension (width, height);
}
......@@ -157,8 +169,11 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
else
fm = new GdkFontMetrics (f);
width += cols * fm.getMaxAdvance ();
height += rows * (fm.getMaxDescent () + fm.getMaxAscent ());
int sizeRows = rows == 0 ? DEFAULT_ROWS : rows;
int sizeCols = cols == 0 ? DEFAULT_COLS : cols;
width += sizeCols * fm.getMaxAdvance ();
height += sizeRows * (fm.getMaxDescent () + fm.getMaxAscent ());
return new Dimension (width, height);
}
......
......@@ -54,6 +54,7 @@ public class GtkTextComponentPeer extends GtkComponentPeer
super (tc);
setText (tc.getText ());
setCaretPosition(0);
}
public native void connectSignals ();
......
......@@ -60,7 +60,7 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
// GtkComponent.create.
if (f == null)
{
f = new Font ("Fixed", Font.PLAIN, 12);
f = new Font ("Dialog", Font.PLAIN, 12);
awtComponent.setFont (f);
}
......
......@@ -129,26 +129,58 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public Image createImage (String filename)
{
return new GtkImage (new GdkPixbufDecoder (filename), null);
if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (filename);
else
{
GdkPixbufDecoder d = new GdkPixbufDecoder (filename);
GtkImage image = new GtkImage (d, null);
d.startProduction (image);
return image;
}
}
public Image createImage (URL url)
{
return new GtkImage (new GdkPixbufDecoder (url), null);
if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (url);
else
{
GdkPixbufDecoder d = new GdkPixbufDecoder (url);
GtkImage image = new GtkImage (d, null);
d.startProduction (image);
return image;
}
}
public Image createImage (ImageProducer producer)
{
return new GtkImage (producer, null);
if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (producer);
else
{
GtkImage image = new GtkImage (producer, null);
producer.startProduction (image);
return image;
}
}
public Image createImage (byte[] imagedata, int imageoffset,
int imagelength)
{
return new GtkImage (new GdkPixbufDecoder (imagedata,
imageoffset,
imagelength),
null);
if (useGraphics2D())
return GdkPixbufDecoder.createBufferedImage (imagedata,
imageoffset,
imagelength);
else
{
GdkPixbufDecoder d = new GdkPixbufDecoder (imagedata,
imageoffset,
imagelength);
GtkImage image = new GtkImage (d, null);
d.startProduction (image);
return image;
}
}
public ColorModel getColorModel ()
......@@ -175,18 +207,12 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public Image getImage (String filename)
{
GdkPixbufDecoder d = new GdkPixbufDecoder (filename);
GtkImage image = new GtkImage (d, null);
d.startProduction (image);
return image;
return createImage (filename);
}
public Image getImage (URL url)
{
GdkPixbufDecoder d = new GdkPixbufDecoder (url);
GtkImage image = new GtkImage (d, null);
d.startProduction (image);
return image;
return createImage (url);
}
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
......
......@@ -78,11 +78,6 @@ public class Applet extends Panel
private transient AppletStub stub;
/**
* The dimensions passed to this applet through its HTML tag.
*/
private transient Dimension dimensions;
/**
* The accessibility context for this applet.
*
* @serial the accessibleContext for this
......@@ -462,41 +457,6 @@ public class Applet extends Panel
s.defaultReadObject();
}
private Dimension getDimensions ()
{
if (dimensions == null)
{
int width = Integer.parseInt(stub.getParameter("width"));
int height = Integer.parseInt(stub.getParameter("height"));
dimensions = new Dimension(width, height);
}
return dimensions;
}
/**
* Returns an instance of {@link Dimension} representing the
* applet's width and height parameters.
*
* @return the applet's preferred size
*/
public Dimension preferredSize()
{
return stub == null ? super.preferredSize () : getDimensions ();
}
/**
* Returns an instance of {@link Dimension} representing the
* applet's width and height parameters.
*
* @return the applet's minimum size
*/
public Dimension minimumSize()
{
return stub == null ? super.minimumSize () : getDimensions ();
}
/**
* This class provides accessibility support for Applets, and is the
* runtime type returned by {@link #getAccessibleContext()}.
......
......@@ -238,8 +238,16 @@ public abstract class AWTEvent extends EventObject
*/
public String toString ()
{
return getClass ().getName () + "[" + paramString () + "] on "
+ ((Component) source).getName ();
String string = null;
if (source instanceof Component)
string = getClass ().getName () + "[" + paramString () + "] on "
+ ((Component) source).getName ();
else if (source instanceof MenuComponent)
string = getClass ().getName () + "[" + paramString () + "] on "
+ ((MenuComponent) source).getName ();
return string;
}
/**
......
......@@ -592,13 +592,21 @@ layoutContainer(Container target)
int x1 = i.left;
int x2 = x1 + w.width + hgap;
int x3 = Math.max(x2 + w.width + hgap, t.width - i.right - e.width);
int x3;
if (t.width <= i.right + e.width)
x3 = x2 + w.width + hgap;
else
x3 = t.width - i.right - e.width;
int ww = t.width - i.right - i.left;
int y1 = i.top;
int y2 = y1 + n.height + vgap;
int midh = Math.max(e.height, Math.max(w.height, c.height));
int y3 = Math.max(y2 + midh + vgap, t.height - i.bottom - s.height);
int y3;
if (t.height <= i.bottom + s.height)
y3 = y2 + midh + vgap;
else
y3 = t.height - i.bottom - s.height;
int hh = y3-y2-vgap;
setBounds(center, x2, y2, x3-x2-hgap, hh);
......
......@@ -81,6 +81,11 @@ private String label;
// List of ActionListeners for this class.
private transient ActionListener action_listeners;
/*
* The number used to generate the name returned by getName.
*/
private static transient long next_button_number = 0;
/*************************************************************************/
/*
......@@ -305,9 +310,24 @@ dispatchEventImpl(AWTEvent e)
protected String
paramString()
{
return ("label=" + getLabel() + ",actionCommand=" + getActionCommand()
+ "," + super.paramString());
return getName () + "," + getX () + "," + getY () + ","
+ getWidth () + "x" + getHeight () + ",label=" + getLabel ();
}
/**
* Generate a unique name for this button.
*
* @return A unique name for this button.
*/
String generateName ()
{
return "button" + getUniqueLong ();
}
private static synchronized long getUniqueLong ()
{
return next_button_number++;
}
} // class Button
......@@ -941,7 +941,7 @@ public abstract class Component
{
if (foreground != null)
return foreground;
return parent == null ? null : parent.getForeground();
return parent == null ? SystemColor.windowText : parent.getForeground();
}
/**
......@@ -982,7 +982,7 @@ public abstract class Component
{
if (background != null)
return background;
return parent == null ? null : parent.getBackground();
return parent == null ? SystemColor.window : parent.getBackground();
}
/**
......@@ -1031,7 +1031,7 @@ public abstract class Component
if (parent != null)
return parent.getFont ();
else
return new Font ("Fixed", Font.PLAIN, 12);
return new Font ("Dialog", Font.PLAIN, 12);
}
/**
......
......@@ -876,11 +876,6 @@ public class Container extends Component
{
return locate (x, y);
}
public Component getComponentAt(int index)
{
return component[index];
}
/**
* Returns the component located at the specified point. This is done
......
......@@ -790,13 +790,26 @@ public class GridBagLayout
info.rowWeights);
} // end of STEP 4
calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
// Adjust cell sizes iff parent size not zero.
if (parentDim.width > 0 && parentDim.height > 0)
{
calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
}
int totalWidth = sumIntArray(info.colWidths);
int totalHeight = sumIntArray(info.rowHeights);
info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
// Make sure pos_x and pos_y are never negative.
if (totalWidth >= parentDim.width)
info.pos_x = parentInsets.left;
else
info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
if (totalHeight >= parentDim.height)
info.pos_y = parentInsets.top;
else
info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
// DEBUG
//dumpLayoutInfo (info);
......
......@@ -81,12 +81,17 @@ public class MediaTracker implements java.io.Serializable
status = ERRORED | COMPLETE;
else if ((flags & ALLBITS) != 0)
status = COMPLETE;
else
else if ((flags & SOMEBITS) != 0)
status = LOADING;
synchronized (MediaTracker.this)
else
status = 0;
if ((status & COMPLETE) == COMPLETE)
{
MediaTracker.this.notifyAll();
synchronized (MediaTracker.this)
{
MediaTracker.this.notifyAll();
}
}
// If status is not COMPLETE then we need more updates.
return (status & COMPLETE) == 0;
......@@ -106,7 +111,8 @@ public class MediaTracker implements java.io.Serializable
e.next = head;
head = e;
// Start tracking image status.
target.checkImage(image, e);
int flags = target.checkImage(image, e);
e.imageUpdate(image, flags, -1, -1, -1, -1);
}
public void addImage(Image image, int id, int width, int height)
......@@ -119,7 +125,8 @@ public class MediaTracker implements java.io.Serializable
e.height = height;
head = e;
// Start tracking image status.
target.checkImage(image, width, height, e);
int flags = target.checkImage(image, width, height, e);
e.imageUpdate(image, flags, -1, -1, width, height);
}
public boolean checkAll()
......
......@@ -424,6 +424,11 @@ dispatchEventImpl(AWTEvent e)
&& (action_listeners != null
|| (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
processEvent(e);
// Send the event to the parent menu if it has not yet been
// consumed.
if (!e.isConsumed ())
((Menu) getParent ()).processEvent (e);
}
/**
......
......@@ -103,29 +103,33 @@ public class TextArea extends TextComponent implements java.io.Serializable
private static transient long next_text_number = 0;
/**
* Initialize a new instance of <code>TextArea</code> that is empty
* and is one row by one column. Both horizontal and vertical
* Initialize a new instance of <code>TextArea</code> that is empty.
* Conceptually the <code>TextArea</code> has 0 rows and 0 columns
* but its initial bounds are defined by its peer or by the
* container in which it is packed. Both horizontal and vertical
* scrollbars will be displayed.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless () is true,
* @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
*/
public TextArea ()
{
this ("", 1, 1, SCROLLBARS_BOTH);
this ("", 0, 0, SCROLLBARS_BOTH);
}
/**
* Initialize a new instance of <code>TextArea</code> that initially
* contains the specified text. Both horizontal and veritcal
* scrollbars will be displayed.
* Initialize a new instance of <code>TextArea</code> that contains
* the specified text. Conceptually the <code>TextArea</code> has 0
* rows and 0 columns but its initial bounds are defined by its peer
* or by the container in which it is packed. Both horizontal and
* veritcal scrollbars will be displayed.
*
* @param text The text to display in this text area.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless () is true,
* @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
*/
public TextArea (String text)
{
this (text, 1, text.length (), SCROLLBARS_BOTH);
this (text, 0, 0, SCROLLBARS_BOTH);
}
/**
......@@ -137,7 +141,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless () is true,
* @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
*/
public TextArea (int rows, int columns)
{
......@@ -154,7 +158,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless () is true,
* @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
*/
public TextArea (String text, int rows, int columns)
{
......@@ -175,7 +179,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
* SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY,
* SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless () is true,
* @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
*/
public TextArea (String text, int rows, int columns, int scrollbarVisibility)
{
......@@ -184,7 +188,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
if (GraphicsEnvironment.isHeadless ())
throw new HeadlessException ();
if (rows < 1 || columns < 0)
if (rows < 0 || columns < 0)
throw new IllegalArgumentException ("Bad row or column value");
if (scrollbarVisibility != SCROLLBARS_BOTH
......
......@@ -141,6 +141,7 @@ setText(String text)
TextComponentPeer tcp = (TextComponentPeer)getPeer();
if (tcp != null)
tcp.setText(text);
setCaretPosition(0);
}
/*************************************************************************/
......
......@@ -60,6 +60,8 @@ public abstract class AbstractAction
* enabled
*/
protected boolean enabled = true;
public static final String ENABLED_PROPERTY = "enabled";
/**
* changeSupport
......@@ -162,7 +164,12 @@ public abstract class AbstractAction
*/
public void putValue(String key, Object value)
{
store.put(key, value);
Object old = getValue(key);
if (old != value)
{
store.put(key, value);
firePropertyChange(key, old, value);
}
}
/**
......@@ -182,7 +189,11 @@ public abstract class AbstractAction
*/
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
if (enabled != this.enabled)
{
this.enabled = enabled;
firePropertyChange(ENABLED_PROPERTY, !this.enabled, this.enabled);
}
}
/**
......@@ -195,17 +206,31 @@ public abstract class AbstractAction
}
/**
* firePropertyChange
* This method fires a PropertyChangeEvent given the propertyName
* and the old and new values.
*
* @param propertyName TODO
* @param oldValue TODO
* @param newValue TODO
* @param propertyName The property that changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
*/
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue)
{
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
/**
* This convenience method fires a PropertyChangeEvent given
* the propertyName and the old and new values.
*
* @param propertyName The property that changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
*/
private void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
{
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
/**
* addPropertyChangeListener
......
......@@ -154,6 +154,8 @@ import javax.swing.text.AttributeSet;
public abstract class AbstractButton extends JComponent
implements ItemSelectable, SwingConstants
{
private static final long serialVersionUID = -937921345538462020L;
/** The icon displayed by default. */
Icon default_icon;
......@@ -292,9 +294,10 @@ public abstract class AbstractButton extends JComponent
extends AccessibleJComponent implements AccessibleAction, AccessibleValue,
AccessibleText
{
protected AccessibleAbstractButton(JComponent c)
private static final long serialVersionUID = -5673062525319836790L;
protected AccessibleAbstractButton()
{
super(c);
}
public AccessibleStateSet getAccessibleStateSet()
......@@ -459,7 +462,7 @@ public abstract class AbstractButton extends JComponent
/**
* Creates a new AbstractButton object.
*/
AbstractButton()
public AbstractButton()
{
this("",null);
}
......@@ -472,28 +475,7 @@ public abstract class AbstractButton extends JComponent
*/
AbstractButton(String txt, Icon icon)
{
text = txt;
default_icon = icon;
model = new DefaultButtonModel();
actionListener = createActionListener();
changeListener = createChangeListener();
itemListener = createItemListener();
model.addActionListener(actionListener);
model.addChangeListener(changeListener);
model.addItemListener(itemListener);
hori_align = CENTER;
hori_text_pos = TRAILING;
vert_align = CENTER;
vert_text_pos = CENTER;
paint_border = true;
content_area_filled = true;
setAlignmentX(LEFT_ALIGNMENT);
setAlignmentY(CENTER_ALIGNMENT);
addFocusListener(new ButtonFocusListener());
init (txt, icon);
updateUI();
}
......@@ -538,6 +520,32 @@ public abstract class AbstractButton extends JComponent
repaint();
}
protected void init(String text, Icon icon)
{
this.text = text;
default_icon = icon;
model = new DefaultButtonModel();
actionListener = createActionListener();
changeListener = createChangeListener();
itemListener = createItemListener();
model.addActionListener(actionListener);
model.addChangeListener(changeListener);
model.addItemListener(itemListener);
hori_align = CENTER;
hori_text_pos = TRAILING;
vert_align = CENTER;
vert_text_pos = CENTER;
paint_border = true;
content_area_filled = true;
setAlignmentX(LEFT_ALIGNMENT);
setAlignmentY(CENTER_ALIGNMENT);
addFocusListener(new ButtonFocusListener());
}
/**
* Get the action command string for this button's model.
*
......@@ -1036,15 +1044,17 @@ public abstract class AbstractButton extends JComponent
action.removePropertyChangeListener(actionPropertyChangeListener);
actionPropertyChangeListener = null;
}
actionPropertyChangeListener = createActionPropertyChangeListener(a);
}
Action old = action;
action = a;
configurePropertiesFromAction(action);
if (action != null)
{
actionPropertyChangeListener = createActionPropertyChangeListener(a);
action.addPropertyChangeListener(actionPropertyChangeListener);
addActionListener(action);
}
......@@ -1067,15 +1077,15 @@ public abstract class AbstractButton extends JComponent
* @param i The new default icon
*/
public void setIcon(Icon i)
{
if (default_icon != i)
{
Icon old = default_icon;
default_icon = i;
if (old != i)
{
firePropertyChange(ICON_CHANGED_PROPERTY, old, i);
Icon old = default_icon;
default_icon = i;
firePropertyChange(ICON_CHANGED_PROPERTY, old, i);
revalidate();
repaint();
}
}
}
/**
......@@ -1204,6 +1214,10 @@ public abstract class AbstractButton extends JComponent
*/
public Icon getDisabledIcon()
{
if (disabled_icon == null
&& default_icon instanceof ImageIcon)
disabled_icon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) default_icon).getImage()));
return disabled_icon;
}
......@@ -1375,7 +1389,8 @@ public abstract class AbstractButton extends JComponent
setIcon((Icon)(a.getValue(Action.SMALL_ICON)));
setEnabled(a.isEnabled());
setToolTipText((String)(a.getValue(Action.SHORT_DESCRIPTION)));
setMnemonic(((Integer)(a.getValue(Action.MNEMONIC_KEY))).intValue());
if (a.getValue(Action.MNEMONIC_KEY) != null)
setMnemonic(((Integer)(a.getValue(Action.MNEMONIC_KEY))).intValue());
setActionCommand((String)(a.getValue(Action.ACTION_COMMAND_KEY)));
}
}
......@@ -1433,9 +1448,21 @@ public abstract class AbstractButton extends JComponent
{
public void propertyChange(PropertyChangeEvent e)
{
Action act = (Action)(e.getSource());
AbstractButton.this.configurePropertiesFromAction(act);
}
Action act = (Action) (e.getSource());
if (e.getPropertyName().equals(AbstractAction.ENABLED_PROPERTY))
setEnabled(act.isEnabled());
else if (e.getPropertyName().equals(Action.NAME))
setText((String)(act.getValue(Action.NAME)));
else if (e.getPropertyName().equals(Action.SMALL_ICON))
setIcon((Icon)(act.getValue(Action.SMALL_ICON)));
else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION))
setToolTipText((String)(act.getValue(Action.SHORT_DESCRIPTION)));
else if (e.getPropertyName().equals(Action.MNEMONIC_KEY))
if (act.getValue(Action.MNEMONIC_KEY) != null)
setMnemonic(((Integer)(act.getValue(Action.MNEMONIC_KEY))).intValue());
else if (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY))
setActionCommand((String)(act.getValue(Action.ACTION_COMMAND_KEY)));
}
};
}
......
/* Box.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -55,8 +55,12 @@ public class Box extends JComponent implements Accessible
{
private static final long serialVersionUID = 1525417495883046342L;
protected class AccessibleBox extends AccessibleAWTContainer
protected class AccessibleBox
// FIXME: disable to make libjava compile; visibility rules are broken
// extends Container.AccessibleAWTContainer
{
private static final long serialVersionUID = -7775079816389931944L;
protected AccessibleBox()
{
}
......@@ -69,8 +73,14 @@ public class Box extends JComponent implements Accessible
public static class Filler extends JComponent implements Accessible
{
protected class AccessibleBoxFiller// extends AccessibleAWTComponent
private static final long serialVersionUID = -1204263191910183998L;
protected class AccessibleBoxFiller
// FIXME: disable to make libjava compile; visibility rules are broken
// extends Component.AccessibleAWTComponent
{
private static final long serialVersionUID = 164963348357479321L;
protected AccessibleBoxFiller()
{
}
......@@ -99,8 +109,9 @@ public class Box extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
// if (accessibleContext == null)
// accessibleContext = new AccessibleBoxFiller();
// FIXME: disable to make libjava compile; visibility rules are broken
// if (accessibleContext == null)
// accessibleContext = new AccessibleBoxFiller();
return accessibleContext;
}
......@@ -172,8 +183,8 @@ public class Box extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleBox();
// if (accessibleContext == null)
// accessibleContext = new AccessibleBox();
return accessibleContext;
}
......
/* ButtonGroup.java --
/* ButtonGroup.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -35,97 +35,145 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
public class ButtonGroup implements Serializable
{
static final long serialVersionUID = 4259076101881721375L;
Vector v = new Vector();
ButtonModel sel;
public ButtonGroup() {}
public void add(AbstractButton b)
{
b.getModel().setGroup(this);
v.addElement(b);
}
public void remove(AbstractButton b)
{
b.getModel().setGroup(null);
v.removeElement(b);
}
public Enumeration getElements() {
return v.elements();
}
public ButtonModel getSelection() {
return sel;
}
AbstractButton FindButton(ButtonModel m)
{
for (int i=0;i<v.size();i++)
{
AbstractButton a = (AbstractButton) v.get(i);
if (a.getModel()== m)
{
return a;
}
}
return null;
}
public void setSelected(ButtonModel m, boolean b)
{
if ((m == sel) &&
(b == true))
{
// clicked on sam item twice.
System.out.println("PRESSED TWICE:" + m + ", sel="+sel);
return;
}
if (sel != null)
{
System.out.println("DESELECTING: " + sel);
sel.setSelected(!b);
AbstractButton but = FindButton(sel);
if (but != null)
{
System.out.println("REPAINT-REQUIST: " + but.text);
//but.revalidate();
but.repaint();
}
}
else
{
System.out.println("NO SELECTION YET");
}
sel = m;
}
public boolean isSelected(ButtonModel m)
{
return (m == sel);
}
public int getButtonCount()
{
return v.size();
}
public class ButtonGroup
implements Serializable
{
private static final long serialVersionUID = 4259076101881721375L;
/**
* The buttons added to this button group.
*/
protected Vector buttons = new Vector();
/**
* The currently selected button model.
*/
ButtonModel sel;
/**
* Creates a new button group.
*/
public ButtonGroup()
{
}
/**
* Adds a button to this group.
*
* @param b the button to add
*/
public void add(AbstractButton b)
{
b.getModel().setGroup(this);
buttons.addElement(b);
}
/**
* Removed a given button from this group.
*
* @param b the button to remove
*/
public void remove(AbstractButton b)
{
b.getModel().setGroup(null);
buttons.removeElement(b);
}
/**
* Returns the currently added buttons.
*
* @return <code>Enumeration</code> over all added buttons
*/
public Enumeration getElements()
{
return buttons.elements();
}
/**
* Returns the currently selected button model.
*
* @return the currently selected button model,
* null if none was selected yet
*/
public ButtonModel getSelection()
{
return sel;
}
AbstractButton FindButton(ButtonModel m)
{
for (int i = 0;i < buttons.size(); i++)
{
AbstractButton a = (AbstractButton) buttons.get(i);
if (a.getModel() == m)
return a;
}
return null;
}
/**
* Sets the currently selected button model. Only one button of a group
* can be selected at a time.
*
* @param m the model to select
* @param b true if this button is to be selected, false otherwise
*/
public void setSelected(ButtonModel m, boolean b)
{
if ((m == sel) && (b == true))
{
// clicked on same item twice.
System.out.println("PRESSED TWICE:" + m + ", sel=" + sel);
return;
}
if (sel != null)
{
System.out.println("DESELECTING: " + sel);
sel.setSelected(! b);
AbstractButton but = FindButton(sel);
if (but != null)
{
System.out.println("REPAINT-REQUEST: " + but.text);
//but.revalidate();
but.repaint();
}
}
else
System.out.println("NO SELECTION YET");
sel = m;
}
/**
* Checks if the given <code>ButtonModel</code> is selected
* in this button group.
*
* @return true of given <code>ButtonModel</code> is selected,
* false otherwise
*/
public boolean isSelected(ButtonModel m)
{
return m == sel;
}
/**
* Return the number of buttons in this button group.
*
* @return the number of buttons
*
* @since 1.3
*/
public int getButtonCount()
{
return buttons.size();
}
}
......@@ -56,50 +56,30 @@ public class CellRendererPane extends Container implements Accessible
{
private static final long serialVersionUID = -7642183829532984273L;
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
/**
* AccessibleCellRendererPane
*/
protected class AccessibleCellRendererPane extends AccessibleAWTContainer {
private static final long serialVersionUID = 7300340301783504481L;
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor AccessibleCellRendererPane
* @param component TODO
*/
protected AccessibleCellRendererPane(CellRendererPane component) {
super();
// TODO
} // AccessibleCellRendererPane()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* getAccessibleRole
* @returns AccessibleRole
*/
public AccessibleRole getAccessibleRole() {
return AccessibleRole.PANEL;
} // getAccessibleRole()
} // AccessibleCellRendererPane
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/**
* AccessibleCellRendererPane
*/
protected class AccessibleCellRendererPane extends AccessibleAWTContainer
{
private static final long serialVersionUID = -8981090083147391074L;
/**
* Constructor AccessibleCellRendererPane
* @param component TODO
*/
protected AccessibleCellRendererPane()
{
}
/**
* getAccessibleRole
* @returns AccessibleRole
*/
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.PANEL;
}
}
/**
* accessibleContext
......@@ -209,16 +189,15 @@ public class CellRendererPane extends Container implements Accessible
// TODO
} // paintComponent()
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleCellRendererPane(this);
} // if
return accessibleContext;
} // getAccessibleContext()
} // CellRendererPane
/**
* getAccessibleContext
* @return AccessibleContext
*/
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleCellRendererPane();
return accessibleContext;
}
}
......@@ -41,6 +41,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.io.Serializable;
import java.util.EventListener;
......@@ -80,56 +81,52 @@ public class DefaultButtonModel implements ButtonModel, Serializable
/** Indicates that the button is <em>partially</em> committed to being
pressed, but not entirely. This usually happens when a user has pressed
but not yet released the mouse button. */
static int ARMED = 1;
public static final int ARMED = 1;
/** State constant indicating that the button is enabled. Buttons cannot
be pressed or selected unless they are enabled. */
static int ENABLED = 2;
public static final int ENABLED = 8;
/** State constant indicating that the user is holding down the button.
When this transitions from true to false, an ActionEvent may be fired,
depending on the value of the "armed" property.*/
static int PRESSED = 4;
public static final int PRESSED = 4;
/** State constant indicating that the mouse is currently positioned over
the button. */
static int ROLLOVER = 8;
public static final int ROLLOVER = 16;
/** State constant indicating that the button is selected. This constant
is only meaningful for toggle-type buttons (radio buttons,
checkboxes). */
static int SELECTED = 16;
public static final int SELECTED = 2;
/** Represents the "state properties" (armed, enabled, pressed, rollover
and selected) by a bitwise combination of integer constants. */
int stateMask;
protected int stateMask = ENABLED;
/** List of ItemListeners, ChangeListeners, and ActionListeners
registered on this model. */
EventListenerList listenerList;
protected EventListenerList listenerList = new EventListenerList();;
/** The single ChangeEvent this model (re)uses to call its
ChangeListeners. */
ChangeEvent changeEvent;
protected ChangeEvent changeEvent = new ChangeEvent(this);
/** The group this model belongs to. Only one button in a group may be
selected at any given time. */
ButtonGroup group;
protected ButtonGroup group;
/** The key code (one of {@link java.awt.event.KeyEvent} VK_*) used to
press this button via a keyboard interface. */
int mnemonic;
protected int mnemonic = KeyEvent.VK_UNDEFINED;
/** The string used as the "command" property of any ActionEvent this
model sends. */
String actionCommand;
protected String actionCommand;
public DefaultButtonModel()
{
stateMask = ENABLED;
mnemonic = java.awt.event.KeyEvent.VK_UNDEFINED;
listenerList = new EventListenerList();
changeEvent = new ChangeEvent(this);
}
/**
......@@ -144,6 +141,18 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
* Returns a specified class of listeners.
*
* @param listenerType the type of listener to return
*
* @return array of listeners
*/
public EventListener[] getListeners(Class listenerType)
{
return listenerList.getListeners(listenerType);
}
/**
* Add an ActionListener to the model. Usually only called to subscribe
* an AbstractButton's listener to the model.
*
......@@ -166,6 +175,16 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
* Returns all registered <code>ActionListener</code> objects.
*
* @return array of <code>ActionListener</code> objects
*/
public ActionListener[] getActionListeners()
{
return (ActionListener[]) listenerList.getListeners(ActionListener.class);
}
/**
* Add an ItemListener to the model. Usually only called to subscribe
* an AbstractButton's listener to the model.
*
......@@ -188,6 +207,16 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
* Returns all registered <code>ItemListener</code> objects.
*
* @return array of <code>ItemListener</code> objects
*/
public ItemListener[] getItemListeners()
{
return (ItemListener[]) listenerList.getListeners(ItemListener.class);
}
/**
* Add a ChangeListener to the model. Usually only called to subscribe
* an AbstractButton's listener to the model.
*
......@@ -210,6 +239,16 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
* Returns all registered <code>ChangeListener</code> objects.
*
* @return array of <code>ChangeListener</code> objects
*/
public ChangeListener[] getChangeListeners()
{
return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
}
/**
* Inform each ItemListener in the {@link listenerList} that an ItemEvent
* has occurred. This happens in response to any change to the {@link
* stateMask} field.
......@@ -218,9 +257,10 @@ public class DefaultButtonModel implements ButtonModel, Serializable
*/
public void fireItemStateChanged(ItemEvent e)
{
EventListener[] ll = listenerList.getListeners(ItemListener.class);
ItemListener[] ll = getItemListeners();
for (int i = 0; i < ll.length; i++)
((ItemListener)ll[i]).itemStateChanged(e);
ll[i].itemStateChanged(e);
}
/**
......@@ -233,9 +273,10 @@ public class DefaultButtonModel implements ButtonModel, Serializable
*/
public void fireActionPerformed(ActionEvent e)
{
EventListener[] ll = listenerList.getListeners(ActionListener.class);
ActionListener[] ll = getActionListeners();
for (int i = 0; i < ll.length; i++)
((ActionListener)ll[i]).actionPerformed(e);
ll[i].actionPerformed(e);
}
/**
......@@ -245,11 +286,12 @@ public class DefaultButtonModel implements ButtonModel, Serializable
*
* @param event The ChangeEvent to fire
*/
public void fireStateChanged(ChangeEvent e)
public void fireStateChanged()
{
EventListener[] ll = listenerList.getListeners(ChangeListener.class);
ChangeListener[] ll = getChangeListeners();
for (int i = 0; i < ll.length; i++)
((ChangeListener)ll[i]).stateChanged(e);
ll[i].stateChanged(changeEvent);
}
/**
......@@ -276,7 +318,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
stateMask = newstate;
fireStateChanged(changeEvent);
fireStateChanged();
if ((oldstate & SELECTED) == 0
&& (newstate & SELECTED) == SELECTED)
......@@ -418,7 +460,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
if (mnemonic != key)
{
mnemonic = key;
fireStateChanged(changeEvent);
fireStateChanged();
}
}
......@@ -434,14 +476,12 @@ public class DefaultButtonModel implements ButtonModel, Serializable
if (actionCommand != s)
{
actionCommand = s;
fireStateChanged(changeEvent);
fireStateChanged();
}
}
/**
* Set the value of the model's "actionCommand" property. This property
* is used as the "command" property of the {@link ActionEvent} fired
* from the model.
* Returns the current value of the model's "actionCommand" property.
*
* @return The current "actionCommand" property
*/
......@@ -453,7 +493,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
/**
* Set the value of the model's "group" property. The model is said to be
* a member of the {@link ButtonGroup} held in its "group" property, and
* only one models in a given group can have their "selected" property be
* only one model in a given group can have their "selected" property be
* <code>true</code> at a time.
*
* @param g The new "group" property
......@@ -463,7 +503,17 @@ public class DefaultButtonModel implements ButtonModel, Serializable
if (group != g)
{
group = g;
fireStateChanged(changeEvent);
fireStateChanged();
}
}
/**
* Returns the current value of the model's "group" property.
*
* @return The value of the "group" property
*/
public ButtonGroup getGroup()
{
return group;
}
}
......@@ -58,50 +58,34 @@ public class DefaultCellEditor
{
static final long serialVersionUID = 3564035141373880027L;
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
/**
* EditorDelegate
*/
protected class EditorDelegate implements ActionListener,
ItemListener, Serializable {
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/**
* value
*/
protected Object value;
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor EditorDelegate
* @param value0 TODO
*/
protected EditorDelegate(DefaultCellEditor editor) {
// TODO
} // EditorDelegate()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* setValue
* @param event TODO
*/
public void setValue(Object event) {
// TODO
} // setValue()
/**
* EditorDelegate
*/
protected class EditorDelegate
implements ActionListener, ItemListener, Serializable
{
private static final long serialVersionUID = -1420007406015481933L;
/**
* value
*/
protected Object value;
/**
* Constructor EditorDelegate
* @param value0 TODO
*/
protected EditorDelegate()
{
}
/**
* setValue
* @param event TODO
*/
public void setValue(Object event)
{
}
/**
* getCellEditorValue
......@@ -172,11 +156,6 @@ public class DefaultCellEditor
} // EditorDelegate
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/**
* editorComponent
*/
......@@ -192,11 +171,6 @@ public class DefaultCellEditor
*/
protected int clickCountToStart;
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor DefaultCellEditor
* @param textfield TODO
......@@ -221,11 +195,6 @@ public class DefaultCellEditor
// TODO
} // DefaultCellEditor()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* getComponent
* @returns Component
......@@ -320,6 +289,4 @@ public class DefaultCellEditor
Object value, boolean isSelected, int row, int column) {
return null; // TODO
} // getTableCellEditorComponent()
} // DefaultCellEditor
}
......@@ -62,6 +62,7 @@ public class DefaultListSelectionModel implements Cloneable,
ListSelectionModel,
Serializable
{
private static final long serialVersionUID = -5718799865110415860L;
/** The list of ListSelectionListeners subscribed to this selection model. */
protected EventListenerList listenerList = new EventListenerList();
......
/* DesktopManager.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,118 +38,140 @@ exception statement from your version. */
package javax.swing;
/**
* DesktopManager
* @author Andrew Selkirk
* @version 1.0
* DesktopManagers are responsible for implementing the behaviours for the
* JInternalFrames that belong to JDesktopPanes. Actions such as maximizing,
* minimizing, iconifying, etc will be delegated to the DesktopManager.
*/
public interface DesktopManager {
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* openFrame
* @param frame TODO
*/
void openFrame(JInternalFrame frame);
/**
* closeFrame
* @param frame TODO
*/
void closeFrame(JInternalFrame frame);
/**
* maximizeFrame
* @param frame TODO
*/
void maximizeFrame(JInternalFrame frame);
/**
* minimizeFrame
* @param frame TODO
*/
void minimizeFrame(JInternalFrame frame);
/**
* iconifyFrame
* @param frame TODO
*/
void iconifyFrame(JInternalFrame frame);
/**
* deiconifyFrame
* @param frame TODO
*/
void deiconifyFrame(JInternalFrame frame);
/**
* activateFrame
* @param frame TODO
*/
void activateFrame(JInternalFrame vframe);
/**
* deactivateFrame
* @param frame TODO
*/
void deactivateFrame(JInternalFrame frame);
/**
* beginDraggingFrame
* @param frame TODO
*/
void beginDraggingFrame(JComponent frame);
/**
* dragFrame
* @param frame TODO
* @param x TODO
* @param y TODO
*/
void dragFrame(JComponent frame, int x, int y);
/**
* endDraggingFrame
* @param frame TODO
*/
void endDraggingFrame(JComponent frame);
/**
* beginResizingFrame
* @param frame TODO
* @param direction TODO
*/
void beginResizingFrame(JComponent frame, int direction);
/**
* resizeFrame
* @param frame TODO
* @param x TODO
* @param y TODO
* @param width TODO
* @param height TODO
*/
void resizeFrame(JComponent frame, int x, int y,
int width, int height);
/**
* endResizingFrame
* @param frame TODO
*/
void endResizingFrame(JComponent frame);
/**
* setBoundsForFrame
* @param frame TODO
* @param x TODO
* @param y TODO
* @param width TODO
* @param height TODO
*/
void setBoundsForFrame(JComponent frame, int x, int y,
int width, int height);
public interface DesktopManager
{
/**
* This method will cause the JInternalFrame to be displayed in the set
* location. This usually is not needed since the user will add the
* JInternalFrame to a Container separately.
*
* @param frame The JInternalFrame to open.
*/
void openFrame(JInternalFrame frame);
/**
* This method should remove the JInternalFrame from its parent.
*
* @param frame The JInternalFrame to close.
*/
void closeFrame(JInternalFrame frame);
/**
* This method should maximize the JInternalFrame to match its parent's
* bounds.
*
* @param frame The JInternalFrame to maximize.
*/
void maximizeFrame(JInternalFrame frame);
/**
* This method should restore the JInternalFrame to its normal bounds.
*
* @param frame The JInternalFrame to minimize.
*/
void minimizeFrame(JInternalFrame frame);
/**
* This method should remove the JInternalFrame from its parent and replace
* it with a JDesktopIcon.
*
* @param frame The JInternalFrame to iconify.
*/
void iconifyFrame(JInternalFrame frame);
/**
* This method should remove the JDesktopIcon from its parent and replace it
* with the JInternalFrame that the JDesktopIcon represents.
*
* @param frame The JInternalFrame to deiconify.
*/
void deiconifyFrame(JInternalFrame frame);
/**
* This method should give focus to the JInternalFrame and its default focus
* owner.
*
* @param frame The JInternalFrame to activate.
*/
void activateFrame(JInternalFrame vframe);
/**
* This method should be called when the JInternalFrame gets deselected and
* subsequently loses focus.
*
* @param frame The JInternalFrame to deactivate.
*/
void deactivateFrame(JInternalFrame frame);
/**
* This method should be called in preparation for dragging. This needs to
* be called prior to dragFrame calls so that the DesktopManager can
* prepare any state information.
*
* @param frame The JInternalFrame to prepare for dragging.
*/
void beginDraggingFrame(JComponent frame);
/**
* This method drags the given JInternalFrame to the given x and y
* coordinates.
*
* @param frame The JInternalFrame to drag.
* @param x The new x coordinate.
* @param y The new y coordinate.
*/
void dragFrame(JComponent frame, int x, int y);
/**
* This method should be called after dragFrame calls. Any information used
* by the DesktopManager for dragging the JInternalFrame can be cleared.
*
* @param frame The JInternalFrame that finished dragging.
*/
void endDraggingFrame(JComponent frame);
/**
* This method should be called prior to any resizeFrame calls. Any state
* information needed by the DesktopManager to resize the JInternalFrame
* will be prepared here.
*
* @param frame The JInternalFrame to resize.
* @param direction One of eight directions specified by SwingConstants.
*/
void beginResizingFrame(JComponent frame, int direction);
/**
* This method is called to resize the given JInternalFrame to the given
* bounds.
*
* @param frame The JInternalFrame to resize.
* @param x The new x coordinate.
* @param y The new y coordinate.
* @param width The new width.
* @param height The new height.
*/
void resizeFrame(JComponent frame, int x, int y, int width, int height);
/**
* This method is called to signify that the resize is finished. Any
* information used to resize the JInternalFrame can now be cleared.
*
* @param frame The JInternalFrame that just finished dragging.
*/
void endResizingFrame(JComponent frame);
/**
* This method does the actual work for reshaping the JInternalFrame.
*
* @param frame The JInternalFrame to resize.
* @param x The new x coordinate.
* @param y The new y coordinate.
* @param width The new width.
* @param height The new height.
*/
void setBoundsForFrame(JComponent frame, int x, int y, int width, int height);
} // DesktopManager
......@@ -45,41 +45,41 @@ import java.awt.Toolkit;
public class GrayFilter extends RGBImageFilter
{
private boolean b;
private int p;
private boolean b;
private int p;
/**
Create a GrayFilter. If b is true then brighten. Also, indicate how much gray.
@param b if brighten
@param p percent of gray, 0 - 100
*/
public GrayFilter(boolean b, int p)
{
this.b = b; //FIXME - HANDLE THIS
this.p = p;
}
/**
* Create a GrayFilter. If b is true then brighten. Also, indicate how much gray.
*
* @param b if brighten
* @param p percent of gray, 0 - 100
*/
public GrayFilter(boolean b, int p)
{
this.b = b; //FIXME - HANDLE THIS
this.p = p;
}
/**
Create grayed image
@param i image to gray
@return a grayed image
*/
public static Image createDisabledImage(Image src)
{
return Toolkit.getDefaultToolkit().createImage( new FilteredImageSource(src.getSource(),
new GrayFilter(false, 100)));
}
/**
Filter RGB to gray
*/
public int filterRGB(int x,
int y,
int rgb)
{
return (int) ( ( p * ( 0.299 * ( (0xff0000 & rgb) >> 16) + 0.587 * ( (0xff00 & rgb) >> 8 ) + 0.114 * (0xff & rgb ) ) ));
}
/**
* Create grayed image
*
* @param src image to gray
*
* @return a grayed image
*/
public static Image createDisabledImage(Image src)
{
return (Toolkit.getDefaultToolkit().
createImage(new FilteredImageSource(src.getSource(),
new GrayFilter(false, 100))));
}
/**
* Filter RGB to gray
*/
public int filterRGB(int x, int y, int rgb)
{
return (int) (p * (0.299 * ((0xff0000 & rgb) >> 16)
+ 0.587 * ((0xff00 & rgb) >> 8) + 0.114 * (0xff & rgb)));
}
}
......@@ -35,65 +35,86 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.Serializable;
import java.net.URL;
public class ImageIcon implements Icon
public class ImageIcon
implements Icon, Serializable
{
Image image;
String file, descr;
Component observer;
private static final long serialVersionUID = 532615968316031794L;
Image image;
String file;
String descr;
Component observer;
public ImageIcon(String s)
{
// if description is not specified, then file name becomes
// desciption for this icon
this(s, s);
}
public ImageIcon(String file,
String descr)
{
this.file = file;
this.descr = descr;
image = Toolkit.getDefaultToolkit().getImage(file);
if (image == null) {
return;
}
//loadImage(image);
}
// not in SUN's spec !!!
public void setParent(Component p)
{
observer = p;
}
public Image getImage()
{ return image; }
public String getDescription()
{ return descr; }
public void setDescription(String description)
{ this.descr = description; }
public int getIconHeight()
{ return image.getHeight(observer); }
public int getIconWidth()
{ return image.getWidth(observer); }
public void paintIcon(Component c,
Graphics g,
int x,
int y)
{
g.drawImage(image, x, y, observer);
}
{
// if description is not specified, then file name becomes
// desciption for this icon
this(s, s);
}
public ImageIcon(Image image)
{
}
public ImageIcon(URL url)
{
image = Toolkit.getDefaultToolkit().getImage(url);
}
public ImageIcon(String file, String descr)
{
this.file = file;
this.descr = descr;
image = Toolkit.getDefaultToolkit().getImage(file);
if (image == null)
return;
//loadImage(image);
}
// not in SUN's spec !!!
public void setParent(Component p)
{
observer = p;
}
public Image getImage()
{
return image;
}
public String getDescription()
{
return descr;
}
public void setDescription(String description)
{
this.descr = description;
}
public int getIconHeight()
{
return image.getHeight(observer);
}
public int getIconWidth()
{
return image.getWidth(observer);
}
public void paintIcon(Component c, Graphics g, int x, int y)
{
g.drawImage(image, x, y, observer);
}
}
/* JApplet.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -51,6 +51,7 @@ import javax.accessibility.AccessibleContext;
public class JApplet extends Applet implements RootPaneContainer
{
private static final long serialVersionUID = 7269359214497372587L;
public final static int HIDE_ON_CLOSE = 0;
public final static int EXIT_ON_CLOSE = 1;
......@@ -136,10 +137,10 @@ public class JApplet extends Applet implements RootPaneContainer
{ return close_action; }
JMenuBar getJMenuBar()
public JMenuBar getJMenuBar()
{ return getRootPane().getJMenuBar(); }
void setJMenuBar(JMenuBar menubar)
public void setJMenuBar(JMenuBar menubar)
{ getRootPane().setJMenuBar(menubar); }
......
......@@ -87,6 +87,7 @@ public class JButton extends AbstractButton implements Accessible
protected void configurePropertiesFromAction(Action a)
{
//Factory method which sets the AbstractButton's properties according to values from the Action instance.
super.configurePropertiesFromAction(a);
}
public AccessibleContext getAccessibleContext()
......
/* JCheckBox.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -47,6 +47,8 @@ import javax.accessibility.AccessibleContext;
*/
public class JCheckBox extends JToggleButton
{
private static final long serialVersionUID = -5246739313864538930L;
public JCheckBox()
{
this(null, null);
......
......@@ -50,6 +50,8 @@ import javax.accessibility.AccessibleRole;
public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
Accessible
{
private static final long serialVersionUID = -6676402307973384715L;
private static final String uiClassID = "CheckBoxMenuItemUI";
private boolean state;
private Object[] selectedObjects;
......@@ -207,7 +209,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJCheckBoxMenuItem(this);
accessibleContext = new AccessibleJCheckBoxMenuItem();
return accessibleContext;
}
......@@ -217,16 +219,13 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
*/
protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem
{
private static final long serialVersionUID = 1079958073579370777L;
/**
* Creates a new AccessibleJCheckBoxMenuItem object.
*
* @param component DOCUMENT ME!
*/
protected AccessibleJCheckBoxMenuItem(JCheckBoxMenuItem component)
protected AccessibleJCheckBoxMenuItem()
{
super(component);
// TODO
}
/**
......
/* JColorChooser.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -57,6 +57,8 @@ import javax.swing.plaf.ColorChooserUI;
*/
public class JColorChooser extends JComponent implements Accessible {
private static final long serialVersionUID = 9168066781620640889L;
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
......@@ -66,6 +68,8 @@ public class JColorChooser extends JComponent implements Accessible {
*/
protected class AccessibleJColorChooser extends JComponent.AccessibleJComponent {
private static final long serialVersionUID = -2038297864782299082L;
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
......@@ -79,15 +83,9 @@ public class JColorChooser extends JComponent implements Accessible {
* Constructor AccessibleJColorChooser
* @param component TODO
*/
protected AccessibleJColorChooser(JColorChooser component) {
super(component);
// TODO
} // AccessibleJColorChooser()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
protected AccessibleJColorChooser()
{
}
/**
* getAccessibleRole
......@@ -355,16 +353,15 @@ public class JColorChooser extends JComponent implements Accessible {
return null; // TODO
} // paramString()
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJColorChooser(this);
} // if
return accessibleContext;
} // getAccessibleContext()
} // JColorChooser
/**
* getAccessibleContext
* @return AccessibleContext
*/
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJColorChooser();
return accessibleContext;
}
}
......@@ -69,39 +69,21 @@ public class JComboBox extends JComponent
{
private static final long serialVersionUID = 5654585963292734470L;
/**
* AccessibleJComboBox
*/
protected class AccessibleJComboBox extends AccessibleJComponent
implements AccessibleAction, AccessibleSelection
{
private static final long serialVersionUID = 8217828307256675666L;
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
/**
* AccessibleJComboBox
*/
protected class AccessibleJComboBox extends AccessibleJComponent
implements AccessibleAction, AccessibleSelection {
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor AccessibleJComboBox
* @param component TODO
*/
protected AccessibleJComboBox(JComboBox component) {
super(component);
// TODO
} // AccessibleJComboBox()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* Constructor AccessibleJComboBox
* @param component TODO
*/
protected AccessibleJComboBox()
{
}
/**
* getAccessibleChildrenCount
......@@ -804,16 +786,18 @@ public class JComboBox extends JComponent
return null; // TODO
} // paramString()
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJComboBox(this);
} // if
return accessibleContext;
} // getAccessibleContext()
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJComboBox();
return accessibleContext;
}
/**
* addActionListener
* @param listener TODO
......
......@@ -57,6 +57,7 @@ import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.awt.image.ImageObserver;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
......@@ -87,7 +88,7 @@ import javax.swing.plaf.ComponentUI;
*/
public abstract class JComponent extends Container implements Serializable
{
static final long serialVersionUID = -5242478962609715464L;
private static final long serialVersionUID = -7908749299918704233L;
/**
* Accessibility support is currently missing.
......@@ -101,7 +102,7 @@ public abstract class JComponent extends Container implements Serializable
protected class AccessibleFocusHandler
implements FocusListener
{
protected AccessibleFocusHandler(AccessibleJComponent component){}
protected AccessibleFocusHandler(){}
public void focusGained(FocusEvent event){}
public void focusLost(FocusEvent valevent){}
}
......@@ -109,15 +110,17 @@ public abstract class JComponent extends Container implements Serializable
protected class AccessibleContainerHandler
implements ContainerListener
{
protected AccessibleContainerHandler(AccessibleJComponent component) {}
protected AccessibleContainerHandler() {}
public void componentAdded(ContainerEvent event) {}
public void componentRemoved(ContainerEvent valevent) {}
}
private static final long serialVersionUID = -7047089700479897799L;
protected ContainerListener accessibleContainerHandler;
protected FocusListener accessibleFocusHandler;
protected AccessibleJComponent(JComponent component) {}
protected AccessibleJComponent() {}
public void addPropertyChangeListener(PropertyChangeListener listener) {}
public void removePropertyChangeListener(PropertyChangeListener listener) {}
public int getAccessibleChildrenCount() { return 0; }
......@@ -273,7 +276,7 @@ public abstract class JComponent extends Container implements Serializable
* @see #getUI
* @see #updateUI
*/
ComponentUI ui;
protected ComponentUI ui;
/**
* A hint to the focus system that this component should or should not
......@@ -343,6 +346,7 @@ public abstract class JComponent extends Container implements Serializable
*/
private static Locale defaultLocale;
public static final String TOOL_TIP_TEXT_KEY = "ToolTipText";
/**
* Constant used to indicate that no condition has been assigned to a
......@@ -735,7 +739,12 @@ public abstract class JComponent extends Container implements Serializable
Object newValue)
throws PropertyVetoException
{
// Support for reporting constrained property changes.
VetoableChangeListener[] listeners = getVetoableChangeListeners();
PropertyChangeEvent evt = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
for (int i = 0; i < listeners.length; i++)
listeners[i].vetoableChange(evt);
}
/**
......@@ -1105,7 +1114,11 @@ public abstract class JComponent extends Container implements Serializable
public JToolTip createToolTip()
{
if (toolTip == null)
toolTip = new JToolTip(toolTipText);
{
toolTip = new JToolTip();
toolTip.setTipText(toolTipText);
}
return toolTip;
}
......@@ -1378,7 +1391,7 @@ public abstract class JComponent extends Container implements Serializable
g2 = doubleBuffer.getGraphics();
g2.setClip(g.getClipBounds());
}
g2 = getComponentGraphics(g2);
paintComponent(g2);
paintBorder(g2);
......@@ -1470,7 +1483,7 @@ public abstract class JComponent extends Container implements Serializable
*/
public void paintImmediately(Rectangle r)
{
Component root = this.getRootPane();
Component root = SwingUtilities.getRoot(this);
if (root == null || ! root.isShowing())
return;
Graphics g = root.getGraphics();
......@@ -1624,7 +1637,7 @@ public abstract class JComponent extends Container implements Serializable
public void scrollRectToVisible(Rectangle r)
{
Component p = getParent();
if (p != null && p instanceof JComponent)
if (p instanceof JComponent)
((JComponent) p).scrollRectToVisible(r);
}
......
......@@ -62,6 +62,7 @@ import javax.accessibility.AccessibleContext;
public class JDialog extends Dialog implements Accessible, WindowConstants,
RootPaneContainer
{
private static final long serialVersionUID = -864070866424508218L;
/** DOCUMENT ME! */
protected AccessibleContext accessibleContext;
......
/* JEditorPane.java --
/* JEditorPane.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -35,207 +35,280 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.accessibility.AccessibleContext;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.EditorKit;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainEditorKit;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
public class JEditorPane extends JTextComponent
{
private static final long serialVersionUID = 3140472492599046285L;
URL page_url;
EditorKit kit;
String ctype = "text/plain";
boolean focus_root;
boolean manages_focus;
public JEditorPane()
{
}
public JEditorPane(String url) throws IOException
{
setPage(url);
}
public JEditorPane(String type, String text)
{
ctype = text;
setText(text);
}
URL page_url;
EditorKit kit;
String ctype = "text/plain";
boolean focus_root;
boolean manages_focus;
public JEditorPane()
{
}
public JEditorPane(String url)
throws IOException
{
this();
setPage(url);
}
public JEditorPane(String type, String text)
{
ctype = text;
setText(text);
}
public JEditorPane(URL url)
throws IOException
{
setPage(url);
}
protected EditorKit createDefaultEditorKit()
{ return new PlainEditorKit(); }
static EditorKit createEditorKitForContentType(String type)
{ return new PlainEditorKit(); }
void fireHyperlinkUpdate(HyperlinkEvent e)
public JEditorPane(URL url) throws IOException
{
setPage(url);
}
protected EditorKit createDefaultEditorKit()
{
return new PlainEditorKit();
}
protected static EditorKit createEditorKitForContentType(String type)
{
return new PlainEditorKit();
}
/**
* Sends a given <code>HyperlinkEvent</code> to all registered listeners.
*
* @param event the event to send
*/
public void fireHyperlinkUpdate(HyperlinkEvent event)
{
HyperlinkListener[] listeners = getHyperlinkListeners();
for (int index = 0; index < listeners.length; ++index)
listeners[index].hyperlinkUpdate(event);
}
public AccessibleContext getAccessibleContext()
{ return null; }
{
return null;
}
String getContentType()
{ return ctype; }
public String getContentType()
{
return ctype;
}
EditorKit getEditorKit()
{ return kit; }
static String getEditorKitClassNameForContentType(String type)
{ return "text/plain"; }
EditorKit getEditorKitForContentType(String type)
{ return kit; }
public Dimension getPreferredSize()
{
//Returns the preferred size for the JEditorPane.
return super.getPreferredSize();
}
public EditorKit getEditorKit()
{
return kit;
}
public static String getEditorKitClassNameForContentType(String type)
{
return "text/plain";
}
public EditorKit getEditorKitForContentType(String type)
{
return kit;
}
/**
* Returns the preferred size for the JEditorPane.
*/
public Dimension getPreferredSize()
{
return super.getPreferredSize();
}
public boolean getScrollableTracksViewportHeight()
{ return false; }
{
return false;
}
public boolean getScrollableTracksViewportWidth()
{ return false; }
URL getPage()
{ return page_url; }
protected InputStream getStream(URL page)
{
try {
return page.openStream();
} catch (Exception e) {
System.out.println("Hhmmm, failed to open stream: " + e);
}
return null;
}
public String getText()
{ return super.getText(); }
public String getUIClassID()
{ return "EditorPaneUI"; }
public boolean isFocusCycleRoot()
{ return focus_root; }
public boolean isManagingFocus()
{ return manages_focus; }
protected String paramString()
{ return "JEditorPane"; }
protected void processComponentKeyEvent(KeyEvent e)
{
//Overridden to handle processing of tab/shift tab.
}
{
return false;
}
public URL getPage()
{
return page_url;
}
protected InputStream getStream(URL page)
{
try
{
return page.openStream();
}
catch (Exception e)
{
System.out.println("Hhmmm, failed to open stream: " + e);
}
return null;
}
public String getText()
{
return super.getText();
}
public String getUIClassID()
{
return "EditorPaneUI";
}
public boolean isFocusCycleRoot()
{
return focus_root;
}
public boolean isManagingFocus()
{
return manages_focus;
}
protected String paramString()
{
return "JEditorPane";
}
/**
* Overridden to handle processing of tab/shift tab.
*/
protected void processComponentKeyEvent(KeyEvent e)
{
}
/**
* Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal.
*/
protected void processKeyEvent(KeyEvent e)
{
//Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal.
}
void read(InputStream in, Object desc)
{
//This method initializes from a stream.
}
static void registerEditorKitForContentType(String type, String classname)
{
//Establishes the default bindings of type to classname.
}
static void registerEditorKitForContentType(String type, String classname, ClassLoader loader)
{
//Establishes the default bindings of type to classname.
}
void replaceSelection(String content)
{
//Replaces the currently selected content with new content represented by the given string.
}
protected void scrollToReference(String reference)
{
//Scrolls the view to the given reference location (that is, the value returned by the UL.getRef method for the URL being displayed).
}
void setContentType(String type)
{
ctype = type;
invalidate();
repaint();
}
void setEditorKit(EditorKit kit)
{
this.kit = kit;
invalidate();
repaint();
}
void setEditorKitForContentType(String type, EditorKit k)
{
ctype = type;
setEditorKit(k);
}
void setPage(String url)
throws IOException
{
// Sets the current URL being displayed.
}
void setPage(URL page)
throws IOException
{
// Sets the current URL being displayed.
}
public void setText(String t)
{
super.setText(t);
}
{
}
/**
* This method initializes from a stream.
*/
public void read(InputStream in, Object desc)
{
}
/**
* Establishes the default bindings of type to classname.
*/
public static void registerEditorKitForContentType(String type,
String classname)
{
}
/**
* Establishes the default bindings of type to classname.
*/
public static void registerEditorKitForContentType(String type,
String classname,
ClassLoader loader)
{
}
/**
* Replaces the currently selected content with new content represented by the given string.
*/
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).
*/
protected void scrollToReference(String reference)
{
}
public void setContentType(String type)
{
ctype = type;
invalidate();
repaint();
}
public void setEditorKit(EditorKit kit)
{
this.kit = kit;
invalidate();
repaint();
}
public void setEditorKitForContentType(String type, EditorKit k)
{
ctype = type;
setEditorKit(k);
}
/**
* Sets the current URL being displayed.
*/
public void setPage(String url) throws IOException
{
}
/**
* Sets the current URL being displayed.
*/
public void setPage(URL page) throws IOException
{
}
public void setText(String t)
{
super.setText(t);
}
/**
* Add a <code>HyperlinkListener</code> object to this editor pane.
*
* @param listener the listener to add
*/
public void addHyperlinkListener(HyperlinkListener listener)
{
listenerList.add (HyperlinkListener.class, listener);
listenerList.add(HyperlinkListener.class, listener);
}
public void removeHyperlinkListener (HyperlinkListener listener)
/**
* Removes a <code>HyperlinkListener</code> object to this editor pane.
*
* @param listener the listener to remove
*/
public void removeHyperlinkListener(HyperlinkListener listener)
{
listenerList.remove (HyperlinkListener.class, listener);
listenerList.remove(HyperlinkListener.class, listener);
}
/**
* Returns all added <code>HyperlinkListener</code> objects.
*
* @return array of listeners
*
* @since 1.4
*/
public HyperlinkListener[] getHyperlinkListeners()
{
return (HyperlinkListener[]) getListeners (HyperlinkListener.class);
return (HyperlinkListener[]) getListeners(HyperlinkListener.class);
}
} // class JEditorPane
}
......@@ -61,55 +61,30 @@ public class JFileChooser extends JComponent implements Accessible {
private static final long serialVersionUID = 3162921138695327837L;
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
/**
* AccessibleJFileChooser
*/
protected class AccessibleJFileChooser extends AccessibleJComponent {
private static final long serialVersionUID = 3318922050345221200L;
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor AccessibleJFileChooser
* @param component TODO
*/
protected AccessibleJFileChooser(JFileChooser component) {
super(component);
// TODO
} // AccessibleJFileChooser()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* getAccessibleRole
* @returns AccessibleRole
*/
public AccessibleRole getAccessibleRole() {
return AccessibleRole.FILE_CHOOSER;
} // getAccessibleRole()
} // AccessibleJFileChooser
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
/**
* AccessibleJFileChooser
*/
protected class AccessibleJFileChooser extends AccessibleJComponent
{
private static final long serialVersionUID = 8205148454060169244L;
/**
* Constructor AccessibleJFileChooser
* @param component TODO
*/
protected AccessibleJFileChooser()
{
}
/**
* getAccessibleRole
* @return AccessibleRole
*/
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.FILE_CHOOSER;
}
}
/**
* uiClassID
......@@ -969,16 +944,15 @@ public class JFileChooser extends JComponent implements Accessible {
return null; // TODO
} // paramString()
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJFileChooser(this);
} // if
return accessibleContext;
} // getAccessibleContext()
} // JFileChooser
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJFileChooser();
return accessibleContext;
}
}
/* JFormattedTextField.java --
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -52,7 +52,7 @@ import javax.swing.text.NavigationFilter;
*/
public class JFormattedTextField extends JTextField
{
private static final long serialVersionUID = 2889768923115424035L;
private static final long serialVersionUID = 5464657870110180632L;
public abstract static class AbstractFormatter implements Serializable
{
......
......@@ -59,10 +59,23 @@ import javax.accessibility.AccessibleContext;
*/
public class JFrame extends Frame implements WindowConstants, RootPaneContainer
{
protected AccessibleContext accessibleContext;
private static final long serialVersionUID = -3362141868504252139L;
protected AccessibleContext accessibleContext;
private int close_action = HIDE_ON_CLOSE;
private static boolean defaultLookAndFeelDecorated = false;
private int close_action = HIDE_ON_CLOSE;
public static void setDefaultLookAndFeelDecorated(boolean d)
{
defaultLookAndFeelDecorated = d;
}
public static boolean isDefaultLookAndFeelDecorated()
{
return defaultLookAndFeelDecorated;
}
/***************************************************
*
......@@ -111,10 +124,10 @@ public class JFrame extends Frame implements WindowConstants, RootPaneContainer
return d;
}
JMenuBar getJMenuBar()
public JMenuBar getJMenuBar()
{ return getRootPane().getJMenuBar(); }
void setJMenuBar(JMenuBar menubar)
public void setJMenuBar(JMenuBar menubar)
{ getRootPane().setJMenuBar(menubar); }
......
......@@ -331,9 +331,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
*/
public Icon getDisabledIcon()
{
//FIXME: We should be gray-scaling the active icon and then returning it
if (disabledIcon == null && activeIcon instanceof ImageIcon)
setDisabledIcon(activeIcon);
disabledIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) activeIcon).getImage()));
return disabledIcon;
}
......
......@@ -91,7 +91,9 @@ import javax.accessibility.Accessible;
*/
public class JLayeredPane extends JComponent implements Accessible
{
public static String LAYER_PROPERTY = "LAYER_PROPERTY";
private static final long serialVersionUID = 5534920399324590459L;
public static final String LAYER_PROPERTY = "layeredContainerLayer";
public static Integer FRAME_CONTENT_LAYER = new Integer (-30000);
......@@ -104,7 +106,7 @@ public class JLayeredPane extends JComponent implements Accessible
TreeMap layers; // Layer Number (Integer) -> Layer Size (Integer)
Hashtable componentToLayer; // Component -> Layer Number (Integer)
JLayeredPane()
public JLayeredPane()
{
layers = new TreeMap ();
componentToLayer = new Hashtable ();
......@@ -492,6 +494,8 @@ public class JLayeredPane extends JComponent implements Accessible
decrLayer (layer);
componentToLayer.remove (c);
super.remove (index);
revalidate();
repaint();
}
/**
......
......@@ -39,6 +39,7 @@ package javax.swing;
import java.awt.Color;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
......@@ -109,24 +110,24 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* Constant value used in "layoutOrientation" property. This value means
* that cells are laid out in multiple columns "newspaper style",
* filling horizontally first, then vertically.
*/
public static int HORIZONTAL_WRAP = 1;
/**
* Constant value used in "layoutOrientation" property. This value means
* that cells are laid out in a single vertical column. This is the default.
*/
public static int VERTICAL = 2;
public static final int VERTICAL = 0;
/**
* Constant value used in "layoutOrientation" property. This value means
* that cells are laid out in multiple columns "newspaper style", filling
* vertically first, then horizontally.
*/
public static int VERTICAL_WRAP = 3;
public static final int VERTICAL_WRAP = 1;
/**
* Constant value used in "layoutOrientation" property. This value means
* that cells are laid out in multiple columns "newspaper style",
* filling horizontally first, then vertically.
*/
public static final int HORIZONTAL_WRAP = 2;
/** Fired in a PropertyChangeEvent when the "cellRenderer" property changes. */
public static final String CELL_RENDERER_PROPERTY_CHANGED = "cellRenderer";
......@@ -560,6 +561,52 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
* Returns <code>true</code> if the model's selection is empty, otherwise
* <code>false</code>.
*
* @return The return value of {@link ListSelectionModel#isSelectionEmpty}
*/
public boolean isSelectionEmpty()
{
return selectionModel.isSelectionEmpty();
}
/**
* Returns the list index of the upper left or upper right corner of the
* {@link #visibleRect} property, depending on the {@link
* #componentOrientation} property.
*
* @return The index of the first visible list cell, or <code>-1</code>
* if none is visible.
*/
public int getFirstVisibleIndex()
{
ComponentOrientation or = getComponentOrientation();
Rectangle r = getVisibleRect();
if (or == ComponentOrientation.RIGHT_TO_LEFT)
r.translate((int) r.getWidth(), 0);
return getUI().locationToIndex(this, r.getLocation());
}
/**
* Returns the list index of the lower right or lower left corner of the
* {@link #visibleRect} property, depending on the {@link
* #componentOrientation} property.
*
* @return The index of the first visible list cell, or <code>-1</code>
* if none is visible.
*/
public int getLastVisibleIndex()
{
ComponentOrientation or = getComponentOrientation();
Rectangle r = getVisibleRect();
r.translate(0, (int) r.getHeight());
if (or == ComponentOrientation.LEFT_TO_RIGHT)
r.translate((int) r.getWidth(), 0);
return getUI().locationToIndex(this, r.getLocation());
}
/**
* Returns the indices of values in the {@link #model} property which are
* selected.
*
......@@ -682,6 +729,44 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
* Sets the selection to cover only the specified value, if it
* exists in the model.
*
* @param obj The object to select
* @param scroll Whether to scroll the list to make the newly selected
* value visible
*
* @see #ensureIndexIsVisible
*/
public void setSelectedValue(Object obj, boolean scroll)
{
for (int i = 0; i < model.getSize(); ++i)
{
if (model.getElementAt(i).equals(obj))
{
setSelectedIndex(i);
if (scroll)
ensureIndexIsVisible(i);
break;
}
}
}
/**
* Scrolls this list to make the specified cell visible. This
* only works if the list is contained within a viewport.
*
* @param i The list index to make visible
*
* @see JComponent#scrollRectToVisible
*/
public void ensureIndexIsVisible(int i)
{
scrollRectToVisible(getUI().getCellBounds(this, i, i));
}
/**
* Sets the {@link #model} property of the list to a new anonymous
* {@link AbstractListModel} subclass which accesses the provided Object
* array directly.
......
......@@ -66,12 +66,25 @@ import javax.swing.plaf.MenuItemUI;
/**
* DOCUMENT ME!
* JMenuBar
*/
public class JMenuBar extends JComponent implements Accessible, MenuElement
{
/** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
/** Fired in a PropertyChangeEvent when the "model" changes. */
public static final String MODEL_CHANGED_PROPERTY = "model";
private static final long serialVersionUID = -8191026883931977036L;
/** JMenuBar's model. It keeps track of selected menu's index */
private transient SingleSelectionModel selectionModel;
private boolean paintBorder;
/* borderPainted property indicating if the menuBar's border will be painted*/
private boolean borderPainted;
/* margin between menu bar's border and its menues*/
private Insets margin;
/**
......@@ -80,16 +93,16 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
public JMenuBar()
{
selectionModel = new DefaultSingleSelectionModel();
paintBorder = true;
borderPainted = true;
updateUI();
}
/**
* DOCUMENT ME!
* Adds menu to the menu bar
*
* @param c DOCUMENT ME!
* @param c menu to add
*
* @return DOCUMENT ME!
* @return reference to the added menu
*/
public JMenu add(JMenu c)
{
......@@ -107,20 +120,15 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
super.addNotify();
}
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public AccessibleContext getAccessibleContext()
{
return null;
}
/**
* DOCUMENT ME!
* Returns reference to this menu bar
*
* @return DOCUMENT ME!
* @return reference to this menu bar
*/
public Component getComponent()
{
......@@ -128,23 +136,26 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Returns component at the specified index.
*
* @param i DOCUMENT ME!
* @param i index of the component to get
*
* @return DOCUMENT ME!
* @return component at the specified index. Null is returned if
* component at the specified index doesn't exist.
* @deprecated Replaced by getComponent(int)
*/
public Component getComponentAtIndex(int i)
{
return getComponentAt(i);
return getComponent(i);
}
/**
* DOCUMENT ME!
* Returns index of the specified component
*
* @param c DOCUMENT ME!
* @param c Component to search for
*
* @return DOCUMENT ME!
* @return index of the specified component. -1 is returned if
* specified component doesnt' exist in the menu bar.
*/
public int getComponentIndex(Component c)
{
......@@ -175,9 +186,9 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Returns margin betweeen menu bar's border and its menues
*
* @return DOCUMENT ME!
* @return margin between menu bar's border and its menues
*/
public Insets getMargin()
{
......@@ -188,11 +199,13 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Return menu at the specified index. If component at the
* specified index is not a menu, then null is returned.
*
* @param index DOCUMENT ME!
* @param index index to look for the menu
*
* @return DOCUMENT ME!
* @return menu at specified index, or null if menu doesn't exist
* at the specified index.
*/
public JMenu getMenu(int index)
{
......@@ -213,9 +226,9 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Returns selection model for this menu bar.
*
* @return DOCUMENT ME!
* @return selection mdoel for this menu bar.
*/
public SingleSelectionModel getSelectionModel()
{
......@@ -223,9 +236,10 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Method of MenuElement interface. It returns subcomponents
* of the menu bar, which are all the menues that it contains.
*
* @return DOCUMENT ME!
* @return MenuElement[] array containing menues in this menu bar
*/
public MenuElement[] getSubElements()
{
......@@ -238,19 +252,21 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
* Set the "UI" property of the menu bar, which is a look and feel class
* responsible for handling the menuBar's input events and painting it.
*
* @return The current "UI" property
*/
public MenuBarUI getUI()
{
return (MenuBarUI) ui;
}
/**
* DOCUMENT ME!
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menu bar.
*
* @return DOCUMENT ME!
* @return The Look and Feel classID. "MenuItemUI"
*/
public String getUIClassID()
{
......@@ -258,39 +274,31 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Returns true if menu bar paints its border and false otherwise
*
* @return DOCUMENT ME!
* @return true if menu bar paints its border and false otherwise
*/
public boolean isBorderPainted()
{
return paintBorder;
return borderPainted;
}
/**
* DOCUMENT ME!
* Returns true if some menu in menu bar is selected.
*
* @return DOCUMENT ME!
*/
public boolean isManagingFocus()
{
return true;
}
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
* @return true if some menu in menu bar is selected and false otherwise
*/
public boolean isSelected()
{
return false;
return selectionModel.isSelected();
}
/**
* DOCUMENT ME!
* This method does nothing by default. This method is need for the
* MenuElement interface to be implemented.
*
* @param isIncluded DOCUMENT ME!
* @param isIncluded true if menuBar is included in the selection
* and false otherwise
*/
public void menuSelectionChanged(boolean isIncluded)
{
......@@ -298,13 +306,14 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Paints border of the menu bar, if its borderPainted property is set to
* true.
*
* @param g DOCUMENT ME!
* @param g The graphics context with which to paint the border
*/
protected void paintBorder(Graphics g)
{
if (paintBorder)
if (borderPainted)
getBorder().paintBorder(this, g, 0, 0, getSize(null).width,
getSize(null).height);
}
......@@ -361,7 +370,14 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
*/
public void setBorderPainted(boolean b)
{
paintBorder = b;
boolean old = borderPainted;
borderPainted = b;
if (b != old)
{
firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
revalidate();
repaint();
}
}
/**
......@@ -384,27 +400,42 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Changes menu bar's selection to the specifies menu.
* This method updates selected index of menu bar's model,
* which results in a model firing change event.
*
* @param sel DOCUMENT ME!
* @param sel menu to select
*/
public void setSelected(Component sel)
{
int index = getComponentIndex(sel);
selectionModel.setSelectedIndex(index);
}
/**
* DOCUMENT ME!
* Sets menuBar's selection model to the one specified
*
* @param model DOCUMENT ME!
* @param model SingleSelectionModel that needs to be set for this menu bar
*/
public void setSelectionModel(SingleSelectionModel model)
{
selectionModel = model;
if (selectionModel != model)
{
SingleSelectionModel oldModel = selectionModel;
selectionModel = model;
firePropertyChange(MODEL_CHANGED_PROPERTY, oldModel,
this.selectionModel);
}
}
/**
* DOCUMENT ME!
* Set the "UI" property of the menu bar, which is a look and feel class
* responsible for handling menuBar's input events and painting it.
*
* @param ui DOCUMENT ME!
* @param ui The new "UI" property
*/
public void setUI(MenuBarUI ui)
{
......@@ -412,7 +443,8 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
* DOCUMENT ME!
* Set the "UI" property to a class constructed, via the {@link
* UIManager}, from the current look and feel.
*/
public void updateUI()
{
......
......@@ -60,12 +60,13 @@ public class JOptionPane extends JComponent implements Accessible
*/
protected class AccessibleJOptionPane extends JComponent.AccessibleJComponent
{
private static final long serialVersionUID = 686071432213084821L;
/**
* Creates a new AccessibleJOptionPane object.
*/
protected AccessibleJOptionPane()
{
super(JOptionPane.this);
}
/**
......@@ -79,6 +80,8 @@ public class JOptionPane extends JComponent implements Accessible
}
}
private static final long serialVersionUID = 5231143276678566796L;
/** The value returned when cancel option is selected. */
public static final int CANCEL_OPTION = 2;
......@@ -418,21 +421,7 @@ public class JOptionPane extends JComponent implements Accessible
*/
public static JDesktopPane getDesktopPaneForComponent(Component parentComponent)
{
if (parentComponent == null)
return null;
if (parentComponent instanceof JDesktopPane)
return (JDesktopPane) parentComponent;
JDesktopPane parent = null;
while (parentComponent.getParent() != null)
{
parentComponent = parentComponent.getParent();
if (parentComponent instanceof JDesktopPane)
{
parent = (JDesktopPane) parentComponent;
break;
}
}
return parent;
return (JDesktopPane) SwingUtilities.getAncestorOfClass(JDesktopPane.class, parentComponent);
}
/**
......@@ -445,21 +434,7 @@ public class JOptionPane extends JComponent implements Accessible
*/
public static Frame getFrameForComponent(Component parentComponent)
{
if (parentComponent == null)
return null;
if (parentComponent instanceof Frame)
return (Frame) parentComponent;
Frame parent = null;
while (parentComponent.getParent() != null)
{
parentComponent = parentComponent.getParent();
if (parentComponent instanceof Frame)
{
parent = (Frame) parentComponent;
break;
}
}
return parent;
return (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parentComponent);
}
/**
......
......@@ -49,55 +49,31 @@ import javax.swing.text.Document;
* @author Andrew Selkirk
* @version 1.0
*/
public class JPasswordField extends JTextField {
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
/**
* AccessibleJPasswordField
*/
protected class AccessibleJPasswordField extends AccessibleJTextField {
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* Constructor AccessibleJPasswordField
* @param component TODO
*/
protected AccessibleJPasswordField(JPasswordField component) {
super(component);
// TODO
} // AccessibleJPasswordField()
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* getAccessibleRole
* @returns AccessibleRole
*/
public AccessibleRole getAccessibleRole() {
return AccessibleRole.PASSWORD_TEXT;
} // getAccessibleRole()
} // AccessibleJPasswordField
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
public class JPasswordField extends JTextField
{
/**
* AccessibleJPasswordField
*/
protected class AccessibleJPasswordField extends AccessibleJTextField
{
private static final long serialVersionUID = -8477039424200681086L;
/**
* Constructor AccessibleJPasswordField
*/
protected AccessibleJPasswordField()
{
}
/**
* getAccessibleRole
* @return AccessibleRole
*/
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.PASSWORD_TEXT;
}
}
/**
* uiClassID
......@@ -254,16 +230,15 @@ public class JPasswordField extends JTextField {
return null; // TODO
} // paramString()
/**
* getAccessibleContext
* @returns AccessibleContext
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJPasswordField(this);
} // if
return accessibleContext;
} // getAccessibleContext()
} // JPasswordField
/**
* getAccessibleContext
* @return AccessibleContext
*/
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJPasswordField();
return accessibleContext;
}
}
......@@ -85,14 +85,15 @@ public class JProgressBar extends JComponent implements SwingConstants,
protected class AccessibleJProgressBar extends AccessibleJComponent
implements AccessibleValue
{
private static final long serialVersionUID = -2938130009392721813L;
/**
* Constructor AccessibleJProgressBar
*
* @param component TODO
*/
protected AccessibleJProgressBar(JProgressBar component)
protected AccessibleJProgressBar()
{
super(component);
}
/**
......@@ -168,6 +169,8 @@ public class JProgressBar extends JComponent implements SwingConstants,
}
}
private static final long serialVersionUID = 1980046021813598781L;
/** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
......@@ -661,7 +664,8 @@ public class JProgressBar extends JComponent implements SwingConstants,
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJProgressBar(this);
accessibleContext = new AccessibleJProgressBar();
return accessibleContext;
}
}
/* JRadioButton.java --
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -42,6 +42,8 @@ import javax.accessibility.AccessibleContext;
public class JRadioButton extends JToggleButton
{
private static final long serialVersionUID = 7751949583255506856L;
public JRadioButton()
{
this(null, null);
......
......@@ -49,6 +49,8 @@ import javax.accessibility.AccessibleRole;
*/
public class JRadioButtonMenuItem extends JMenuItem implements Accessible
{
private static final long serialVersionUID = 8482658191548521743L;
private static final String uiClassID = "RadioButtonMenuItemUI";
/**
......@@ -185,7 +187,7 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJRadioButtonMenuItem(this);
accessibleContext = new AccessibleJRadioButtonMenuItem();
return accessibleContext;
}
......@@ -195,16 +197,13 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
*/
protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem
{
private static final long serialVersionUID = 4381471510145292179L;
/**
* Creates a new AccessibleJRadioButtonMenuItem object.
*
* @param component DOCUMENT ME!
*/
protected AccessibleJRadioButtonMenuItem(JRadioButtonMenuItem component)
protected AccessibleJRadioButtonMenuItem()
{
super(component);
// TODO
}
/**
......
......@@ -67,14 +67,16 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
protected class AccessibleJScrollBar extends JComponent.AccessibleJComponent
implements AccessibleValue
{
private static final long serialVersionUID = -7758162392045586663L;
/**
* Creates a new AccessibleJSlider object.
*
* @param value0 DOCUMENT ME!
*/
protected AccessibleJScrollBar(JScrollBar value0)
protected AccessibleJScrollBar()
{
super(value0);
super();
}
/**
......@@ -150,6 +152,8 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
}
}
private static final long serialVersionUID = -8195169869225066566L;
/** Fired in a PropertyChangeEvent when the "blockIncrement" changes. */
public static final String BLOCK_INCREMENT_CHANGED_PROPERTY = "blockIncrement";
......@@ -725,7 +729,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJScrollBar(this);
accessibleContext = new AccessibleJScrollBar();
return accessibleContext;
}
}
......@@ -79,20 +79,23 @@ public class JScrollPane
extends JComponent
implements Accessible, ScrollPaneConstants
{
JViewport columnHeader;
JViewport rowHeader;
private static final long serialVersionUID = 5203525440012340014L;
protected JViewport columnHeader;
protected JViewport rowHeader;
Component lowerLeft;
Component lowerRight;
Component upperLeft;
Component upperRight;
protected Component lowerLeft;
protected Component lowerRight;
protected Component upperLeft;
protected Component upperRight;
JScrollBar horizontalScrollBar;
int horizontalScrollBarPolicy;
JScrollBar verticalScrollBar;
int verticalScrollBarPolicy;
protected JScrollBar horizontalScrollBar;
protected int horizontalScrollBarPolicy;
protected JScrollBar verticalScrollBar;
protected int verticalScrollBarPolicy;
JViewport viewport;
protected JViewport viewport;
Border viewportBorder;
boolean wheelScrollingEnabled;
ChangeListener scrollListener;
......
......@@ -55,14 +55,15 @@ public class JSeparator extends JComponent implements SwingConstants,
*/
protected class AccessibleJSeparator extends AccessibleJComponent
{
private static final long serialVersionUID = 916332890553201095L;
/**
* Constructor AccessibleJSeparator
*
* @param component TODO
*/
protected AccessibleJSeparator(JSeparator component)
protected AccessibleJSeparator()
{
super(component);
}
/**
......@@ -76,6 +77,8 @@ public class JSeparator extends JComponent implements SwingConstants,
}
}
private static final long serialVersionUID = 125301223445282357L;
/** The orientation of the JSeparator. */
private transient int orientation = HORIZONTAL;
......@@ -198,7 +201,8 @@ public class JSeparator extends JComponent implements SwingConstants,
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJSeparator(this);
accessibleContext = new AccessibleJSeparator();
return accessibleContext;
}
}
......@@ -122,14 +122,15 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
protected class AccessibleJSlider extends JComponent.AccessibleJComponent
implements AccessibleValue
{
private static final long serialVersionUID = -6301740148041106789L;
/**
* Creates a new AccessibleJSlider object.
*
* @param value0 DOCUMENT ME!
*/
protected AccessibleJSlider(JSlider value0)
protected AccessibleJSlider()
{
super(value0);
}
/**
......@@ -933,7 +934,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJSlider(this);
accessibleContext = new AccessibleJSlider();
return accessibleContext;
}
}
/* JSplitPane.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
......@@ -26,14 +63,15 @@ public class JSplitPane extends JComponent implements Accessible
protected class AccessibleJSplitPane extends JComponent.AccessibleJComponent
implements AccessibleValue
{
private static final long serialVersionUID = -1788116871416305366L;
/**
* Creates a new AccessibleJSplitPane object.
*
* @param value0 DOCUMENT ME!
*/
protected AccessibleJSplitPane(JSplitPane value0)
protected AccessibleJSplitPane()
{
super(value0);
}
/**
......@@ -109,6 +147,8 @@ public class JSplitPane extends JComponent implements Accessible
}
}
private static final long serialVersionUID = -5634142046175988380L;
/** The constraints string used to add components to the bottom. */
public static final String BOTTOM = "bottom";
......@@ -311,7 +351,8 @@ public class JSplitPane extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJSplitPane(this);
accessibleContext = new AccessibleJSplitPane();
return accessibleContext;
}
......@@ -522,7 +563,7 @@ public class JSplitPane extends JComponent implements Accessible
*/
public void remove(int index)
{
Component component = getComponentAt(index);
Component component = getComponent(index);
if (component == leftComponent)
leftComponent = null;
else if (component == rightComponent)
......
......@@ -79,14 +79,16 @@ public class JTabbedPane extends JComponent implements Serializable,
protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent
implements AccessibleSelection, ChangeListener
{
private static final long serialVersionUID = 7610530885966830483L;
/**
* Creates a new AccessibleJTabbedPane object.
*
* @param c DOCUMENT ME!
*/
public AccessibleJTabbedPane(JTabbedPane c)
public AccessibleJTabbedPane()
{
super(c);
super();
}
/**
......@@ -224,6 +226,12 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
protected class ModelListener implements ChangeListener, Serializable
{
private static final long serialVersionUID = 497359819958114132L;
protected ModelListener()
{
}
/**
* This method is called whenever the model is changed.
*
......@@ -304,7 +312,9 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void setComponent(Component c)
{
JTabbedPane.this.remove(component);
this.component = c;
JTabbedPane.this.add(c);
}
/**
......@@ -542,10 +552,10 @@ public class JTabbedPane extends JComponent implements Serializable,
protected SingleSelectionModel model;
/** Indicates that the TabbedPane is in scrolling mode. */
public static int SCROLL_TAB_LAYOUT = 1;
public static final int SCROLL_TAB_LAYOUT = 1;
/** Indicates that the TabbedPane is in wrap mode. */
public static int WRAP_TAB_LAYOUT = 0;
public static final int WRAP_TAB_LAYOUT = 0;
/** The current tabPlacement of the TabbedPane. */
protected int tabPlacement = SwingConstants.TOP;
......@@ -825,12 +835,12 @@ public class JTabbedPane extends JComponent implements Serializable,
checkIndex(index, -1, tabs.size());
if (index != getSelectedIndex())
{
if (getSelectedIndex() != -1)
if (getSelectedIndex() != -1 && getSelectedComponent() != null)
getSelectedComponent().hide();
if (index != -1)
if (index != -1 && getComponentAt(index) != null)
getComponentAt(index).show();
model.setSelectedIndex(index);
}
model.setSelectedIndex(index);
}
/**
......@@ -874,13 +884,17 @@ public class JTabbedPane extends JComponent implements Serializable,
// Hide the component so we don't see it. Do it before we parent it
// so we don't trigger a repaint.
component.hide();
super.add(component);
if (component != null)
{
component.hide();
super.add(component);
}
if (getSelectedIndex() == -1)
setSelectedIndex(0);
layout();
repaint();
}
/**
......@@ -1474,7 +1488,7 @@ public class JTabbedPane extends JComponent implements Serializable,
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
accessibleContext = new AccessibleJTabbedPane(this);
accessibleContext = new AccessibleJTabbedPane();
return accessibleContext;
}
}
......@@ -58,6 +58,8 @@ public class JTable extends JComponent
implements TableModelListener, Scrollable, TableColumnModelListener,
ListSelectionListener, CellEditorListener, Accessible
{
private static final long serialVersionUID = 3876025080382781659L;
public static final int AUTO_RESIZE_ALL_COLUMNS = 4;
public static final int AUTO_RESIZE_LAST_COLUMN = 3;
public static final int AUTO_RESIZE_NEXT_COLUMN = 1;
......
/* JTextArea.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
import java.awt.Dimension;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;
public class JTextArea extends JTextComponent
{
private static final long serialVersionUID = -6141680179310439825L;
private int rows;
private int columns;
private boolean wrapping;
/**
* Creates a new <code>JTextArea</code> object.
*/
public JTextArea()
{
this(null, null, 0, 0);
}
/**
* Creates a new <code>JTextArea</code> object.
*
* @param text the initial text
*/
public JTextArea(String text)
{
this(null, text, 0, 0);
}
/**
* Creates a new <code>JTextArea</code> object.
*
* @param rows the number of rows
* @param columns the number of cols
*
* @exception IllegalArgumentException if rows or columns are negative
*/
public JTextArea(int rows, int columns)
{
this(null, null, rows, columns);
}
/**
* Creates a new <code>JTextArea</code> object.
*
* @param text the initial text
* @param rows the number of rows
* @param columns the number of cols
*
* @exception IllegalArgumentException if rows or columns are negative
*/
public JTextArea(String text, int rows, int columns)
{
this(null, text, rows, columns);
}
/**
* Creates a new <code>JTextArea</code> object.
*
* @param the document model to use
*/
public JTextArea(Document doc)
{
this(doc, null, 0, 0);
}
/**
* Creates a new <code>JTextArea</code> object.
*
* @param the document model to use
* @param text the initial text
* @param rows the number of rows
* @param columns the number of cols
*
* @exception IllegalArgumentException if rows or columns are negative
*/
public JTextArea(Document doc, String text, int rows, int columns)
{
setDocument(doc == null ? createDefaultModel() : doc);
setText(text);
setRows(rows);
setColumns(columns);
}
/**
* Appends some text.
*
* @param toAppend the text to append
*/
public void append(String toAppend)
{
setText(getText() + toAppend);
}
/**
* Creates the default document model.
*
* @return a new default model
*/
protected Document createDefaultModel()
{
return new PlainDocument();
}
public boolean getScrollableTracksViewportWidth()
{
return wrapping ? true : super.getScrollableTracksViewportWidth();
}
/**
* Returns the UI class ID string.
*
* @return the string "TextAreaUI"
*/
public String getUIClassID()
{
return "TextAreaUI";
}
/**
* Returns the current number of columns.
*
* @return number of columns
*/
public int getColumns()
{
return columns;
}
/**
* Sets the number of rows.
*
* @param columns number of columns
*
* @exception IllegalArgumentException if columns is negative
*/
public void setColumns(int columns)
{
if (columns < 0)
throw new IllegalArgumentException();
this.columns = columns;
}
/**
* Returns the current number of rows.
*
* @return number of rows
*/
public int getRows()
{
return rows;
}
/**
* Sets the number of rows.
*
* @param columns number of columns
*
* @exception IllegalArgumentException if rows is negative
*/
public void setRows(int rows)
{
if (rows < 0)
throw new IllegalArgumentException();
this.rows = rows;
}
/**
* Checks whethet line wrapping is enabled.
*
* @return true if line wrapping is enabled, false otherwise
*/
public boolean getLineWrap()
{
return wrapping;
}
/**
* Enables/disables line wrapping.
*
* @param wrapping true to enable line wrapping, false otherwise
*/
public void setLineWrap(boolean wrapping)
{
this.wrapping = wrapping;
}
}
/* JTextField.java --
/* JTextField.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -35,73 +35,185 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.accessibility.AccessibleStateSet;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;
public class JTextField extends JEditorPane
public class JTextField extends JTextComponent
implements SwingConstants
{
/**
* AccessibleJTextField
*/
protected class AccessibleJTextField extends AccessibleJTextComponent
{
private static final long serialVersionUID = 8255147276740453036L;
/**
* AccessibleJTextField
*/
protected class AccessibleJTextField extends AccessibleJTextComponent {
/**
* Constructor AccessibleJTextField
*/
protected AccessibleJTextField()
{
}
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
/**
* getAccessibleStateSet
* @return AccessibleStateSet
*/
public AccessibleStateSet getAccessibleStateSet()
{
return null;
}
}
/**
* Constructor AccessibleJTextField
* @param component TODO
*/
protected AccessibleJTextField(JTextField component) {
super(component);
// TODO
} // AccessibleJTextField()
private static final long serialVersionUID = 353853209832607592L;
public static final String notifyAction = "notify-field-accept";
private int columns;
//-------------------------------------------------------------
// Methods ----------------------------------------------------
//-------------------------------------------------------------
/**
* Creates a new instance of <code>JTextField</code>.
*/
public JTextField()
{
this(null, null, 0);
}
/**
* getAccessibleStateSet
* @returns AccessibleStateSet
*/
public AccessibleStateSet getAccessibleStateSet() {
return null; // TODO
} // getAccessibleStateSet()
/**
* Creates a new instance of <code>JTextField</code>.
*
* @param text the initial text
*/
public JTextField(String text)
{
this(null, text, 0);
}
/**
* Creates a new instance of <code>JTextField</code>.
*
* @param columns the number of columns
*
* @exception IllegalArgumentException if columns %lt; 0
*/
public JTextField(int columns)
{
this(null, null, columns);
}
/**
* Creates a new instance of <code>JTextField</code>.
*
* @param text the initial text
* @param columns the number of columns
*
* @exception IllegalArgumentException if columns %lt; 0
*/
public JTextField(String text, int columns)
{
this(null, text, columns);
}
} // AccessibleJTextField
/**
* Creates a new instance of <code>JTextField</code>.
*
* @param doc the document to use
* @param text the initial text
* @param columns the number of columns
*
* @exception IllegalArgumentException if columns %lt; 0
*/
public JTextField(Document doc, String text, int columns)
{
if (doc == null)
doc = createDefaultModel();
setDocument(doc);
setText(text);
setColumns(columns);
}
Vector actions = new Vector();
/**
* Creates the default model for this text field.
* This implementation returns an instance of <code>PlainDocument</code>.
*
* @return a new instance of the default model
*/
protected Document createDefaultModel()
{
return new PlainDocument();
}
public JTextField()
/**
* Adds a new listener object to this text field.
*
* @param listener the listener to add
*/
public void addActionListener(ActionListener listener)
{
listenerList.add(ActionListener.class, listener);
}
public JTextField(int a)
{
}
/**
* Removes a listener object from this text field.
*
* @param listener the listener to remove
*/
public void removeActionListener(ActionListener listener)
{
listenerList.remove(ActionListener.class, listener);
}
public void addActionListener(ActionListener l)
{
actions.addElement(l);
}
/**
* Returns all registered <code>ActionListener</code> objects.
*
* @return an array of listeners
*/
public ActionListener[] getActionListeners()
{
return (ActionListener[]) getListeners(ActionListener.class);
}
public void removeActionListener(ActionListener l)
{
actions.removeElement(l);
}
/**
* Sends an action event to all registered
* <code>ActionListener</code> objects.
*/
protected void fireActionPerformed()
{
ActionEvent event = new ActionEvent(this, 0, notifyAction);
ActionListener[] listeners = getActionListeners();
public void selectAll()
{
}
for (int index = 0; index < listeners.length; ++index)
listeners[index].actionPerformed(event);
}
/**
* Returns the number of columns of this text field.
*
* @return the number of columns
*/
public int getColumns()
{
return columns;
}
public void setColumns(int columns)
{
if (columns < 0)
throw new IllegalArgumentException();
this.columns = columns;
// FIXME: Invalidate layout.
}
public void selectAll()
{
}
}
......@@ -47,6 +47,8 @@ public class JToggleButton extends AbstractButton implements Accessible
public static class ToggleButtonModel extends DefaultButtonModel
{
private static final long serialVersionUID = -1589950750899943974L;
public void setPressed(boolean b)
{
if (! isEnabled())
......@@ -62,6 +64,8 @@ public class JToggleButton extends AbstractButton implements Accessible
}
private static final long serialVersionUID = -3128248873429850443L;
public JToggleButton()
{
this(null, null);
......@@ -82,6 +86,12 @@ public class JToggleButton extends AbstractButton implements Accessible
this(text, null);
}
public JToggleButton(String text, boolean selected)
{
this(text, null);
setSelected(selected);
}
public JToggleButton(String text, Icon icon)
{
this(text, icon, false);
......@@ -96,17 +106,20 @@ public class JToggleButton extends AbstractButton implements Accessible
model.setSelected(selected);
}
/**
* Gets the AccessibleContext associated with this JToggleButton.
*/
public AccessibleContext getAccessibleContext()
{
//Gets the AccessibleContext associated with this JToggleButton.
return null;
}
/**
* Returns a string that specifies the name of the L&amp;F class that renders
* this component.
*/
public String getUIClassID()
{
//Returns a string that specifies the name of the L&F class that renders this component.
return "ToggleButtonUI";
}
......
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