diff options
author | Lillian Angel <langel@redhat.com> | 2005-11-24 19:37:13 +0000 |
---|---|---|
committer | Lillian Angel <langel@redhat.com> | 2005-11-24 19:37:13 +0000 |
commit | 5b0d018e85489a365d0fb6d4f3740800c75daa5e (patch) | |
tree | df7db5cd0a200fb5ab4327f541f33e713b8323d9 | |
parent | a1e252ad245d85f1068bf6ea1c80ba02fe6866da (diff) | |
download | classpath-5b0d018e85489a365d0fb6d4f3740800c75daa5e.tar.gz |
2005-11-24 Lillian Angel <langel@redhat.com>
* javax/swing/plaf/basic/BasicToolBarUI.java
(mousePressed): When using the BasicLookAndFeel, the mouse
should be in the center of the dragWindow while dragging.
* javax/swing/plaf/metal/MetalToolBarUI.java
(createDockingListener): Implemented.
(MetalDockingListener): New class.
(MetalDockingListener.init): Implemented.
(MetalDockingListener.mousePressed): Implemented. When using the
MetalLookAndFeel, the mouse should not be offset while dragging.
(MetalDockingListener.mouseDragged): Implemented. Does not do
anything different than dragging in the BasicLookAndFeel.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | javax/swing/plaf/basic/BasicToolBarUI.java | 2 | ||||
-rw-r--r-- | javax/swing/plaf/metal/MetalToolBarUI.java | 55 |
3 files changed, 70 insertions, 1 deletions
@@ -1,5 +1,19 @@ 2005-11-24 Lillian Angel <langel@redhat.com> + * javax/swing/plaf/basic/BasicToolBarUI.java + (mousePressed): When using the BasicLookAndFeel, the mouse + should be in the center of the dragWindow while dragging. + * javax/swing/plaf/metal/MetalToolBarUI.java + (createDockingListener): Implemented. + (MetalDockingListener): New class. + (MetalDockingListener.init): Implemented. + (MetalDockingListener.mousePressed): Implemented. When using the + MetalLookAndFeel, the mouse should not be offset while dragging. + (MetalDockingListener.mouseDragged): Implemented. Does not do + anything different than dragging in the BasicLookAndFeel. + +2005-11-24 Lillian Angel <langel@redhat.com> + * javax/swing/plaf/basic/BasicArrowButton.java (paint): Fixed locations, so button is drawn in proper place. * javax/swing/plaf/basic/BasicSplitPaneDivider.java diff --git a/javax/swing/plaf/basic/BasicToolBarUI.java b/javax/swing/plaf/basic/BasicToolBarUI.java index 7bf2a4ab1..261db687a 100644 --- a/javax/swing/plaf/basic/BasicToolBarUI.java +++ b/javax/swing/plaf/basic/BasicToolBarUI.java @@ -1060,7 +1060,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants isDragging = true; if (dragWindow != null) - dragWindow.setOffset(new Point(e.getX(), e.getY())); + dragWindow.setOffset(new Point(cachedBounds.width/2, cachedBounds.height/2)); dragTo(e.getPoint(), origin); } diff --git a/javax/swing/plaf/metal/MetalToolBarUI.java b/javax/swing/plaf/metal/MetalToolBarUI.java index ab7f533f2..16e22ac52 100644 --- a/javax/swing/plaf/metal/MetalToolBarUI.java +++ b/javax/swing/plaf/metal/MetalToolBarUI.java @@ -40,12 +40,14 @@ package javax.swing.plaf.metal; import java.awt.Point; import java.awt.event.ContainerListener; +import java.awt.event.MouseEvent; import java.beans.PropertyChangeListener; import javax.swing.JComponent; import javax.swing.JToolBar; import javax.swing.border.Border; +import javax.swing.event.MouseInputListener; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicToolBarUI; @@ -170,4 +172,57 @@ public class MetalToolBarUI extends BasicToolBarUI if (dragWindow != null) dragWindow.setOffset(p); } + + /** + * Creates and returns an instance of MetalDockingListener. + * + * @return an instance of MetalDockingListener. + */ + protected MouseInputListener createDockingListener() + { + return new MetalDockingListener(toolBar); + } + + /** + * This is the MouseHandler class that allows the user to drag the JToolBar + * in and out of the parent and dock it if it can. + */ + protected class MetalDockingListener extends BasicToolBarUI.DockingListener + { + /** + * Creates a new DockingListener object. + * + * @param t The JToolBar this DockingListener is being used for. + */ + public MetalDockingListener(JToolBar t) + { + super(t); + } + + /** + * This method is called when the mouse is pressed in the JToolBar. If the + * press doesn't occur in a place where it causes the JToolBar to be + * dragged, it returns. Otherwise, it starts a drag session. + * + * @param e The MouseEvent. + */ + public void mousePressed(MouseEvent e) + { + super.mousePressed(e); + setDragOffset(new Point(e.getX(), e.getY())); + } + + /** + * This method is called when the mouse is dragged. It delegates the drag + * painting to the dragTo method. + * + * @param e The MouseEvent. + */ + public void mouseDragged(MouseEvent e) + { + // Does not do anything differently than dragging + // BasicToolBarUI.DockingListener + super.mouseDragged(e); + } + } } |