I implemented some missing 1.5 swing functions.
2006-06-16 Lillian Angel <[EMAIL PROTECTED]>
* java/awt/font/TextLayout.java:
Removed unneeded imports.
* javax/swing/plaf/basic/BasicScrollBarUI.java:
Added new thumbRollover field.
(mouseMoved): Added code to set thumbRollover field.
(isThumbRollover): New function.
(setThumbRollover): New function.
(getSupportsAbsolutePositioning): Implemented. This
needs to be changed once the feature has been
implemented.
* javax/swing/plaf/basic/BasicSliderUI.java:
Added new dragging field.
(mouseDragged): Initialized dragging field.
(isDragging): New function.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(focusGained): Marked as not implemented.
(focusLost): Likewise.
Index: java/awt/font/TextLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/font/TextLayout.java,v
retrieving revision 1.11
diff -u -r1.11 TextLayout.java
--- java/awt/font/TextLayout.java 15 Jun 2006 18:59:28 -0000 1.11
+++ java/awt/font/TextLayout.java 16 Jun 2006 15:14:09 -0000
@@ -43,13 +43,11 @@
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Shape;
-import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
import java.text.Bidi;
import java.util.Map;
Index: javax/swing/plaf/basic/BasicScrollBarUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v
retrieving revision 1.35
diff -u -r1.35 BasicScrollBarUI.java
--- javax/swing/plaf/basic/BasicScrollBarUI.java 13 Jun 2006 09:28:57 -0000 1.35
+++ javax/swing/plaf/basic/BasicScrollBarUI.java 16 Jun 2006 15:14:10 -0000
@@ -302,8 +302,10 @@
*/
public void mouseMoved(MouseEvent e)
{
- // Not interested in where the mouse
- // is unless it is being dragged.
+ if (thumbRect.contains(e.getPoint()))
+ thumbRollover = true;
+ else
+ thumbRollover = false;
}
/**
@@ -486,6 +488,9 @@
/** The scrollbar this UI is acting for. */
protected JScrollBar scrollbar;
+
+ /** True if the mouse is over the thumb. */
+ boolean thumbRollover;
/**
* This method adds a component to the layout.
@@ -1401,4 +1406,39 @@
value = min;
return value;
}
+
+ /**
+ * Returns true if the mouse is over the thumb.
+ *
+ * @return true if the mouse is over the thumb.
+ */
+ public boolean isThumbRollover()
+ {
+ return thumbRollover;
+ }
+
+ /**
+ * Set thumbRollover to active. This indicates
+ * whether or not the mouse is over the thumb.
+ *
+ * @param active - true if the mouse is over the thumb.
+ */
+ protected void setThumbRollover(boolean active)
+ {
+ thumbRollover = active;
+ }
+
+ /**
+ * Indicates whether the user can position the thumb with
+ * a mouse click (i.e. middle button).
+ *
+ * @return true if the user can position the thumb with a mouse
+ * click.
+ */
+ public boolean getSupportsAbsolutePositioning()
+ {
+ // The positioning feature has not been implemented.
+ // So, false is always returned.
+ return false;
+ }
}
Index: javax/swing/plaf/basic/BasicSliderUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v
retrieving revision 1.32
diff -u -r1.32 BasicSliderUI.java
--- javax/swing/plaf/basic/BasicSliderUI.java 13 Jun 2006 15:10:38 -0000 1.32
+++ javax/swing/plaf/basic/BasicSliderUI.java 16 Jun 2006 15:14:10 -0000
@@ -371,6 +371,7 @@
*/
public void mouseDragged(MouseEvent e)
{
+ dragging = true;
if (slider.isEnabled())
{
currentMouseX = e.getX();
@@ -450,6 +451,7 @@
*/
public void mouseReleased(MouseEvent e)
{
+ dragging = false;
if (slider.isEnabled())
{
currentMouseX = e.getX();
@@ -593,6 +595,9 @@
/** True if the slider has focus. */
private transient boolean hasFocus;
+
+ /** True if the user is dragging the slider. */
+ boolean dragging;
/**
* Creates a new Basic look and feel Slider UI.
@@ -605,6 +610,16 @@
}
/**
+ * Returns true if the user is dragging the slider.
+ *
+ * @return true if the slider is being dragged.
+ */
+ protected boolean isDragging()
+ {
+ return dragging;
+ }
+
+ /**
* Gets the shadow color to be used for this slider. The shadow color is the
* color used for drawing the top and left edges of the track.
*
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.48
diff -u -r1.48 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java 12 Jun 2006 16:55:56 -0000 1.48
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java 16 Jun 2006 15:14:10 -0000
@@ -98,6 +98,7 @@
* @param e The FocusEvent.
*/
public void focusGained(FocusEvent e)
+ throws NotImplementedException
{
// FIXME: Implement.
}
@@ -108,6 +109,7 @@
* @param e The FocusEvent.
*/
public void focusLost(FocusEvent e)
+ throws NotImplementedException
{
// FIXME: Implement.
}