[Patch][gui] java.awt.dnd.DropTarget
Michael Koch
konqueror@gmx.de
Thu Jan 27 19:20:00 GMT 2005
Hi list,
I commited the attached patch for Graydon. It was part of his JEdit
patch for GNU classpath.
Michael
2005-01-27 Graydon Hoare <graydon@redhat.com>
* java/awt/dnd/DropTarget.java
(addDropTargetListener): Despite documentation, do not throw.
* javax/swing/JComponent.java: Set a default DropTarget.
-------------- next part --------------
Index: java/awt/dnd/DropTarget.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/dnd/DropTarget.java,v
retrieving revision 1.7.20.1
diff -u -r1.7.20.1 DropTarget.java
--- java/awt/dnd/DropTarget.java 27 Sep 2004 15:14:28 -0000 1.7.20.1
+++ java/awt/dnd/DropTarget.java 27 Jan 2005 19:13:21 -0000
@@ -211,9 +211,10 @@
public void addDropTargetListener (DropTargetListener dtl)
throws TooManyListenersException
{
- if (dtl != null)
- throw new TooManyListenersException ();
-
+ // Sun's JDK does not, despite documentation, throw any sort of
+ // exception here when you install an additional DropTargetListener.
+ // So to be compatible, we do the same thing.
+
dropTargetListener = dtl;
}
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JComponent.java,v
retrieving revision 1.7.2.27
diff -u -r1.7.2.27 JComponent.java
--- javax/swing/JComponent.java 25 Jan 2005 07:07:42 -0000 1.7.2.27
+++ javax/swing/JComponent.java 27 Jan 2005 19:13:21 -0000
@@ -1,5 +1,5 @@
/* JComponent.java -- Every component in swing inherits from this class.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,6 +50,7 @@
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.dnd.DropTarget;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ContainerEvent;
@@ -395,6 +396,7 @@
{
super();
super.setLayout(new FlowLayout());
+ setDropTarget(new DropTarget());
defaultLocale = Locale.getDefault();
debugGraphicsOptions = DebugGraphics.NONE_OPTION;
}
@@ -870,6 +872,9 @@
*/
protected Graphics getComponentGraphics(Graphics g)
{
+ if (debugGraphicsOptions != DebugGraphics.NONE_OPTION)
+ g = new DebugGraphics(g, this);
+
Graphics g2 = g.create();
g2.setFont(this.getFont());
g2.setColor(this.getForeground());
More information about the Java-patches
mailing list